/[MITgcm]/MITgcm/verification/natl_box_adjoint/README
ViewVC logotype

Contents of /MITgcm/verification/natl_box_adjoint/README

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.10 - (show annotations) (download)
Fri Sep 2 23:52:58 2005 UTC (18 years, 9 months ago) by dimitri
Branch: MAIN
Changes since 1.9: +44 -17 lines
Modified verification/natl_box_adjoint/README

1 # Example: Subtropical North Atlantic and Labrador Sea Areas
2 # ==========================================================
3 # - forward/adjoint run
4 # - optimization cost function
5 # - The input data is real*8
6 # - The tests below assume that a "taf" executable is available
7 # (http://www.fastopt.de/)
8
9 >>>>>>>>>>>>>>>>>>>> DO THESE THINGS FIRST <<<<<<<<<<<<<<<<<<<<
10 cvs co MITgcm_code
11 cvs co MITgcm/verification/natl_box_adjoint
12 cvs co MITgcm/verification/lab_sea
13 cd MITgcm
14 emacs verification/natl_box_adjoint/README &
15 cd verification/natl_box_adjoint
16 gunzip results*/output*.gz
17 mkdir exe
18 cd input
19 wget -nd -r -A"PH*" http://channel.mit.edu/datasets/MITgcm_input_files/MITgcm/verification/natl_box_adjoint/input
20 cd ../input_seaice
21 wget -nd -r -A"*labsea*" http://channel.mit.edu/datasets/MITgcm_input_files/MITgcm/verification/natl_box_adjoint/input_seaice
22 wget -nd -r -A"pickup*" http://channel.mit.edu/datasets/MITgcm_input_files/MITgcm/verification/natl_box_adjoint/input_seaice
23 >>>>>>>>>>>>>>>>>>>> DO THESE THINGS FIRST <<<<<<<<<<<<<<<<<<<<
24
25 ####################
26 # Experiment no. 1 #
27 ####################
28 # Use air-sea fluxes as controls (standard case):
29 # perform gradient checks for first four elements of the
30 # heat flux part of the control vector (grdchkvarindex = 3).
31 # - with GMREDI, KPP, and shortwave heating
32 # - 4 timesteps
33
34 # Compile code in build/:
35 cd ../build
36 ../../../tools/genmake2 -ieee -mods=../code
37 make depend
38 make adall
39
40 # To run:
41 cd ../exe
42 cp ../input/* .
43 \rm output.txt
44 ../build/mitgcmuv_ad >& output.txt
45 # To verify the results of the gradient check, type:
46 grep grad-res output.txt
47 # A reference output is in:
48 grep grad-res ../results/output.txt_adm
49
50
51 ####################
52 # Experiment no. 2 #
53 ####################
54 # Use bulk formulae and atmospheric state controls
55 # (only differences to experiment 1 are in
56 # ECCO_CPPOPTIONS.h and in data.grdchk):
57 # perform gradient checks for first four elements of the
58 # air temperture part of the control vector (grdchkvarindex = 7).
59
60 # Compile code in build/:
61 cd ../build
62 rm -f *.o *.f *.p rii_files *.flow
63 rm -f *.F *.h *.c Makefile* *.template genmake_*
64 ../../../tools/genmake2 -ieee -mods=../code_bulk
65 make depend
66 make adall
67
68 # To run:
69 cd ../exe
70 cp ../input_bulk/* .
71 cp ../input_bulk/data.grdchk_precip data.grdchk
72 cp ../input/PH_*.data .
73 \rm output.txt
74 ../build/mitgcmuv_ad >& output.txt
75 # To verify the results of the gradient check, type:
76 grep grad-res output.txt
77 # A reference output is in:
78 grep grad-res ../results_bulk/output.txt_adm
79
80
81 ####################
82 # Experiment no. 4 #
83 ####################
84 # Same as exp. 2, but with ALLOW_SEAICE defined and useseaice = .true.
85
86 # Compile code in build/:
87 cd ../build
88 rm -f *.o *.f *.p rii_files *.flow
89 rm -f *.F *.h *.c Makefile* *.template genmake_*
90 ../../../tools/genmake2 -ieee -mods=../code_seaice
91 cp ../code_seaice/SEAICE_OPTIONS.h.FLUXES SEAICE_OPTIONS.h
92 make depend
93 make adall
94
95 # To run:
96 cd ../exe
97 cp ../input_bulk/* .
98 cp ../input_bulk/data.grdchk_precip data.grdchk
99 cp ../input_seaice/data.seaice.cgrid data.seaice
100 cp ../input_seaice/data.pkg .
101 cp ../input/PH_*.data .
102 \rm output.txt
103 ../build/mitgcmuv_ad >& output.txt
104 # To verify the results of the gradient check, type:
105 grep grad-res output.txt
106 # A reference output is in:
107 grep grad-res ../results_seaice/output_exp4.txt_adm
108
109
110 ####################
111 # Experiment no. 5 #
112 ####################
113 # Same as exp. 4, but using sea-ice bulk formulae.
114 # This experiment tests pkg/seaice bulk formulae over open water.
115 # No sea-ice is formed anywhere in the domain.
116
117 # Compile code in build/:
118 cd ../build
119 rm -f *.o *.f *.p rii_files *.flow
120 rm -f *.F *.h *.c Makefile* *.template genmake_*
121 ../../../tools/genmake2 -ieee -mods=../code_seaice
122 make depend
123 make adall
124
125 # To run:
126 cd ../exe
127 cp ../input_bulk/* .
128 cp ../input_bulk/data.grdchk_precip data.grdchk
129 cp ../input_seaice/data.seaice.cgrid data.seaice
130 cp ../input_seaice/data.pkg .
131 cp ../input/PH_*.data .
132 \rm output.txt
133 ../build/mitgcmuv_ad >& output.txt
134 # To verify the results of the gradient check, type:
135 grep grad-res output.txt
136 # A reference output is in:
137 grep grad-res ../results_seaice/output_exp5.txt_adm
138
139
140 ####################
141 # Experiment no. 6 #
142 ####################
143 # Same as experiment 5, but in the Labrador Sea rather than in
144 # the North Atlantic subduction region. The cost function is
145 # total ice volume over the 4-hour test period.
146 #
147 # The cost function data files are not used. They contain:
148 # labsea_TP_fields : filled with -9999
149 # labsea_TP_mean : hour 100 ssh (cm) of lab_sea experiment
150 # labsea_ERS_fields : filled with -9999
151 # labsea_SST_fields : 14 * Levitus annual mean SST
152 # labsea_Lev.ptmp : 14 * Levitus annual mean temperature
153 # labsea_Lev.salt : 14 * Levitus annual mean salinity
154 # labsea_ssh.err : filled with -9999
155 # labsea_geoid.err : constant 0.2 with -9999 landmask
156 # labsea_totflux.err : 100 with -9999 landmask
157 # labsea_pme.err : 4e-8 with -9999 landmask
158 # labsea_ustress.err : 3 with -9999 landmask
159 # labsea_vstress.err : 3 with -9999 landmask
160
161 # To run:
162 cd ../exe
163 cp ../input_seaice/* .
164 cp ../input_bulk/data.grdchk .
165 \rm output.txt
166 ../build/mitgcmuv_ad >& output.txt
167 # To verify the results of the gradient check, type:
168 grep grad-res output.txt
169 # A reference output is in:
170 grep grad-res ../results_seaice/output_exp6.txt_adm
171
172
173 ####################
174 # Experiment no. 6a #
175 ####################
176 # Same as experiment 6, but cost function is now misfit between
177 # daily mean seaice model AREA (fractional ice coverage) and
178 # Scanning Microwave Radiometer (SMR) observations;
179 # fileneme: labsea_daily92to03_20x16_ICECONC
180 # Gradient check needs to run long enough (e.g. 240 timesteps)
181 # for sufficiently large gradients to build.
182 #
183 # To run:
184 cd ../exe
185 cp ../input_seaice/* .
186 cp ../input_seaice/data.240 data
187 cp ../input_seaice/data.seaice.cost_smrarea data.seaice
188 cp ../input_bulk/data.grdchk .
189 \rm output.txt
190 ../build/mitgcmuv_ad >& output.txt
191 # To verify the results of the gradient check, type:
192 grep grad-res output.txt
193 # A reference output is in:
194 grep grad-res ../results_seaice/output_exp6a.txt_adm
195
196
197 ####################
198 # Experiment no. 7 #
199 ####################
200 # Same as experiment 6, but finite difference gradient check for
201 # air temperature is computed and compared for the complete domain.
202 #
203 # Notes:
204 # variables xx_* contain control vector perturbation
205 # variables adxx_* contain cost function gradient relative to control
206
207 # To run:
208 cd ../exe
209 cp ../input_seaice/* .
210 \rm output.txt
211 ../build/mitgcmuv_ad >& output.txt
212 # To verify the results of the gradient check, type:
213 grep grad-res output.txt > grad-res.txt
214 cd ../results_seaice
215 # plot with matlab:
216 matlab
217 lookat_exp8
218
219
220 ####################
221 # Experiment no. 8 #
222 ####################
223 # Same as experiment 7, but starting from a checkpoint file.
224
225 # To run:
226 cd ../exe
227 cp ../input_seaice/* .
228 cp data.001 data
229 \rm output.txt
230 ../build/mitgcmuv_ad >& output.txt
231 # To verify the results of the gradient check, type:
232 grep grad-res output.txt > grad-res.txt
233 cd ../results_seaice
234 matlab
235 lookat_exp8
236
237
238 ####################
239 # Experiment no. 9 #
240 ####################
241 # Same as experiment 8, but starting from time step 180.
242 # This includes a location (12,8) which experiences a phase
243 # transition from no-ice to sea-ice, and which therefore has
244 # a very large and inaccurate gradient.
245
246 # To run:
247 cd ../exe
248 cp ../input_seaice/* .
249 cp data.180 data
250 \rm output.txt
251 ../build/mitgcmuv_ad >& output.txt
252 # To verify the results of the gradient check, type:
253 grep grad-res output.txt > grad-res.txt
254 cd ../results_seaice
255 matlab
256 lookat_exp8
257
258
259 #####################
260 # Experiment no. 10 #
261 #####################
262 # Set up a 100-day sensitivity experiment.
263 # Things start falling apart, see below.
264 # Longer integrations periods cause NANs in adjoint gradient.
265 # Note: cost_ssh is hardwired for 1-day ssh records
266 # "topexperiod" in data.cost is never used.
267
268 # Compile code in build/:
269 cd ../build
270 rm -f *.o *.f *.p rii_files *.flow
271 rm -f *.F *.h *.c Makefile* *.template genmake_*
272 ../../../tools/genmake2 -mods=../code_seaice
273 make depend
274 make adall
275 make ftlall
276
277 # First run for 24 hours:
278 cd ../exe
279 cp ../input_seaice/* .
280 cp data.24 data
281 cp ../input_bulk/data.grdchk .
282 # run the ADM
283 \rm output.txt_adm
284 ../build/mitgcmuv_ad >& output.txt_adm
285 # run the TLM
286 \rm output.txt_tlm
287 ../build/mitgcmuv_ad >& output.txt_tlm
288 # To verify the results of the gradient check, type:
289 grep grad-res output.txt_adm
290 grep grad-res output.txt_tlm
291 # A reference output is in:
292 grep grad-res ../results_seaice/output_exp10.txt_adm
293 grep grad-res ../results_seaice/output_exp10.txt_tlm
294
295 # Now run for 100 days:
296 cp data.100day data
297 \rm output.txt_adm
298 ../build/mitgcmuv_ad >& output.txt_adm
299 grep grad-res output.txt_adm
300 #
301 grad-res proc # i j k fc ref fc + eps fc - eps
302 grad-res proc # i j k adj grad fd grad 1 - fd/adj
303 grad-res -------------------------------
304 grad-res 0 1 17 2 1 0.584991977E+12 0.584969292E+12 0.585035823E+12
305 grad-res 0 1 1 20 0 -.154328414E+42 -.332655172E+12 0.100000000E+01
306
307 # Now modify data.pkg and run for 100 days without KPP and GM:
308 emacs -nw data.pkg
309 \rm output.txt_adm
310 ../build/mitgcmuv_ad < /dev/null >& output.txt_adm
311 grep grad-res output.txt_adm
312 #
313 grad-res proc # i j k fc ref fc + eps fc - eps
314 grad-res proc # i j k adj grad fd grad 1 - fd/adj
315 grad-res -------------------------------
316 grad-res 0 1 17 2 1 0.775568418E+12 0.775568716E+12 0.775568120E+12
317 grad-res 0 1 1 20 0 0.298288524E+10 0.298245351E+10 0.144733246E-03
318
319 # Now modify data and run for 375 days without KPP and GM:
320 emacs -nw data
321 \rm output.txt_adm
322 ../build/mitgcmuv_ad < /dev/null >& output.txt_adm
323 grep grad-res output.txt_adm
324 #
325 grad-res proc # i j k fc ref fc + eps fc - eps
326 grad-res proc # i j k adj grad fd grad 1 - fd/adj
327 grad-res -------------------------------
328 grad-res 0 1 17 2 1 0.896287794E+12 0.896287828E+12 0.896287760E+12
329 grad-res 0 1 1 20 0 0.341242829E+09 0.341148397E+09 0.276729326E-03
330
331 # Now modify data and run for 3650 days without KPP and GM:
332 emacs -nw data
333 \rm output.txt_adm
334 ../build/mitgcmuv_ad < /dev/null >& output.txt_adm
335 grep grad-res output.txt_adm
336 #
337 grad-res proc # i j k fc ref fc + eps fc - eps
338 grad-res proc # i j k adj grad fd grad 1 - fd/adj
339 grad-res -------------------------------
340
341
342
343
344
345
346
347
348
349
350 #####################
351 # Experiment no. 11 #
352 #####################
353 >>>>>>>>>> PH: THIS ONE NOT YET UPDATED <<<<<<<<<<
354 # Same as experiment 8, but using 2-CPU MPI configuration.
355
356 # Compile code in bin/:
357 cd ../bin
358 rm -rf *.o *.f *.p rii_files
359 rm -rf *.F *.h *.c Makefile*
360 cp ../verification/natl_box_adjoint/code_seaice/*.h .
361 cp ../verification/natl_box_adjoint/code_seaice/.genmakerc .
362 cp ../verification/natl_box_adjoint/code_seaice/SIZE.h.MPI SIZE.h
363 cp ../verification/natl_box_adjoint/code_seaice/CPP_EEOPTIONS.h.MPI CPP_EEOPTIONS.h
364 # Configure and compile the code:
365 ../tools/genmake -mpi -makefile
366 # ==> on alhena use:
367 # ../tools/genmake -platform=o2k -mpi -makefile
368 make depend
369 # Generate the adjoint code:
370 cd ../adjoint
371 cp ../verification/natl_box_adjoint/code_seaice/makefile .
372 make adtaf
373 make adchange
374 rm -f makefile
375 # Go back and compile the code:
376 cd ../bin
377 make
378 # To run:
379 cd ../exe
380 cp ../verification/natl_box_adjoint/input_seaice/* .
381 cp data.001 data
382 cp ../verification/natl_box_adjoint/input_bulk/data.grdchk .
383 mpirun -np 2 mitgcmuv
384 # To verify the results of the gradient check, type:
385 grep "ph-grd 3" STDOUT.0000
386 # To plot adjoint sensitivy fields
387 cd ../verification/natl_box_adjoint/results_seaice
388 matlab
389 lookat_exp10
390
391
392 #####################
393 # Experiment no. 12 #
394 #####################
395 # Same as experiment 6, but including LSR dynamic solver.
396
397 # Compile code in build/:
398 cd ../build
399 rm -f *.o *.f *.p rii_files *.flow
400 rm -f *.F *.h *.c Makefile* *.template genmake_*
401 ../../../tools/genmake2 -ieee -mods=../code_seaice
402 cp ../code_seaice/SEAICE_OPTIONS.h.DYN SEAICE_OPTIONS.h
403 make depend
404 make adall
405 make ftlall
406
407 # To run:
408 cd ../exe
409 cp ../input_seaice/* .
410 cp data.seaice.lsr data.seaice
411 cp ../input_bulk/data.grdchk .
412 # run the ADM
413 ../build/mitgcmuv_ad >&! output.txt_adm
414 # run the TLM
415 ../build/mitgcmuv_ftl >&! output.txt_tlm
416
417 # To verify the results of the gradient check, type:
418 grep grad-res output.txt_adm
419 # A reference output is in:
420 grep grad-res ../results_seaice/output_exp12.txt_adm
421
422
423 #####################
424 # Experiment no. 13 #
425 #####################
426 # Same as experiment 12, but finite difference gradient check for
427 # air temperature is computed and compared for the complete domain.
428
429 # To run:
430 cd ../exe
431 cp ../input_seaice/* .
432 cp data.seaice.lsr data.seaice
433 ../build/mitgcmuv_ad >&! output.txt_adm
434 # To verify the results of the gradient check, type:
435 grep grad-res output.txt_adm > grad-res.txt
436 cd ../results_seaice
437 matlab
438 lookat_exp8
439
440
441 #####################
442 # Experiment no. 14 #
443 #####################
444 >>>>>>>>>> PH: THIS ONE NOT YET UPDATED <<<<<<<<<<
445 # Same as in 12 but for a 100-day sensitivity experiment.
446
447 # Compile code in bin/:
448 cd ../bin
449 rm -rf *.o *.f *.p rii_files
450 rm -rf *.F *.h *.c Makefile*
451 cp ../verification/natl_box_adjoint/code_seaice/*.h .
452 rm -f tamc.h
453 cp ../verification/natl_box_adjoint/code_seaice/.genmakerc .
454 cp ../verification/natl_box_adjoint/code_seaice/SEAICE_OPTIONS.h.MULTILEVEL SEAICE_OPTIONS.h
455 # Configure and compile the code:
456 ../tools/genmake -makefile
457 make depend
458 # Generate the adjoint code:
459 cd ../adjoint
460 cp ../verification/natl_box_adjoint/code_seaice/makefile .
461 make adtaf
462 make adchange
463 rm -f makefile
464 # Go back and compile the code:
465 cd ../bin
466 make
467 # To run:
468 cd ../exe
469 cp ../verification/natl_box_adjoint/input_seaice/* .
470 cp data.100day data
471 cp ../verification/natl_box_adjoint/input_bulk/data.grdchk .
472 cp data.seaice.lsr data.seaice
473 ../build/mitgcmuv >&! output.txt
474 # To verify the results of the gradient check, type:
475 grep "ph-grd 3" output.txt
476
477 # For 100-day experiment, with cost_ice_flag = 1, the adjoint gradient
478 # blows up, as in Exp. 10
479 # 1.d-04 0.251994583E+11 -.899637862E+10 0.372048919E+10 -.344972301E+10
480 # adj grad -.160660304+210 -.378763253+210 -.239235971+211 -.386444881+209
481
482 # With cost_ice_flag = 2, i.e., mean sea-ice area
483 # 1.d-04 -.152618243E+11 0.605974121E+06 -.155375485E+11 -.153368205E+11
484 # adj grad 0.000000000E+00 0.000000000E+00 -.124076923E+09 0.000000000E+00
485
486 # With cost_ice_flag = 6, i.e., a quadratic cost function
487 # 1.d-12 -.106128607E+12 0.106330784E+12 -.106446555E+12 -.106237252E+12
488 # 1.d-08 0.106450924E+08 0.103670536E+05 0.349155947E+05 0.335081902E+05
489 # 1.d-04 -.106143365E+04 0.206965778E+00 -.105672737E+04 -.106326894E+04
490 # 1.d-02 -.120891636E-02 0.106325012E+02 0.841459268E+01 -.107119297E+02
491 # 1.d-01 -.102221209E-02 -.124805738E-02 0.821489714E+01 -.331974254E-02
492 # 1.d-00 0.113825328E-03 -.105881751E+00 0.104550010E+02 -.106209116E+00
493 # adj grad 0.000000000E+00 0.000000000E+00 0.887775373E+01 0.000000000E+00
494
495
496 #####################
497 # Experiment no. 15 #
498 #####################
499 # Same as experiment 6, but with SEAICE_MULTILEVEL.
500
501 # Compile code in build/:
502 rm -f *.o *.f *.p rii_files *.flow
503 rm -f *.F *.h *.c Makefile* *.template genmake_*
504 ../../../tools/genmake2 -ieee -mods=../code_seaice
505 cp ../code_seaice/SEAICE_OPTIONS.h.MULTILEVEL SEAICE_OPTIONS.h
506 make depend
507 make adall
508
509 # To run:
510 cd ../exe
511 cp ../input_seaice/* .
512 cp ../input_bulk/data.grdchk .
513 ../build/mitgcmuv_ad >&! output.txt
514
515 # To verify the results of the gradient check, type:
516 grep grad-res output.txt
517 # The reference output is in:
518 grep grad-res ../results_seaice/output_exp15.txt_adm
519
520 # This test suggests that SEAICE_MULTILEVEL decreases the accuracy of
521 # the adjoint model, perhaps because the adjoint model is not handling
522 # multiple recomputations in budget properly.
523
524
525 #####################
526 # Experiment no. 20 #
527 #####################
528 # Same as experiment 10, but using divided adjoint.

  ViewVC Help
Powered by ViewVC 1.1.22