/[MITgcm]/MITgcm_contrib/verification_other/natl_box_adjoint/README
ViewVC logotype

Contents of /MITgcm_contrib/verification_other/natl_box_adjoint/README

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


Revision 1.1 - (show annotations) (download)
Sat Feb 4 01:57:34 2012 UTC (12 years, 2 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64k, checkpoint64x, checkpoint64z, checkpoint64o, checkpoint64p, checkpoint64r, checkpoint64w, checkpoint64v, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint64m, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65u, checkpoint65j, checkpoint67a, checkpoint67b, checkpoint65i, checkpoint67d, checkpoint65m, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65e, checkpoint64i, checkpoint64h, checkpoint65h, checkpoint65, checkpoint64j, checkpoint65n, HEAD
move un-tested set-up from MITgcm/verification/natl_box_adjoint to Contrib/verification_other

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

  ViewVC Help
Powered by ViewVC 1.1.22