/[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.13 - (show annotations) (download)
Tue Sep 6 16:25:29 2005 UTC (15 years, 9 months ago) by dimitri
Branch: MAIN
CVS Tags: checkpoint57t_post, checkpoint58l_post, checkpoint58e_post, checkpoint57v_post, checkpoint57s_post, checkpoint58b_post, checkpoint58m_post, checkpoint58u_post, checkpoint58r_post, checkpoint57y_post, checkpoint58g_post, checkpoint57x_post, checkpoint58n_post, checkpoint58x_post, checkpoint58t_post, checkpoint58h_post, checkpoint58w_post, checkpoint58j_post, checkpoint57y_pre, checkpoint58q_post, checkpoint57r_post, checkpoint58, checkpoint58f_post, checkpoint58d_post, checkpoint58c_post, checkpoint57w_post, checkpint57u_post, checkpoint58a_post, checkpoint58i_post, checkpoint58o_post, checkpoint57z_post, checkpoint58y_post, checkpoint58k_post, checkpoint58v_post, checkpoint58s_post, checkpoint58p_post
Changes since 1.12: +11 -8 lines
Modified verification/natl_box_adjoint for 10-year test.

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_ftl >& 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 grad-res -------------------------------
331 grad-res 0 2 20 4 1 0.896287794E+12 0.896287837E+12 0.896287752E+12
332 grad-res 0 2 2 40 0 0.425898569E+09 0.424819718E+09 0.253311730E-02
333 grad-res -------------------------------
334 grad-res 0 3 19 6 1 0.896287794E+12 0.896287810E+12 0.896287779E+12
335 grad-res 0 3 3 60 0 0.155522387E+09 0.155305087E+09 0.139722658E-02
336 grad-res -------------------------------
337 grad-res 0 4 11 8 1 0.896287794E+12 0.896335295E+12 0.896334240E+12
338 grad-res 0 4 4 80 0 0.205181064E+12 0.527474334E+10 0.974292251E+00
339
340 # Now modify data and run for 3650 days without KPP and GM:
341 emacs -nw data
342 \rm output.txt_adm
343 ../build/mitgcmuv_ad < /dev/null >& output.txt_adm &
344 grep grad-res output.txt_adm
345 #
346 grad-res proc # i j k fc ref fc + eps fc - eps
347 grad-res proc # i j k adj grad fd grad 1 - fd/adj
348 grad-res -------------------------------
349 grad-res 0 1 17 2 1 0.589620342E+12 0.588645621E+12 0.580985192E+12
350 grad-res 0 1 1 20 0 0.191626271E+43 0.383021453E+14 0.100000000E+01
351 grad-res -------------------------------
352 grad-res 0 2 20 4 1 0.589620342E+12 0.592671001E+12 0.589646830E+12
353 grad-res 0 2 2 40 0 0.267667844E+43 0.151208553E+14 0.100000000E+01
354 grad-res -------------------------------
355 grad-res 0 3 19 6 1 0.589620342E+12 0.589897088E+12 0.590977596E+12
356 grad-res 0 3 3 60 0 0.941766989E+42 -.540254080E+13 0.100000000E+01
357 grad-res -------------------------------
358 grad-res 0 4 11 8 1 0.589620342E+12 0.594465341E+12 0.591740211E+12
359 grad-res 0 4 4 80 0 0.115838596E+46 0.136256470E+14 0.100000000E+01
360
361
362 #####################
363 # Experiment no. 11 #
364 #####################
365 >>>>>>>>>> PH: THIS ONE NOT YET UPDATED <<<<<<<<<<
366 # Same as experiment 8, but using 2-CPU MPI configuration.
367
368 # Compile code in bin/:
369 cd ../bin
370 rm -rf *.o *.f *.p rii_files
371 rm -rf *.F *.h *.c Makefile*
372 cp ../verification/natl_box_adjoint/code_seaice/*.h .
373 cp ../verification/natl_box_adjoint/code_seaice/.genmakerc .
374 cp ../verification/natl_box_adjoint/code_seaice/SIZE.h.MPI SIZE.h
375 cp ../verification/natl_box_adjoint/code_seaice/CPP_EEOPTIONS.h.MPI CPP_EEOPTIONS.h
376 # Configure and compile the code:
377 ../tools/genmake -mpi -makefile
378 # ==> on alhena use:
379 # ../tools/genmake -platform=o2k -mpi -makefile
380 make depend
381 # Generate the adjoint code:
382 cd ../adjoint
383 cp ../verification/natl_box_adjoint/code_seaice/makefile .
384 make adtaf
385 make adchange
386 rm -f makefile
387 # Go back and compile the code:
388 cd ../bin
389 make
390 # To run:
391 cd ../exe
392 cp ../verification/natl_box_adjoint/input_seaice/* .
393 cp data.001 data
394 cp ../verification/natl_box_adjoint/input_bulk/data.grdchk .
395 mpirun -np 2 mitgcmuv
396 # To verify the results of the gradient check, type:
397 grep "ph-grd 3" STDOUT.0000
398 # To plot adjoint sensitivy fields
399 cd ../verification/natl_box_adjoint/results_seaice
400 matlab
401 lookat_exp10
402
403
404 #####################
405 # Experiment no. 12 #
406 #####################
407 # Same as experiment 6, but including LSR dynamic solver.
408
409 # Compile code in build/:
410 cd ../build
411 rm -f *.o *.f *.p rii_files *.flow
412 rm -f *.F *.h *.c Makefile* *.template genmake_*
413 ../../../tools/genmake2 -ieee -mods=../code_seaice
414 cp ../code_seaice/SEAICE_OPTIONS.h.DYN SEAICE_OPTIONS.h
415 make depend
416 make adall
417 make ftlall
418
419 # To run:
420 cd ../exe
421 cp ../input_seaice/* .
422 cp data.seaice.lsr data.seaice
423 cp ../input_bulk/data.grdchk .
424 # run the ADM
425 ../build/mitgcmuv_ad >&! output.txt_adm
426 # run the TLM
427 ../build/mitgcmuv_ftl >&! output.txt_tlm
428
429 # To verify the results of the gradient check, type:
430 grep grad-res output.txt_adm
431 # A reference output is in:
432 grep grad-res ../results_seaice/output_exp12.txt_adm
433
434
435 #####################
436 # Experiment no. 13 #
437 #####################
438 # Same as experiment 12, but finite difference gradient check for
439 # air temperature is computed and compared for the complete domain.
440
441 # To run:
442 cd ../exe
443 cp ../input_seaice/* .
444 cp data.seaice.lsr data.seaice
445 ../build/mitgcmuv_ad >&! output.txt_adm
446 # To verify the results of the gradient check, type:
447 grep grad-res output.txt_adm > grad-res.txt
448 cd ../results_seaice
449 matlab
450 lookat_exp8
451
452
453 #####################
454 # Experiment no. 14 #
455 #####################
456 >>>>>>>>>> PH: THIS ONE NOT YET UPDATED <<<<<<<<<<
457 # Same as in 12 but for a 100-day sensitivity experiment.
458
459 # Compile code in bin/:
460 cd ../bin
461 rm -rf *.o *.f *.p rii_files
462 rm -rf *.F *.h *.c Makefile*
463 cp ../verification/natl_box_adjoint/code_seaice/*.h .
464 rm -f tamc.h
465 cp ../verification/natl_box_adjoint/code_seaice/.genmakerc .
466 cp ../verification/natl_box_adjoint/code_seaice/SEAICE_OPTIONS.h.MULTILEVEL SEAICE_OPTIONS.h
467 # Configure and compile the code:
468 ../tools/genmake -makefile
469 make depend
470 # Generate the adjoint code:
471 cd ../adjoint
472 cp ../verification/natl_box_adjoint/code_seaice/makefile .
473 make adtaf
474 make adchange
475 rm -f makefile
476 # Go back and compile the code:
477 cd ../bin
478 make
479 # To run:
480 cd ../exe
481 cp ../verification/natl_box_adjoint/input_seaice/* .
482 cp data.100day data
483 cp ../verification/natl_box_adjoint/input_bulk/data.grdchk .
484 cp data.seaice.lsr data.seaice
485 ../build/mitgcmuv >&! output.txt
486 # To verify the results of the gradient check, type:
487 grep "ph-grd 3" output.txt
488
489 # For 100-day experiment, with cost_ice_flag = 1, the adjoint gradient
490 # blows up, as in Exp. 10
491 # 1.d-04 0.251994583E+11 -.899637862E+10 0.372048919E+10 -.344972301E+10
492 # adj grad -.160660304+210 -.378763253+210 -.239235971+211 -.386444881+209
493
494 # With cost_ice_flag = 2, i.e., mean sea-ice area
495 # 1.d-04 -.152618243E+11 0.605974121E+06 -.155375485E+11 -.153368205E+11
496 # adj grad 0.000000000E+00 0.000000000E+00 -.124076923E+09 0.000000000E+00
497
498 # With cost_ice_flag = 6, i.e., a quadratic cost function
499 # 1.d-12 -.106128607E+12 0.106330784E+12 -.106446555E+12 -.106237252E+12
500 # 1.d-08 0.106450924E+08 0.103670536E+05 0.349155947E+05 0.335081902E+05
501 # 1.d-04 -.106143365E+04 0.206965778E+00 -.105672737E+04 -.106326894E+04
502 # 1.d-02 -.120891636E-02 0.106325012E+02 0.841459268E+01 -.107119297E+02
503 # 1.d-01 -.102221209E-02 -.124805738E-02 0.821489714E+01 -.331974254E-02
504 # 1.d-00 0.113825328E-03 -.105881751E+00 0.104550010E+02 -.106209116E+00
505 # adj grad 0.000000000E+00 0.000000000E+00 0.887775373E+01 0.000000000E+00
506
507
508 #####################
509 # Experiment no. 15 #
510 #####################
511 # Same as experiment 6, but with SEAICE_MULTILEVEL.
512
513 # Compile code in build/:
514 rm -f *.o *.f *.p rii_files *.flow
515 rm -f *.F *.h *.c Makefile* *.template genmake_*
516 ../../../tools/genmake2 -ieee -mods=../code_seaice
517 cp ../code_seaice/SEAICE_OPTIONS.h.MULTILEVEL SEAICE_OPTIONS.h
518 make depend
519 make adall
520
521 # To run:
522 cd ../exe
523 cp ../input_seaice/* .
524 cp ../input_bulk/data.grdchk .
525 ../build/mitgcmuv_ad >&! output.txt
526
527 # To verify the results of the gradient check, type:
528 grep grad-res output.txt
529 # The reference output is in:
530 grep grad-res ../results_seaice/output_exp15.txt_adm
531
532 # This test suggests that SEAICE_MULTILEVEL decreases the accuracy of
533 # the adjoint model, perhaps because the adjoint model is not handling
534 # multiple recomputations in budget properly.
535
536
537 #####################
538 # Experiment no. 20 #
539 #####################
540 # Same as experiment 10, but using divided adjoint.

  ViewVC Help
Powered by ViewVC 1.1.22