Skip to content

Commit 8e45135

Browse files
authored
Merge pull request #268 from sit23/shallow_and_baro_clean_gfort_input_file
Finally adding shallow and barotropic models to the Isca master
2 parents f77ba4e + e601caa commit 8e45135

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+5940
-125
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ coverage.xml
7979
.pytest_cache/
8080
test/.cache
8181
test/results.xml
82+
*.sh.e*
83+
*.sh.o*
8284

8385
# Translations
8486
*.mo

exp/test_cases/MiMA/MiMA_test_case.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
# is used to load the correct compilers. The env file is always loaded from
2020
# $GFDL_BASE and not the checked out git repo.
2121

22-
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
23-
2422
# create an Experiment object to handle the configuration of model parameters
2523
# and output diagnostics
2624
exp = Experiment('mima_test_experiment', codebase=cb)
@@ -174,6 +172,9 @@
174172
})
175173
#Lets do a run!
176174
if __name__=="__main__":
175+
176+
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
177+
177178
exp.run(1, use_restart=False, num_cores=NCORES)
178179
for i in range(2,121):
179180
exp.run(i, num_cores=NCORES)

exp/test_cases/axisymmetric/axisymmetric_test_case.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
# is used to load the correct compilers. The env file is always loaded from
2020
# $GFDL_BASE and not the checked out git repo.
2121

22-
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
23-
2422
# create an Experiment object to handle the configuration of model parameters
2523
# and output diagnostics
2624
exp = Experiment('axisymmetric_test_case', codebase=cb)
@@ -182,6 +180,9 @@
182180

183181
#Lets do a run!
184182
if __name__=="__main__":
183+
184+
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
185+
185186
exp.run(1, use_restart=False, num_cores=NCORES)
186187
for i in range(2,121):
187188
exp.run(i, num_cores=NCORES)
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import os
2+
3+
import numpy as np
4+
5+
from isca import BarotropicCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
6+
7+
NCORES = 8
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 = BarotropicCodeBase.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('barotropic_stirring_test_experiment', 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+
diag.add_field('barotropic_diagnostics', 'ucomp', time_avg=True)
32+
diag.add_field('barotropic_diagnostics', 'vcomp', time_avg=True)
33+
diag.add_field('barotropic_diagnostics', 'vor', time_avg=True)
34+
diag.add_field('barotropic_diagnostics', 'pv', time_avg=True)
35+
diag.add_field('barotropic_diagnostics', 'stream', time_avg=True)
36+
diag.add_field('barotropic_diagnostics', 'trs', time_avg=True)
37+
diag.add_field('barotropic_diagnostics', 'tr', time_avg=True)
38+
diag.add_field('barotropic_diagnostics', 'eddy_vor', time_avg=True)
39+
diag.add_field('barotropic_diagnostics', 'delta_u', time_avg=True)
40+
diag.add_field('stirring_mod', 'stirring', time_avg=True)
41+
diag.add_field('stirring_mod', 'stirring_amp', time_avg=True)
42+
diag.add_field('stirring_mod', 'stirring_sqr', time_avg=True)
43+
44+
exp.diag_table = diag
45+
46+
#Empty the run directory ready to run
47+
exp.clear_rundir()
48+
49+
#Define values for the 'core' namelist
50+
exp.namelist = namelist = Namelist({
51+
'main_nml':{
52+
'days' : 30,
53+
'hours' : 0,
54+
'minutes': 0,
55+
'seconds': 0,
56+
'dt_atmos': 1200,
57+
'calendar': 'no_calendar',
58+
},
59+
60+
'atmosphere_nml':{
61+
'print_interval': 86400,
62+
},
63+
64+
'fms_io_nml':{
65+
'threading_write' :'single',
66+
'fileset_write': 'single'
67+
},
68+
69+
'fms_nml':{
70+
'print_memory_usage':True,
71+
'domains_stack_size': 200000,
72+
},
73+
74+
'barotropic_dynamics_nml':{
75+
'triang_trunc' : True,
76+
'num_lat' : 128,
77+
'num_lon' : 256,
78+
'num_fourier' : 85,
79+
'num_spherical' : 86,
80+
'fourier_inc' : 1,
81+
'damping_option' : 'resolution_dependent',
82+
'damping_order' : 2,
83+
'damping_coeff' : 1.157E-4,
84+
'damping_coeff_r': 1.929E-6,
85+
'grid_tracer' : True,
86+
'spec_tracer' : True,
87+
'm_0' : 6,
88+
'zeta_0' : 0.0,
89+
'eddy_lat' : 45.0,
90+
'eddy_width' : 10.0,
91+
'robert_coeff' : 0.04,
92+
'initial_zonal_wind' : 'zero',
93+
},
94+
95+
'barotropic_physics_nml':{
96+
},
97+
98+
'stirring_nml': {
99+
'decay_time':172800,
100+
'amplitude':3.e-11,
101+
'lat0':45.,
102+
'lon0':180.,
103+
'widthy':12.,
104+
'widthx':45.,
105+
'B':1.0,
106+
},
107+
108+
})
109+
110+
#Lets do a run!
111+
if __name__=="__main__":
112+
113+
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
114+
115+
exp.run(1, use_restart=False, num_cores=NCORES)
116+
for i in range(2,121):
117+
exp.run(i, num_cores=NCORES)
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import os
2+
3+
import numpy as np
4+
5+
from isca import BarotropicCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
6+
7+
NCORES = 8
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 = BarotropicCodeBase.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('barotropic_test_experiment', 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+
diag.add_field('barotropic_diagnostics', 'ucomp', time_avg=True)
32+
diag.add_field('barotropic_diagnostics', 'vcomp', time_avg=True)
33+
diag.add_field('barotropic_diagnostics', 'vor', time_avg=True)
34+
diag.add_field('barotropic_diagnostics', 'pv', time_avg=True)
35+
diag.add_field('barotropic_diagnostics', 'stream', time_avg=True)
36+
diag.add_field('barotropic_diagnostics', 'trs', time_avg=True)
37+
diag.add_field('barotropic_diagnostics', 'tr', time_avg=True)
38+
diag.add_field('barotropic_diagnostics', 'eddy_vor', time_avg=True)
39+
diag.add_field('barotropic_diagnostics', 'delta_u', time_avg=True)
40+
41+
exp.diag_table = diag
42+
43+
#Empty the run directory ready to run
44+
exp.clear_rundir()
45+
46+
#Define values for the 'core' namelist
47+
exp.namelist = namelist = Namelist({
48+
'main_nml':{
49+
'days' : 30,
50+
'hours' : 0,
51+
'minutes': 0,
52+
'seconds': 0,
53+
'dt_atmos': 1200,
54+
'calendar': 'no_calendar',
55+
},
56+
57+
'atmosphere_nml':{
58+
'print_interval': 86400,
59+
},
60+
61+
'fms_io_nml':{
62+
'threading_write' :'single',
63+
'fileset_write': 'single'
64+
},
65+
66+
'fms_nml':{
67+
'print_memory_usage':True,
68+
'domains_stack_size': 200000,
69+
},
70+
71+
'barotropic_dynamics_nml':{
72+
'triang_trunc' : True,
73+
'num_lat' : 128,
74+
'num_lon' : 256,
75+
'num_fourier' : 85,
76+
'num_spherical' : 86,
77+
'fourier_inc' : 1,
78+
'damping_option' : 'resolution_dependent',
79+
'damping_order' : 4,
80+
'damping_coeff' : 1.e-04,
81+
'grid_tracer' : True,
82+
'spec_tracer' : True,
83+
'm_0' : 4,
84+
'zeta_0' : 8.e-05,
85+
'eddy_lat' : 45.0,
86+
'eddy_width' : 15.0,
87+
'robert_coeff' : 0.04,
88+
},
89+
90+
'barotropic_physics_nml':{
91+
},
92+
})
93+
94+
#Lets do a run!
95+
if __name__=="__main__":
96+
97+
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
98+
99+
exp.run(1, use_restart=False, num_cores=NCORES)
100+
for i in range(2,121):
101+
exp.run(i, num_cores=NCORES)

exp/test_cases/bucket_hydrology/bucket_model_test_case.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
# is used to load the correct compilers. The env file is always loaded from
2020
# $GFDL_BASE and not the checked out git repo.
2121

22-
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
23-
2422
# create an Experiment object to handle the configuration of model parameters
2523
# and output diagnostics
2624
exp = Experiment('bucket_test_experiment', codebase=cb)
@@ -179,6 +177,8 @@
179177

180178
#Lets do a run!
181179
if __name__=="__main__":
180+
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
181+
182182
exp.run(1, use_restart=False, num_cores=NCORES)
183183
for i in range(2,121):
184184
exp.run(i, num_cores=NCORES)

exp/test_cases/frierson/frierson_test_case.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
# is used to load the correct compilers. The env file is always loaded from
2020
# $GFDL_BASE and not the checked out git repo.
2121

22-
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
23-
2422
# create an Experiment object to handle the configuration of model parameters
2523
# and output diagnostics
2624
exp = Experiment('frierson_test_experiment', codebase=cb)
@@ -173,6 +171,8 @@
173171

174172
#Lets do a run!
175173
if __name__=="__main__":
174+
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
175+
176176
exp.run(1, use_restart=False, num_cores=NCORES)
177177
for i in range(2,121):
178178
exp.run(i, num_cores=NCORES)

exp/test_cases/giant_planet/giant_planet_test_case.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
# is used to load the correct compilers. The env file is always loaded from
2020
# $GFDL_BASE and not the checked out git repo.
2121

22-
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
23-
2422
# create an Experiment object to handle the configuration of model parameters
2523
# and output diagnostics
2624
exp = Experiment('giant_planet_test_experiment', codebase=cb)
@@ -207,6 +205,8 @@
207205

208206
#Lets do a run!
209207
if __name__=="__main__":
208+
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
209+
210210
exp.run(1, use_restart=False, num_cores=NCORES)
211211
for i in range(2,121):
212212
exp.run(i, num_cores=NCORES)

exp/test_cases/held_suarez/held_suarez_test_case.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
# is used to load the correct compilers. The env file is always loaded from
1919
# $GFDL_BASE and not the checked out git repo.
2020

21-
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
22-
2321
# create an Experiment object to handle the configuration of model parameters
2422
# and output diagnostics
2523

@@ -104,6 +102,9 @@
104102

105103
#Lets do a run!
106104
if __name__ == '__main__':
105+
106+
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
107+
107108
exp.run(1, num_cores=NCORES, use_restart=False)
108109
for i in range(2, 13):
109110
exp.run(i, num_cores=NCORES) # use the restart i-1 by default

exp/test_cases/realistic_continents/realistic_continents_fixed_sst_test_case.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
# is used to load the correct compilers. The env file is always loaded from
2222
# $GFDL_BASE and not the checked out git repo.
2323

24-
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
25-
2624
# create an Experiment object to handle the configuration of model parameters
2725
# and output diagnostics
2826
exp = Experiment('realistic_continents_fixed_sst_test_experiment', codebase=cb)
@@ -72,6 +70,8 @@
7270

7371
#Lets do a run!
7472
if __name__=="__main__":
73+
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
74+
7575
exp.run(1, use_restart=False, num_cores=NCORES)
7676
for i in range(2,121):
7777
exp.run(i, num_cores=NCORES)

0 commit comments

Comments
 (0)