-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_topog
executable file
·162 lines (134 loc) · 4.37 KB
/
run_topog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#
echo " "
echo " =>executing: run_topog"
echo " "
#
# run script for driving the "topog.F" module
#
# options: (must choose only one of these)
# -Dscripps_kmt : interpolate Scripps topography to "kmt"
# on MOM grid
# -Didealized_kmt : use the test case idealized "kmt"
# -Dread_my_kmt : import a "kmt"
#
# options: (optional)
# -Dwrite_my_kmt : export a "kmt"
#
# options: (must choose only one of these)
# -Dread_my_grid : read in your own grid definition
# -Dgenerate_a_grid : generate a grid based on USER INPUT
# in grids.F
# optional options:
#
# -Drectangular_box : sets "kmt" to a flat bottom rectangular box
# -Dflat_bottom : sets "kmt" over ocean to maximum levels (km)
# -Dcyclic : sets cyclic conditons in zonal direction
#
set DISPLAY_OPTION = ' ' # for batch mode
#set DISPLAY_OPTION = '-Dascii_display' # ascii editor
#set DISPLAY_OPTION = '-Dsgi_display' #gfdl graphics only
set INTERACTIVE_OPTION = '-Dinteractive_edit_topography ' #gfdl graphics only
if ("$DISPLAY_OPTION" != "-Dascii_display" && "$DISPLAY_OPTION" != "-Dsgi_display") then
set INTERACTIVE_OPTION = ' ' #no interaction if no display
endif
set PROMPT_OPTION = ' '
#set PROMPT_OPTION = '-Dprompt_shallow -Dprompt_perimeter_violations -Dprompt_nonadvective -Dprompt_potholes' #gfdl graphics only
if ($INTERACTIVE_OPTION == ' ') then
set PROMPT_OPTION = ' ' #no prompts if no interaction
endif
#set TOPOGRAPHY = '-Dscripps_kmt'
#set TOPOGRAPHY = '-Dread_my_kmt'
set TOPOGRAPHY = '-Didealized_kmt'
#set OPTIONS = '-Ddrive_topog -Dgenerate_a_grid'
set OPTIONS = '-Ddrive_topog -Dgenerate_a_grid -Dcyclic'
set OTHER_OPTIONS = ' '
#set OTHER_OPTIONS = ' -Dwrite_my_kmt'
#set OTHER_OPTIONS = ' -Dskip_interp_details -Dskip_island_map -Dskip_kmt_map '
set ALL_OPTIONS = "$OTHER_OPTIONS $OPTIONS $TOPOGRAPHY $DISPLAY_OPTION $INTERACTIVE_OPTION $PROMPT_OPTION"
echo OPTION LIST: $ALL_OPTIONS
echo " "
set MOM2 = /home/rcp/MOM_2 # base model code
set WORK = TEMP_DIR # temp directory
set error = false
if (! -r grids.F) then
echo '=>Error: need to have "grids.F" in this UPDATES directory'
echo ' copy "grids.F" to this directory and make modifications here'
set error = true
endif
if (! -r topog.F) then
echo '=>Error: need to have "topog.F" in this UPDATES directory'
set error = true
endif
if (! -r size.h) then
echo '=>Error: need to have "size.h" in this UPDATES directory'
set error = true
endif
if ("$error" == "true") then
exit
endif
echo "=>Grabbing sources from $MOM2"
if (-d $WORK) then
/bin/rm -r $WORK
endif
mkdir $WORK
cd $WORK
set list = (stdunits.h coord.h util.F iomngr.F iomngr.h size_check.F topog.h isleperim.F glstuff.F glstuff.h)
foreach file ($list)
echo $file
cp $MOM2/$file .
end
cp ../grids.F .
cp ../size.h .
cp ../topog.F .
set DELTAS = `ls ../delta*`
if ("$DELTAS" == "") then
echo ' no topographic "delta" files were found... So none to copy'
else
echo ' copying existing topographic "delta" files from this UPDATES directory'
cp ../delta* .
endif
if (-s kmt.dta) then
echo " =>Note: copying kmt.dta from this UPDATES directory"
cp ../kmt.dta .
endif
if ("$TOPOGRAPHY" == "-Dscripps_kmt") then
set SCRIPPS_PATH = $MOM2
if (! -r $SCRIPPS_PATH/scripps.top) then
echo '=>Error: file "scripps.top" could not be found '
echo ' when using the scripps_kmt option'
echo ' change the SCRIPPS_PATH in run_topog to point to it'
exit
else
echo " copying SCRIPPS topography from $SCRIPPS_PATH/scripps.top"
cp $SCRIPPS_PATH/scripps.top .
endif
endif
chmod u+w *
echo "=>compiling..."
if ($DISPLAY_OPTION == "-Dsgi_display") then
f77 -P $ALL_OPTIONS topog.F; f77 topog.i -lfgl -lgl_s
else
f77 -P $ALL_OPTIONS topog.F; f77 topog.i
endif
echo "=> running...results are being written to results_topog"
if ($DISPLAY_OPTION == "-Dascii_display") then
a.out
else
a.out > ../results_topog
endif
set DELTAS = `ls delta*`
if ("$DELTAS" == "") then
echo ' =>Note: no topographic "delta" files was created'
else
echo " =>Note: Copying $DELTAS to this UPDATES directory"
cp delta* ../
endif
if (-s kmt.dta) then
echo " =>Note: Exporting kmt.dta into this UPDATES directory"
cp kmt.dta ../
else
echo ' =>Note: no kmt.dta file was created for export'
endif
chmod u+w *
cd ../
/bin/rm -r $WORK