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

Diff of /MITgcm/verification/natl_box_adjoint/README

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

revision 1.1 by heimbach, Tue Feb 5 20:34:35 2002 UTC revision 1.2 by heimbach, Thu Nov 6 22:57:38 2003 UTC
# Line 0  Line 1 
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    
7    >>>>>>>>>>>>>>>>>>>> DO THESE THINGS FIRST <<<<<<<<<<<<<<<<<<<<
8    mkdir verification/natl_box_adjoint/exe
9    cd verification/natl_box_adjoint/exe
10    ln -s ../build/mitgcmuv_ad .
11    ln -s ../build/mitgcmuv_ftl .
12    >>>>>>>>>>>>>>>>>>>> DO THESE THINGS FIRST <<<<<<<<<<<<<<<<<<<<
13    
14    ####################
15    # Experiment no. 1 #
16    ####################
17    # Use air-sea fluxes as controls (standard case):
18    # perform gradient checks for first four elements of the
19    # heat flux part of the control vector (grdchkvarindex = 3).
20    # - with GMREDI, KPP, and shortwave heating
21    # - 4 timesteps
22    
23    # Compile code in build/:
24     cd ../build
25     ../../../tools/genmake2 -mods=../code
26     make depend
27     make adall
28    
29    # To run:
30     cd ../exe
31     cp ../input/* .
32     ./mitgcmuv_ad >&! output.txt
33    # To verify the results of the gradient check, type:
34     grep grad-res output.txt
35    # A reference output is in:
36     grep grad-res ../results/output.txt_adm
37    
38    
39    ####################
40    # Experiment no. 2 #
41    ####################
42    # Use bulk formulae and atmospheric state controls
43    # (only differences to experiment 1 are in
44    # ECCO_CPPOPTIONS.h and in data.grdchk):
45    # perform gradient checks for first four elements of the
46    # air temperture part of the control vector (grdchkvarindex = 7).
47    
48    # Compile code in build/:
49     cd ../build
50     rm -f *.o *.f *.p rii_files *.flow
51     rm -f *.F *.h *.c Makefile* *.template genmake_*
52     ../../../tools/genmake2 -mods=../code_bulk
53     make depend
54     make adall
55    
56    # To run:
57     cd ../exe
58     cp ../input_bulk/* .
59     cp ../input/PH_*.data .
60     ./mitgcmuv_ad >&! output.txt
61    # To verify the results of the gradient check, type:
62     grep grad-res output.txt
63    # A reference output is in:
64     grep grad-res ../results_bulk/output.txt_adm
65    
66    
67    ####################
68    # Experiment no. 4 #
69    ####################
70    # Same as exp. 2, but with ALLOW_SEAICE defined and useseaice = .true.
71    
72    # Compile code in build/:
73     cd ../build
74     rm -f *.o *.f *.p rii_files *.flow
75     rm -f *.F *.h *.c Makefile* *.template genmake_*
76     ../../../tools/genmake2 -mods=../code_seaice
77     cp ../code_seaice/SEAICE_OPTIONS.h.FLUXES SEAICE_OPTIONS.h
78     make depend
79     make adall
80    
81    # To run:
82     cd ../exe
83     cp ../input_bulk/* .
84     cp ../input_seaice/data.seaice.cgrid data.seaice
85     cp ../input_seaice/data.pkg .
86     cp ../input/PH_*.data .
87     ./mitgcmuv_ad >&! output.txt
88    # To verify the results of the gradient check, type:
89     grep grad-res output.txt
90    # A reference output is in:
91     grep grad-res ../results_seaice/output_exp4.txt_adm
92    
93    
94    ####################
95    # Experiment no. 5 #
96    ####################
97    # Same as exp. 4, but using sea-ice bulk formulae.
98    # This experiment tests pkg/seaice bulk formulae over open water.
99    # No sea-ice is formed anywhere in the domain.
100    
101    # Compile code in build/:
102     cd ../build
103     rm -f *.o *.f *.p rii_files *.flow
104     rm -f *.F *.h *.c Makefile* *.template genmake_*
105     ../../../tools/genmake2 -mods=../code_seaice
106     make depend
107     make adall
108    
109    # To run:
110     cd ../exe
111     cp ../input_bulk/* .
112     cp ../input_seaice/data.seaice.cgrid data.seaice
113     cp ../input_seaice/data.pkg .
114     cp ../input/PH_*.data .
115     ./mitgcmuv_ad >&! output.txt
116    # To verify the results of the gradient check, type:
117     grep grad-res output.txt
118    # A reference output is in:
119     grep grad-res ../results_seaice/output_exp5.txt_adm
120    
121    
122    ####################
123    # Experiment no. 6 #
124    ####################
125    # Same as experiment 5, but in the Labrador Sea rather than in
126    # the North Atlantic subduction region.  The cost function is
127    # total ice volume over the 4-hour test period.
128    #
129    # The cost function data files are not used.  They contain:
130    # labsea_TP_fields   : filled with -9999
131    # labsea_TP_mean     : hour 100 ssh (cm) of lab_sea experiment
132    # labsea_ERS_fields  : filled with -9999
133    # labsea_SST_fields  : 14 * Levitus annual mean SST
134    # labsea_Lev.ptmp    : 14 * Levitus annual mean temperature
135    # labsea_Lev.salt    : 14 * Levitus annual mean salinity
136    # labsea_ssh.err     : filled with -9999
137    # labsea_geoid.err   : constant 0.2 with -9999 landmask
138    # labsea_totflux.err : 100 with -9999 landmask
139    # labsea_pme.err     : 4e-8 with -9999 landmask
140    # labsea_ustress.err : 3 with -9999 landmask
141    # labsea_vstress.err : 3 with -9999 landmask
142    
143    # To run:
144     cd ../exe
145     cp ../input_seaice/* .
146     cp ../input_bulk/data.grdchk .
147     ./mitgcmuv_ad >&! output.txt
148    # To verify the results of the gradient check, type:
149     grep grad-res output.txt
150    # A reference output is in:
151     grep grad-res ../results_seaice/output_exp6.txt_adm
152    
153    
154    ####################
155    # Experiment no. 7 #
156    ####################
157    # Same as experiment 6, but finite difference gradient check for
158    # air temperature is computed and compared for the complete domain.
159    #
160    # Notes:
161    # variables xx_* contain control vector perturbation
162    # variables adxx_* contain cost function gradient relative to control
163    
164    # To run:
165     cd ../exe
166     cp ../input_seaice/* .
167     ./mitgcmuv_ad >&! output.txt
168    # To verify the results of the gradient check, type:
169     grep grad-res output.txt > grad-res.txt
170    # A reference output is in:
171     grep grad-res ../results_seaice/output_exp6.txt_adm
172    # plot with matlab:
173     cd ../results_seaice
174     matlab
175     lookat_exp8
176    
177    
178    ####################
179    # Experiment no. 8 #
180    ####################
181    >>>>>>>>>> PH: THIS ONE NOT YET UPDATED <<<<<<<<<<
182    # Same as experiment 7, but starting from a checkpoint file.
183    
184    # To run:
185     cd ../../../exe
186     cp ../verification/natl_box_adjoint/input_seaice/* .
187     cp data.001 data
188     ./mitgcmuv >&! output.txt
189    # To verify the results of the gradient check, type:
190     grep "ph-grd 3" output.txt > ph-grd.txt
191     cd ../verification/natl_box_adjoint/results_seaice
192     matlab
193     lookat_exp8
194    
195    
196    ####################
197    # Experiment no. 9 #
198    ####################
199    >>>>>>>>>> PH: THIS ONE NOT YET UPDATED <<<<<<<<<<
200    # Same as experiment 8, but starting from time step 180.
201    # This includes a location (12,8) which experiences a phase
202    # transition from no-ice to sea-ice, and which therefore has
203    # a very large and inaccurate gradient.
204    
205    # To run:
206     cd ../../../exe
207     cp ../verification/natl_box_adjoint/input_seaice/* .
208     cp data.180 data
209     ./mitgcmuv >&! output.txt
210    # To verify the results of the gradient check, type:
211     grep "ph-grd 3" output.txt > ph-grd.txt
212     cd ../verification/natl_box_adjoint/results_seaice
213     matlab
214     lookat_exp8
215    
216    
217    #####################
218    # Experiment no. 10 #
219    #####################
220    # Set up a 100-day sensitivity experiment.
221    # Things start falling apart, see below.
222    # Longer integrations periods cause NANs in adjoint gradient.
223    # Note: cost_ssh is hardwired for 1-day ssh records
224    #       "topexperiod" in data.cost is never used.
225    
226    # Compile code in build/:
227     cd ../build
228     rm -f *.o *.f *.p rii_files *.flow
229     rm -f *.F *.h *.c Makefile* *.template genmake_*
230     ../../../tools/genmake2 -mods=../code_seaice
231     make depend
232     make adall
233     make ftlall
234    
235    # To run:
236    # PH: I modified data to run 24 timesteps only
237     cd ../exe
238     cp ../input_seaice/* .
239     cp data.24 data
240     cp ../input_bulk/data.grdchk .
241    # run the ADM
242     ./mitgcmuv_ad >&! output.txt_adm
243    # run the TLM
244     ./mitgcmuv_ftl >&! output.txt_tlm
245    
246    # For 100 days, adjoint gradient is NAN
247    
248    # Following table compares finite difference gradient for various choices
249    # of grdchk_eps.
250     1.d-12   -.177327175E+20 0.140230277E+20 -.254542273E+20 0.138603531E+19
251     1.d-8    0.174714613E+16 -.527867903E+15 0.403581037E+15 0.377322748E+12
252     1.d-4    0.999954825E+11 0.156018218E+12 -.474931072E+11 -.357260091E+11
253     1.d-2    0.634576350E+09 -.185440863E+10 -.599212833E+09 -.334417056E+10
254    
255    # Following table compares adjoint and finite difference gradient for
256    # various choices of nTimeSteps
257    # with nTimeSteps=4
258     adj grad  0.103151639E+00 0.308058453E+00 -.732758366E+04 -.161844794E+06
259     1.d-4     0.305175781E+00 0.305175781E+00 -.732757568E+04 -.161844788E+06
260    # with nTimeSteps=24
261     adj grad  0.137444822E+04 0.365984818E+04 0.256198267E+05 -.204077640E+06
262     1.d-4     0.137313843E+04 0.365982056E+04 0.256221008E+05 -.204077454E+06
263    # with nTimeSteps=240
264     adj grad  0.443328852E+39 -.133652133E+38 -.905448973E+38 -.598093614E+40
265     1.d-4     -.209616183E+10 0.257127391E+10 -.917457365E+10 0.104622205E+10
266    # with nTimeSteps=480
267     adj grad  -.217869560E+39 0.656820132E+37 0.444973903E+38 0.293927165E+40
268     1.d-4     -.848343350E+09 0.186724144E+10 -.768266406E+10 0.188919420E+10
269    # with nTimeSteps=960
270     adj grad  -.125255788E+49 0.377613667E+47 0.255820763E+48 0.168982206E+50
271     1.d-4     0.683065531E+10 -.241320782E+11 -.359080729E+11 0.222805821E+11
272    # with nTimeSteps=1920
273     adj grad  0.993422132E+94 -.299490969E+93 -.202895220E+94 -.134022280E+96
274     1.d-4     0.677603652E+12 0.115923780E+12 -.383606246E+12 -.393716060E+12
275    # with nTimeSteps=2400
276     adj grad  0.204800998+114 -.617421814+112 -.418282846+113 -.276296408+115
277     1.d-4     0.796041873E+12 0.280172355E+12 -.429971310E+12 -.655627972E+12
278    # with nTimeSteps=3600
279     adj grad  0.123800977+143 -.373227788+141 -.252849475+142 -.167019524+144
280     1.d-4     0.154270431E+12 0.246315840E+12 0.392679620E+12 0.816557457E+11
281    
282    # With cost_ice_flag = 2
283    # adj grad  0.500216760+194 -.353450868+194 -.799381224+195 -.173412383+194
284    # 1.d-04    -.327859949E+08 -.300222927E+10 0.252204364E+09 -.658448165E+10
285    # 1.d-03    -.572185323E+08 0.614938314E+08 -.850914638E+09 0.248982808E+08
286    # 1.d-02    -.624721639E+07 -.147537212E+08 -.114497432E+09 -.358163526E+08
287    # 1.d-01    0.603974309E+07 -.684786020E+07 -.149337451E+09 -.601790080E+07
288    # 1.d-00    -.497381448E+06 -.404972657E+05 -.142684281E+09 -.501277195E+08
289    
290    # 100 day experiment with cost_ice_flag = 3, but in North Atlantic
291    # domain, i.e., with no sea-ice is OK
292     adj grad  0.234593317E+17 0.166950683E+17 0.238665515E+17 0.249850733E+17
293     1.d-4     0.234313954E+17 0.166674930E+17 0.238322031E+17 0.249217155E+17
294    
295    # with same order of magnitude results as those from pkg/exf bulk formulae
296     adj grad  0.279968788E+17 0.226979382E+17 0.269224396E+17 0.323359773E+17
297     1.d-4     0.279944626E+17 0.226935335E+17 0.269274317E+17 0.323399293E+17
298    
299    # 10 day experiment with cost_ice_flag = 3 is OK
300     adj grad  0.353941629E+17 0.955451129E+16 -.265793314E+17 0.232229067E+16
301     1.d-4     0.353943893E+17 0.955563114E+16 -.265195776E+17 0.232137949E+16
302     1-fd/adj  -.639540199E-05 -.117207086E-03 0.224813073E-02 0.392362727E-03
303    
304    # 100 day experiment with cost_ice_flag = 3 fails
305     adj grad  0.134326162+285 0.434825818+285 0.353667347+285 -.121707013+286
306     1.d-4     -.248910431E+20 -.581887317E+20 0.530805948E+18 0.554441614E+20
307    
308    # 100 day experiment with cost_ice_flag = 4 fails
309     adj grad  0.942881479+279 0.305219181+280 0.248251262+280 -.854303341+280
310     1.d-4     0.550158678E+19 -.107685572E+20 -.139042495E+20 0.445855968E+20
311    
312    # 100 day experiment with cost_ice_flag = 5 fails
313     adj grad  0.149606733+285 0.484290396+285 0.393899563+285 -.135552065+286
314     1.d-4     -.300535490E+20 -.689378119E+20 0.300954675E+19 0.767231924E+20
315    
316    
317    # With cost_ice_flag = 6, i.e., a quadratic cost function
318    # 1.d-04    -.525101466E+01 -.328685504E+03 0.267928050E+02 -.563072857E+03
319    # 1.d-03    -.313705632E+01 0.463320361E+01 -.458088751E+02 0.571140277E+00
320    # 1.d-02    -.232806373E+00 -.104311448E+01 0.173597838E+02 -.394705606E+01
321    # 1.d-01    0.515424287E+00 -.578962143E+00 0.108556846E+02 -.563596055E+00
322    # 1.d-00    -.480177391E-01 -.327366136E-02 0.107190195E+02 -.498391127E+01
323    # adj grad  NAN             NAN             NAN             NAN
324    
325    # 100 day experiments with all albedos set to a constant 0.4, with
326    # IMAX_TICE=50, and with HSNOW=0 also fail with NANs
327    
328    # 100-day with undef  ALLOW_GMREDI
329     adj grad  0.846385475+258 0.198955589+259 0.729012228+259 0.320320183+256
330     1.d-4     -.577220699E+12 -.987464011E+12 -.342421713E+12 -.553564700E+12
331    
332    # Adjoint gradient is OK for 100 days is KPP and GM
333    # are undefined in CPP_OPTIONS file:
334     adj grad  0.717330426E+06 0.106802371E+07 0.443223909E+06 -.581863641E+08
335     1.d-4     0.717581787E+06 0.106213684E+07 0.441527100E+06 -.581863293E+08
336    # Above experiment fails with NANs when extended to 375 days
337    # but it works OK is SEAICE_initialHEFF = 0.0 instead of 1.0
338     adj grad  -.256772533E+05 -.782710992E+05 -.273621212E+05 -.133527839E+09
339     1.d-4     -.256640625E+05 -.779858398E+05 -.272338867E+05 -.133528066E+09
340    # 10-yr experiment with above parameters fails with NANs
341    
342    # 100-day with yneg=0 in growth.F
343     adj grad  -.246704815E+07 -.171229406E+09 -.113862028E+08 -.156706660E+08
344     1.d-4     -.246699463E+07 -.171229277E+09 -.113861792E+08 -.156706763E+08
345    # 375-day with yneg=0 in growth.F
346     (in progress)
347    
348    
349    #####################
350    # Experiment no. 11 #
351    #####################
352    >>>>>>>>>> PH: THIS ONE NOT YET UPDATED <<<<<<<<<<
353    # Same as experiment 8, but using 2-CPU MPI configuration.
354    
355    # Compile code in bin/:
356     cd ../bin
357     rm -rf *.o *.f *.p rii_files
358     rm -rf *.F *.h *.c Makefile*
359     cp ../verification/natl_box_adjoint/code_seaice/*.h .
360     cp ../verification/natl_box_adjoint/code_seaice/.genmakerc .
361     cp ../verification/natl_box_adjoint/code_seaice/SIZE.h.MPI SIZE.h
362     cp ../verification/natl_box_adjoint/code_seaice/CPP_EEOPTIONS.h.MPI CPP_EEOPTIONS.h
363    # Configure and compile the code:
364     ../tools/genmake -mpi -makefile
365    # ==> on alhena use:
366    # ../tools/genmake -platform=o2k -mpi -makefile
367     make depend
368    # Generate the adjoint code:
369     cd ../adjoint
370     cp ../verification/natl_box_adjoint/code_seaice/makefile .
371     make adtaf
372     make adchange
373     rm -f makefile
374    # Go back and compile the code:
375     cd ../bin
376     make
377    # To run:
378     cd ../exe
379     cp ../verification/natl_box_adjoint/input_seaice/* .
380     cp data.001 data
381     cp ../verification/natl_box_adjoint/input_bulk/data.grdchk .
382     mpirun -np 2 mitgcmuv
383    # To verify the results of the gradient check, type:
384     grep "ph-grd 3" STDOUT.0000
385    # To plot adjoint sensitivy fields
386     cd ../verification/natl_box_adjoint/results_seaice
387     matlab
388     lookat_exp10
389    
390    
391    #####################
392    # Experiment no. 12 #
393    #####################
394    # Same as experiment 6, but including LSR dynamic solver.
395    
396    # Compile code in build/:
397     cd ../build
398     rm -f *.o *.f *.p rii_files *.flow
399     rm -f *.F *.h *.c Makefile* *.template genmake_*
400     ../../../tools/genmake2 -mods=../code_seaice
401     cp ../code_seaice/SEAICE_OPTIONS.h.DYN SEAICE_OPTIONS.h
402     make depend
403     make adall
404     make ftlall
405    
406    # To run:
407     cd ../exe
408     cp ../input_seaice/* .
409     cp data.seaice.lsr data.seaice
410     cp ../input_bulk/data.grdchk .
411    # run the ADM
412     ./mitgcmuv_ad >&! output.txt_adm
413    # run the TLM
414     ./mitgcmuv_tlm >&! output.txt_tlm
415    
416    # To verify the results of the gradient check, type:
417     grep grad-res output.txt_adm
418    # A reference output is in:
419     grep grad-res ../results_seaice/output_exp12.txt_adm
420    
421    
422    #####################
423    # Experiment no. 13 #
424    #####################
425    # Same as experiment 12, but finite difference gradient check for
426    # air temperature is computed and compared for the complete domain.
427    
428    # To run:
429     cd ../exe
430     cp ../input_seaice/* .
431     cp data.seaice.lsr data.seaice
432     ./mitgcmuv_ad >&! output.txt_adm
433    # To verify the results of the gradient check, type:
434     grep grad-res output.txt_adm > grad-res.txt
435     cd ../results_seaice
436     matlab
437     lookat_exp8
438    
439    
440    #####################
441    # Experiment no. 14 #
442    #####################
443    >>>>>>>>>> PH: THIS ONE NOT YET UPDATED <<<<<<<<<<
444    # Same as in 12 but for a 100-day sensitivity experiment.
445    
446    # Compile code in bin/:
447     cd ../bin
448     rm -rf *.o *.f *.p rii_files
449     rm -rf *.F *.h *.c Makefile*
450     cp ../verification/natl_box_adjoint/code_seaice/*.h .
451     rm -f tamc.h
452     cp ../verification/natl_box_adjoint/code_seaice/.genmakerc .
453     cp ../verification/natl_box_adjoint/code_seaice/SEAICE_OPTIONS.h.MULTILEVEL SEAICE_OPTIONS.h
454    # Configure and compile the code:
455     ../tools/genmake -makefile
456     make depend
457    # Generate the adjoint code:
458     cd ../adjoint
459     cp ../verification/natl_box_adjoint/code_seaice/makefile .
460     make adtaf
461     make adchange
462     rm -f makefile
463    # Go back and compile the code:
464     cd ../bin
465     make
466    # To run:
467     cd ../exe
468     cp ../verification/natl_box_adjoint/input_seaice/* .
469     cp data.100day data
470     cp ../verification/natl_box_adjoint/input_bulk/data.grdchk .
471     cp data.seaice.lsr data.seaice
472     ./mitgcmuv >&! output.txt
473    # To verify the results of the gradient check, type:
474     grep "ph-grd 3" output.txt
475    
476    # For 100-day experiment, with cost_ice_flag = 1, the adjoint gradient
477    # blows up, as in Exp. 10
478    # 1.d-04    0.251994583E+11 -.899637862E+10 0.372048919E+10 -.344972301E+10
479    # adj grad  -.160660304+210 -.378763253+210 -.239235971+211 -.386444881+209
480    
481    # With cost_ice_flag = 2, i.e., mean sea-ice area
482    # 1.d-04    -.152618243E+11 0.605974121E+06 -.155375485E+11 -.153368205E+11
483    # adj grad  0.000000000E+00 0.000000000E+00 -.124076923E+09 0.000000000E+00
484    
485    # With cost_ice_flag = 6, i.e., a quadratic cost function
486    # 1.d-12    -.106128607E+12 0.106330784E+12 -.106446555E+12 -.106237252E+12
487    # 1.d-08    0.106450924E+08 0.103670536E+05 0.349155947E+05 0.335081902E+05
488    # 1.d-04    -.106143365E+04 0.206965778E+00 -.105672737E+04 -.106326894E+04
489    # 1.d-02    -.120891636E-02 0.106325012E+02 0.841459268E+01 -.107119297E+02
490    # 1.d-01    -.102221209E-02 -.124805738E-02 0.821489714E+01 -.331974254E-02
491    # 1.d-00    0.113825328E-03 -.105881751E+00 0.104550010E+02 -.106209116E+00
492    # adj grad  0.000000000E+00 0.000000000E+00 0.887775373E+01 0.000000000E+00
493    
494    
495    #####################
496    # Experiment no. 15 #
497    #####################
498    # Same as experiment 6, but with SEAICE_MULTILEVEL.
499    
500    # Compile code in build/:
501     rm -f *.o *.f *.p rii_files *.flow
502     rm -f *.F *.h *.c Makefile* *.template genmake_*
503     ../../../tools/genmake2 -mods=../code_seaice
504     cp ../code_seaice/SEAICE_OPTIONS.h.MULTILEVEL SEAICE_OPTIONS.h
505     make depend
506     make adall
507    
508    # To run:
509     cd ../exe
510     cp ../input_seaice/* .
511     cp ../input_bulk/data.grdchk .
512     ./mitgcmuv_ad >&! output.txt
513    
514    # To verify the results of the gradient check, type:
515     grep grad-res output.txt
516    # The reference output is in:
517     grep grad-res ../results_seaice/output_exp15.txt_adm
518    
519    # This test suggests that SEAICE_MULTILEVEL decreases the accuracy of
520    # the adjoint model, perhaps because the adjoint model is not handling
521    # multiple recomputations in budget properly.
522    
523    
524    #####################
525    # Experiment no. 20 #
526    #####################
527    # Same as experiment 10, but using divided adjoint.

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22