# Example: Subtropical North Atlantic and Labrador Sea Areas # ========================================================== # - forward/adjoint run # - optimization cost function # - with KPP & shortwave heating # - gmredi turned off (until merge to c48) # - The input data is real*8 # - 4 timesteps #################### # Experiment no. 1 # #################### # Use air-sea fluxes as controls (standard case): # perform gradient checks for first four elements of the # heat flux part of the control vector (grdchkvarindex = 3). # Compile code in bin/: cd bin cp ../verification/natl_box_adjoint/code/.genmakerc . cp ../verification/natl_box_adjoint/code/*.h . # Configure and compile the code: ../tools/genmake -makefile make depend # Generate the adjoint code: cd ../adjoint make adtaf make adchange # Go back and compile the code: cd ../bin make # To run: cd ../exe cp ../verification/natl_box_adjoint/input/* . mitgcmuv >&! output.txt # To verify the results of the gradient check, type: grep ph-grd output.txt # A reference output is in: grep ph-grd ../verification/natl_box_adjoint/results/output.txt #################### # Experiment no. 2 # #################### # Use bulk formulae and atmospheric state controls # (only differences to experiment 1 are in # ECCO_CPPOPTIONS.h and in data.grdchk): # perform gradient checks for first four elements of the # air temperture part of the control vector (grdchkvarindex = 7). # Compile code in bin/: cd ../bin rm -rf *.o *.f *.p rii_files rm -rf *.F *.h *.c Makefile* cp ../verification/natl_box_adjoint/code_bulk/.genmakerc . cp ../verification/natl_box_adjoint/code_bulk/*.h . # Configure and compile the code: ../tools/genmake -makefile make depend # Generate the adjoint code: cd ../adjoint make adtaf make adchange # Go back and compile the code: cd ../bin make # To run: cd ../exe cp ../verification/natl_box_adjoint/input_bulk/* . cp ../verification/natl_box_adjoint/input/PH_*.data . ./mitgcmuv >&! output.txt # To verify the results of the gradient check, type: grep ph-grd output.txt # A reference output is in: grep ph-grd ../verification/natl_box_adjoint/results_bulk/output.txt #################### # Experiment no. 3 # #################### # Same as exp. 2, but with ALLOW_SEAICE defined. # Compile code in bin/: cd ../bin rm -rf *.o *.f *.p rii_files rm -rf *.F *.h *.c Makefile* cp ../verification/natl_box_adjoint/code_seaice/*.h . cp ../verification/natl_box_adjoint/code_seaice/.genmakerc . cp ../verification/natl_box_adjoint/code_seaice/SEAICE_OPTIONS.h.FLUXES SEAICE_OPTIONS.h # Configure and compile the code: ../tools/genmake -makefile make depend # Generate the adjoint code: cd ../adjoint mv makefile makefile.old cp ../verification/natl_box_adjoint/code_seaice/makefile . make adtaf make adchange rm -f makefile mv makefile.old makefile # Go back and compile the code: cd ../bin make # To run: cd ../exe cp ../verification/natl_box_adjoint/input_bulk/* . cp ../verification/natl_box_adjoint/input/PH_*.data . ./mitgcmuv >&! output.txt # To verify the results of the gradient check, type: grep ph-grd output.txt # A reference output is in: grep ph-grd ../verification/natl_box_adjoint/results_bulk/output.txt #################### # Experiment no. 4 # #################### # Uses same executable as exp. 3, but with useseaice = .true. # To run: cd ../exe cp ../verification/natl_box_adjoint/input_bulk/* . cp ../verification/natl_box_adjoint/input_seaice/data.seaice.cgrid data.seaice cp ../verification/natl_box_adjoint/input_seaice/data.pkg . cp ../verification/natl_box_adjoint/input/PH_*.data . ./mitgcmuv >&! output.txt # To verify the results of the gradient check, type: grep ph-grd output.txt # A reference output is in: grep ph-grd ../verification/natl_box_adjoint/results_bulk/output.txt #################### # Experiment no. 5 # #################### # Same as exp. 4, but using sea-ice bulk formulae. # This experiment tests pkg/seaice bulk formulae over open water. # No sea-ice is formed anywhere in the domain. # There is a worrisome 3-4% discrepancy between ajoint # model and finite difference gradients. # Compile code in bin/: cd ../bin rm -rf *.o *.f *.p rii_files rm -rf *.F *.h *.c Makefile* cp ../verification/natl_box_adjoint/code_seaice/*.h . cp ../verification/natl_box_adjoint/code_seaice/.genmakerc . # Configure and compile the code: ../tools/genmake -makefile make depend # Generate the adjoint code: cd ../adjoint mv makefile makefile.old cp ../verification/natl_box_adjoint/code_seaice/makefile . make adtaf make adchange rm -f makefile mv makefile.old makefile # Go back and compile the code: cd ../bin make # To run: cd ../exe cp ../verification/natl_box_adjoint/input_bulk/* . cp ../verification/natl_box_adjoint/input_seaice/data.seaice.cgrid data.seaice cp ../verification/natl_box_adjoint/input_seaice/data.pkg . cp ../verification/natl_box_adjoint/input/PH_*.data . ./mitgcmuv >&! output.txt # To verify the results of the gradient check, type: grep ph-grd output.txt # A reference output is in: grep ph-grd ../verification/natl_box_adjoint/results_bulk/output.exp5 #################### # Experiment no. 6 # #################### # Same as experiment 5, but in the Labrador Sea rather than in # the North Atlantic subduction region. This experiment does # include sea-ice, but cost function data files are bogus: # labsea_TP_fields : filled with -9999 # labsea_TP_mean : hour 100 ssh (cm) of lab_sea experiment # labsea_ERS_fields : filled with -9999 # labsea_SST_fields : 14 * Levitus annual mean SST # labsea_Lev.ptmp : 14 * Levitus annual mean temperature # labsea_Lev.salt : 14 * Levitus annual mean salinity # labsea_ssh.err : filled with -9999 # labsea_geoid.err : constant 0.2 with -9999 landmask # labsea_totflux.err : 100 with -9999 landmask # labsea_pme.err : 4e-8 with -9999 landmask # labsea_ustress.err : 3 with -9999 landmask # labsea_vstress.err : 3 with -9999 landmask # The gradient check does not work. The finite difference # gradient has a strong dependence on grdchk_eps. # To run: cd ../exe cp ../verification/natl_box_adjoint/input_seaice/* . ./mitgcmuv >&! output.txt # To verify the results of the gradient check, type: grep ph-grd output.txt # A reference output is in: grep ph-grd ../verification/natl_box_adjoint/results_seaice/output.txt