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

Adding code to run the shallow-water and barotropic vorticity equation sets #197

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
55b85b1
Added code necessary to run shallow water and barotropic vorticity co…
sit23 May 14, 2019
dea4afd
Copied example input and diag file entries into test case, and set up…
sit23 May 14, 2019
a5a6c8e
updated experiment to get it to run, and updated leapfrog and damping…
sit23 May 14, 2019
bd7df06
Integrated barotropic vorticity equation into Isca framework too. Nee…
sit23 May 14, 2019
4c22f20
Fixed small typo in barotropic codebase object.
sit23 May 14, 2019
717a94a
Rewrite of stirring module to retain functionality, but to get rid of…
sit23 May 16, 2019
2f6acc0
Updated shallow code to include stirring, but thanks to rewrite of st…
sit23 May 16, 2019
6c696ee
Remove needless string definitions.
sit23 May 16, 2019
993966c
Adding comments to stirring file to point out origin.
sit23 May 16, 2019
4693d72
Making the wavenumber range of the forcing a namelist parameter set.
sit23 May 16, 2019
f8fcd5c
Trying to make scott and polvani 2007 esque flows.
sit23 May 16, 2019
a279626
Adding missing model files that I forgot to commit. These are necessa…
sit23 May 16, 2019
e74e5c0
Added ability to do deep velocities, I think. Seems reasonable. Now t…
sit23 May 17, 2019
172087f
Updaing shallow water code to better account for deep velocities in i…
sit23 May 31, 2019
de1f769
First lot of experiments for poster. Run at T170 and forced at small-…
sit23 May 31, 2019
c09ad56
Updating outputs for energy diagnostics.
sit23 Jun 18, 2019
c1a3f2a
Updated experiments.
sit23 Jun 29, 2019
4e46f2c
Ignorning supercomputer log files.
sit23 Jul 2, 2019
f1cc51d
Adding diagnostics for momentum budget.
sit23 Jul 2, 2019
0fd581d
Merge branch 'shallow_and_baro' of github.com:sit23/Isca into shallow…
sit23 Jul 2, 2019
ee7394d
Added daily output for more useful diagnostics.
sit23 Jul 18, 2019
bee23e0
Adding momentum budget analysis outputs.
sit23 Jul 18, 2019
cbca8c7
parameter updates.
sit23 Feb 7, 2020
bb15cef
Update shallow code to include vortex migration experiments.
sit23 Mar 19, 2020
985e952
Merge branch 'shallow_and_baro' of github.com:sit23/Isca into shallow…
sit23 Dec 10, 2020
f51205e
Merge branch 'master' into shallow_and_baro
sit23 Dec 10, 2020
d706b34
Removing unecessary experiment files.
sit23 Dec 10, 2020
3acc1db
Merge branch 'master' into shallow_and_baro_clean
sit23 Oct 16, 2021
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ coverage.xml
.pytest_cache/
test/.cache
test/results.xml
*.sh.e*
*.sh.o*

# Translations
*.mo
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import os

import numpy as np

from isca import BarotropicCodeBase, 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 = BarotropicCodeBase.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.

cb.compile() # compile the source code to working directory $GFDL_WORK/codebase

# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
exp = Experiment('barotropic_stirring_test_experiment', 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('barotropic_diagnostics', 'ucomp', time_avg=True)
diag.add_field('barotropic_diagnostics', 'vcomp', time_avg=True)
diag.add_field('barotropic_diagnostics', 'vor', time_avg=True)
diag.add_field('barotropic_diagnostics', 'pv', time_avg=True)
diag.add_field('barotropic_diagnostics', 'stream', time_avg=True)
diag.add_field('barotropic_diagnostics', 'trs', time_avg=True)
diag.add_field('barotropic_diagnostics', 'tr', time_avg=True)
diag.add_field('barotropic_diagnostics', 'eddy_vor', time_avg=True)
diag.add_field('barotropic_diagnostics', 'delta_u', time_avg=True)
diag.add_field('stirring_mod', 'stirring', time_avg=True)
diag.add_field('stirring_mod', 'stirring_amp', time_avg=True)
diag.add_field('stirring_mod', 'stirring_sqr', 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': 1200,
'calendar': 'no_calendar',
},

'atmosphere_nml':{
'print_interval': 86400,
},

'fms_io_nml':{
'threading_write' :'single',
'fileset_write': 'single'
},

'fms_nml':{
'print_memory_usage':True,
'domains_stack_size': 200000,
},

'barotropic_dynamics_nml':{
'triang_trunc' : True,
'num_lat' : 128,
'num_lon' : 256,
'num_fourier' : 85,
'num_spherical' : 86,
'fourier_inc' : 1,
'damping_option' : 'resolution_dependent',
'damping_order' : 2,
'damping_coeff' : 1.157E-4,
'damping_coeff_r': 1.929E-6,
'grid_tracer' : True,
'spec_tracer' : True,
'm_0' : 6,
'zeta_0' : 0.0,
'eddy_lat' : 45.0,
'eddy_width' : 10.0,
'robert_coeff' : 0.04,
'initial_zonal_wind' : 'zero',
},

'barotropic_physics_nml':{
},

'stirring_nml': {
'decay_time':172800,
'amplitude':3.e-11,
'lat0':45.,
'lon0':180.,
'widthy':12.,
'widthx':45.,
'B':1.0,
},

})

#Lets do a run!
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES)
for i in range(2,121):
exp.run(i, num_cores=NCORES)
100 changes: 100 additions & 0 deletions exp/test_cases/barotropic_vorticity_equation/barotropic_vor_eq_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import os

import numpy as np

from isca import BarotropicCodeBase, 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 = BarotropicCodeBase.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.

cb.compile() # compile the source code to working directory $GFDL_WORK/codebase

# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
exp = Experiment('barotropic_test_experiment', 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('barotropic_diagnostics', 'ucomp', time_avg=True)
diag.add_field('barotropic_diagnostics', 'vcomp', time_avg=True)
diag.add_field('barotropic_diagnostics', 'vor', time_avg=True)
diag.add_field('barotropic_diagnostics', 'pv', time_avg=True)
diag.add_field('barotropic_diagnostics', 'stream', time_avg=True)
diag.add_field('barotropic_diagnostics', 'trs', time_avg=True)
diag.add_field('barotropic_diagnostics', 'tr', time_avg=True)
diag.add_field('barotropic_diagnostics', 'eddy_vor', time_avg=True)
diag.add_field('barotropic_diagnostics', 'delta_u', 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': 1200,
'calendar': 'no_calendar',
},

'atmosphere_nml':{
'print_interval': 86400,
},

'fms_io_nml':{
'threading_write' :'single',
'fileset_write': 'single'
},

'fms_nml':{
'print_memory_usage':True,
'domains_stack_size': 200000,
},

'barotropic_dynamics_nml':{
'triang_trunc' : True,
'num_lat' : 128,
'num_lon' : 256,
'num_fourier' : 85,
'num_spherical' : 86,
'fourier_inc' : 1,
'damping_option' : 'resolution_dependent',
'damping_order' : 4,
'damping_coeff' : 1.e-04,
'grid_tracer' : True,
'spec_tracer' : True,
'm_0' : 4,
'zeta_0' : 8.e-05,
'eddy_lat' : 45.0,
'eddy_width' : 15.0,
'robert_coeff' : 0.04,
},

'barotropic_physics_nml':{
},
})

#Lets do a run!
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES)
for i in range(2,121):
exp.run(i, num_cores=NCORES)
126 changes: 126 additions & 0 deletions exp/test_cases/shallow_water/shallow_water_stirring_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import os

import numpy as np

from isca import ShallowCodeBase, 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 = ShallowCodeBase.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.

cb.compile() # compile the source code to working directory $GFDL_WORK/codebase

# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
exp = Experiment('shallow_stirring_test_experiment', 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('shallow_diagnostics', 'ucomp', time_avg=True)
diag.add_field('shallow_diagnostics', 'vcomp', time_avg=True)
diag.add_field('shallow_diagnostics', 'vor', time_avg=True)
diag.add_field('shallow_diagnostics', 'div', time_avg=True)
diag.add_field('shallow_diagnostics', 'h', time_avg=True)
diag.add_field('shallow_diagnostics', 'pv', time_avg=True)
diag.add_field('shallow_diagnostics', 'stream', time_avg=True)
diag.add_field('shallow_diagnostics', 'trs', time_avg=True)
diag.add_field('shallow_diagnostics', 'tr', time_avg=True)
diag.add_field('stirring_mod', 'stirring', time_avg=True)
diag.add_field('stirring_mod', 'stirring_amp', time_avg=True)
diag.add_field('stirring_mod', 'stirring_sqr', 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': 1200,
'calendar': 'no_calendar',
},

'atmosphere_nml':{
'print_interval': 86400,
},

'fms_io_nml':{
'threading_write' :'single',
'fileset_write': 'single'
},

'fms_nml':{
'print_memory_usage':True,
'domains_stack_size': 200000,
},

'shallow_dynamics_nml':{
'num_lon' : 256,
'num_lat' : 128,
'num_fourier' : 85,
'num_spherical' : 86,
'fourier_inc' : 1,
'damping_option' : 'resolution_dependent',
'damping_order' : 4,
'damping_coeff' : 1.e-04,
'h_0' : 3.e04,
'grid_tracer' : True,
'spec_tracer' : True,
'robert_coeff' : 0.04,
'robert_coeff_tracer' : 0.04,
},

'shallow_physics_nml':{
'fric_damp_time' : -50.0,
'therm_damp_time' : -10.0,
'del_h' : 2.e04,
'h_0' : 3.e04,
'h_amp' : 1.e05,
'h_lon' : 90.0,
'h_lat' : 25.0,
'h_width' : 15.0,
'itcz_width' : 4.0,
'h_itcz' : 4.e04,
},

#The below stirring parameters are those of Vallis et al 2004 DOI: 10.1175/1520-0469(2004)061<0264:AMASDM>2.0.CO;2
#They have a decorrelation time set by 'decay_time', chosen to be 2 days by default. The forcing is also localised in
#latitude and longitude, with the centre of the forcing set by lat0 and lon0, and the width of the gaussians set by
#'widthy and widthx'. B sets the variation in longitude, with ampx = 1 + B*exp(-xx/widthx**2)

'stirring_nml': {
'decay_time':172800,
'amplitude':3.e-13,
'lat0':45.,
'lon0':180.,
'widthy':12.,
'widthx':45.,
'B':1.0,
},

})

#Lets do a run!
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES)
for i in range(2,122):
exp.run(i, num_cores=NCORES)
Loading