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

Column model pr #82

Merged
merged 99 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
02cf367
initial modifications towards creting a column model within Isca. Cha…
ntlewis Nov 14, 2018
560acfa
Additional column model files and modifications
ntlewis Nov 18, 2018
4fa27d7
Complete addition of column model
ntlewis Dec 11, 2018
5a4c1ab
tidy new column files
ntlewis Dec 12, 2018
fde960d
remove debugging print statements in atmosphere.F90
ntlewis Dec 12, 2018
42c5b30
revert grey path_names file to original
ntlewis Dec 12, 2018
c1accef
Add ColumnCodeBase to isca python module
ntlewis Dec 12, 2018
ab022c3
Add ability for model to output data generated when running with only…
ntlewis Dec 12, 2018
8207b4a
Add column test case python script
ntlewis Dec 12, 2018
aba6b48
update column test experiment to use vetical diffusion, needs this fo…
ntlewis Dec 12, 2018
6b02a5f
further updating experiment script with info ref. vertical diffusion
ntlewis Dec 12, 2018
904572e
add ability to change wtm air
ntlewis Dec 17, 2018
9d5986f
add valid_range_t namelist option for column
ntlewis Jan 9, 2019
021fe73
add simple surface to idealized moist phys
ntlewis Jan 9, 2019
d8802de
add simple surface
ntlewis Jan 9, 2019
6fe12af
remove duplicated axes = get_axis_id()
ntlewis Jan 9, 2019
7cfe446
add alternative integration method for two_stream_gray_rad. CAUTION: …
ntlewis Jan 9, 2019
8ccb1f1
initial modifications towards creting a column model within Isca. Cha…
ntlewis Nov 14, 2018
9716b79
Additional column model files and modifications
ntlewis Nov 18, 2018
45dabc6
Complete addition of column model
ntlewis Dec 11, 2018
967fc36
tidy new column files
ntlewis Dec 12, 2018
6f18fdc
remove debugging print statements in atmosphere.F90
ntlewis Dec 12, 2018
22427f2
revert grey path_names file to original
ntlewis Dec 12, 2018
9d37343
Add ColumnCodeBase to isca python module
ntlewis Dec 12, 2018
12367c2
Add ability for model to output data generated when running with only…
ntlewis Dec 12, 2018
aa75743
Add column test case python script
ntlewis Dec 12, 2018
f5d3219
update column test experiment to use vetical diffusion, needs this fo…
ntlewis Dec 12, 2018
bcebd3a
further updating experiment script with info ref. vertical diffusion
ntlewis Dec 12, 2018
1d27e83
add ability to change wtm air
ntlewis Dec 17, 2018
6a5ba6b
add valid_range_t namelist option for column
ntlewis Jan 9, 2019
c4f79e7
add simple surface to idealized moist phys
ntlewis Jan 9, 2019
bb6c8ff
add simple surface
ntlewis Jan 9, 2019
46cd7f3
remove duplicated axes = get_axis_id()
ntlewis Jan 9, 2019
91f0832
add alternative integration method for two_stream_gray_rad. CAUTION: …
ntlewis Jan 9, 2019
442828b
field_table and path_names for column model
ntlewis Jan 11, 2019
2bec4f7
Merge branch 'column_model' of https://github.com/ntlewis/Isca into c…
ntlewis Jan 11, 2019
3527eac
correct latitude for global average option
ntlewis Jan 14, 2019
817ced4
Add ability for RRTM to read in ozone vertical profile from namelist …
ntlewis Jan 15, 2019
09dba68
remove garbage file produced by emacs
ntlewis Jan 15, 2019
8f80f3c
remove garbage file
ntlewis Jan 15, 2019
63c2bfd
remove erroneously commited custom land masks, nothing to do with SCM
ntlewis Jan 15, 2019
8425426
fix rrtm warning message
ntlewis Jan 15, 2019
a68d04d
remove subroutine imports from spectral_dynamics and transforms when …
ntlewis Jan 15, 2019
ca859e3
do not use or compile dynamical core
ntlewis Jan 15, 2019
919b8a5
remove alternative integration method in grey radiation. This enhance…
ntlewis Jan 15, 2019
e240d52
remove accidental whitespace changes
ntlewis Jan 15, 2019
3de8bc1
remove accidental whitespace changes
ntlewis Jan 15, 2019
ac32acd
remove simple surface. this enhancement should not be part of column …
ntlewis Jan 15, 2019
8c085d3
remove simple surface
ntlewis Jan 15, 2019
e0fa785
remove accidental whitespace changes
ntlewis Jan 15, 2019
0bc7d45
remove simple surface from surface_flux_mod
ntlewis Jan 15, 2019
8ecf54e
remove accidental whitespace change
ntlewis Jan 15, 2019
c9d0f65
remove garbage file produced by emacs
ntlewis Jan 15, 2019
f48693f
remove changes to constants_mod made for Venus work
ntlewis Jan 15, 2019
bd13a5b
remove whitespace errors
ntlewis Jan 15, 2019
aa03a5b
remove overwrite_data=True from column test experiments
ntlewis Jan 15, 2019
392f302
import get_grid_domain from spec_mpp_mod in column_initialise_fields
ntlewis Jan 17, 2019
1b696a8
Make changes so modules compile without transforms_mod
ntlewis Jan 17, 2019
8de8b69
git add atmos_param/rrtm_radiation/rrtm_radiation.F90 ! DANGEROUS COM…
ntlewis Jan 17, 2019
d1b83b0
Fix definition of lat boundaries
ntlewis Jan 18, 2019
ccd95ee
move rrtm_radiation.f90 to rrtm_radiation.F90
ntlewis Feb 27, 2019
807758e
changes .f90 to .F90 in path_names for rrtm_radiation
ntlewis Feb 27, 2019
391b476
merge changes to master into column_model_pr
ntlewis Jun 9, 2020
a59c65d
disable socrates compilation with column model. In future: add a Colu…
ntlewis Jun 9, 2020
81aac71
add additional scm warning for RRTM ozone read-in
ntlewis Jun 9, 2020
c0f9f9d
add Socrates functionality for column model. see column_test_socrates…
ntlewis Jun 9, 2020
e999dfc
fixed insolation in socrates test case so that it yields the 'correct…
ntlewis Jun 10, 2020
29b641e
(column) Fix accidental change to RRTM
ntlewis Jun 15, 2020
6b0ecaf
changed dt_rad:3600. to dt_rad:3600 to avoid namelist error
ntlewis Jun 15, 2020
e3d2e71
change resolution for giant_planet trip test so it doesnt crash
ntlewis Jun 15, 2020
0ef6195
revert giant planet trip test changes
ntlewis Jun 15, 2020
a658e35
added space to re-jig travis
ntlewis Jun 17, 2020
4ed1f2c
add files so Isca can run with intel compilers in Oxford
ntlewis Jun 19, 2020
24c47d0
Merge branch 'master' into column_model_pr
ntlewis May 31, 2022
d267f91
Merge branch 'master' into column_model_pr
ntlewis Jun 8, 2022
577db78
update column path names to include simple cloud scheme
ntlewis Jun 8, 2022
6350a46
add flag to constrain q to be decreasing with height only
ntlewis Feb 26, 2024
0249cac
add code to use lcl depth for pbl depth
ntlewis Feb 26, 2024
eb7fa09
fix additions for lcl bl depth and stratospheric q
ntlewis Feb 27, 2024
a463bbe
Merge branch 'master' into column_model_pr
ntlewis Feb 28, 2024
d055759
re-add ability to prescribe ozone in SCM
ntlewis Feb 28, 2024
ea1833f
add simple cloud scheme path names
ntlewis Feb 28, 2024
bd28843
Update path_names
ntlewis Feb 28, 2024
cccc6f4
Update path_names to include socrates_set_cld
ntlewis Feb 28, 2024
ef5ad18
fix if statement .eqv. in socrates_interface (bug introduced when clo…
ntlewis Feb 28, 2024
92da4a8
fix python scm_interp_routine used to compute ozone profile for SCM
ntlewis Feb 28, 2024
0886ff6
increase run length for default column_test
ntlewis Feb 28, 2024
21d348a
specify bind-to socket when running SCM experiments (this means that …
ntlewis Feb 28, 2024
bf8fe9d
turn on Brett's options to constrain stratospheric q, and to use the …
ntlewis Feb 28, 2024
8556034
change initial specific humidity to q=1e-3, so that stratospheric q i…
ntlewis Feb 28, 2024
c62e1a6
tidy comments
ntlewis Feb 28, 2024
123c5c2
Update test_cases README.md to mention SCM
ntlewis Feb 28, 2024
dd8d134
modify ape_aquaplanet experiment so that it runs with gfortran (conve…
ntlewis Feb 29, 2024
7f335ed
Delete src/extra/env/ox-desk2
ntlewis Feb 29, 2024
f4a950d
Update column_test.py
ntlewis Feb 29, 2024
2dd2005
Update column_test_rrtm_ozone.py
ntlewis Feb 29, 2024
4389661
Update column_test_socrates_ozone.py
ntlewis Feb 29, 2024
dbaa8c1
Update column_test.py
ntlewis Feb 29, 2024
8cf7d60
Delete src/extra/python/isca/templates/mkmf.template.ox
ntlewis Feb 29, 2024
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
3 changes: 3 additions & 0 deletions exp/test_cases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
`bucket_hydrology`
* As described in Isca paper (Vallis et al., 2017) but without q-fluxes

`column_test_case`
* Single column configuration of Isca. Please cite McKim et al. (2024, submitted) (<https://doi.org/10.22541/essoar.170904795.55675140/v1>) if you use the SCM.

`frierson`
* Control case of the so-called `Frierson model` described in e.g. <https://doi.org/10.1175/JAS3753.1>

Expand Down
4 changes: 2 additions & 2 deletions exp/test_cases/ape_aquaplanet/socrates_ape_aquaplanet_T42.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
'do_read_ozone': True,
'ozone_file_name':'ozone_1990',
'ozone_field_name':'ozone_1990',
'dt_rad':4320.,
'solday':90., #turn off seasonal cycle - diurnal by default
'dt_rad':4320,
'solday':90, #turn off seasonal cycle - diurnal by default
'co2_ppmv':348.0,
'store_intermediate_rad':True,
'chunk_size': 16,
Expand Down
3 changes: 2 additions & 1 deletion exp/test_cases/axisymmetric/axisymmetric_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
'do_read_ozone':True,
'ozone_file':'ozone_1990',
'dt_rad': 3600, #Set RRTM radiation timestep to 3600 seconds, meaning it runs every 5 atmospheric timesteps

},

# FMS Framework configuration
Expand Down Expand Up @@ -183,4 +184,4 @@
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES)
for i in range(2,121):
exp.run(i, num_cores=NCORES)
exp.run(i, num_cores=NCORES)
202 changes: 202 additions & 0 deletions exp/test_cases/column_test_case/column_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
"""
This script configures a column model that uses Isca's columnwise physics routines.

Single column configuration of Isca. Please cite McKim et al. (2024, submitted) (https://doi.org/10.22541/essoar.170904795.55675140/v1) if you use the SCM.

Useful for testing new convection / radiation parametrizations, as the dynamical core is
bypassed so the model runs a gazillion times faster (especially if you're only simulating
one column). Can in principle simulate many (in lat and lon) at the same time.

The wind is prescribed (it needs to be non-zero at the surface to allow for latent and
sensible surface heat fluxes). Currently the user can set a namelist variable 'surface_wind'
that sets u_surf and v_surf = surface_wind / sqrt(2), so that wind_surf = sqrt(u_surf**2 +
v_surf**2) = surface_wind. u and v at all other altitudes are set to zero (hardcoded).

At the moment the model needs to use the vertical turbulent diffusion parameterization in order
for the mixed layer code to work. This is not very consistent as the u and v wind are prescribed
and so the u,v tendenency from the diffusion is thrown away. Hence an implicit assumption when
using the column model is that 'the dynamics' would restore the surface winds to their prescribed
speed, so that du/dt total is zero.

The column model is currently initiated as a bit of a hack. The line

'from isca import ColumnCodeBase'

sets a compiler flag -DCOLUMN_MODEL that tells the model to use the following files:

atmos_column/column.F90
atmos_column/column_grid.F90
atmos_column/column_init_cond.F90
atmos_column/column_initialize_fields.F90

to initialize the model (including constructing the model grid), do the model timestepping
(using a leapfrog scheme as before), and handle input/output.

Works with either hs_forcing, or the physics packages in idealized_moist_phys. Even when
multiple columns are simulated, the model can only run on 1 core at the moment (will endeavour
to fix this as some point). Also, the column model cannot read in topography input files.

Any questions to Neil Lewis:
n.t.lewis@exeter.ac.uk
"""


import os

import numpy as np

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


# column model only uses 1 core
NCORES = 1

# compile code
base_dir = os.path.dirname(os.path.realpath(__file__))
cb = ColumnCodeBase.from_directory(GFDL_BASE)
cb.compile()

# create an Experiment object to handle the configuration of model parameters
exp = Experiment('column_test_exp', 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('column', 'ps', time_avg=True)
diag.add_field('column', 'bk')
diag.add_field('column', 'pk')
diag.add_field('atmosphere', 'precipitation', 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('column', 'sphum', time_avg=True)
diag.add_field('column', 'ucomp', time_avg=True)
diag.add_field('column', 'vcomp', time_avg=True)
diag.add_field('column', 'temp', time_avg=True)
diag.add_field('two_stream', 'swdn_toa', time_avg=True)
diag.add_field('atmosphere', 'dt_ug_diffusion', time_avg=True)
diag.add_field('atmosphere', 'dt_vg_diffusion', 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' : 360,
'hours' : 0,
'minutes': 0,
'seconds': 0,
'dt_atmos':1440,
'current_date' : [1,1,1,0,0,0],
'calendar' : 'thirty_day'
},

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

'column_nml': {
'lon_max': 1, # number of columns in longitude, default begins at lon=0.0
'lat_max': 1, # number of columns in latitude, precise
# latitude can be set in column_grid_nml if only 1 lat used.
'num_levels': 31, # number of levels
'initial_sphum': 1e-3,
'q_decrease_only':True, # constrain q in stratosphere
},

'column_grid_nml': {
'lat_value': np.rad2deg(np.arcsin(1/np.sqrt(3))) # set latitude to that which causes insolation in frierson p2 radiation to be insolation / 4.
#'global_average': True # don't use this option at the moment
},

# set initial condition, NOTE: currently there is not an option to read in initial condition from a file (aside from a restart file).
'column_init_cond_nml': {
'initial_temperature': 264., # initial atmospheric temperature
'surf_geopotential': 0.0, # applied to all columns
'surface_wind': 5. # as described above
},

'idealized_moist_phys_nml': {
'do_damping': False, # no damping in column model, surface wind prescribed
'turb':True,
'mixed_layer_bc':True,
'do_simple': True, # simple RH calculation
'roughness_mom': 3.21e-05,
'roughness_heat':3.21e-05,
'roughness_moist':3.21e-05,
'two_stream_gray': True, #Use grey radiation
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use the simple Betts Miller convection scheme
'do_lcl_diffusivity_depth':True, # use convection scheme LCL height to set PBL depth
},

'two_stream_gray_rad_nml': {
'rad_scheme': 'frierson', #Select radiation scheme to use, which in this case is Frierson
'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.2, # default: 0.0
},

'qe_moist_convection_nml': {
'rhbm':0.7, # rh criterion for convection
'Tmin':160., # min temperature for convection scheme look up tables
'Tmax':350. # max temperature for convection scheme look up tables
},

'lscale_cond_nml': {
'do_simple':True, # only rain
'do_evap':False, # no re-evaporation of falling precipitation
},

'surface_flux_nml': {
'use_virtual_temp': True, # use virtual temperature for BL stability
'do_simple': True,
'old_dtaudv': True
},

'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
},

#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':False,
'evaporation':True,
'depth': 2.5, #Depth of mixed layer used
'albedo_value': 0.30, #Albedo value used
},

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

# define pressure coordinate
'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],
},

# 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
},
})

#Lets do a run!
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES, mpirun_opts='--bind-to socket')
for i in range(2,11):
exp.run(i, num_cores=NCORES, mpirun_opts='--bind-to socket')
Loading
Loading