source: codes/icosagcm/trunk/param_sets/make_rundefs.sh @ 1030

Last change on this file since 1030 was 284, checked in by dubos, 10 years ago

Updated make_rundefs.sh and new DCMIP parameter files

  • Property svn:executable set to *
File size: 9.3 KB
RevLine 
[194]1#!/bin/bash
2
3function print()
4{
5    # prints one comment line followed by any number of "key = value" lines
6    echo "# $1 : $2 (default=$3)"
7    shift; shift; shift;
8    while (($# > 0)) ; do
9        echo "$1 = $2"
10        shift; shift;
11    done
12    echo
13}
14
15################################### Planet #######################################
16 
[215]17function radius { print 'Planetary radius' real 6371220 radius $1 
[194]18}
19function g      { print Gravity real 9.80616 g $1 
20}
21function omega { print 'Planetary rotation rate' real 7.292E-5 omega $1 
22}
23function kappa { print 'kappa=Rd/cpp' real 0.2857143 kappa $1 
24}
25function cpp     { print 'Heat capacity at constant pressure' real 1004.70885 cpp $1
26}
27function preff { print 'Reference pressure' real 101325 preff $1 
28}
29function scale_factor { print 'Scale factor for small planet experiment' real 1. scale_factor $1 
30}
31
32##################################### Mesh #####################################
33
34function nbp   { print 'Number of subdivisions on a main triangle' integer 40 nbp $1 
35}
36function split { print 'Sub splitting of main rhombus' integer 1 nsplit_i $1 nsplit_j $2 
37}
38function llm   { print 'Number of vertical layers' integer 19 llm $1 
39}
[195]40function disvert { print 'Vertical grid' '[std|ncar|ncarl30]' std disvert $1 
[194]41}
42function ncar_dz { print 'Model layer thickness in m, used if disvert=ncar' real 300 ncar_dz $1
43}
44function optim_it { print 'Mesh optimisation : number of iterations' integer 0 optim_it $1 
45}
46
47################################# Numerics ###################################
48
49function scheme { print 'Time-stepping scheme' '[euler|leapfrog_matsuno|runge_kutta]' runge_kutta scheme $1 
50}
51function time_step { print 'Time step in s' real 480 dt $1 
52}
53function matsuno { print 'Matsuno period' integer 5 matsuno_period $1 
54}
55function itau_adv { print 'Advection called every itau_adv time steps' integer 2 itau_adv $1 
56}
[217]57function nqtot { print 'Number of tracers' integer 1 nqtot $1
[194]58}
59function caldyn { print 'Equations solved' '[gcm|adv]' gcm caldyn $1 
60}
[195]61function caldyn_conserv { print 'Discretization of Coriolis term' '[energy|enstophy]' energy caldyn_conserv $1 
[194]62}
63function caldyn_eta { print 'Vertical coordinate' '[eta_mass|eta_lag]' mass caldyn_eta $1 
64}
65function boussinesq { print 'Boussinesq approximation, requires eta_lag' '[.FALSE.|.TRUE.]' .FALSE. boussinesq $1
66}
67############################### Time and output ###############################
68
[278]69function time_style() { print 'Time style' '[none|dcmip]' dcmip time_style $1 
[194]70}
71function run_length() { print 'Run length in s' real ?? run_length $1 
72}
73function write_period { print 'Interval in s between two outputs' integer ?? write_period $1 
74}
75function out_pressure_level { print 'Pressure level to which interpolate T' real 0 out_pression_level $1
76}
77
78################################ Physics ######################################
79
80function etat0 { 
[284]81    OPTS=$(printf '\n#   [jablonowsky06|academic|dcmip[1-4]|heldsz|dcmip2_schaer_noshear]')
[217]82    print 'Initial state' "$OPTS" jablonowsky06 etat0 $1
[194]83}
84function dissip
85{
86    print 'Dissipation time for grad(div)' real 5000 tau_graddiv $1
87    print 'Exponent of grad(div) disspation' integer 1 nitergdiv $2
88    print 'Dissipation time for curl(curl)' real 5000 tau_gradrot $3
[195]89    print 'Exponent of curl(curl) disspation' integer 1 nitergrot $4
90    print 'Dissipation time for div(grad)' real 5000 tau_divgrad $5
91    print 'Exponent of div(grad) disspation' integer 1 niterdivgrad $6
[194]92}
[284]93# Standard dissipation values for a few nbp
94function dissip32() { dissip 21600 2 50000 2 50000 2
95}
96function dissip40() { dissip 18000 2 18000 2 18000 2
97}
98function dissip64() { dissip 10800 2 10800 2 10800 2
99}
100function dissip80() { dissip 9000 2 9000 2 9000 2
101}
102
103
[194]104function guided_type { print 'Type of guiding terms' '[none|dcmip1]' none guided_type $1 
105}
106
[284]107function rayleigh_friction_type { print 'Type of Rayleigh friction' '[none|dcmip21]' none rayleigh_friction_type $1 
108}
109
110function rayleigh_friction_tau { print 'Relaxation time for Rayleigh friction' '0' none rayleigh_friction_tau $1 
111}
112
113function guided_type { print 'Type of guiding terms' '[none|dcmip1]' none guided_type $1 
114}
115
[217]116function physics { print 'Physics package' '[none|held_suarez|dcmip]' none physics $1
[194]117}
118
[215]119function itau_physics { print 'Call physics every itau_physics time steps' 'integer' 1 itau_physics $1
120}
121
[194]122#################################### DCMIP #################################
[197]123
[194]124function dcmip1_def()
125{
[249]126    etat0 dcmip1
[194]127    OPTS=$(printf '\n#    [const|slotted_cyl|cos_bell|dbl_cos_bell_q1|dbl_cos_bell_q2|complement|hadley|dcmip11]')
128    print 'DCMIP 1.1 advection test, initial tracer field' "$OPTS" cos_bell dcmip1_shape $1
[249]129    print 'DCMIP 1.1 advection test, wind field' '[solid|deform|hadley]' deform dcmip1_wind $2
[194]130}
131function dcmip_refs()
132{
133    print 'Reference temperature T0 for DCMIP test cases' real 300 ncar_T0 $1
134    print 'Reference pressure p0 for DCMIP test cases, used by disvert if disver=ncar' real 1e5 ncar_p0 $2
135    print 'Exponent for B(eta), used by disvert if disvert=ncar' integer 1 ncar_disvert_c $3
136}
137function dcmip_physics()
138{
139    physics dcmip
140    print 'DCMIP physics' '[0|1]' 1 dcmip_physics $1
141}
142function dcmip4_testcase { print 'DCMIP 4 Test case' '[1|2]' 1 dcmip4_testcase $1 
143}
144
145####################### Functions generating parameter files ####################
146
147function params {
148    # executes any number of "command arg" commands
149    while (($# > 0)) ; do
150        $1 $2
151        shift; shift;
152    done
153}
154
155function group { 
156    # prints one separation line then executes any number of "command arg" commands
157    echo
158    echo "#---------------- $1 ----------------"
159    echo
160    shift
161    params $*
162}
163
164function williamson91()
165{
166    group 'Mesh' nbp 40 llm 1 optim_it 100 ; split 2 2
[197]167    group 'Numerics' time_step 480 caldyn_conserv enstrophy
[194]168    group 'Time and output' out_pressure_level 85000 write_period 21600 run_length 864000
169    group 'Physical parameters' radius 6.37122e6 g 9.80616 caldyn_eta eta_lag boussinesq .TRUE. etat0 williamson91.6
170    dissip 5000 2 5000 2 5000 2   
171}
172
173function held_suarez()
174{
175    group 'Mesh' nbp 40 llm 19 disvert std optim_it 1000 ; split 2 2
[278]176    group 'Numerics' itau_adv 1 time_step 480 nqtot 0
177    group 'Time and output' time_style none run_length 103680000 write_period 86400
[197]178    group 'Planet' radius 6.371e6 g 9.8 omega 7.292e-5 kappa 0.2857143 cpp 1004 preff 1e5
[217]179    group 'Physical parameters' etat0 held_suarez physics held_suarez
[284]180    dissip40
[194]181}
182
183function const_dcmip
184{
185    group 'Planet' radius 6.37122e6 g 9.80616 kappa 0.2857143 cpp 1004.5 preff 1e5 omega $1 
186    group 'Constants' ; dcmip_refs 300 1e5 1
187}
188
189function dcmip11
190{
[284]191    const_dcmip 0
[194]192    group 'Mesh' nbp 80 llm 60 disvert ncar ncar_dz 200 optim_it 100 ; split 2 2
[197]193    group 'Numerics' caldyn adv time_step 180
[194]194    group 'Time' run_length 1036800 write_period 86400
[249]195    group 'Physical parameters' nqtot 5 guided_type dcmip1 ; dcmip1_def dcmip11 deform
[194]196}
197
[284]198function dcmip20
199{
200    const_dcmip 0 # non-rotating
201    group 'Mesh' nbp 64 llm 15 disvert ncar ncar_dz 800 optim_it 100 ; split 2 2
202    group 'Numerics' time_step 300
203    dissip64
204    group 'Time' run_length 518400 write_period 21600
205    group 'Physical parameters' scale_factor 1 etat0 dcmip2_mountain
206}
207
[194]208function dcmip21
209{
[284]210# small planet : we define the unscaled time as T and the scaled time is T/X
211# time.f90 divides times and lengths scales by scale factor X
212# the DCMIP document uses the words "scaled" and "unscaled" ambiguously
213# at p.3 the "rescaled radius" is a/X
214# in the description of experiment 2.1 (p. 32) "T in unscaled time units" means T/X
215# and "T in scaled times units" means T
216# I understand the document as tau_rayleigh/X=25s
217    const_dcmip 0 # non-rotating
[194]218    group 'Mesh' nbp 64 llm 60 disvert ncar ncar_dz 500 optim_it 100 ; split 2 2
[197]219    group 'Numerics' time_step 300
[284]220    dissip64
[194]221    group 'Time' run_length 3.6e6 write_period 50000
[284]222    group 'Physical parameters' scale_factor 500  etat0 dcmip2_schaer_noshear rayleigh_friction_tau 12500 rayleigh_friction_type dcmip2_schaer_noshear
[194]223}
224
225function dcmip3
226{
[284]227    const_dcmip 0 # non-rotating
[194]228    group 'Mesh' nbp 80 llm 10 disvert ncar ncar_dz 1000 optim_it 100 ; split 2 2
[197]229    group 'Numerics' time_step 240
[284]230    dissip80
[194]231    group 'Time' run_length 4.5e5 write_period 12500
[284]232    group 'Physical parameters' scale_factor 125 etat0 dcmip3
[194]233}
234
[284]235# Next DCMIP test cases have rotation
236
[197]237function dcmip4x
[194]238{
239    echo 'INCLUDEDEF = const.def'
[195]240    group 'Mesh' nbp 80 llm 30 disvert ncarl30 optim_it 100 ; split 2 2
[197]241    group 'Numerics' time_step 240
[284]242    dissip80
[194]243    group 'Time' run_length 3.6e6 write_period 21600
[197]244    group 'Physical parameters' nqtot 2 etat0 dcmip4 dcmip4_testcase $1
[194]245}
246
[197]247function dcmip42
[194]248{
[197]249    dcmip4x 2
250    dcmip_physics 1
251}
252
253function dcmip51
254{
[194]255    echo 'INCLUDEDEF = const.def'
[195]256    group 'Mesh' nbp 64 llm 30 disvert ncarl30 optim_it 1000 ; split 2 2
[197]257    group 'Numerics' time_step 300
[284]258    dissip64
[194]259    group 'Time' run_length 864000 write_period 7200
[215]260    group 'Physical parameters' nqtot 1 etat0 dcmip5 dcmip_physics 0 itau_physics 6
[194]261}
262   
263########## Main program : generate all *.def files in param_sets ##############
264
265function mkcd { cd $ROOT ; mkdir -p $1 ; cd $1
266}
267
268set -o errexit
269ROOT=$PWD
270
271mkcd climate/Held_Suarez
272held_suarez > run.def
273
274mkcd shallow_water/williamson91
275williamson91 > run6.def
276
277mkcd dcmip2012
278const_dcmip 7.292e-5 > const.def
279dcmip11 > run11.def
[284]280dcmip20 > run20.def
[194]281dcmip21 > run21.def
[284]282dcmip3  > run3.def
[197]283dcmip4x 1 > run41.def
[194]284dcmip42 > run42.def
[197]285dcmip51 > run51.def
Note: See TracBrowser for help on using the repository browser.