Now I need to run the Adjoint model, but I have a few questions and ask for help.
Question 01
CPPS
The first question is when running the adjoint model, which CPPs should I turn on? CPPs
The followings are the CPPs I’m using now. I don’t know whether they’re appropriate
ADJOINT Adjoint Model.
ADM_DRIVER Generic adjoint model driver.
ANA_BSFLUX Analytical kinematic bottom salinity flux.
ANA_BTFLUX Analytical kinematic bottom temperature flux.
ASSUMED_SHAPE Using assumed-shape arrays.
AVERAGES Writing out time-averaged nonlinear model fields.
CURVGRID Orthogonal curvilinear grid.
DIFF_GRID Horizontal diffusion coefficient scaled by grid size.
DIURNAL_SRFLUX Modulate shortwave radiation by the local diurnal cycle.
DJ_GRADPS Parabolic Splines density Jacobian (Shchepetkin, 2002).
DOUBLE_PRECISION Double precision arithmetic.
FORWARD_MIXING Read in Forward vertical mixing for Tangent/Adjoint.
FORWARD_READ Read in Forward solution for Tangent/Adjoint.
LMD_CONVEC LMD convective mixing due to shear instability.
LMD_MIXING Large/McWilliams/Doney interior mixing.
LMD_NONLOCAL LMD convective nonlocal transport.
LMD_RIMIX LMD diffusivity due to shear instability.
LMD_SKPP KPP surface boundary layer mixing.
MASKING Land/Sea masking.
MIX_GEO_TS Mixing of tracers along geopotential surfaces.
MIX_S_UV Mixing of momentum along constant S-surfaces.
MPI MPI distributed-memory configuration.
NONLIN_EOS Nonlinear Equation of State for seawater.
NO_WRITE_GRID Not Writing grid arrays into NetCDF ouput files.
PERFECT_RESTART Processing perfect restart variables.
POWER_LAW Power-law shape time-averaging barotropic filter.
PROFILE Time profiling activated .
QCORRECTION Surface net heat flux correction.
!RST_SINGLE Double precision fields in restart NetCDF file.
SALINITY Using salinity.
SCORRECTION Surface salinity flux correction.
SOLAR_SOURCE Solar Radiation Source Term.
SOLVE3D Solving 3D Primitive Equations.
SPLINES Conservative parabolic spline reconstruction.
SPONGE Enhanced horizontal mixing in the sponge areas.
TANGENT Tangent Linear Model.
TS_U3HADVECTION Third-order upstream horizontal advection of tracers.
TS_U3HADVECTION_TL TL/AD third-order upstream horizontal tracer advection.
TS_C4VADVECTION Fourth-order centered vertical advection of tracers.
TS_C4VADVECTION_TL TL/AD fourth-order centered vertical tracer advection.
TS_DIF2 Harmonic mixing of tracers.
UV_ADV Advection of momentum.
UV_COR Coriolis term.
UV_U3HADVECTION Third-order upstream horizontal advection of 3D momentum.
UV_C4VADVECTION Fourth-order centered vertical advection of momentum.
UV_LOGDRAG Logarithmic bottom stress.
UV_VIS2 Harmonic mixing of momentum.
VISC_GRID Horizontal viscosity coefficient scaled by grid size.
Qusetion 2
Here some key Cpps are ADM_DRIVER/FORWARD_READ/FORWARD_MIXING/TANGENT. If I don’t turn on the TANGENT (only use ADM_DRIVER), I can’t compile the h file. So I turn on TANGENT and ADM_DRIVER at the same time. But is this right? If it’s not, what CPPs should I turn on when running adjoint model?
Question 3
What variables are included in ADJOINT initial file (referring to the “IADNAME” in ocean.in file)? And what's the variables' phycial meaning? How should prepare the adjoint initial file. I'm also confused about TANGENT initial file (referring to the “IADNAME” in ocean.in file).
Firstly, I compiled the CPPS above (Including TANGENT and AMD_DRIVER, is this right?). Then I created adjoint initial file and tangent initial file (They contain the exactly same variables with nonlinear FWD model, still I don’t know whether it’s right.)
So the next step is how to fill the initial value in adjoint initial file. I ran two nonlinear FWD runs for the same time periods (the difference between these two FWD runs is that different initial variables value, i.e. the initial file for FWD_run_2 is formed by putting small perturbations on initial file for the FWD_run_1 ). The totally number of time step is nt=1800 and dt=240s. Then I got two history files: FWD_Run1 history file adn FWD_RUN2 history file.
The variables value in ADJOINT initial file (referring to the “IADNAME” in ocean.in file) is from the variables ( zeta, u, v, ubar, vbar, temperature and salt) in FWD_RUN2 history file at nt=1800 MINUS the variables in FWD_RUN1 history file at nt=1800.
QUESTION 4
Another problem is how to choose FWD file, because I have turned on FORWARD_READ and I believe FWD file is needed in running adjoint model . In my experiments, I use the history file in FWD_run2 as the FWD file. Is the purpose of using FWD file in running adjoint models to provide basic state?
QUESTION 5
During running the adjoint model, I found variables' value in TANGENT initial file have no effects on the outputs log. I have tried numerical experiments to prove that. Is value in tangent initial file not important in my case?
QUESTION 6
I found all values of the first step in output log file are zero except NET_VOLUME(referring to the information below). But I checked and I'm sure the adjoint initial conditions are read. So why all these values are zero?
The outputs are quit bads and the value become very big. The followings are part of the log files:
Horizontal mixing scaled by grid size, GRDMAX = 6.94566037E+00 km
ADM: GET_STATE - Read state initial conditions, t = 5060 00:00:00
(Grid 01, File: adj_ini_ep2_5d.nc, Rec=0001, Index=1)
- free-surface
(Min = -3.31498981E-02 Max = 2.35404968E-02)
- vertically integrated u-momentum component
(Min = -1.37489259E-01 Max = 1.06969558E-01)
- vertically integrated v-momentum component
(Min = -7.00207800E-02 Max = 1.29006475E-01)
- u-momentum component
(Min = -8.60021234E-01 Max = 6.43136680E-01)
- v-momentum component
(Min = -7.10997880E-01 Max = 6.18543744E-01)
- potential temperature
(Min = -1.67613792E+00 Max = 2.60050201E+00)
- salinity
(Min = -7.42897034E-01 Max = 4.36103821E-01)
GET_2DFLDR - surface u-momentum stress, t = 5085 00:00:00
(Rec=0000050, Index=1, File: upk_oa_frc_new3.nc)
(Tmin= 3615.0000 Tmax= 5385.0000)
(Min = -1.66444237E-04 Max = 1.16405727E-04)
GET_2DFLDR - surface v-momentum stress, t = 5085 00:00:00
STEP Day HH:MM:SS KINETIC_ENRG POTEN_ENRG TOTAL_ENRG NET_VOLUME
1800 5060 00:00:00 0.000000E+00 0.000000E+00 0.000000E+00 1.649574E+17
AD_DEF_HIS - creating adjoint file: ./adj_0002.nc
AD_WRT_HIS - wrote adjoint fields (Index=1,1) into time record = 0000001
1799 5059 23:56:00 6.634337E-08 7.734070E-08 1.436841E-07 1.649574E+17
1798 5059 23:52:00 8.680197E-08 9.767410E-08 1.844761E-07 1.649574E+17
1797 5059 23:48:00 1.144691E-07 1.062443E-07 2.207134E-07 1.649574E+17
1796 5059 23:44:00 1.481901E-07 1.210721E-07 2.692622E-07 1.649574E+17
1795 5059 23:40:00 1.875095E-07 1.287752E-07 3.162847E-07 1.649574E+17
1794 5059 23:36:00 2.319469E-07 1.376249E-07 3.695717E-07 1.649574E+17
1793 5059 23:32:00 2.811079E-07 1.484915E-07 4.295994E-07 1.649574E+17
1792 5059 23:28:00 3.346508E-07 1.595945E-07 4.942453E-07 1.649574E+17
1791 5059 23:24:00 3.922752E-07 1.688023E-07 5.610776E-07 1.649574E+17
1790 5059 23:20:00 4.536903E-07 1.756225E-07 6.293128E-07 1.649574E+17
1789 5059 23:16:00 5.186411E-07 1.838048E-07 7.024458E-07 1.649574E+17
1788 5059 23:12:00 5.868418E-07 1.931219E-07 7.799637E-07 1.649574E+17
1787 5059 23:08:00 6.580903E-07 2.003852E-07 8.584755E-07 1.649574E+17
1786 5059 23:04:00 7.322316E-07 2.068728E-07 9.391045E-07 1.649574E+17
1785 5059 23:00:00 8.091295E-07 2.154935E-07 1.024623E-06 1.649574E+17
1784 5059 22:56:00 8.886222E-07 2.251323E-07 1.113755E-06 1.649574E+17
1783 5059 22:52:00 9.705317E-07 2.331147E-07 1.203646E-06 1.649574E+17
1782 5059 22:48:00 1.054638E-06 2.394569E-07 1.294094E-06 1.649574E+17
1781 5059 22:44:00 1.140783E-06 2.471343E-07 1.387918E-06 1.649574E+17
1780 5059 22:40:00 1.228867E-06 2.546277E-07 1.483495E-06 1.649574E+17
1779 5059 22:36:00 1.318815E-06 2.618227E-07 1.580637E-06 1.649574E+17
1778 5059 22:32:00 1.410537E-06 2.687657E-07 1.679303E-06 1.649574E+17
1777 5059 22:28:00 1.503802E-06 2.760315E-07 1.779833E-06 1.649574E+17
1776 5059 22:24:00 1.598472E-06 2.831175E-07 1.881590E-06 1.649574E+17
1775 5059 22:20:00 1.694421E-06 2.919085E-07 1.986330E-06 1.649574E+17
1774 5059 22:16:00 1.791507E-06 3.022877E-07 2.093795E-06 1.649574E+17
1773 5059 22:12:00 1.889691E-06 3.144694E-07 2.204161E-06 1.649574E+17
1772 5059 22:08:00 1.988808E-06 3.272836E-07 2.316092E-06 1.649574E+17
1771 5059 22:04:00 2.088763E-06 3.394954E-07 2.428258E-06 1.649574E+17
1770 5059 22:00:00 2.189467E-06 3.498941E-07 2.539361E-06 1.649574E+17
1769 5059 21:56:00 2.290762E-06 3.576002E-07 2.648363E-06 1.649574E+17
1768 5059 21:52:00 2.392459E-06 3.631618E-07 2.755621E-06 1.649574E+17
1767 5059 21:48:00 2.494370E-06 3.672085E-07 2.861578E-06 1.649574E+17
1766 5059 21:44:00 2.596362E-06 3.719398E-07 2.968301E-06 1.649574E+17
1765 5059 21:40:00 2.698317E-06 3.774175E-07 3.075735E-06 1.649574E+17
1764 5059 21:36:00 2.800203E-06 3.835947E-07 3.183797E-06 1.649574E+17
1763 5059 21:32:00 2.901925E-06 3.908848E-07 3.292810E-06 1.649574E+17
1762 5059 21:28:00 3.003364E-06 3.984364E-07 3.401801E-06 1.649574E+17
1761 5059 21:24:00 3.104334E-06 4.062670E-07 3.510601E-06 1.649574E+17
1760 5059 21:20:00 3.204706E-06 4.147785E-07 3.619485E-06 1.649574E+17
1759 5059 21:16:00 3.304466E-06 4.238138E-07 3.728280E-06 1.649574E+17
1758 5059 21:12:00 3.403443E-06 4.331627E-07 3.836606E-06 1.649574E+17
1757 5059 21:08:00 3.501473E-06 4.429714E-07 3.944445E-06 1.649574E+17
1756 5059 21:04:00 3.598428E-06 4.531208E-07 4.051549E-06 1.649574E+17
1755 5059 21:00:00 3.694132E-06 4.629114E-07 4.157044E-06 1.649574E+17
1754 5059 20:56:00 3.788375E-06 4.722322E-07 4.260608E-06 1.649574E+17
1753 5059 20:52:00 3.880933E-06 4.815661E-07 4.362499E-06 1.649574E+17
1752 5059 20:48:00 3.971535E-06 4.912949E-07 4.462830E-06 1.649574E+17
1751 5059 20:44:00 4.059498E-06 5.013667E-07 4.560865E-06 1.649574E+17
1750 5059 20:40:00 4.144781E-06 5.115737E-07 4.656355E-06 1.649574E+17
1749 5059 20:36:00 4.226785E-06 5.211047E-07 4.747890E-06 1.649574E+17
1748 5059 20:32:00 4.304513E-06 5.297111E-07 4.834224E-06 1.649574E+17
1747 5059 20:28:00 4.376652E-06 5.382656E-07 4.914918E-06 1.649574E+17
1746 5059 20:24:00 4.439956E-06 5.471721E-07 4.987128E-06 1.649574E+17
1745 5059 20:20:00 4.492862E-06 5.563795E-07 5.049241E-06 1.649574E+17
1744 5059 20:16:00 4.530853E-06 5.662093E-07 5.097063E-06 1.649574E+17
1743 5059 20:12:00 4.547045E-06 5.765736E-07 5.123618E-06 1.649574E+17
1742 5059 20:08:00 4.530901E-06 5.875468E-07 5.118448E-06 1.649574E+17
1741 5059 20:04:00 4.465674E-06 5.989614E-07 5.064635E-06 1.649574E+17
1740 5059 20:00:00 4.325264E-06 6.103149E-07 4.935578E-06 1.649574E+17
1739 5059 19:56:00 4.068823E-06 6.218044E-07 4.690627E-06 1.649574E+17
1738 5059 19:52:00 3.632212E-06 6.336629E-07 4.265875E-06 1.649574E+17
1737 5059 19:48:00 2.914322E-06 6.455192E-07 3.559841E-06 1.649574E+17
1736 5059 19:44:00 1.755640E-06 6.570862E-07 2.412727E-06 1.649574E+17
1735 5059 19:40:00 -9.586398E-08 6.684265E-07 5.725626E-07 1.649574E+17
1734 5059 19:36:00 -3.038947E-06 6.793078E-07 -2.359639E-06 1.649574E+17
1733 5059 19:32:00 -7.705178E-06 6.892909E-07 -7.015888E-06 1.649574E+17
1732 5059 19:28:00 -1.509569E-05 6.978530E-07 -1.439784E-05 1.649574E+17
1731 5059 19:24:00 -2.679839E-05 7.040716E-07 -2.609432E-05 1.649574E+17
1730 5059 19:20:00 -4.533315E-05 7.064696E-07 -4.462668E-05 1.649574E+17
1729 5059 19:16:00 -7.470046E-05 7.030048E-07 -7.399745E-05 1.649574E+17
1728 5059 19:12:00 -1.212541E-04 6.910947E-07 -1.205630E-04 1.649574E+17
1727 5059 19:08:00 -1.950884E-04 6.672843E-07 -1.944212E-04 1.649574E+17
1726 5059 19:04:00 -3.122451E-04 6.267287E-07 -3.116184E-04 1.649574E+17
1725 5059 19:00:00 -4.982217E-04 5.627013E-07 -4.976590E-04 1.649574E+17
1724 5059 18:56:00 -7.935524E-04 4.656536E-07 -7.930867E-04 1.649574E+17
1723 5059 18:52:00 -1.262684E-03 3.220181E-07 -1.262362E-03 1.649574E+17
1722 5059 18:48:00 -2.008094E-03 1.129645E-07 -2.007981E-03 1.649574E+17
1721 5059 18:44:00 -3.192734E-03 -1.870661E-07 -3.192921E-03 1.649574E+17
1720 5059 18:40:00 -5.075742E-03 -6.129116E-07 -5.076355E-03 1.649574E+17
1719 5059 18:36:00 -8.069220E-03 -1.212625E-06 -8.070433E-03 1.649574E+17
1718 5059 18:32:00 -1.282854E-02 -2.052485E-06 -1.283059E-02 1.649574E+17
1717 5059 18:28:00 -2.039594E-02 -3.223185E-06 -2.039916E-02 1.649574E+17
1716 5059 18:24:00 -3.242889E-02 -4.848485E-06 -3.243374E-02 1.649574E+17
1715 5059 18:20:00 -5.156319E-02 -7.097543E-06 -5.157029E-02 1.649574E+17
1714 5059 18:16:00 -8.199029E-02 -1.020179E-05 -8.200049E-02 1.649574E+17
1713 5059 18:12:00 -1.303752E-01 -1.447784E-05 -1.303897E-01 1.649574E+17
1712 5059 18:08:00 -2.073157E-01 -2.035884E-05 -2.073361E-01 1.649574E+17
1711 5059 18:04:00 -3.296623E-01 -2.843667E-05 -3.296908E-01 1.649574E+17
1710 5059 18:00:00 -5.242055E-01 -3.951913E-05 -5.242450E-01 1.649574E+17
1709 5059 17:56:00 -8.335371E-01 -5.470860E-05 -8.335918E-01 1.649574E+17
1708 5059 17:52:00 -1.325366E+00 -7.550933E-05 -1.325441E+00 1.649574E+17
1707 5059 17:48:00 -2.107322E+00 -1.039740E-04 -2.107426E+00 1.649574E+17
1706 5059 17:44:00 -3.350486E+00 -1.429039E-04 -3.350629E+00 1.649574E+17
1705 5059 17:40:00 -5.326769E+00 -1.961204E-04 -5.326965E+00 1.649574E+17
1704 5059 17:36:00 -8.468317E+00 -2.688341E-04 -8.468586E+00 1.649574E+17
1703 5059 17:32:00 -1.346189E+01 -3.681485E-04 -1.346225E+01 1.649574E+17
1702 5059 17:28:00 -2.139877E+01 -5.037489E-04 -2.139927E+01 1.649574E+17
1701 5059 17:24:00 -3.401295E+01 -6.888403E-04 -3.401364E+01 1.649574E+17
1700 5059 17:20:00 -5.405946E+01 -9.414259E-04 -5.406040E+01 1.649574E+17
1699 5059 17:16:00 -8.591516E+01 -1.286048E-03 -8.591645E+01 1.649574E+17
1698 5059 17:12:00 -1.365331E+02 -1.756156E-03 -1.365349E+02 1.649574E+17
1697 5059 17:08:00 -2.169580E+02 -2.397338E-03 -2.169603E+02 1.649574E+17
1696 5059 17:04:00 -3.447323E+02 -3.271710E-03 -3.447355E+02 1.649574E+17
1695 5059 17:00:00 -5.477175E+02 -4.463916E-03 -5.477220E+02 1.649574E+17
1694 5059 16:56:00 -8.701604E+02 -6.089277E-03 -8.701665E+02 1.649574E+17
1693 5059 16:52:00 -1.382323E+03 -8.304916E-03 -1.382331E+03 1.649574E+17
1692 5059 16:48:00 -2.195771E+03 -1.132488E-02 -2.195783E+03 1.649574E+17
1691 5059 16:44:00 -3.487641E+03 -1.544077E-02 -3.487656E+03 1.649574E+17
1690 5059 16:40:00 -5.539152E+03 -2.104977E-02 -5.539173E+03 1.649574E+17
1689 5059 16:36:00 -8.796734E+03 -2.869304E-02 -8.796763E+03 1.649574E+17
1688 5059 16:32:00 -1.396903E+04 -3.910726E-02 -1.396907E+04 1.649574E+17
1687 5059 16:28:00 -2.218081E+04 -5.329582E-02 -2.218086E+04 1.649574E+17
1686 5059 16:24:00 -3.521721E+04 -7.262538E-02 -3.521729E+04 1.649574E+17
1685 5059 16:20:00 -5.591120E+04 -9.895731E-02 -5.591130E+04 1.649574E+17
1684 5059 16:16:00 -8.875827E+04 -1.348261E-01 -8.875840E+04 1.649574E+17
1683 5059 16:12:00 -1.408915E+05 -1.836824E-01 -1.408917E+05 1.649574E+17
1682 5059 16:08:00 -2.236285E+05 -2.502241E-01 -2.236287E+05 1.649574E+17
1681 5059 16:04:00 -3.549240E+05 -3.408483E-01 -3.549244E+05 1.649574E+17
1680 5059 16:00:00 -5.632609E+05 -4.642631E-01 -5.632614E+05 1.649574E+17
1679 5059 15:56:00 -8.938196E+05 -6.323229E-01 -8.938202E+05 1.649574E+17
1678 5059 15:52:00 -1.418261E+06 -8.611645E-01 -1.418262E+06 1.649574E+17
1677 5059 15:48:00 -2.250237E+06 -1.172754E+00 -2.250238E+06 1.649574E+17
1676 5059 15:44:00 -3.569985E+06 -1.596989E+00 -3.569986E+06 1.649574E+17
1675 5059 15:40:00 -5.663311E+06 -2.174563E+00 -5.663313E+06 1.649574E+17
1674 5059 15:36:00 -8.983393E+06 -2.960853E+00 -8.983396E+06 1.649574E+17
1673 5059 15:32:00 -1.424873E+07 -4.031226E+00 -1.424874E+07 1.649574E+17
1672 5059 15:28:00 -2.259842E+07 -5.488241E+00 -2.259843E+07 1.649574E+17
1671 5059 15:24:00 -3.583818E+07 -7.471455E+00 -3.583819E+07 1.649574E+17
1670 5059 15:20:00 -5.683026E+07 -1.017076E+01 -5.683027E+07 1.649574E+17
1669 5059 15:16:00 -9.011131E+07 -1.384452E+01 -9.011133E+07 1.649574E+17
1668 5059 15:12:00 -1.428713E+08 -1.884425E+01 -1.428713E+08 1.649574E+17
1667 5059 15:08:00 -2.265043E+08 -2.564817E+01 -2.265044E+08 1.649574E+17
I'm not familiar with adjoint model and I need your help.
Any suggestion will be appreciated.