Skip to content

Commit 7acc5d2

Browse files
authored
Merge pull request #246 from daw538/simcloud
Simcloud: A simple cloud scheme for Isca
2 parents 5b72697 + 1feab10 commit 7acc5d2

31 files changed

+4502
-1596
lines changed
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../realistic_continents/input/siconc_clim_amip.nc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../realistic_continents/input/sst_clim_amip.nc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,325 @@
1+
import os
2+
import numpy as np
3+
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
4+
5+
NCORES = 16
6+
NUM_LEVELS = 25
7+
8+
base_dir = os.path.dirname(os.path.realpath(__file__))
9+
# a CodeBase can be a directory on the computer,
10+
# useful for iterative development
11+
cb = SocratesCodeBase.from_directory(GFDL_BASE)
12+
13+
# or it can point to a specific git repo and commit id.
14+
# This method should ensure future, independent, reproducibility of results.
15+
# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
16+
17+
# compilation depends on computer specific settings. The $GFDL_ENV
18+
# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
19+
# is used to load the correct compilers. The env file is always loaded from
20+
# $GFDL_BASE and not the checked out git repo.
21+
22+
# create an Experiment object to handle the configuration of model parameters
23+
# and output diagnostics
24+
exp = Experiment('soc_realistic_continents_fixed_sst_with_linear_cld_scheme', codebase=cb)
25+
26+
# Tell model how to write diagnostics
27+
diag = DiagTable()
28+
diag.add_file('atmos_monthly', 30, 'days', time_units='days')
29+
30+
# Tell model which diagnostics to write
31+
32+
# need at least ps, pk, bk and zsurf to do vertical interpolation onto plevels from sigma
33+
diag.add_field('dynamics', 'ps', time_avg=True)
34+
diag.add_field('dynamics', 'bk')
35+
diag.add_field('dynamics', 'pk')
36+
diag.add_field('dynamics', 'zsurf')
37+
38+
diag.add_field('dynamics', 'sphum', time_avg=True)
39+
diag.add_field('dynamics', 'ucomp', time_avg=True)
40+
diag.add_field('dynamics', 'vcomp', time_avg=True)
41+
diag.add_field('dynamics', 'omega', time_avg=True)
42+
diag.add_field('dynamics', 'temp', time_avg=True)
43+
diag.add_field('dynamics', 'vor', time_avg=True)
44+
diag.add_field('dynamics', 'div', time_avg=True)
45+
46+
diag.add_field('atmosphere', 'precipitation', time_avg=True)
47+
diag.add_field('mixed_layer', 't_surf', time_avg=True)
48+
diag.add_field('mixed_layer', 'ice_conc', time_avg=True)
49+
diag.add_field('mixed_layer', 'flux_lhe', time_avg=True)
50+
diag.add_field('mixed_layer', 'flux_t', time_avg=True)
51+
52+
# all-sky radiation fluxes at TOA and surface
53+
diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
54+
diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
55+
diag.add_field('socrates', 'soc_olr', time_avg=True)
56+
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
57+
diag.add_field('socrates', 'soc_toa_sw_up', time_avg=True)
58+
diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
59+
60+
diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
61+
diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
62+
diag.add_field('socrates', 'soc_surf_flux_lw_down', time_avg=True)
63+
diag.add_field('socrates', 'soc_surf_flux_sw_down', time_avg=True)
64+
65+
# clear-sky radiation fluxes at TOA and surface
66+
diag.add_field('socrates', 'soc_olr_clr', time_avg=True)
67+
diag.add_field('socrates', 'soc_toa_sw_clr', time_avg=True)
68+
diag.add_field('socrates', 'soc_toa_sw_up_clr', time_avg=True)
69+
diag.add_field('socrates', 'soc_flux_lw_clr', time_avg=True)
70+
diag.add_field('socrates', 'soc_flux_sw_clr', time_avg=True)
71+
72+
diag.add_field('socrates', 'soc_surf_flux_lw_clr', time_avg=True)
73+
diag.add_field('socrates', 'soc_surf_flux_sw_clr', time_avg=True)
74+
diag.add_field('socrates', 'soc_surf_flux_lw_down_clr', time_avg=True)
75+
diag.add_field('socrates', 'soc_surf_flux_sw_down_clr', time_avg=True)
76+
77+
# Cloud related diagnostics
78+
diag.add_field('cloud_simple', 'cf', time_avg=True)
79+
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
80+
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
81+
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
82+
diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
83+
#diag.add_field('ls_cloud', 'rhcrit', time_avg=True)
84+
85+
diag.add_field('cloud_cover', 'tot_cld_amt', time_avg=True)
86+
diag.add_field('cloud_cover', 'high_cld_amt', time_avg=True)
87+
diag.add_field('cloud_cover', 'mid_cld_amt', time_avg=True)
88+
diag.add_field('cloud_cover', 'low_cld_amt', time_avg=True)
89+
#diag.add_field('socrates', 'soc_tot_cloud_cover', time_avg=True)
90+
91+
# Some intermediate outputs from marine strat clouds diag module
92+
# diag.add_field('strat_cloud', 'eis', time_avg=True)
93+
# diag.add_field('strat_cloud', 'ectei', time_avg=True)
94+
# diag.add_field('strat_cloud', 'lts', time_avg=True)
95+
# diag.add_field('strat_cloud', 'ELF', time_avg=True)
96+
# diag.add_field('strat_cloud', 'zlcl', time_avg=True)
97+
# diag.add_field('strat_cloud', 'z700', time_avg=True)
98+
# diag.add_field('strat_cloud', 'gamma700', time_avg=True)
99+
# diag.add_field('strat_cloud', 'gamma_DL', time_avg=True)
100+
# diag.add_field('strat_cloud', 'theta', time_avg=True)
101+
# diag.add_field('strat_cloud', 'dthdp', time_avg=True)
102+
# diag.add_field('strat_cloud', 'beta1', time_avg=True)
103+
# diag.add_field('strat_cloud', 'beta2', time_avg=True)
104+
# diag.add_field('strat_cloud', 'zinv', time_avg=True)
105+
# diag.add_field('strat_cloud', 'alpha', time_avg=True)
106+
# diag.add_field('strat_cloud', 'DS', time_avg=True)
107+
# diag.add_field('strat_cloud', 'IS', time_avg=True)
108+
109+
exp.diag_table = diag
110+
111+
# Empty the run directory ready to run
112+
exp.clear_rundir()
113+
114+
exp.inputfiles = [os.path.join(GFDL_BASE, 'input/rrtm_input_files/ozone_1990.nc'),
115+
os.path.join(base_dir, 'input/era_land_t42_filtered.nc'),
116+
os.path.join(base_dir, 'input/sst_clim_amip.nc'),
117+
os.path.join(base_dir, 'input/siconc_clim_amip.nc')]
118+
119+
# Define values for the 'core' namelist
120+
exp.namelist = Namelist({
121+
'main_nml':{
122+
'days' : 30,
123+
'hours' : 0,
124+
'minutes' : 0,
125+
'seconds' : 0,
126+
'dt_atmos': 720, # 600
127+
'current_date': [1,1,1,0,0,0],
128+
'calendar': 'thirty_day'
129+
},
130+
131+
'socrates_rad_nml': {
132+
'stellar_constant': 1370.,
133+
#'lw_spectral_filename': os.path.join(GFDL_BASE, 'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_lw_ga7'),
134+
#'sw_spectral_filename': os.path.join(GFDL_BASE, 'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_sw_ga7'),
135+
'lw_spectral_filename': os.path.join(GFDL_BASE, 'src/atmos_param/socrates/src/trunk/data/spectra/ga3_1/sp_lw_ga3_1'),
136+
'sw_spectral_filename': os.path.join(GFDL_BASE, 'src/atmos_param/socrates/src/trunk/data/spectra/ga3_1/sp_sw_ga3_0'),
137+
'do_read_ozone': True,
138+
'ozone_file_name' : 'ozone_1990',
139+
'ozone_field_name': 'ozone_1990',
140+
'dt_rad': 4320, # 3600,
141+
'store_intermediate_rad': True,
142+
'chunk_size': 16,
143+
'use_pressure_interp_for_half_levels': False,
144+
'tidally_locked': False,
145+
},
146+
147+
'idealized_moist_phys_nml': {
148+
'do_damping': True,
149+
'turb': True,
150+
'mixed_layer_bc': True,
151+
'do_virtual': False,
152+
'do_simple': True,
153+
'roughness_mom' : 3.21e-05,
154+
'roughness_heat' : 3.21e-05,
155+
'roughness_moist': 3.21e-05,
156+
'two_stream_gray': False, # Use the grey radiation scheme
157+
'do_socrates_radiation': True,
158+
'convection_scheme': 'SIMPLE_BETTS_MILLER', # Use simple Betts miller convection
159+
'do_cloud_simple': True, # Turn on the cloud scheme switch
160+
'land_option': 'input',
161+
'land_file_name': 'INPUT/era_land_t42_filtered.nc',
162+
'land_roughness_prefactor': 10.0,
163+
'roughness_mom' : 2.e-04, # Ocean roughness lengths
164+
'roughness_heat' : 2.e-04, # Ocean roughness lengths
165+
'roughness_moist': 2.e-04, # Ocean roughness lengths
166+
'bucket': True, # Run with the bucket model
167+
'init_bucket_depth_land': 0.15,
168+
},
169+
170+
# Using linear cloud scheme option
171+
'cloud_simple_nml': {
172+
'do_qcl_with_temp': True,
173+
'do_cloud_cover_diags': True,
174+
'do_add_stratocumulus': True,
175+
'reff_liq': 14, # Units: micron
176+
'reff_ice': 25, # Units: micron
177+
'qcl_val': 0.18, # Units: g/kg, not kg/kg
178+
},
179+
180+
'large_scale_cloud_nml': {
181+
'cf_diag_formula_name': 'linear',
182+
'do_adjust_cld_by_omega': False,
183+
'do_freezedry': True,
184+
'qv_polar_val': 0.006, # Units: kg/kg
185+
'freezedry_power': 2.5,
186+
'do_fitted_rhcrit': False,
187+
'linear_a_surf': 42,
188+
'linear_a_top': 13,
189+
'linear_power': 11,
190+
},
191+
192+
'marine_strat_cloud_nml': {
193+
'sc_diag_method': 'Park_ELF',
194+
'intermediate_outputs_diags': False,
195+
'dthdp_min_threshold': -0.08,
196+
'park_a': 1.3,
197+
'park_b': -0.1,
198+
},
199+
200+
'cloud_cover_diag_nml':{
201+
'overlap_assumption': 'maximum-random', # or 'maximum', 'random'
202+
'mid_cld_bottom': 7.0e4,
203+
'high_cld_bottom': 4.0e4,
204+
'cf_min': 0,
205+
},
206+
207+
'vert_turb_driver_nml': {
208+
'do_mellor_yamada': False, # default: True
209+
'do_diffusivity': True, # default: False
210+
'do_simple': True, # default: False
211+
'constant_gust': 0.0, # default: 1.0
212+
'use_tau': False
213+
},
214+
215+
'diffusivity_nml': {
216+
'do_entrain': True, #False,
217+
'do_simple': True,
218+
},
219+
220+
'surface_flux_nml': {
221+
'use_virtual_temp': False,
222+
'do_simple': True,
223+
'old_dtaudv': True,
224+
'land_humidity_prefactor': 1,
225+
'land_evap_prefactor': 0.6,
226+
#'ocean_evap_prefactor': 1,
227+
},
228+
229+
'atmosphere_nml': {
230+
'idealized_moist_model': True
231+
},
232+
233+
#Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
234+
'mixed_layer_nml': {
235+
'tconst': 285.,
236+
'prescribe_initial_dist': True,
237+
'evaporation': True,
238+
'depth': 20.0, # Depth of mixed layer used
239+
'land_option': 'input', # Tell mixed layer to get land mask from input file
240+
'land_h_capacity_prefactor': 0.1, # What factor to multiply mixed-layer depth by over land.
241+
'albedo_value': 0.12, # Ocean albedo value
242+
'land_albedo_prefactor': 1.3, # What factor to multiply ocean albedo by over land
243+
'do_qflux': False, # Don't use the prescribed analytical formula for q-fluxes
244+
'do_read_sst': True, # Read in sst values from input file
245+
'do_sc_sst': True, # Do specified ssts (need both to be true)
246+
'sst_file': 'sst_clim_amip', # Set name of sst input file
247+
'specify_sst_over_ocean_only': True, # Make sure sst only specified in regions of ocean.
248+
# Copy from realistic_continents namelist
249+
'update_albedo_from_ice': True, # Use the simple ice model to update surface albedo
250+
'ice_albedo_value': 0.7, # What value of albedo to use in regions of ice
251+
#'ice_concentration_threshold': 0.5, # ice concentration threshold above which to make albedo equal to ice_albedo_value
252+
'ice_albedo_method': 'ramp_function',
253+
},
254+
255+
'qe_moist_convection_nml': {
256+
'rhbm': 0.7,
257+
'Tmin': 160.,
258+
'Tmax': 350.,
259+
},
260+
261+
'lscale_cond_nml': {
262+
'do_simple': True,
263+
'do_evap': True,
264+
},
265+
266+
'sat_vapor_pres_nml': {
267+
'do_simple': True,
268+
'construct_table_wrt_liq_and_ice': True,
269+
'show_all_bad_values': True,
270+
},
271+
272+
'damping_driver_nml': {
273+
'do_rayleigh': True,
274+
'trayfric': -0.5, # neg. value: time in *days*
275+
'sponge_pbottom': 150., # Setting the lower pressure boundary for the model sponge layer in Pa.
276+
'do_conserve_energy': True,
277+
},
278+
279+
# FMS Framework configuration
280+
'diag_manager_nml': {
281+
'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
282+
},
283+
284+
'fms_nml': {
285+
'domains_stack_size': 600000 # default: 0
286+
},
287+
288+
'fms_io_nml': {
289+
'threading_write': 'single', # default: multi
290+
'fileset_write': 'single', # default: multi
291+
},
292+
293+
'spectral_dynamics_nml': {
294+
'damping_order': 4,
295+
'water_correction_limit': 200.e2,
296+
'reference_sea_level_press': 1.0e5,
297+
'num_levels': NUM_LEVELS, # How many model pressure levels to use
298+
'valid_range_t': [100., 800.],
299+
'initial_sphum': [2.e-6],
300+
'vert_coord_option': 'uneven_sigma',
301+
'surf_res': 0.03, # 0.2, # Parameter that sets the vertical distribution of sigma levels
302+
'scale_heights': 11.0,
303+
'exponent': 7.0,
304+
'robert_coeff': 0.03,
305+
'ocean_topog_smoothing': 0.8,
306+
},
307+
308+
'spectral_init_cond_nml':{
309+
'topog_file_name': 'era_land_t42_filtered.nc',
310+
'topography_option': 'input',
311+
},
312+
})
313+
314+
315+
if __name__=="__main__":
316+
317+
cb.compile(debug=False)
318+
319+
OVERWRITE = False
320+
321+
# Set up the experiment object, with the first argument being the experiment name.
322+
# This will be the name of the folder that the data will appear in.
323+
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=OVERWRITE)
324+
for i in range(2, 25):
325+
exp.run(i, num_cores=NCORES, overwrite_data=OVERWRITE)

exp/test_cases/socrates_test/socrates_aquaplanet.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
108108
},
109109

110-
111110
'vert_turb_driver_nml': {
112111
'do_mellor_yamada': False, # default: True
113112
'do_diffusivity': True, # default: False
@@ -152,8 +151,8 @@
152151
},
153152

154153
'sat_vapor_pres_nml': {
155-
'do_simple':True,
156-
},
154+
'do_simple':True
155+
},
157156

158157
'damping_driver_nml': {
159158
'do_rayleigh': True,
@@ -199,8 +198,7 @@
199198
#Set up the experiment object, with the first argument being the experiment name.
200199
#This will be the name of the folder that the data will appear in.
201200

202-
overwrite=False
203-
204-
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
201+
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)
202+
205203
for i in range(2,121):
206204
exp.run(i, num_cores=NCORES, overwrite_data=overwrite)

exp/test_cases/socrates_test/socrates_aquaplanet_amip_with_topo_clouds.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@
125125
'two_stream_gray': False, #Use the grey radiation scheme
126126
'do_socrates_radiation': True,
127127
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
128-
'do_cloud_simple': True, # this is where the clouds scheme is turned on
128+
'do_cloud_spookie': True, # this is where the clouds scheme is turned on
129129
'land_option' : 'input',
130130
'land_file_name' : 'INPUT/era-spectral7_T42_64x128.out.nc',
131131
'land_roughness_prefactor' :10.0,
132132
},
133133

134-
'cloud_simple_nml': { #use all existing defaults as in code
134+
'cloud_spookie_nml': { #use all existing defaults as in code
135135
'spookie_protocol':2
136136
},
137137

exp/test_cases/socrates_test/socrates_aquaplanet_cloud.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@
124124
'two_stream_gray': False, #Use the grey radiation scheme
125125
'do_socrates_radiation': True,
126126
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
127-
'do_cloud_simple': True # this is where the clouds scheme is turned on
127+
'do_cloud_spookie': True # this is where the clouds scheme is turned on
128128
},
129129

130-
'cloud_simple_nml': { #use all existing defaults as in code
130+
'cloud_spookie_nml': { #use all existing defaults as in code
131131
'spookie_protocol':2
132132
},
133133

0 commit comments

Comments
 (0)