Back to home page

darwin3

 
 

    


Warning, /doc/ocean_state_est/ocean_state_est.rst is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit ad59256d on 2025-12-15 00:05:36 UTC
3220fe4136 gael*0001 .. _chap_state_estimation:
                0002 
ad59256d7d aver*0003 Packages III - Ocean State Estimation
                0004 =====================================
6997d81055 gael*0005 
                0006 This chapter describes packages that have been introduced for ocean
                0007 state estimation purposes and in relation with automatic differentiation
32ce3e9e96 Mart*0008 (see :ref:`chap_autodiff`). Various examples in this chapter rely on two
3220fe4136 gael*0009 model configurations that can be setup as explained in :ref:`sec:exp:llc`
6997d81055 gael*0010 
                0011 .. _sec:pkg:ecco:
                0012 
                0013 ECCO: model-data comparisons using gridded data sets
                0014 ----------------------------------------------------
                0015 
                0016 Author: Gael Forget
                0017 
ad59256d7d aver*0018 The functionalities implemented in :filelink:`pkg/ecco` are: (1) output
6997d81055 gael*0019 time-averaged model fields to compare with gridded data sets; (2)
                0020 compute normalized model-data distances (i.e., cost functions); (3)
                0021 compute averages and transports (i.e., integrals). The former is
                0022 achieved as the model runs forwards in time whereas the others occur
                0023 after time-integration has completed. Following
                0024 :cite:`for-eta:15` the total cost function is formulated
                0025 generically as
                0026 
13d362b8c1 Ou W*0027 .. math:: \mathcal{J}(\vec{u}) = \sum_i \alpha_i \left(\vec{d}_i^T R_i^{-1}
                0028    \vec{d}_i\right) + \sum_j \beta_j \vec{u}^T\vec{u}
6997d81055 gael*0029    :label: Jtotal
                0030 
                0031 .. math::
                0032    \vec{d}_i = \mathcal{P}(\vec{m}_i - \vec{o}_i)
                0033    :label: Jposproc
                0034 
                0035 .. math::
                0036    \vec{m}_i = \mathcal{S}\mathcal{D}\mathcal{M}(\vec{v})
                0037    :label: Jpreproc
                0038 
                0039 .. math::
                0040    \vec{v}   = \mathcal{Q}(\vec{u})
                0041    :label: Upreproc
                0042 
                0043 .. math::
                0044    \vec{u}   = \mathcal{R}(\vec{u}')
                0045    :label: Uprecond
                0046 
                0047 using symbols defined in :numref:`gencost_symbols`. Per
                0048 Equation :eq:`Jpreproc` model counterparts
                0049 (:math:`\vec{m}_i`) to observational data (:math:`\vec{o}_i`) derive
                0050 from adjustable model parameters (:math:`\vec{v}`) through model
                0051 dynamics integration (:math:`\mathcal{M}`), diagnostic calculations
                0052 (:math:`\mathcal{D}`), and averaging in space and time
                0053 (:math:`\mathcal{S}`). Alternatively :math:`\mathcal{S}` stands for
32ce3e9e96 Mart*0054 subsampling in space and time in the context of
6997d81055 gael*0055 :numref:`sec:pkg:profiles` (:ref:`sec:pkg:profiles`). Plain
                0056 model-data misfits (:math:`\vec{m}_i-\vec{o}_i`) can be penalized
                0057 directly in Eq. :eq:`Jtotal` but penalized misfits
                0058 (:math:`\vec{d}_i`) more generally derive from
                0059 :math:`\vec{m}_i-\vec{o}_i` through the generic :math:`\mathcal{P}`
                0060 post-processor (Eq. :eq:`Jposproc`). Eqs. :eq:`Upreproc`-:eq:`Uprecond`
                0061 pertain to model control parameter adjustment capabilities described in
                0062 :numref:`sec:pkg:ctrl` (:ref:`sec:pkg:ctrl`).
                0063 
                0064 .. table:: Symbol used in formulating generic cost functions.
                0065   :name: gencost_symbols
                0066 
                0067   +-----------------------------------+-----------------------------------+
                0068   | symbol                            | definition                        |
                0069   +===================================+===================================+
                0070   | :math:`\vec{u}`                   | vector of nondimensional control  |
                0071   |                                   | variables                         |
                0072   +-----------------------------------+-----------------------------------+
                0073   | :math:`\vec{v}`                   | vector of dimensional control     |
                0074   |                                   | variables                         |
                0075   +-----------------------------------+-----------------------------------+
                0076   | :math:`\alpha_i, \beta_j`         | misfit and control cost function  |
                0077   |                                   | multipliers (1 by default)        |
                0078   +-----------------------------------+-----------------------------------+
                0079   | :math:`R_i`                       | data error covariance matrix      |
                0080   |                                   | (:math:`R_i^{-1}` are weights)    |
                0081   +-----------------------------------+-----------------------------------+
                0082   | :math:`\vec{d}_i`                 | a set of model-data differences   |
                0083   +-----------------------------------+-----------------------------------+
                0084   | :math:`\vec{o}_i`                 | observational data vector         |
                0085   +-----------------------------------+-----------------------------------+
                0086   | :math:`\vec{m}_i`                 | model counterpart to              |
                0087   |                                   | :math:`\vec{o}_i`                 |
                0088   +-----------------------------------+-----------------------------------+
                0089   | :math:`\mathcal{P}`               | post-processing operator (e.g., a |
                0090   |                                   | smoother)                         |
                0091   +-----------------------------------+-----------------------------------+
                0092   | :math:`\mathcal{M}`               | forward model dynamics operator   |
                0093   +-----------------------------------+-----------------------------------+
                0094   | :math:`\mathcal{D}`               | diagnostic computation operator   |
                0095   +-----------------------------------+-----------------------------------+
                0096   | :math:`\mathcal{S}`               | averaging/subsampling operator    |
                0097   +-----------------------------------+-----------------------------------+
                0098   | :math:`\mathcal{Q}`               | Pre-processing operator           |
                0099   +-----------------------------------+-----------------------------------+
                0100   | :math:`\mathcal{R}`               | Pre-conditioning operator         |
                0101   +-----------------------------------+-----------------------------------+
                0102 
                0103 .. _costgen:
                0104 
                0105 Generic Cost Function
                0106 ~~~~~~~~~~~~~~~~~~~~~
                0107 
                0108 The parameters available for configuring generic cost function terms in
                0109 ``data.ecco`` are given in :numref:`gencost_ecco_params` and
                0110 examples of possible specifications are available in:
                0111 
                0112 -  MITgcm_contrib/verification_other/global_oce_cs32/input/data.ecco
                0113 
                0114 -  MITgcm_contrib/verification_other/global_oce_cs32/input_ad.sens/data.ecco
                0115 
                0116 -  MITgcm_contrib/gael/verification/global_oce_llc90/input.ecco_v4/data.ecco
                0117 
13d362b8c1 Ou W*0118 The gridded observation file name is specified by :varlink:`gencost_datafile`.
                0119 Observational time series may be provided as on big file or split into yearly
                

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 121.

0120 files finishing in ‘\_1992’, ‘\_1993’, etc. The corresponding :math:`\vec{m}_i` 0121 physical variable is specified via the :varlink:`gencost_barfile` root (see 0122 :numref:`gencost_ecco_barfile`). A file named as specified by 0123 :varlink:`gencost_barfile` gets created where averaged fields are written 0124 progressively as the model steps forward in time. After the final time step 0125 this file is re-read by :filelink:`cost_generic.F <pkg/ecco/cost_generic.F>` to 0126 compute the corresponding cost function term. If :varlink:`gencost_outputlevel`

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 128.

0127 = 1 and :varlink:`gencost_name`\ =‘foo’ then :filelink:`cost_generic.F 0128 <pkg/ecco/cost_generic.F>` outputs model-data misfit fields (i.e.,

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 130.

0129 :math:`\vec{d}_i`) to a file named ‘misfit_foo.data’ for offline analysis and 0130 visualization. 6997d81055 gael*0131 0132 In the current implementation, model-data error covariance matrices 0133 :math:`R_i` omit non-diagonal terms. Specifying :math:`R_i` thus boils 0134 down to providing uncertainty fields (:math:`\sigma_i` such that 13d362b8c1 Ou W*0135 :math:`R_i=\sigma_i^2`) in a file specified via :varlink:`gencost_errfile`. By 6997d81055 gael*0136 default :math:`\sigma_i` is assumed to be time-invariant but a 0137 :math:`\sigma_i` time series of the same length as the :math:`\vec{o}_i` 0138 time series can be provided using the ``variaweight`` option 0139 (:numref:`gencost_ecco_preproc`). By 0140 default cost functions are quadratic but 0141 :math:`\vec{d}_i^T R_i^{-1} \vec{d}_i` can be replaced with 0142 :math:`R_i^{-1/2} \vec{d}_i` using the ``nosumsq`` option 0143 (:numref:`gencost_ecco_preproc`). 0144 0145 In principle, any averaging frequency should be possible, but only

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 147.

0146 ‘day’, ‘month’, ‘step’, and ‘const’ are implemented for 13d362b8c1 Ou W*0147 :varlink:`gencost_avgperiod`. If two different averaging frequencies are needed 6997d81055 gael*0148 for a variable used in multiple cost function terms (e.g., daily and

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 150.

0149 monthly) then an extension starting with ‘\_’ should be added to 13d362b8c1 Ou W*

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 151.

0150 :varlink:`gencost_barfile` (such as ‘\_day’ and ‘\_mon’). [1]_ If two cost 6997d81055 gael*0151 function terms use the same variable and frequency, however, then using 13d362b8c1 Ou W*0152 a common :varlink:`gencost_barfile` saves disk space. 0153 0154 Climatologies of :math:`\vec{m}_i` can be formed from the time series of model 0155 averages in order to compare with climatologies of :math:`\vec{o}_i` by

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 157.

0156 activating the ‘clim’ option via :varlink:`gencost_preproc` and setting the 0157 corresponding :varlink:`gencost_preproc_i` integer parameter to the number of 0158 records (i.e., a # of months, days, or time steps) per climatological 0159 cycle. The generic post-processor (:math:`\mathcal{P}` in Eq. :eq:`Jposproc`) 0160 also allows model-data misfits to be, for example, smoothed in space by setting

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 162.

0161 :varlink:`gencost_posproc` to ‘smooth’ and specifying the smoother parameters 4890e8ebab antn*0162 via :varlink:`gencost_posproc_c` (name of a smoothing scale file) and 0163 :varlink:`gencost_posproc_i` (an integer specifying the smoother number of time 0164 steps, see :numref:`gencost_ecco_preproc`). The smoothing scale file can be 0165 be based on the large-scale parameter specified in data.smooth or prepared as b938a3c63b antn*0166 a factor of the model resolution dxC and dyC. As an example, one can read in 0167 offline the model dxC and dyC and create a characteristic length-scale as 0168 sqrt(dxC^2 + dyC^2), then multiply by a factor of 3 if one wants the smoothed 4890e8ebab antn*0169 (large scale) field to be of length-scale 3x that of the model grid spacing. 0170 The smoother number of time steps `gencost_posproc_i` can be the same as that 0171 used in data.smooth. Other options associated with the computation 13d362b8c1 Ou W*0172 of Eq. :eq:`Jtotal` are summarized in :numref:`gencost_ecco_preproc` and 0173 further discussed below. Multiple :varlink:`gencost_preproc` / 0174 :varlink:`gencost_posproc` options may be specified per cost term. 0175 0176 In general the specification of :varlink:`gencost_name` is optional, has no 0177 impact on the end-result, and only serves to distinguish between cost function 0178 terms amongst the model output (STDOUT.0000, STDERR.0000, costfunction000, 0179 misfit*.data). Exceptions listed in :numref:`gencost_ecco_name` however 0180 activate alternative cost function codes (in place of :filelink:`cost_generic.F 0181 <pkg/ecco/cost_generic.F>`) described in :numref:`v4custom`. In this section 0182 and in :numref:`gencost_ecco_barfile` (unlike in other parts of the manual)

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 184.

0183 ‘zonal’ / ‘meridional’ are to be taken literally and these components are 0184 centered (i.e., not at the staggered model velocity points). Preparing gridded 0185 velocity data sets for use in cost functions thus boils down to interpolating 0186 them to XC / YC. 0187 0188 The :varlink:`gencost_kLev_select` option allows the user to select the 0189 vertical level of a 3D model field, thereby creating a 2D field out of that 0190 slice which is used for the cost computation. For example, drifter velocities 0191 correspond to the second depth level of the grid used in ECCOv4, so model 0192 velocities are selected from this depth level to compare to the drifter 0193 observations. The user can specify this in ``data.ecco`` with: 0194 :varlink:`gencost_kLev_select` ``( i ) = 2``, where i is replaced with the 0195 index for that cost function term. 0196 0197 .. table:: Run-time parameters used in formulating generic cost functions and 0198 defined via `ecco_gencost_nml`` namelist in ``data.ecco``. All 0199 parameters are vectors of length ``NGENCOST`` (the # of available 0200 cost terms) except for ``gencost_proc*`` are arrays of size 0201 ``NGENPPROC``\ :math:`\times`\ ``NGENCOST`` (10 :math:`\times`\ 20 0202 by default; can be changed in ``ECCO_SIZE.h`` at compile time). In 0203 addition, the ``gencost_is3d`` internal parameter is reset to true 0204 on the fly in all 3D cases in :numref:`gencost_ecco_barfile`. 6997d81055 gael*0205 :name: gencost_ecco_params 0206 aa93ca8e85 Ciar*0207 +---------------------------+-------------------+-----------------------------------+ 0208 | parameter | type | function | 0209 +===========================+===================+===================================+ 0210 | ``gencost_name`` | character(\*) | Name of cost term | 0211 +---------------------------+-------------------+-----------------------------------+ 0212 | ``gencost_barfile`` | character(\*) | File to receive model counterpart | 0213 | | | :math:`\vec{m}_i` (See | 0214 | | | :numref:`gencost_ecco_barfile`) | 0215 +---------------------------+-------------------+-----------------------------------+ 0216 | ``gencost_datafile`` | character(\*) | File containing | 0217 | | | observational data | 0218 | | | :math:`\vec{o}_i` | 0219 +---------------------------+-------------------+-----------------------------------+ 0220 | ``gencost_avgperiod`` | character(5) | Averaging period for | 0221 | | | :math:`\vec{o}_i` and | 0222 | | | :math:`\vec{m}_i` | 0223 | | | (see text) | 0224 +---------------------------+-------------------+-----------------------------------+ 0225 | ``gencost_outputlevel`` | integer | Greater than 0 will | 0226 | | | output misfit fields | 0227 +---------------------------+-------------------+-----------------------------------+ 0228 | ``gencost_errfile`` | character(\*) | Uncertainty field | 0229 | | | name (not used in | 0230 | | | :numref:`intgen`) | 0231 +---------------------------+-------------------+-----------------------------------+ 0232 | ``gencost_mask`` | character(\*) | Mask file name root | 0233 | | | (used only in | 0234 | | | :numref:`intgen`) | 0235 +---------------------------+-------------------+-----------------------------------+ 0236 | ``mult_gencost`` | real | Multiplier | 0237 | | | :math:`\alpha_i` | 0238 | | | (default: 1) | 0239 +---------------------------+-------------------+-----------------------------------+ 0240 | ``gencost_preproc`` | character(\*) | Preprocessor names | 0241 +---------------------------+-------------------+-----------------------------------+ 0242 | ``gencost_preproc_c`` | character(\*) | Preprocessor | 0243 | | | character arguments | 0244 +---------------------------+-------------------+-----------------------------------+ 0245 | ``gencost_preproc_i`` | integer(\*) | Preprocessor integer | 0246 | | | arguments | 0247 +---------------------------+-------------------+-----------------------------------+ 0248 | ``gencost_preproc_r`` | real(\*) | Preprocessor real | 0249 | | | arguments | 0250 +---------------------------+-------------------+-----------------------------------+ 0251 | ``gencost_posproc`` | character(\*) | Post-processor names | 0252 +---------------------------+-------------------+-----------------------------------+ 0253 | ``gencost_posproc_c`` | character(\*) | Post-processor | 0254 | | | character arguments | 0255 +---------------------------+-------------------+-----------------------------------+ 0256 | ``gencost_posproc_i`` | integer(\*) | Post-processor | 0257 | | | integer arguments | 0258 +---------------------------+-------------------+-----------------------------------+ 0259 | ``gencost_posproc_r`` | real(\*) | Post-processor real | 0260 | | | arguments | 0261 +---------------------------+-------------------+-----------------------------------+ 0262 | ``gencost_spmin`` | real | Data less than this | 0263 | | | value will be omitted | 0264 +---------------------------+-------------------+-----------------------------------+ 0265 | ``gencost_spmax`` | real | Data greater than | 0266 | | | this value will be | 0267 | | | omitted | 0268 +---------------------------+-------------------+-----------------------------------+ 0269 | ``gencost_spzero`` | real | Data points equal to | 0270 | | | this value will be | 0271 | | | omitted | 0272 +---------------------------+-------------------+-----------------------------------+ 0273 | ``gencost_startdate1`` | integer | Start date of | 0274 | | | observations | 0275 | | | (YYYMMDD) | 0276 +---------------------------+-------------------+-----------------------------------+ 0277 | ``gencost_startdate2`` | integer | Start date of | 0278 | | | observations (HHMMSS) | 0279 +---------------------------+-------------------+-----------------------------------+ 0280 | ``gencost_is3d`` | logical | Needs to be true for | 0281 | | | 3D fields | 0282 +---------------------------+-------------------+-----------------------------------+ 0283 | ``gencost_enddate1`` | integer | Not fully implemented | 0284 | | | (used only in | 0285 | | | :numref:`v4custom`) | 0286 +---------------------------+-------------------+-----------------------------------+ 0287 | ``gencost_enddate2`` | integer | Not fully implemented | 0288 | | | (used only in | 0289 | | | :numref:`v4custom`) | 0290 +---------------------------+-------------------+-----------------------------------+ 0291 | ``gencost_kLev_select`` | integer | Vertical level of a 3D field to | 0292 | | | create a 2D field for cost | 0293 | | | computation | 0294 +---------------------------+-------------------+-----------------------------------+ 0295 | ``gencost_useDensityMask``| logical | Needs to be true if density | 0296 | | | following feature is used | 0297 +---------------------------+-------------------+-----------------------------------+ 0298 | ``gencost_sigmaLow`` | real | Use to define minimum density | 0299 | | | surface chosen | 0300 +---------------------------+-------------------+-----------------------------------+ 0301 | ``gencost_sigmaHigh`` | real | Used to define maximum density | 0302 | | | surface chosen | 0303 +---------------------------+-------------------+-----------------------------------+ 0304 | ``gencost_refPressure`` | real | Defines reference pressure used | 0305 | | | in density following feature | 0306 +---------------------------+-------------------+-----------------------------------+ 0307 | ``gencost_tanhScale`` | real | Used in defining density levels | 0308 | | | in density following feature | 0309 +---------------------------+-------------------+-----------------------------------+ 6997d81055 gael*0310 13d362b8c1 Ou W*0311 .. table:: Implemented ``gencost_barfile`` options (as of checkpoint 65z) that 0312 can be used via :filelink:`cost_generic.F 0313 <pkg/ecco/cost_generic.F>` (:numref:`costgen`). An extension

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 315.

0314 starting with ‘\_’ can be appended at the end of the variable name 0315 to distinguish between separate cost function terms. Note: the

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 317.

0316 ‘m_eta’ formula depends on the ``ATMOSPHERIC_LOADING`` and 0317 ``ALLOW_PSBAR_STERIC`` compile-time options and

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 319.

0318 ‘useRealFreshWaterFlux’ run-time parameter. 6997d81055 gael*0319 :name: gencost_ecco_barfile 0320 0321 +-----------------------+-----------------------+-----------------------+ 0322 | variable name | description | remarks | 0323 +=======================+=======================+=======================+ 0324 | ``m_eta`` | sea surface height | free surface + ice + | 0325 | | | global steric | 0326 | | | correction | 0327 +-----------------------+-----------------------+-----------------------+ 0328 | ``m_sst`` | sea surface | first level potential | 0329 | | temperature | temperature | 0330 +-----------------------+-----------------------+-----------------------+ 0331 | ``m_sss`` | sea surface salinity | first level salinity | 0332 +-----------------------+-----------------------+-----------------------+ 0333 | ``m_bp`` | bottom pressure | phiHydLow | 0334 +-----------------------+-----------------------+-----------------------+ 0335 | ``m_siarea`` | sea-ice area | from pkg/seaice | 0336 +-----------------------+-----------------------+-----------------------+ 0337 | ``m_siheff`` | sea-ice effective | from pkg/seaice | 0338 | | thickness | | 0339 +-----------------------+-----------------------+-----------------------+ 0340 | ``m_sihsnow`` | snow effective | from pkg/seaice | 0341 | | thickness | | 0342 +-----------------------+-----------------------+-----------------------+ 0343 | ``m_theta`` | potential temperature | three-dimensional | 0344 +-----------------------+-----------------------+-----------------------+ 0345 | ``m_salt`` | salinity | three-dimensional | 0346 +-----------------------+-----------------------+-----------------------+ 0347 | ``m_UE`` | zonal velocity | three-dimensional | 0348 +-----------------------+-----------------------+-----------------------+ 0349 | ``m_VN`` | meridional velocity | three-dimensional | 0350 +-----------------------+-----------------------+-----------------------+ 0351 | ``m_ustress`` | zonal wind stress | from pkg/exf | 0352 +-----------------------+-----------------------+-----------------------+ 0353 | ``m_vstress`` | meridional wind | from pkg/exf | 0354 | | stress | | 0355 +-----------------------+-----------------------+-----------------------+ 0356 | ``m_uwind`` | zonal wind | from pkg/exf | 0357 +-----------------------+-----------------------+-----------------------+ 0358 | ``m_vwind`` | meridional wind | from pkg/exf | 0359 +-----------------------+-----------------------+-----------------------+ 0360 | ``m_atemp`` | atmospheric | from pkg/exf | 0361 | | temperature | | 0362 +-----------------------+-----------------------+-----------------------+ 0363 | ``m_aqh`` | atmospheric specific | from pkg/exf | 0364 | | humidity | | 0365 +-----------------------+-----------------------+-----------------------+ 0366 | ``m_precip`` | precipitation | from pkg/exf | 0367 +-----------------------+-----------------------+-----------------------+ 0368 | ``m_swdown`` | downward shortwave | from pkg/exf | 0369 +-----------------------+-----------------------+-----------------------+ 0370 | ``m_lwdown`` | downward longwave | from pkg/exf | 0371 +-----------------------+-----------------------+-----------------------+ 0372 | ``m_wspeed`` | wind speed | from pkg/exf | 0373 +-----------------------+-----------------------+-----------------------+ 0374 | ``m_diffkr`` | vertical/diapycnal | three-dimensional, | 0375 | | diffusivity | constant | 0376 +-----------------------+-----------------------+-----------------------+ 0377 | ``m_kapgm`` | GM diffusivity | three-dimensional, | 0378 | | | constant | 0379 +-----------------------+-----------------------+-----------------------+ 0380 | ``m_kapredi`` | isopycnal diffusivity | three-dimensional, | 0381 | | | constant | 0382 +-----------------------+-----------------------+-----------------------+ 0383 | ``m_geothermalflux`` | geothermal heat flux | constant | 0384 +-----------------------+-----------------------+-----------------------+ 0385 | ``m_bottomdrag`` | bottom drag | constant | 0386 +-----------------------+-----------------------+-----------------------+ 0387 0388 .. table:: ``gencost_preproc`` and ``gencost_posproc`` options 0389 implemented as of checkpoint 65z. Note: the distinction between 0390 ``gencost_preproc`` and ``gencost_posproc`` seems unclear and may be 0391 revisited in the future. 0392 :name: gencost_ecco_preproc 0393 0394 +-----------------------+-----------------------+-----------------------+ 0395 | name | description | ``gencost_preproc_i`` | 0396 | | | , ``_r``, or ``_c`` | 0397 +=======================+=======================+=======================+ 0398 | ``gencost_preproc`` | | | 0399 +-----------------------+-----------------------+-----------------------+ b938a3c63b antn*0400 | ``clim`` | Use climatological | integer: no. of | 6997d81055 gael*0401 | | misfits | records per | 0402 | | | climatological cycle | 0403 +-----------------------+-----------------------+-----------------------+

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 405.

0404 | ``mean`` | Use time mean of | — | 0405 | | misfits | | 0406 +-----------------------+-----------------------+-----------------------+

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 408.

0407 | ``anom`` | Use anomalies from | — | 0408 | | time mean | | 0409 +-----------------------+-----------------------+-----------------------+

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 411.

0410 | ``variaweight`` | Use time-varying | — | 0411 | | weight :math:`W_i` | | 0412 +-----------------------+-----------------------+-----------------------+

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 414.

0413 | ``nosumsq`` | Use linear misfits | — | 0414 +-----------------------+-----------------------+-----------------------+ 0415 | ``factor`` | Multiply | real: the scaling | 0416 | | :math:`\vec{m}_i` by | factor | 0417 | | a scaling factor | | 0418 +-----------------------+-----------------------+-----------------------+ 11c3150c71 Mart*

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 420.

0419 | ``offset`` | subtract mean misfit | — | 0420 +-----------------------+-----------------------+-----------------------+ 0421 | ``mindepth`` | mask (ignore) misfit | real: minimum water | 0422 | | above minimum depth | depth (:math:`< 0`) | 0423 +-----------------------+-----------------------+-----------------------+ 6997d81055 gael*0424 | ``gencost_posproc`` | | | 0425 +-----------------------+-----------------------+-----------------------+ 0426 | ``smooth`` | Smooth misfits | character: smoothing | 0427 | | | scale file | 0428 +-----------------------+-----------------------+-----------------------+ 0429 | | | integer: smoother # | 0430 | | | of time steps | 0431 +-----------------------+-----------------------+-----------------------+ 0432 0433 .. _intgen: 0434 0435 Generic Integral Function 0436 ~~~~~~~~~~~~~~~~~~~~~~~~~ 0437 0438 The functionality described in this section is operated by 13d362b8c1 Ou W*0439 :filelink:`cost_gencost_boxmean.F <pkg/ecco/cost_gencost_boxmean.F>`. It is 0440 primarily aimed at obtaining a mechanistic understanding of a chosen physical 0441 variable via adjoint sensitivity computations (see :ref:`chap_autodiff`) as 0442 done for example in :cite:`maro-eta:99,heim-eta:11,fuku-etal:14`. Thus the 0443 quadratic term in Eq. :eq:`Jtotal` (:math:`\vec{d}_i^T R_i^{-1} \vec{d}_i`) is 0444 by default replaced with a :math:`d_i` scalar [2]_ that derives from model 0445 fields through a generic integral formula (Eq. :eq:`Jpreproc`). The 0446 specification of :varlink:`gencost_barfile` again selects the physical variable 0447 type. Current valid options to use :filelink:`cost_gencost_boxmean.F 0448 <pkg/ecco/cost_gencost_boxmean.F>` are reported in

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 450.

0449 :numref:`genint_ecco_barfile`. A suffix starting with ``‘_’`` can again be 0450 appended to :varlink:`gencost_barfile`. 6997d81055 gael*0451 0452 The integral formula is defined by masks provided via binary files which 13d362b8c1 Ou W*0453 names are specified via :varlink:`gencost_mask`. There are two cases: (1) if

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 455.

0454 ``gencost_mask = ‘foo_mask’`` and :varlink:`gencost_barfile` is of the 6997d81055 gael*

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 456.

0455 ‘m_boxmean\*’ type then the model will search for horizontal, vertical, 0456 and temporal mask files named ``foo_maskC``, ``foo_maskK``, and 13d362b8c1 Ou W*0457 ``foo_maskT``; (2) if instead :varlink:`gencost_barfile` is of the 6997d81055 gael*

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 459.

0458 ‘m_horflux\_’ type then the model will search for ``foo_maskW``, 0459 ``foo_maskS``, ``foo_maskK``, and ``foo_maskT``. 0460

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 462.

0461 The ‘C’ mask or the ‘W’ / ‘S’ masks are expected to be two-dimensional

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 463.

0462 fields. The ‘K’ and ‘T’ masks (both optional; all 1 by default) are

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 464.

0463 expected to be one-dimensional vectors. The ‘K’ vector length should

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 465.

0464 match Nr. The ‘T’ vector length should match the # of records that the 13d362b8c1 Ou W*0465 specification of :varlink:`gencost_avgperiod` implies but there is no 6997d81055 gael*

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 467.

0466 restriction on its values. In case #1 (‘m_boxmean\*’) the ‘C’ and ‘K’ 0467 masks should consists of +1 and 0 values and a volume average will be

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 469.

0468 computed accordingly. In case #2 (‘m_horflux\*’) the ‘W’, ‘S’, and ‘K’ 0469 masks should consists of +1, -1, and 0 values and an integrated 0470 horizontal transport (or overturn) will be computed accordingly. 0471 35c4fdc74b Emma*0472 .. note:: 0473 0474 By default, ``m_boxmean`` cost functions are sums of masked, weighted 0475 variables, where the weight of each cell is the current cell volume 0476 divided by the total masked *initial* volume (sum of masked 0477 ``eccoVol_0``). Note that cell volumes vary in time in the case of 0478 a non-linear free surface (see :numref:`nonlinear-freesurface` 0479 (:ref:`nonlinear-freesurface`)). To obtain a true weighted mean in 0480 the case of a non-linear free surface, please define 0481 ``ECCO_VARIABLE_AREAVOLGLOB`` in ``ECCO_OPTIONS.h``, which instead 0482 uses the total masked current volume to weight contributions. 0483 aa93ca8e85 Ciar*0484 In order to define a control volume using both a depth range and a

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 486.

0485 density range, use a ‘K’ mask and also set 0486 :varlink:`gencost_useDensityMask` ``=.TRUE.``. When the density range 0487 feature is active, the control volume is defined at each timestep by

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 489.

0488 the bounds set in the ‘K’ mask and also by the density range specified 0489 by the parameters :varlink:`gencost_sigmaLow` (the minimum density to 0490 be included in the control volume) and :varlink:`gencost_sigmaHigh` 0491 (the maximum density to be included in the control volume). As a default 0492 :varlink:`gencost_refPressure` should be set to 0, but other values can 0493 be used (e.g. 1000 dbar, 2000 dbar). 0494 13d362b8c1 Ou W*0495 .. table:: Implemented :varlink:`gencost_barfile` options (as of checkpoint 0496 67x) that can be used via :filelink:`cost_gencost_boxmean.F 0497 <pkg/ecco/cost_gencost_boxmean.F>` (:numref:`intgen`). 6997d81055 gael*0498 :name: genint_ecco_barfile 0499 0500 +---------------------+----------------------------------+------------------+ 0501 | variable name | description | remarks | 0502 +=====================+==================================+==================+ 0503 | ``m_boxmean_theta`` | mean of theta over box | specify box | 0504 +---------------------+----------------------------------+------------------+ 0505 | ``m_boxmean_salt`` | mean of salt over box | specify box | 0506 +---------------------+----------------------------------+------------------+ 0507 | ``m_boxmean_eta`` | mean of SSH over box | specify box | 0508 +---------------------+----------------------------------+------------------+ 7b8b86ab99 Timo*0509 | ``m_boxmean_shifwf``| total shelfice freshwater flux | specify box | 0510 | | over box | | 0511 +---------------------+----------------------------------+------------------+ 0512 | ``m_boxmean_shihf`` | total shelfice heat flux over box| specify box | 0513 +---------------------+----------------------------------+------------------+ 38d78826c7 Ciar*0514 | ``m_boxmean_vol`` | total volume over box | specify box | b938a3c63b antn*0515 +---------------------+----------------------------------+------------------+ 6997d81055 gael*0516 | ``m_horflux_vol`` | volume transport through section | specify transect | 0517 +---------------------+----------------------------------+------------------+ 0518 0519 .. _v4custom: 0520 0521 Custom Cost Functions 0522 ~~~~~~~~~~~~~~~~~~~~~ 0523 13d362b8c1 Ou W*0524 This section (very much a work in progress...) pertains to the special cases of 0525 :filelink:`cost_gencost_bpv4.F <pkg/ecco/cost_gencost_bpv4.F>`, 0526 :filelink:`cost_gencost_seaicev4.F <pkg/ecco/cost_gencost_seaicev4.F>`, 0527 :filelink:`cost_gencost_sshv4.F <pkg/ecco/cost_gencost_sshv4.F>`, 0528 :filelink:`cost_gencost_sstv4.F <pkg/ecco/cost_gencost_sstv4.F>`, 0529 :filelink:`cost_gencost_transp.F <pkg/ecco/>`, and 0530 :filelink:`cost_gencost_moc.F <pkg/ecco/cost_gencost_moc.>`. The 0531 :filelink:`cost_gencost_transp.F <pkg/ecco/cost_gencost_transp.F>` function can 0532 be used to compute a transport of volume, heat, or salt through a specified b938a3c63b antn*0533 section (non quadratic cost function). To this end one sets

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 535.

0534 ``gencost_name = ‘transp*’``, where ``*`` is an optional suffix starting

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 536.

0535 with ``‘_’``, and set :varlink:`gencost_barfile` to one of ``m_trVol``, 0536 ``m_trHeat``, and ``m_trSalt``. 13d362b8c1 Ou W*0537 0538 The :filelink:`cost_gencost_moc.F <pkg/ecco/cost_gencost_moc.F>` function is 0539 similar to transport function, but is intended to compute the meridional 0540 overturning streamfunction maximum based on the volumetric transport integrated 0541 from the floor to surface, as in Smith and Heimbach (2019) :cite:`smith:19`. 0542 Therefore, this function is intended to work with :varlink:`gencost_barfile` 0543 ``= m_trVol``, and note that the first 3 characters of :varlink:`gencost_name` 0544 must be ``moc``, as depicted in :numref:`gencost_ecco_name`. Users can specify 0545 a latitude band to compute the MOC with appropriately defined West ('W') and 0546 South ('S') masks as described in :numref:`intgen`. As an example see 0547 parameter group (3) in `this data.ecco file 0548 <https://github.com/MITgcm/verification_other/blob/master/global_oce_cs32/input_ad.sens/data.ecco>`_ 0549 . 0550 0551 Note: the functionality in :filelink:`cost_gencost_transp.F 0552 <pkg/ecco/cost_gencost_transp.F>` is not regularly tested. Users interested in 0553 computing volumetric transports through a section are recommended to use the 0554 ``m_horflux_vol`` capabilities described above as it is regularly tested. Users 0555 interested in computing heat and salt transport should note the following about 0556 ``m_trHeat`` and ``m_trSalt``: 736e27304c Timo*0557 0558 1. The associated advection scheme with transports may be inconsistent with 32ce3e9e96 Mart*0559 the model unless ``ENUM_CENTERED_2ND`` is implemented 736e27304c Timo*0560 2. Bolus velocities are not included 0561 3. Diffusion components are not included 0562 0563 13d362b8c1 Ou W*0564 .. table:: Pre-defined :varlink:`gencost_name` special cases (as of checkpoint 6997d81055 gael*0565 65z; :numref:`v4custom`). 0566 :name: gencost_ecco_name 0567 0568 +-----------------------+-----------------------+-----------------------+ 0569 | name | description | remarks | 0570 +=======================+=======================+=======================+ 0571 | ``sshv4-mdt`` | sea surface height | mean dynamic | 0572 | | | topography (SSH - | 0573 | | | geod) | 0574 +-----------------------+-----------------------+-----------------------+ 0575 | ``sshv4-tp`` | sea surface height | Along-Track | 0576 | | | Topex/Jason SLA | 0577 | | | (level 3) | 0578 +-----------------------+-----------------------+-----------------------+ 0579 | ``sshv4-ers`` | sea surface height | Along-Track | 0580 | | | ERS/Envisat SLA | 0581 | | | (level 3) | 0582 +-----------------------+-----------------------+-----------------------+ 0583 | ``sshv4-gfo`` | sea surface height | Along-Track GFO class | 0584 | | | SLA (level 3) | 0585 +-----------------------+-----------------------+-----------------------+ 0586 | ``sshv4-lsc`` | sea surface height | Large-Scale SLA (from | 0587 | | | the above) | 0588 +-----------------------+-----------------------+-----------------------+ 0589 | ``sshv4-gmsl`` | sea surface height | Global-Mean SLA (from | 0590 | | | the above) | 0591 +-----------------------+-----------------------+-----------------------+ 0592 | ``bpv4-grace`` | bottom pressure | GRACE maps (level 4) | 0593 +-----------------------+-----------------------+-----------------------+ 0594 | ``sstv4-amsre`` | sea surface | Along-Swath SST | 0595 | | temperature | (level 3) | 0596 +-----------------------+-----------------------+-----------------------+ 0597 | ``sstv4-amsre-lsc`` | sea surface | Large-Scale SST (from | 0598 | | temperature | the above) | 0599 +-----------------------+-----------------------+-----------------------+ 0600 | ``si4-cons`` | sea ice concentration | needs sea-ice adjoint | 0601 | | | (level 4) | 0602 +-----------------------+-----------------------+-----------------------+ 0603 | ``si4-deconc`` | model sea ice | proxy penalty (from | 0604 | | deficiency | the above) | 0605 +-----------------------+-----------------------+-----------------------+ 0606 | ``si4-exconc`` | model sea ice excess | proxy penalty (from | 0607 | | | the above) | 0608 +-----------------------+-----------------------+-----------------------+ 0609 | ``transp_trVol`` | volume transport | specify masks | 0610 | | | (:numref:`intgen`) | 0611 +-----------------------+-----------------------+-----------------------+ 0612 | ``transp_trHeat`` | heat transport | specify masks | 0613 | | | (:numref:`intgen`) | 0614 +-----------------------+-----------------------+-----------------------+ 0615 | ``transp_trSalt`` | salt transport | specify masks | 0616 | | | (:numref:`intgen`) | 0617 +-----------------------+-----------------------+-----------------------+ df462307fb Timo*0618 | ``moc_trVol`` | meridional ovt. | specify masks | 0619 | | streamfn. maximum | (:numref:`intgen`) | 0620 +-----------------------+-----------------------+-----------------------+ 6997d81055 gael*0621 0622 Key Routines 0623 ~~~~~~~~~~~~ 0624 13d362b8c1 Ou W*0625 TBA ... 0626 :filelink:`ecco_readparms.F <pkg/ecco/ecco_readparms.F>`, 0627 :filelink:`ecco_check.F <pkg/ecco/ecco_check.F>`, 0628 :filelink:`ecco_summary.F <pkg/ecco/ecco_summary.F>`, 0629 :filelink:`cost_generic.F <pkg/ecco/cost_generic.F>`, 0630 :filelink:`cost_gencost_boxmean.F <pkg/ecco/cost_gencost_boxmean.F>`, 0631 :filelink:`ecco_toolbox.F <pkg/ecco/ecco_toolbox.F>`, 0632 :filelink:`ecco_phys.F <pkg/ecco/ecco_phys.F>`, 0633 :filelink:`cost_gencost_customize.F <pkg/ecco/cost_gencost_customize.F>`, 0634 :filelink:`cost_averagesfields.F <pkg/ecco/cost_averagesfields.F>`, ... 6997d81055 gael*0635 0636 Compile Options 0637 ~~~~~~~~~~~~~~~ 0638 13d362b8c1 Ou W*0639 TBA ... 0640 :varlink:`ALLOW_GENCOST_CONTRIBUTION`, 0641 :varlink:`ALLOW_GENCOST3D`, 0642 :varlink:`ALLOW_PSBAR_STERIC`, 0643 :varlink:`ALLOW_SHALLOW_ALTIMETRY`, 0644 :varlink:`ALLOW_HIGHLAT_ALTIMETRY`, 0645 :varlink:`ALLOW_PROFILES_CONTRIBUTION`, 0646 :varlink:`ALLOW_ECCO_OLD_FC_PRINT`, 0647 ... 0648 0649 packages required for some functionalities: 0650 :filelink:`smooth <pkg/smooth>`, 0651 :filelink:`profiles <pkg/profiles>`, 0652 :filelink:`ctrl <pkg/ctrl>` 6997d81055 gael*0653 0654 .. _sec:pkg:profiles: 0655 0656 PROFILES: model-data comparisons at observed locations 0657 ------------------------------------------------------ 0658 0659 Author: Gael Forget 0660 ad59256d7d aver*0661 The purpose of :filelink:`pkg/profiles <pkg/profiles>` is to allow sampling of MITgcm runs 6997d81055 gael*0662 according to a chosen pathway (after a ship or a drifter, along 0663 altimeter tracks, etc.), typically leading to easy model-data 0664 comparisons. Given input files that contain positions and dates, 0665 pkg/profiles will interpolate the model trajectory at the observed 0666 location. In particular, pkg/profiles can be used to do model-data 0667 comparison online and formulate a least-squares problem (ECCO 0668 application). 0669 0670 The pkg/profiles namelist is called data.profiles. In the example below, 32ce3e9e96 Mart*0671 it includes two input netcdf file names (ARGOifremer_r8.nc 6997d81055 gael*0672 and XBT_v5.nc) that should be linked to the run directory 0673 and *cost function* multipliers that only matter in the 0674 context of automatic differentiation (see :ref:`chap_autodiff`). The 0675 first index is a file number and the second index (in mult\* only) is a 0676 variable number. By convention, the variable number is an integer 0677 ranging 1 to 6: temperature, salinity, zonal velocity, meridional 0678 velocity, sea surface height anomaly, and passive tracer. 0679 0680 .. more updates are needed below 0681 0682 The netcdf input file structure is illustrated in the case of XBT_v5.nc 32ce3e9e96 Mart*0683 To create such files, one can use the MITprof matlab toolbox obtained 6997d81055 gael*0684 from https://github.com/gaelforget/MITprof . 0685 At run time, each file is scanned to determine which 0686 variables are included; these will be interpolated. The (final) output 0687 file structure is similar but with interpolated model values in prof_T 0688 etc., and it contains model mask variables (e.g. prof_Tmask). The very 0689 model output consists of one binary (or netcdf) file per processor. 0690 The final netcdf output is to be built from those using 0691 netcdf_ecco_recompose.m (offline). 0692 0693 When the k2 option is used (e.g. for cubed sphere runs), the input file 0694 is to be completed with interpolation grid points and coefficients 0695 computed offline using netcdf_ecco_GenericgridMain.m. Typically, you 0696 would first provide the standard namelist and files. After detecting 0697 that interpolation information is missing, the model will generate 0698 special grid files (profilesXCincl1PointOverlap\* etc.) and then stop. 0699 You then want to run netcdf_ecco_GenericgridMain.m using the special 0700 grid files. *This operation could eventually be inlined.* 0701 0702 ``Example: data.profiles`` 0703 0704 :: 0705 0706 # 0707 # \*****************\* 0708 # PROFILES cost function 0709 # \*****************\* 0710 &PROFILES_NML 0711 #

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 713.

0712 profilesfiles(1)= ’ARGOifremer_r8’, 0713 mult_profiles(1,1) = 1., 0714 mult_profiles(1,2) = 1.,

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 716.

0715 profilesfiles(2)= ’XBT_v5’, 0716 mult_profiles(2,1) = 1., 0717 # 0718 / 0719 0720 ``Example: XBT_v5.nc`` 0721 0722 :: 0723 0724 netcdf XBT_v5 { 0725 dimensions: a9ebda6af0 gael*0726 iPROF = 278026 ; 6997d81055 gael*0727 iDEPTH = 55 ; 0728 lTXT = 30 ; 0729 variables: 0730 double depth(iDEPTH) ; 0731 depth:units = "meters" ; 0732 double prof_YYYYMMDD(iPROF) ; 0733 prof_YYYYMMDD:missing_value = -9999. ; 0734 prof_YYYYMMDD:long_name = "year (4 digits), month (2 digits), day (2 digits)" ; 0735 double prof_HHMMSS(iPROF) ; 0736 prof_HHMMSS:missing_value = -9999. ; 0737 prof_HHMMSS:long_name = "hour (2 digits), minute (2 digits), second (2 digits)" ; 0738 double prof_lon(iPROF) ; 0739 prof_lon:units = "(degree E)" ; 0740 prof_lon:missing_value = -9999. ; 0741 double prof_lat(iPROF) ; 0742 prof_lat:units = "(degree N)" ; 0743 prof_lat:missing_value = -9999. ; 0744 char prof_descr(iPROF, lTXT) ; 0745 prof_descr:long_name = "profile description" ; 0746 double prof_T(iPROF, iDEPTH) ; 0747 prof_T:long_name = "potential temperature" ; 0748 prof_T:units = "degree Celsius" ; 0749 prof_T:missing_value = -9999. ; 0750 double prof_Tweight(iPROF, iDEPTH) ; 0751 prof_Tweight:long_name = "weights" ; 0752 prof_Tweight:units = "(degree Celsius)-2" ; 0753 prof_Tweight:missing_value = -9999. ; 0754 } 0755 ad59256d7d aver*0756 .. _sec:pkg:ObsFit: 0757 0758 OBSFIT: grid-independent model-data comparisons 0759 ------------------------------------------------------ 0760 0761 Author: Ariane Verdy 0762 0763 Introduction 0764 ~~~~~~~~~~~~ 0765 0766 :filelink:`pkg/obsfit <pkg/obsfit>` is a versatile package used for grid-independent model-data comparisons 0767 including cost function calculations. 0768 0769 Given an observational dataset, OBSFIT samples the model during the run at the time and location of observations, 0770 calculates the cost (sum of weighted misfits), and produces a model-equivalent output file that is directly 0771 comparable to an input file containing observational data. 0772 It is designed to accommodate datasets that are sparse, irregular, or non-local. 0773 OBSFIT works in "observations space", meaning that the model is interpolated to the observations locations, not the other way around. Hence observations do not have to be interpolated or constrained to a fixed set of depth levels, and model-data comparisons are independent of the model grid. 0774 This increases the efficiency of data 0775 assimilation for many datasets and allows compatibility with multi-grid state estimation. OBSFIT offers the 0776 capability of assimilating high-resolution altimetry data (e.g., `SWOT <https://swot.jpl.nasa.gov>`_), 0777 high-frequency radar (HRF), and spatially/temporally averaged data such as tomography or SST products. 0778 0779 Description 0780 ~~~~~~~~~~~ 0781 0782 The code is evolved from :filelink:`pkg/profiles <pkg/profiles>` and shares much of its general structure. 0783 In addition to relaxing pkg/profile's constraint on vertical levels, OBSFIT can handle: 0784 0785 - spatial averages of multiple sample locations; 0786 0787 - time averages (or a cumulative integral) of multiple sampled points; 0788 0789 - observations that are combinations of multiple variables. 0790 0791 .. _obsfit_space: 0792 0793 Observations vs. Samples 0794 ^^^^^^^^^^^^^^^^^^^^^^^^ 0795 One feature of this package is that it allows measured observations to be averages in both space and/or time 0796 (or alternatively, integrated values in space and/or time via optional parameter choices, see :ref:`below <obsfit_time>`). 0797 Samples, defined as instantaneous model data values 0798 at specific locations (which may or may not coincide with model gridpoints), are aggregated and 0799 interpolated for comparison with observations. Hence, in OBSFIT, sampled points are referred to as *samples*, the averaged/integrated values as *model-equivalents*, and the measured values as *observations*. The cost function is evaluated from the misfit between *model-equivalents* and *observations*. 0800 As an example, consider observations of integrated sound speed along the acoustic ray path: 0801 in such case, one specifies multiple locations at which to sample the model, as we require model 0802 data at multiple locations to calculate the model-equivalent of a single observation. 0803 Sample locations are used during the model run to extract model data (and save it to file). Then, sampled 0804 values are combined at the end of the run to calculate the model-equivalent values to the observations. 0805 0806 In many applications, *observations* are not spatially averaged or integrated; in that case, NP = 1 and *samples* and *observations* are effectively the same. A feature of the obsefit package, however, is that it allows each observation to be comprised of a number of samples (NP). Each of those NP samples is assigned a relative 0807 weight in the average/integral; by default all samples are weighed equally. (Note that the our definition of weights is 0808 different from the uncertainty-related weights in :filelink:`pkg/profiles`.) 0809 0810 .. _obsfit_type: 0811 0812 Sample types 0813 ^^^^^^^^^^^^ 0814 0815 Each OBSFIT sample is assigned a type corresponding to the model variable that will be sampled. 0816 There are currently five types of variables implemented in the code: potential temperature, salinity, 0817 zonal velocity, meridional velocity, and sea surface height. Other variables can be added in 0818 ``obsfit_sampling.F``. Observations can be made of samples 0819 of different types; for example, one could compute the along-shore current speed (a combination of 0820 zonal and meridional velocities) or the water spiciness (a combination of temperature and salinity). 0821 0822 0823 For sea surface height (SSH) observations, OBSFIT samples the model variable :varlink:`etaN`. Inputs should thus 0824 be the total dynamic height (SSH relative to the geoid), not SSH anomalies. Because of arbitrary reference 0825 values for the dynamic topography, the mean offset between modeled and observed SSH is removed when the cost is calculated, for each dataset (i.e., each obsfit input file). 0826 0827 .. _obsfit_time: 0828 0829 Observation duration 0830 ^^^^^^^^^^^^^^^^^^^^ 0831 0832 Each OBSFIT observation is assigned a start time and a duration. 0833 Observations with a specified positive duration are averaged in time, whereas a negative duration 0834 is used to indicate time integration, and instantaneous observations have duration=0 0835 (if no duration is provided, duration=0 is assumed). During each 0836 model time step which falls within the specified observation window, the model is sampled 0837 at each specified sample location. 0838 In other words, all samples inherit the time and duration from the corresponding observation. 0839 If observation time does not align exactly with model time steps, samples are taken from model data 0840 at the beginning of the time step in which the observation time falls (time interpolation is not 0841 necessary as long as the model time step is relatively small). 0842 Sampled values are saved in tiled files. For non-zero specified duration, accumulated values 0843 are saved in the tiled files and the average is calculated at the end of the model run. 0844 0845 0846 Interpolation 0847 ^^^^^^^^^^^^^ 0848 0849 Sampling is done by interpolating model values from grid points surrounding the 0850 sample location (up to 8 surrounding grid points are used). For a cartesian or spherical polar grid, 0851 interpolation factors (not to be confused with weights!) are calculated from the input longitude, latitude, and depth. 0852 For a curvilinear grid (LLC, etc), interpolation factors are computed offline and included in the input file (see below). 0853 0854 Cost Functions 0855 ^^^^^^^^^^^^^^ 0856 0857 0858 OBSFIT configuration and compiling 0859 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0860 0861 OBSFIT can be turned on or off at compile time 0862 (see :numref:`building_code`) 0863 0864 - using the ``packages.conf`` file by adding ``obsfit`` to it 0865 0866 - or using :filelink:`genmake2 <tools/genmake2>` adding ``-enable=obsfit`` or 0867 ``-disable=obsfit`` switches 0868 0869 - *required packages and CPP options*: :filelink:`pkg/cal` must be enabled to use OBSFIT. No other packages or CPP options are required. 0870 0871 If needed, edit :filelink:`OBSFIT_SIZE.h <pkg/obsfit/OBSFIT_SIZE.h>` to change the maximum number of input files, 0872 total number of observations, number of samples per tile, or number of samples per observation. For maximum efficiency, 0873 set those to the smallest values possible for your input datasets. 0874 0875 Run-time requirements 0876 ~~~~~~~~~~~~~~~~~~~~~ 0877 0878 Pre-processing: How to make OBSFIT input files 0879 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0880 0881 Users must provide at least one OBSFIT input file, in netCDF format, with observed values and sampling locations. 0882 Typically, different datasets will be processed as separate files. In OBSFIT input files, all fields will be 0883 vectors -- with the exception of position and integration factors for the generic grid case. 0884 0885 They must include the following fields: 0886 0887 - obs_val (observed value) 0888 0889 - obs_uncert (uncertainty on the observed value) 0890 0891 - obs_YYYYMMDD (observation start time [year,month,day]) 0892 0893 - obs_HHMMSS (observation start time [hour,min,sec]) 0894 0895 - sample_type (variable type, [integer; see table below]) 0896 0897 - sample_lon (longitude) 0898 0899 - sample_lat (latitude) 0900 0901 - sample_depth (depth) 0902 0903 0904 The following fields are optional: 0905 0906 - obs_delt (observation duration [default=0; negative for time integration]) 0907 0908 - obs_np (number of samples in the observation [default=1]) 0909 0910 - sample_weight (weighting factor [default=1/obs_np]) 0911 0912 0913 If the grid is not longitude/latitude, i.e. for a generic grid case, additional fields are needed: 0914 0915 - sample_point 0916 0917 - sample_interp_XC11 0918 0919 - sample_interp_YC11 0920 0921 - sample_interp_XCNINJ 0922 0923 - sample_interp_YCNINJ 0924 0925 - sample_interp_i 0926 0927 - sample_interp_j 0928 0929 - sample_interp_k 0930 0931 - sample_interp_frac 0932 0933 0934 0935 See make_obsfit_example.m for a simple matlab example with a longitude-latitude grid. 0936 A python toolbox, ObsPrep, for formatting ungridded datasets into objects readable by pkg/obsfit using xarray 0937 is under development: https://github.com/ECCO-Hackweek/EH24-processors-llc/tree/main?tab=readme-ov-file. The application computes the required *sample_interp* fields. 0938 0939 In the simplest case, the number of samples per observation is 1; then obs_np = 1 (by default), sample_weight = 1 (by default), and sample_{type/lon/lat/depth} give the variable type/longitude/latitude/depth of the observation. If there are {N} observations, each field listed above is a vector of size {1xN}. 0940 0941 If observations are spatial averages or integrals, one must specify the number of samples that make each observation, as well as their relative weight. If there are {N} observations, obs* fields are vectors of size {1xN} and sample* fields are vectors of size :math:`\sum_N` (obs_np). Note that the number of samples can be different for each observation. 0942 0943 The observation start time is given in two separate fields, obs_YYYYMMDD and obs_HHMMSS. They are numeric values with 8 and 6 digits, respectively. The first 4 digits of obs_YYYYMMDD correspond to the year, the next 2 to the month, and the last 2 to the day; a similar notation is used for obs_HHMMSS. 0944 0945 0946 Sample types currently supported: 0947 0948 ============== ====== 0949 Variable Type 0950 ============== ====== 0951 :math:`\theta` 1 0952 :math:`S` 2 0953 :math:`u` 3 0954 :math:`v` 4 0955 SSH 5 0956 ============== ====== 0957 0958 0959 Enabling the package 0960 ^^^^^^^^^^^^^^^^^^^^ 0961 0962 :filelink:`/pkg/obsfit` package is switched on/off at run-time by 0963 setting :varlink:`useOBSFIT` ``= .TRUE.,`` in ``data.pkg``. 0964 0965 General flags and parameters 0966 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0967 0968 :numref:`tab_phys_pkg_obsfit_runtimeparms` lists run-time parameters. 0969 0970 .. tabularcolumns:: |\Y{.275}|\Y{.20}|\Y{.525}| 0971 0972 .. table:: Run-time parameters and default values 0973 :class: longtable 0974 :name: tab_phys_pkg_obsfit_runtimeparms 0975 0976 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 0977 | Name | Default value | Description | 0978 +====================================+==============================+=========================================================================+ 0979 | :varlink:`obsfitDir` | ' ' | subdirectory name containing OBSFIT data files | 0980 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 0981 | :varlink:`obsfitFiles` | ' ' | OBSFIT data filenames (``.nc`` automatically appended) | 0982 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 0983 | :varlink:`mult_obsfit` | 1.0 | multiplier factor for observation in total cost function calculation | 0984 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 0985 | :varlink:`obsfit_facmod` | 1.0 | | 0986 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 0987 | :varlink:`obsfitDoNcOutput` | FALSE | boolean to generate tiled output file in netCDF format | 0988 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 0989 0990 0991 File ``data.obsfit`` must be present in the run folder. Here is an example: 0992 0993 :: 0994 0995 # ********************* 0996 # OBSFIT cost function 0997 # ********************* 0998 &OBSFIT_NML 0999 obsfitDir = 'OBSFIT', 1000 obsfitFiles(1) = 'swot_L3', 1001 mult_obsfit(1) = 1.0, 1002 obsfitFiles(2) = 'moorings', 1003 mult_obsfit(2) = 0.0, 1004 & 1005 1006 1007 In this example there are two input files: swot_L3.nc and moorings.nc 1008 (note that the suffix .nc should not be included in data.obsfit). They have multiplier factors that will 1009 multiply their respective cost in the total cost calculation. For example, the first dataset 1010 will be counted with a factor=1, and the second dataset will not influence the total cost 1011 since its multiplier is 0. Output files will be written in a folder called "OBSFIT" that 1012 will be created if it doesn't already exist. 1013 1014 1015 ``Example: swot_L3.nc`` 1016 1017 :: 1018 1019 netcdf swot_L3.nc { 1020 dimensions: 1021 iOBS = 1575 ; 1022 iSAMPLE = 1575; 1023 variables: 1024 double obs_val(iOBS) ; 1025 double obs_uncert(iOBS) ; 1026 double obs_YYYYMMDD(iOBS) ; 1027 obs_YYYYMMDD:missing_value = -9999. ; 1028 obs_YYYYMMDD:long_name = "year (4 digits), month (2 digits), day (2 digits)" ; 1029 double obs_HHMMSS(iOBS) ; 1030 obs_HHMMSS:missing_value = -9999. ; 1031 obs_HHMMSS:long_name = "hour (2 digits), minute (2 digits), second (2 digits)" ; 1032 double sample_lon(iSAMPLE) ; 1033 sample_lon:units = "(degree E)" ; 1034 sample_lon:missing_value = -9999. ; 1035 double sample_lat(iSAMPLE) ; 1036 sample_lat:units = "(degree N)" ; 1037 sample_lat:missing_value = -9999. ; 1038 double sample_depth(iSAMPLE) ; 1039 sample_depth:units = "(meters)" ; 1040 sample_depth:missing_value = -9999. ; 1041 double sample_type(iSAMPLE) ; 1042 sample_type:missing_value = -9999. ; 1043 sample_type:long_name = "1=T, 2=S, 3=u, 4=v, 5=SSH" ; 1044 } 1045 1046 Post-processing 1047 ^^^^^^^^^^^^^^^ 1048 1049 For each input file, two new files are created. One, named <original_filename>.equi.nc, 1050 contains model-equivalent values for direct comparison with observation data. 1051 The other, named <original_filename>.misfits.nc, contains model-observations misfits. 1052 "equi.nc" output files include two variables, mod_val and mod_mask. They are in the same format as the input files, 1053 thus obs_val and mod_val are directly comparable. The mask indicates missing model-equivalent values. 1054 1055 A simple way to plot the observed values and model-equivalent values in matlab could be: 1056 1057 :: 1058 1059 load swot_L3.nc 1060 figure; scatter(sample_lon, sample_lat, 30, obs_val); 1061 load swot_L3.equi.nc 1062 figure; scatter(sample_lon, sample_lat, 30, mod_val); 1063 1064 Experiments and tutorials that use OBSFIT 1065 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1066 1067 /verification/global_oce_biogeo_bling/ 1068 1069 6997d81055 gael*1070 .. _sec:pkg:ctrl: 1071 1072 CTRL: Model Parameter Adjustment Capability 1073 ------------------------------------------- 1074 b938a3c63b antn*1075 Author: Gael Forget, An T. Nguyen, Martin Losch 1076 1077 .. _gen_ctrl: 1078 1079 Generic Control Parameters 1080 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6997d81055 gael*1081 13d362b8c1 Ou W*1082 Package :filelink:`ctrl <pkg/ctrl>` provides an interface to defining the 1083 control variables for an optimization. After defining CPP-flags 32ce3e9e96 Mart*1084 :varlink:`ALLOW_GENTIM2D_CONTROL`, :varlink:`ALLOW_GENARR2D_CONTROL`, 1085 :varlink:`ALLOW_GENARR3D_CONTROL` in :filelink:`CTRL_OPTIONS.h b938a3c63b antn*1086 <pkg/ctrl/CTRL_OPTIONS.h>`, the parameters available for configuring generic 13d362b8c1 Ou W*1087 cost terms in ``data.ctrl`` are given in :numref:`gencost_ctrl_params`. The 1088 control variables are stored as fields on the model grid in files 1089 ``$ctrlvar.$iternumber.data/meta``, and corresponding gradients in 1090 ``ad$ctrlvar.$iternumber.data/meta``, where ``$ctrl`` is defined in 1091 ``data.ctrl`` (see :numref:`gencost_ctrl_files` for possible options) and 1092 ``$iternumber`` is the 10-digit iteration number of the optimization. Further, 1093 :filelink:`ctrl <pkg/ctrl>` maps the gradient fields to a vector that can be 1094 handed over to an optimization routine (see :numref:`sectionoptim`) and maps 1095 the resulting new control vector to the model grid unless CPP-flag 1096 :varlink:`EXCLUDE_CTRL_PACK` is defined in :filelink:`CTRL_OPTIONS.h 1097 <pkg/ctrl/CTRL_OPTIONS.h>`. 1098 b938a3c63b antn*1099 .. _gen_ctrl_param: 13d362b8c1 Ou W*1100 b938a3c63b antn*1101 Run-time Parameters 1102 ^^^^^^^^^^^^^^^^^^^ 1103 1104 .. table:: Parameters in namelist group :varlink:`ctrl_nml_genarr` in ``data.ctrl``. The 13d362b8c1 Ou W*1105 ``*`` can be replaced by ``arr2d``, ``arr3d``, or ``tim2d`` for 1106 time-invariant two and three dimensional controls and time-varying 1107 2D controls, respectively. Parameters for ``genarr2d``, 1108 ``genarr3d``, and ``gentime2d`` are arrays of length 1109 :varlink:`maxCtrlArr2D`, :varlink:`maxCtrlArr3D`, and 1110 :varlink:`maxCtrlTim2D`, respectively, with one entry per term in 1111 the cost function. 6997d81055 gael*1112 :name: gencost_ctrl_params 1113 b938a3c63b antn*1114 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1115 | Name | Default value | Description | 1116 +====================================+==============================+=========================================================================+ 1117 | ``xx_gen*_file`` | :kbd:`' '` | control fllename: prefix from :numref:`gencost_ctrl_files` + suffix | 1118 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1119 | ``xx_gen*_weight`` | :kbd:`' '` | filename for weights in the form of :math:`\sigma_{\vec{u}_j}^{-2}` | 1120 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1121 | ``xx_gen*_bounds`` | 0.0, 0.0, 0.0, 0.0, 0.0 | apply bounds | 1122 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1123 | ``xx_gen*_preproc`` | :kbd:`' '` | control preprocessor (see :numref:`gencost_ctrl_preproc`) | 1124 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1125 | ``xx_gen*_preproc_c`` | :kbd:`' '` | preprocessor character arguments (see :numref:`genarr_preproc_c`) | 1126 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1127 | ``xx_gen*_preproc_i`` | 0 | preprocessor integer arguments | 1128 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1129 | ``xx_gen*_preproc_r`` | 0.0 | preprocessor real arguments | 1130 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1131 | ``gen*Precond`` | 1.0 | preconditioning factor | 1132 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1133 | ``mult_gen*`` | 1.0 | cost function multiplier :math:`\beta_j` | 1134 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1135 | :varlink:`xx_gentim2d_period` | 0.0 | frequency of adjustments (s) | 1136 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1137 | :varlink:`xx_gentim2d_startdate1` | :varlink:`startdate_1` | adjustment start date 1 yyyymmdd (default from :filelink:`pkg/cal`; | 1138 | | | see :numref:`sub_phys_pkg_cal`) | 1139 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1140 | :varlink:`xx_gentim2d_startdate2` | :varlink:`startdate_2` | adjustment start date 2 hhmmss (default from :filelink:`pkg/cal`; | 1141 | | | see :numref:`sub_phys_pkg_cal`) | 1142 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1143 | :varlink:`xx_gentim2d_cumsum` | FALSE | accumulate control adjustments | 1144 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1145 | :varlink:`xx_gentim2d_glosum` | FALSE | global sum of adjustment (note: output is still 2D) | 1146 +------------------------------------+------------------------------+-------------------------------------------------------------------------+ 1147 1148 .. _gen_ctrl_fields: 1149 1150 Generic Control Fields 1151 ^^^^^^^^^^^^^^^^^^^^^^ 6997d81055 gael*1152 7b8b86ab99 Timo*1153 .. table:: Generic control prefixes implemented as of checkpoint 67x. 6997d81055 gael*1154 :name: gencost_ctrl_files 1155 11c3150c71 Mart*1156 +--------------------+-----------------------+--------------------------------+ 1157 | | name | description | 1158 +====================+=======================+================================+ 1159 | 2D, time-invariant | ``genarr2d`` | | 1160 | controls | | | 1161 +--------------------+-----------------------+--------------------------------+ 1162 | | ``xx_etan`` | initial sea surface height | 1163 +--------------------+-----------------------+--------------------------------+ 1164 | | ``xx_bottomdrag`` | bottom drag | 1165 +--------------------+-----------------------+--------------------------------+ 1166 | | ``xx_geothermal`` | geothermal heat flux | 1167 +--------------------+-----------------------+--------------------------------+ b938a3c63b antn*1168 | | ``xx_shicoefft`` | package :ref:`shelfice | 1169 | | | <sub_phys_pkg_shelfice>` | 1170 | | | thermal transfer coefficient | 11c3150c71 Mart*1171 | | | (see :numref:`shi_ctrl`) | 1172 +--------------------+-----------------------+--------------------------------+ b938a3c63b antn*1173 | | ``xx_shicoeffs`` | package :ref:`shelfice | 1174 | | | <sub_phys_pkg_shelfice>` | 1175 | | | salinity transfer | 11c3150c71 Mart*1176 | | | coefficient | 1177 | | | (see :numref:`shi_ctrl`) | 1178 +--------------------+-----------------------+--------------------------------+ b938a3c63b antn*1179 | | ``xx_shicdrag`` | package :ref:`shelfice | 1180 | | | <sub_phys_pkg_shelfice>` | 1181 | | | drag coefficient | 11c3150c71 Mart*1182 | | | (see :numref:`shi_ctrl`) | 1183 +--------------------+-----------------------+--------------------------------+ b938a3c63b antn*1184 | | ``xx_depth`` | bottom topography; | 1185 | | | requires #define | 11c3150c71 Mart*1186 | | | :varlink:`ALLOW_DEPTH_CONTROL` | 1187 +--------------------+-----------------------+--------------------------------+ b938a3c63b antn*1188 | | ``xx_siheff`` | package :ref:`seaice | 1189 | | | <sub_phys_pkg_seaice>` | 1190 | | | initial sea ice thickness | 1191 +--------------------+-----------------------+--------------------------------+ 1192 | | ``xx_siarea`` | package :ref:`seaice | 1193 | | | <sub_phys_pkg_seaice>` | 1194 | | | initial sea ice area | c69ccc91fb antn*1195 +--------------------+-----------------------+--------------------------------+ 1196 +--------------------+-----------------------+--------------------------------+ 11c3150c71 Mart*1197 | 3D, time-invariant | ``genarr3d`` | | 1198 | controls | | | 1199 +--------------------+-----------------------+--------------------------------+ 1200 | | ``xx_theta`` | initial potential temperature | 1201 +--------------------+-----------------------+--------------------------------+ 1202 | | ``xx_salt`` | initial salinity | 1203 +--------------------+-----------------------+--------------------------------+ 1204 | | ``xx_uvel`` | initial zonal velocity | 1205 +--------------------+-----------------------+--------------------------------+ 1206 | | ``xx_vvel`` | initial meridional velocity | 1207 +--------------------+-----------------------+--------------------------------+ b938a3c63b antn*1208 | | ``xx_kapgm`` | package :ref:`gmredi | 1209 | | | <sub_phys_pkg_gmredi>` | 1210 | | | GM thickness diffusivity | 1211 | | | (see :numref:`GM_bolus_desc`) | 11c3150c71 Mart*1212 +--------------------+-----------------------+--------------------------------+ b938a3c63b antn*1213 | | ``xx_kapredi`` | package :ref:`gmredi | 1214 | | | <sub_phys_pkg_gmredi>` | 1215 | | | isopycnal ("Redi") diffusivity | 1216 | | | (see :numref:`GM_redi_desc`) | 11c3150c71 Mart*1217 +--------------------+-----------------------+--------------------------------+ 1218 | | ``xx_diffkr`` | diapycnal diffusivity | 1219 +--------------------+-----------------------+--------------------------------+ b938a3c63b antn*1220 +--------------------+-----------------------+--------------------------------+ 11c3150c71 Mart*1221 | 2D, time-varying | ``gentim2D`` | | 1222 | controls | | | 1223 +--------------------+-----------------------+--------------------------------+ 1224 | | ``xx_atemp`` | atmospheric temperature | 1225 +--------------------+-----------------------+--------------------------------+ 1226 | | ``xx_aqh`` | atmospheric specific humidity | 1227 +--------------------+-----------------------+--------------------------------+ 1228 | | ``xx_swdown`` | downward shortwave | 1229 +--------------------+-----------------------+--------------------------------+ 1230 | | ``xx_lwdown`` | downward longwave | 1231 +--------------------+-----------------------+--------------------------------+ 1232 | | ``xx_precip`` | precipitation | 1233 +--------------------+-----------------------+--------------------------------+ 1234 | | ``xx_runoff`` | river runoff | 1235 +--------------------+-----------------------+--------------------------------+ 1236 | | ``xx_uwind`` | zonal wind | 1237 +--------------------+-----------------------+--------------------------------+ 1238 | | ``xx_vwind`` | meridional wind | 1239 +--------------------+-----------------------+--------------------------------+ 1240 | | ``xx_tauu`` | zonal wind stress | 1241 +--------------------+-----------------------+--------------------------------+ 1242 | | ``xx_tauv`` | meridional wind stres | 1243 +--------------------+-----------------------+--------------------------------+ 1244 | | ``xx_gen_precip`` | globally averaged | b938a3c63b antn*1245 | | | precipitation | 11c3150c71 Mart*1246 +--------------------+-----------------------+--------------------------------+ 1247 | | ``xx_hflux`` | net heat flux | 1248 +--------------------+-----------------------+--------------------------------+ 1249 | | ``xx_sflux`` | net salt (EmPmR) flux | 1250 +--------------------+-----------------------+--------------------------------+ 1251 | | ``xx_shifwflx`` | shelfice melt rate | 1252 +--------------------+-----------------------+--------------------------------+ 6997d81055 gael*1253 b938a3c63b antn*1254 .. _gen_ctrl_proc: 1255 1256 Generic Control Processing Options 1257 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1258 6997d81055 gael*1259 .. table:: ``xx_gen????d_preproc`` options implemented as of checkpoint 7b8b86ab99 Timo*1260 67x. Notes: :math:`^a`: If ``noscaling`` is false, the control 6997d81055 gael*1261 adjustment is scaled by one on the square root of the weight before 13d362b8c1 Ou W*1262 being added to the base control variable; if ``noscaling`` is true, 1263 the control is multiplied by the weight in the cost function itself. 6997d81055 gael*1264 :name: gencost_ctrl_preproc 1265 1266 +-----------------------+-----------------------+-----------------------+ 1267 | name | description | arguments | 1268 +=======================+=======================+=======================+ b938a3c63b antn*1269 | ``WC01`` | correlation modeling | integer: operator | 6997d81055 gael*1270 | | | type (default: 1) | 1271 +-----------------------+-----------------------+-----------------------+ b938a3c63b antn*1272 | ``smooth`` | smoothing without | integer: operator | 6997d81055 gael*1273 | | normalization | type (default: 1) | 1274 +-----------------------+-----------------------+-----------------------+ b938a3c63b antn*1275 | ``docycle`` | average period | integer: cycle length | 6997d81055 gael*1276 | | replication | | 1277 +-----------------------+-----------------------+-----------------------+ b938a3c63b antn*1278 | ``replicate`` | alias for ``docycle`` |(units of | 6997d81055 gael*1279 | | |``xx_gentim2d_period``)| 1280 +-----------------------+-----------------------+-----------------------+ b938a3c63b antn*1281 | ``rmcycle`` | periodic average | integer: cycle length | 6997d81055 gael*1282 | | subtraction | | 1283 +-----------------------+-----------------------+-----------------------+ b938a3c63b antn*

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 1285.

1284 | ``variaweight`` | use time-varying | — | 6997d81055 gael*1285 | | weight | | 1286 +-----------------------+-----------------------+-----------------------+ b938a3c63b antn*

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 1288.

1287 | ``noscaling`` | do not scale with | — | 7b8b86ab99 Timo*1288 | :math:`^{a}` | ``xx_gen*_weight`` | | 6997d81055 gael*1289 +-----------------------+-----------------------+-----------------------+ b938a3c63b antn*

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 1291.

1290 | ``documul`` | sets | — | 6997d81055 gael*1291 | | ``xx_gentim2d_cumsum``| | 1292 | | | | 1293 +-----------------------+-----------------------+-----------------------+ b938a3c63b antn*

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 1295.

1294 | ``doglomean`` | sets | — | 6997d81055 gael*1295 | | ``xx_gentim2d_glosum``| | 1296 | | | | 1297 +-----------------------+-----------------------+-----------------------+ 1298 7b8b86ab99 Timo*1299 1300 .. table:: ``xx_gen????d_preproc_c`` options implemented as of checkpoint 1301 67x. 1302 :name: genarr_preproc_c 1303 1304 +-----------------------+-----------------------+-----------------------+ 1305 | name | description | arguments | 1306 +=======================+=======================+=======================+ 1307 |``log10ctrl`` | Control adjustments to| See | b938a3c63b antn*1308 | | log10 of | :numref:`log_ctrl` | 7b8b86ab99 Timo*1309 | | 2D or 3D array | | 1310 | | (not available for | | 1311 | | ``xx_gentim2d``). | | 1312 +-----------------------+-----------------------+-----------------------+ 1313 6997d81055 gael*1314 The control problem is non-dimensional by default, as reflected in the 1315 omission of weights in control penalties [(:math:`\vec{u}_j^T\vec{u}_j` 1316 in :eq:`Jtotal`]. Non-dimensional controls 1317 (:math:`\vec{u}_j`) are scaled to physical units (:math:`\vec{v}_j`) 1318 through multiplication by the respective uncertainty fields 1319 (:math:`\sigma_{\vec{u}_j}`), as part of the generic preprocessor 1320 :math:`\mathcal{Q}` in :eq:`Upreproc`. Besides the 1321 scaling of :math:`\vec{u}_j` to physical units, the preprocessor 1322 :math:`\mathcal{Q}` can include, for example, spatial correlation b938a3c63b antn*1323 modeling (using an implementation of Weaver and Coutier, 2001 1324 :cite:`weaver:01`) by 6997d81055 gael*

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 1326.

1325 setting ``xx_gen*_preproc = ’WC01’``. Alternatively, setting

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 1327.

1326 ``xx_gen*_preproc = ’smooth’`` activates the smoothing part of ``WC01``, 1327 but omits the normalization. Additionally, bounds for the controls can 1328 be specified by setting ``xx_gen*_bounds``. In forward mode, adjustments 1329 to the :math:`i^\text{th}` control are clipped so that they remain b938a3c63b antn*1330 between ``xx_gen*_bounds(i,1)`` and ``xx_gen*_bounds(i,4)``. The bounds 1331 have no effect in adjoint mode unless ``xx_gen*_bounds(i,j)`` < 1332 ``xx_gen*_bounds(i,j+1)`` for :math:`j = 1, 3`. When this is the case,

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 1334.

1333 the bounds will “emulate a local minimum†as follows in 1334 :filelink:`pkg/ctrl/adctrl_bound.F`. On the minimum end, 1335 when ``xx_gen*(i)`` < ``xx_gen*_bounds(i,2)`` and the gradient 1336 ``adxx_gen*(i)`` > 0.0, i.e., the derivative suggests that a 1337 further decrease of ``xx_gen*(i)`` will decrease the cost, an adjustment 1338 is enforced to reverse the sign of the gradient ``adxx_gen*(i)`` to be 1339 negative such that any further decrease in ``xx_gen*(i)`` toward its minimum 1340 bound ``xx_gen*_bounds(i,1)`` will be penalized. The opposite is enforced 1341 at the maximum end when ``xx_gen*(i)`` > ``xx_gen*_bounds(i,3)`` 1342 and ``adxx_gen*(i)`` < 0.0 such that the sign of the gradient 1343 ``adxx_gen*(i)`` will be reversed to positive to penalize any further 1344 increase in ``xx_gen*(i)`` toward its maximum bound ``xx_gen*_bounds(i,4)``. 6997d81055 gael*1345 1346 For the case of time-varying controls, the frequency is specified by 13d362b8c1 Ou W*1347 :varlink:`xx_gentim2d_period`. The generic control package interprets special 1348 values of :varlink:`xx_gentim2d_period` in the same way as the ``exf`` package: 6997d81055 gael*1349 a value of :math:`-12` implies cycling monthly fields while a value of 1350 :math:`0` means that the field is steady. Time varying weights can be 1351 provided by specifying the preprocessor ``variaweight``, in which case 13d362b8c1 Ou W*1352 the :varlink:`xx_gentim2d_weight` file must contain as many records as the 6997d81055 gael*1353 control parameter time series itself (approximately the run length 13d362b8c1 Ou W*1354 divided by :varlink:`xx_gentim2d_period`). 6997d81055 gael*1355 1356 The parameter ``mult_gen*`` sets the multiplier for the corresponding 1357 cost function penalty [:math:`\beta_j` in :eq:`Jtotal`; 1358 :math:`\beta_j = 1` by default). The preconditioner, :math:`\cal{R}`, 1359 does not directly appear in the estimation problem, but only serves to 1360 push the optimization process in a certain direction in control space; 1361 this operator is specified by ``gen*Precond`` (:math:`=1` by default). 1362 13d362b8c1 Ou W*1363 Note that control parameters exist for each individual near surface atmospheric 1364 state variable, as well as the net heat and salt (EmPmR) fluxes. The user must 1365 be mindful of control parameter combinations that make sense according to their 1366 specific setup, e.g., with the :ref:`EXF package <ssub_phys_pkg_exf_config>`. df462307fb Timo*1367 b938a3c63b antn*1368 .. _gen_ctrl_rec: 1369 1370 Generic Control Record Access 1371 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1372 For each control variable ``$ctrlvar``, three pairs of ``.data`` files (and their 1373 corresponding ``.meta``) are required or produced per adjoint run: 1374 1375 :: 1376 1377 1a $ctrlvar.effective.$iternumber.data 1378 1b ad$ctrlvar.effective.$iternumber.data 1379 1380 2a $ctrlvar.tmp.$iternumber.data 1381 2b ad$ctrlvar.tmp.$iternumber.data 1382 1383 3a $ctrlvar.$iternumber.data 1384 3b ad$ctrlvar.$iternumber.data 1385 1386 Pair 1a,b are the physical fields with physical units. Pair 2a,b are temporary 1387 files storing a repeat cycle for use during calculations when 1388 :varlink:`docycle` and :varlink:`rmcycle` are active. Pair 3a,b have units or 1389 no units depending on the setting of :varlink:`noscaling`, which controls 1390 scaling/unscaling by the corresponding ``xx_gen*_weight`` (see 1391 :numref:`gencost_ctrl_preproc`). 1392 1393 In an adjoint run with the 2-D time-dependent controls (CPP-flag 1394 :varlink:`ALLOW_GENTIM2D_CONTROL` defined), three variables 1395 :varlink:`startrec`, :varlink:`endrec`, and :varlink:`diffrec` = 1396 :varlink:`endrec` - :varlink:`startrec` + 1 will be 1397 initialized as a function of the startdate (:varlink:`startdate_1`, 1398 :varlink:`startdate_2`) in ``data.cal``, the control variables startdates 1399 (:varlink:`xx_gentim2d_startdate1`, :varlink:`xx_gentim2d_startdate2`) in 1400 ``data.ctrl``, and the pickup time :varlink:`nIter0` in 1401 :filelink:`packages_init_fixed.F <model/src/packages_init_fixed.F>` (which 1402 calls :filelink:`ctrl_init.F <pkg/ctrl/ctrl_init.F>`, 1403 :filelink:`ctrl_init_rec.F <pkg/ctrl/ctrl_init_rec.F>`). These three variables 1404 are subsequently used to determine the record length of the three pairs (1--3) 1405 of the above files, in the order as follows: 1406 1407 - First the ``ad$ctrlvar.[effective,tmp,].$iternumber`` files (1b,2b,3b) above 1408 are initialized with zeros in 1409 :filelink:`packages_init_fixed.F <model/src/packages_init_fixed.F>`--> 1410 :filelink:`ctrl_init.F <pkg/ctrl/ctrl_init.F>`--> 1411 :filelink:`ctrl_init_ctrlvar.F <pkg/ctrl/ctrl_init_ctrlvar.F>` 1412 (with :varlink:`yadprefix` = ``'ad'``); 1b and 2b have size :varlink:`diffrec` 1413 and 3b has size :varlink:`endrec`. 1414 1415 .. parsed-literal :: 1416 1417 Flow of :filelink:`pkg/ctrl` when the adjoint is running (below, for $iternumber=0000000001): 1418 1419 Note: :filelink:`the_model_main.F <model/src/the_model_main.F>` calls :filelink:`the_main_loop.F <model/src/the_main_loop.F>`, but once the code is generated from TAF, 1420 the preprocessed form the_model_main.f calls either mdthe_main_loop or adthe_main_loop 1421 1422 :filelink:`the_model_main <model/src/the_model_main.F>` 1423 \|-:filelink:`initialise_fixed <model/src/initialise_fixed.F>` 1424 \|-:filelink:`ini_parms <model/src/ini_parms.F>` 1425 \|-:filelink:`packages_boot <model/src/packages_boot.F>`, :filelink:`packages_readparms <model/src/packages_readparms.F>` 1426 \|-:filelink:`set_parms <model/src/set_parms.F>`, :filelink:`ini_model_io <model/src/ini_model_io.F>`, :filelink:`ini_grid <model/src/ini_grid.F>`, :filelink:`load_ref_files <model/src/load_ref_files.F>`, :filelink:`ini_eos <model/src/ini_eos.F>`, :filelink:`set_ref_state <model/src/set_ref_state.F>`, 1427 :filelink:`set_grid_factors <model/src/set_grid_factors.F>`, :filelink:`ini_depths <model/src/ini_depths.F>`, :filelink:`ini_masks_etc <model/src/ini_masks_etc.F>` 1428 1429 \|-:filelink:`packages_init_fixed <model/src/packages_init_fixed.F>` 1430 \|-:filelink:`cal_init_fixed <pkg/cal/cal_init_fixed.F>`, :filelink:`diagnostics_init_early <pkg/diagnostics/diagnostics_init_early.F>`, :filelink:`diagnostics_main_init <pkg/diagnostics/diagnostics_main_init.F>`, :filelink:`gad_init_fixed <pkg/generic_advdiff/gad_init_fixed.F>`, 1431 :filelink:`mom_init_fixed <pkg/mom_common/mom_init_fixed.F>`, :filelink:`obcs_init_fixed <pkg/obcs/obcs_init_fixed.F>`, :filelink:`exf_init_fixed <pkg/exf/exf_init_fixed.F>`, :filelink:`kpp_init_fixed <pkg/kpp/kpp_init_fixed.F>`, :filelink:`gmredi_init_fixed <pkg/gmredi/gmredi_init_fixed.F>`, 1432 :filelink:`seaice_cost_init_fixed <pkg/seaice/seaice_cost_init_fixed.F>`, :filelink:`smooth_init_fixed <pkg/smooth/smooth_init_fixed.F>`, :filelink:`ecco_cost_init_fixed <pkg/ecco/ecco_cost_init_fixed.F>`, 1433 :filelink:`profiles_init_fixed <pkg/profiles/profiles_init_fixed.F>`, :filelink:`seaice_init_fixed <pkg/seaice/seaice_init_fixed.F>`, :filelink:`salt_plume_init_fixed <pkg/salt_plume/salt_plume_init_fixed.F>` 1434 1435 \|-:filelink:`ctrl_init <pkg/ctrl/ctrl_init.F>` 1436 \|-:filelink:`active_write_xyz <pkg/autodiff/active_file.F>`\ ('wunit') 1437 \|-:filelink:`ctrl_init_ctrlvar <pkg/ctrl/ctrl_init_ctrlvar.F>`\ (genarr2d, genarr3d) 1438 1439 \|-:filelink:`ctrl_init_rec <pkg/ctrl/ctrl_init_rec.F>`\ (gentim2d_startdate, diffrec, startrec, endrec) 1440 \|-:filelink:`ctrl_init_ctrlvar <pkg/ctrl/ctrl_init_ctrlvar.F>`\ (xx_atemp.effective.0000000001, 'c','xy') 1441 \|-:filelink:`ctrl_set_fname <pkg/ctrl/ctrl_set_fname.F>`\ (xx_fname,fname) 1442 **--> fname(1:3)=[,ad,hn]xx_atemp.effective.0000000001** 1443 \|-:filelink:`ctrl_set_globfld_xy <pkg/ctrl/ctrl_set_globfld_xy.F>`\ (fname(2)) (with yadprefix='ad') 1444 \|-:filelink:`mds_write_field <pkg/mdsio/mdsio_write_field.F>`\ (adxx_atemp.effective.0000000001) **<- size diffrec** 1445 \|-:filelink:`ctrl_init_ctrlvar <pkg/ctrl/ctrl_init_ctrlvar.F>`\ (xx_atemp.tmp.0000000001) 1446 \|-:filelink:`ctrl_set_fname <pkg/ctrl/ctrl_set_fname.F>`\(xx_fname,fname) 1447 **--> fname(1:3)=[,ad,hn]xx_atemp.tmp.0000000001** 1448 \|-:filelink:`ctrl_set_globfld_xy <pkg/ctrl/ctrl_set_globfld_xy.F>`\ (fname(2)) (with yadprefix='ad') 1449 \|-:filelink:`mds_write_field <pkg/mdsio/mdsio_write_field.F>`\ (adxx_atemp.tmp.0000000001) **<- size diffrec** 1450 \|-:filelink:`ctrl_init_ctrlvar <pkg/ctrl/ctrl_init_ctrlvar.F>`\ (xx_atemp.0000000001) 1451 \|-:filelink:`ctrl_set_fname <pkg/ctrl/ctrl_set_fname.F>`\(xx_fname,fname) 1452 **--> fname(1:3)=[,ad,hn]xx_atemp.0000000001** 1453 \|-:filelink:`ctrl_set_globfld_xy <pkg/ctrl/ctrl_set_globfld_xy.F>`\ (fname(2)) (with yadprefix='ad') 1454 \|-:filelink:`mds_write_field <pkg/mdsio/mdsio_write_field.F>`\ (adxx_atemp.0000000001) **<- size endrec** 1455 1456 - Second, within ``initiase_variamd.f`` (see below), records 1457 :varlink:`startrec` to :varlink:`endrec` of file 3a 1458 ``$ctrvar.$iternumber.data`` are read in :filelink:`ctrl_map_ini_gentim2d.F 1459 <pkg/ctrl/ctrl_map_ini_gentim2d.F>`, processed if scaling or smoothing, etc., 1460 need to be applied, and then written to (1a,2a) 1461 ``$ctrlvar.{effective,tmp}.data`` of size :varlink:`diffrec`. Note these 1462 routines contain a ``md`` or ``ad`` suffix and are produced by TAF, e.g., 1463 ``s/r ctrl_map_ini_gentim2dmd`` (found in TAF-generated file 1464 ``ctrl_map_ini_gentim2d_ad.f``) called from ``s/r initialize_variamd`` (found 1465 in TAF-generated file ``initialize_varia_ad.f``), which in turn is called 1466 from ``s/r adthe_main_loop`` (found in TAF-generated file 1467 ``the_main_loop_ad.f``); alternatively, all of these routines are found the 1468 concatenated file ``ad_taf_output.f``. 1469 1470 .. parsed-literal :: 1471 1472 \|-adthe_main_loop **only available in the_main_loop_ad.f, called from the_model_main.f** 1473 \|-adopen (many tapes, ocean variables, atmos, obcs, etc) **initialize tapelev grid, etc.** 1474 1475 \|-initialise_variamd 1476 \|-packages_init_variablesmd 1477 \|-:filelink:`diagnostics_init_varia <pkg/diagnostics/diagnostics_init_varia.F>`, :filelink:`kpp_init_varia <pkg/kpp/kpp_init_varia.F>`, :filelink:`exf_init_varia <pkg/exf/exf_init_varia.F>` **store salt,theta** 1478 \|-:filelink:`profiles_init_varia <pkg/profiles/profiles_init_varia.F>`, :filelink:`ecco_init_varia <pkg/ecco/ecco_init_varia.F>`, :filelink:`obcs_init_variables <pkg/obcs/obcs_init_variables.F>` **some done after ctrl** 1479 \|-ctrl_init_variablesmd 1480 \|-:filelink:`ctrl_map_ini_genarr <pkg/ctrl/ctrl_map_ini_genarr.F>` 1481 \|-:filelink:`ctrl_map_genarr2d <pkg/ctrl/ctrl_map_genarr.F>` **e.g., set etan,siheff ctrl** 1482 \|-:filelink:`ctrl_map_genarr3d <pkg/ctrl/ctrl_map_genarr.F>` **e.g., set logdiffkr ctrl** 1483 \|-ctrl_map_ini_gentim2dmd 1484 \|-:filelink:`ctrl_init_rec <pkg/ctrl/ctrl_init_rec.F>`\ (xx_atemp) 1485 **example here for atemp: [startrec,endrec,diffrec]=[24,37,14]** 1486 \|-:filelink:`active_read_xy <pkg/autodiff/active_file.F>`\ (fnamegenIn,lrec) 1487 **read in xx_atemp.0000000001.data from 24->37** 1488 \|-:filelink:`active_write_xy <pkg/autodiff/active_file.F>`\ (fnamegenOut,irec) 1489 **write out to xx_atemp.effective.0000000001.data from 1->14** 1490 \|-:filelink:`active_read_xy <pkg/autodiff/active_file.F>`\ (fnamegenOut,irec) 1491 **read in xx_atemp.effective.0000000001.data 1->14, do some math** 1492 \|-:filelink:`active_write_xy <pkg/autodiff/active_file.F>`\ (fnamegenTmp,irec) 1493 **write out to xx_atemp.tmp.0000000001.data 1->14** 1494 do irec=1,diffrec 1495 \|-:filelink:`active_read_xy <pkg/autodiff/active_file.F>`\ (fnamegenOut,irec) 1496 \|-:filelink:`mds_read_field <pkg/mdsio/mdsio_read_field.F>`\ (xx_gentim2d_weight,jrec) 1497 **if variaweight, jrec=lrec, else jrec=1** 1498 \|-:filelink:`smooth_correl2d <pkg/smooth/smooth_correl2d.F>` **or smooth2d** 1499 \|-xx_gen/sqrt(wgentim2d) **if doscaling** 1500 \|-exch_xy_rl 1501 \|-:filelink:`active_write_xy <pkg/autodiff/active_file.F>`\ (fnamegenOut,irec) 1502 **write out to xx_atemp.effective.0000000001.data (smooth/scaled)** 1503 enddo 1504 1505 The difference in length of records for 3[a,b] compared to 1[a,b] and 2[a,b] is 1506 due to the fact that we need to access records :varlink:`startrec` thru 1507 :varlink:`endrec` in 3a, i.e., file 3a needs a total of at least 1508 :varlink:`endrec` records; file 3b is automatically generated to provide access 1509 to :varlink:`endrec` thru :varlink:`startrec` (i.e., in reverse order). File 1510 3b, in particular, is where adjoint sensitivity will be accumulated backward 1511 and written; note the model would thus crash if its last record were 1512 :varlink:`diffrec` rather than :varlink:`endrec`. For pairs 1[a,b] and 2[a,b], 1513 because they are generated *after* we have already accessed the correct records 1514 :varlink:`startrec` to :varlink:`endrec` in 3a, we simply create and write out 1515 these records in the shorter file size :varlink:`diffrec`. After their file 1516 size initializations, the control adjustment field with physical unit from file 1517 1a is passed on to :filelink:`pkg/exf` for surface forcing application. 1518 1519 Note, that :varlink:`xx_gentim2d_startdate` can be used to control how many 1520 records the different :varlink:`xx_gentim2d` files 1521 contain. :numref:`xx_var_sketch` illustrates a few examples. 1522 1523 .. figure:: figs/ctrl_var_sketch.* 1524 :width: 100% 1525 :align: center 1526 :alt: xx_var_sketch 1527 :name: xx_var_sketch 1528 1529 Sketch illustrating which parts of the timeline are covered by which 1530 :varlink:`xx_gentim2d` files. 1531 7b8b86ab99 Timo*1532 .. _shi_ctrl: 1533 1534 Shelfice Control Parameters 1535 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1536 1537 The available iceshelf control parameters depend on the form of transfer 1538 coefficient used in the simulation. 1539 1540 The adjustments ``xx_shicoefft`` and ``xx_shicoeffs`` are available when the 1541 velocity **independent** form of transfer coefficients is used, by setting 1542 ``#undef`` :varlink:`SHI_ALLOW_GAMMAFRICT` 1543 in :filelink:`SHELFICE_OPTIONS.h <pkg/shelfice/SHELFICE_OPTIONS.h>` at 1544 compile time (see :numref:`tab_phys_pkg_shelfice_compileparms`) and 1545 :varlink:`SHELFICEuseGammaFrict` ``=.FALSE.`` in ``data.shelfice`` (see 1546 :numref:`tab_phys_pkg_shelfice_runtimeparms`). These parameters provide 1547 adjustments to :math:`\gamma_T` and/or :math:`\gamma_S` directly. If only one 1548 of either is used, the value of the other is set based on the control 1549 adjustments used together with :varlink:`SHELFICEsaltToHeatRatio`, which can be 1550 set in ``data.shelfice``. See :ref:`tab_phys_pkg_shelfice_runtimeparms` for 1551 the default. 1552 1553 The adjustment ``xx_shicdrag`` is available in the velocity **dependent** form 1554 of the ice-ocean transfer coefficients, which is specified by ``#define`` 1555 :varlink:`SHI_ALLOW_GAMMAFRICT` and :varlink:`SHELFICEuseGammaFrict` 1556 ``=.TRUE.`` at compile time and run time respectively. This parameter provides 1557 adjustments to the drag coefficient at the ice ocean boundary, but by default 1558 only adjusts the drag coefficient used to compute the thermal and freshwater 1559 fluxes, neglecting the momentum contributions. To allow the contribution 1560 directly to momentum fluxes, specify ``xx_genarr2d_preproc_c(*,iarr) = 'mom'`` 1561 in ``data.ctrl``. 1562 1563 .. _log_ctrl: 1564 1565 Logarithmic Control Parameters 1566 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1567 1568 As indicated in :numref:`genarr_preproc_c`, the base-10 logarithm of a 1569 control field can be adjusted by specifying the character option 1570 ``genarr*d_preproc_c(k2,iarr) = 'log10ctrl'``, with ``k2`` and ``iarr`` 1571 as appropriate, and ``*d`` denoting that ``2d`` or ``3d`` are available. 1572 As a concrete example, if the control parameter is updating ``fld2d``, 1573 then the field will be set as follows: 1574 1575 .. code-block:: fortran 1576 1577 fld2d(i,j,bi,bj) = 10**( log10InitVal + xx_genarr2d(i,j,bi,bj,iarr) ) 1578 1579 where ``log10InitVal`` is a scalar with a default value of 0, but can be changed 1580 by setting ``gencost_preproc_r(k2,iarr)``. This is useful in the case where 1581 ``doInitXX=.TRUE.``. 1582 Concretely, if we had an initial guess for ``fld2d = 10^-4`` then one could set 1583 the following in ``data.ctrl``: 1584 1585 :: 1586 1587 xx_genarr2d_file(1) = 'xx_fld2d' 1588 xx_genarr2d_weight(1) = 'nonzero_weights.data' 1589 xx_genarr2d_preproc_c(1,1) = 'log10ctrl' 1590 xx_genarr2d_preproc_r(1,1) = -4. , 1591 1592 Note that the ``log10ctrl`` option can only be used when a weight file 1593 is provided, and finally that this log-option cannot be used with 1594 ``xx_gen*_preproc(k2,iarr) = 'noscaling',``. 1595 1596 6997d81055 gael*1597 .. _sec:pkg:smooth: 1598 1599 SMOOTH: Smoothing And Covariance Model 1600 -------------------------------------- 1601 1602 Author: Gael Forget 1603 1604 TO BE CONTINUED... 1605 1606 .. _sectionoptim: 1607 1608 The line search optimisation algorithm 1609 -------------------------------------- 1610 1611 Author: Patrick Heimbach 1612 1613 General features 1614 ~~~~~~~~~~~~~~~~ 1615 1616 The line search algorithm is based on a quasi-Newton variable storage 1617 method which was implemented by :cite:`gil-lem:89`. 1618 1619 TO BE CONTINUED... 1620 1621 The online vs. offline version 1622 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1623 1624 - | **Online version** 1625 | Every call to *simul* refers to an execution of the forward and 1626 adjoint model. Several iterations of optimization may thus be 1627 performed within a single run of the main program (lsopt_top). The 1628 following cases may occur: 1629 1630 - cold start only (no optimization) 1631 1632 - cold start, followed by one or several iterations of optimization 1633 1634 - warm start from previous cold start with one or several iterations 1635 1636 - warm start from previous warm start with one or several iterations 1637 1638 - | **Offline version** 1639 | Every call to simul refers to a read procedure which reads the 1640 result of a forward and adjoint run Therefore, only one call to 1641 simul is allowed, itmax = 0, for cold start itmax = 1, for warm 1642 start Also, at the end, **x(i+1)** needs to be computed and saved 1643 to be available for the offline model and adjoint run 1644 1645 In order to achieve minimum difference between the online and offline 1646 code **xdiff(i+1)** is stored to file at the end of an (offline) 1647 iteration, but recomputed identically at the beginning of the next 1648 iteration. 1649 1650 Number of iterations vs. number of simulations 1651 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1652 1653 | - itmax: controls the max. number of iterations 1654 | - nfunc: controls the max. number of simulations within one iteration 1655 1656 Summary 1657 ^^^^^^^ 1658 1659 |   1660 | From one iteration to the next the descent direction changes. Within 1661 one iteration more than one forward and adjoint run may be performed. 1662 The updated control used as input for these simulations uses the same 1663 descent direction, but different step sizes. 1664 1665 Description 1666 ^^^^^^^^^^^ 1667 1668 |   1669 | From one iteration to the next the descent direction dd changes using 1670 the result for the adjoint vector gg of the previous iteration. In 1671 lsline the updated control 1672 1673 .. math:: 1674 1675 \tt 1676 xdiff(i,1) = xx(i-1) + tact(i-1,1)*dd(i-1) 1677 1678 serves as input for a forward and adjoint model run yielding a new 1679 gg(i,1). In general, the new solution passes the 1st and 2nd Wolfe 1680 tests so xdiff(i,1) represents the solution sought: 1681 1682 .. math:: {\tt xx(i) = xdiff(i,1)} 1683 1684 If one of the two tests fails, an inter- or extrapolation is invoked 1685 to determine a new step size tact(i-1,2). If more than one function 1686 call is permitted, the new step size is used together with the "old" 1687 descent direction dd(i-1) (i.e. dd is not updated using the new 1688 gg(i)), to compute a new 1689 1690 .. math:: {\tt xdiff(i,2) = xx(i-1) + tact(i-1,2)*dd(i-1)} 1691 1692 that serves as input in a new forward and adjoint run, yielding 1693 gg(i,2). If now, both Wolfe tests are successful, the updated solution 1694 is given by 1695 1696 .. math:: 1697 1698 \tt 1699 xx(i) = xdiff(i,2) = xx(i-1) + tact(i-1,2)*dd(i-1) 1700 1701 In order to save memory both the fields dd and xdiff have a double 1702 usage. 1703 1704 - |   1705 | - in *lsopt_top*: used as x(i) - x(i-1) for Hessian update 1706 | - in *lsline*: intermediate result for control update x = x + 1707 tact*dd 1708 1709 - |   1710 | - in *lsopt_top, lsline*: descent vector, dd = -gg and hessupd 1711 | - in *dgscale*: intermediate result to compute new preconditioner 1712 1713 The parameter file lsopt.par 1714 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1715 1716 - **NUPDATE** max. no. of update pairs (gg(i)-gg(i-1), xx(i)-xx(i-1)) 1717 to be stored in OPWARMD to estimate Hessian [pair of current iter. is 1718 stored in (2*jmax+2, 2*jmax+3) jmax must be > 0 to access these 1719 entries] Presently NUPDATE must be > 0 (i.e. iteration without 1720 reference to previous iterations through OPWARMD has not been tested) 1721 1722 - **EPSX** relative precision on xx bellow which xx should not be 1723 improved 1724 1725 - **EPSG** relative precision on gg below which optimization is 1726 considered successful 1727 1728 - **IPRINT** controls verbose (>=1) or non-verbose output 1729 1730 - **NUMITER** max. number of iterations of optimisation; NUMTER = 0: 1731 cold start only, no optimization 1732 1733 - **ITER_NUM** index of new restart file to be created (not necessarily 1734 = NUMITER!) 1735 1736 - **NFUNC** max. no. of simulations per iteration (must be > 0); is 1737 used if step size tact is inter-/extrapolated; in this case, if NFUNC 1738 > 1, a new simulation is performed with same gradient but "improved" 1739 step size 1740 1741 - **FMIN** first guess cost function value (only used as long as first 1742 iteration not completed, i.e. for jmax <= 0) 1743 1744 OPWARMI, OPWARMD files 1745 ^^^^^^^^^^^^^^^^^^^^^^ 1746 1747 Two files retain values of previous iterations which are used in latest 1748 iteration to update Hessian: 1749 1750 - **OPWARMI**: contains index settings and scalar variables 1751 1752 +-------------+-------------------------------------------------------+ 1753 | n = nn | no. of control variables | 1754 +-------------+-------------------------------------------------------+ 1755 | fc = ff | cost value of last iteration | 1756 +-------------+-------------------------------------------------------+ 1757 | isize | no. of bytes per record in OPWARMD | 1758 +-------------+-------------------------------------------------------+ 1759 | m = nupdate | max. no. of updates for Hessian | 1760 +-------------+-------------------------------------------------------+ 1761 | jmin, jmax | pointer indices for OPWARMD file (cf. below) | 1762 +-------------+-------------------------------------------------------+ 1763 | gnorm0 | norm of first (cold start) gradient gg | 1764 +-------------+-------------------------------------------------------+ 1765 | iabsiter | total number of iterations with respect to cold start | 1766 +-------------+-------------------------------------------------------+ 1767 1768 - **OPWARMD**: contains vectors (control and gradient) 1769 1770 +-----------------------+-----------------------+-----------------------+ 1771 | entry | name | description | 1772 +=======================+=======================+=======================+ 1773 | 1 | xx(i) | control vector of | 1774 | | | latest iteration | 1775 +-----------------------+-----------------------+-----------------------+ 1776 | 2 | gg(i) | gradient of latest | 1777 | | | iteration | 1778 +-----------------------+-----------------------+-----------------------+ 1779 | 3 | xdiff(i),diag | preconditioning | 1780 | | | vector; (1,...,1) for | 1781 | | | cold start | 1782 +-----------------------+-----------------------+-----------------------+ 1783 | 2*jmax+2 | gold=g(i)-g(i-1) | for last update | 1784 | | | (jmax) | 1785 +-----------------------+-----------------------+-----------------------+ 1786 | 2*jmax+3 | xdiff=tact*d=xx(i)-xx | for last update | 1787 | | (i-1) | (jmax) | 1788 +-----------------------+-----------------------+-----------------------+ 1789 1790 :: 1791 1792 1793 Example 1: jmin = 1, jmax = 3, mupd = 5 1794 1795 1 2 3 | 4 5 6 7 8 9 empty empty 1796 |___|___|___| | |___|___| |___|___| |___|___| |___|___| |___|___| 1797 0 | 1 2 3 1798 1799 Example 2: jmin = 3, jmax = 7, mupd = 5 ---> jmax = 2 1800 32ce3e9e96 Mart*1801 1 2 3 | 6997d81055 gael*1802 |___|___|___| | |___|___| |___|___| |___|___| |___|___| |___|___| 1803 | 6 7 3 4 5 1804 1805 Error handling 1806 ^^^^^^^^^^^^^^ 1807 1808 :: 1809 1810 lsopt_top 1811 | 1812 |---- check arguments 1813 |---- CALL INSTORE 1814 | | 1815 | |---- determine whether OPWARMI available: 1816 | * if no: cold start: create OPWARMI 1817 | * if yes: warm start: read from OPWARMI 1818 | create or open OPWARMD 1819 | 1820 |---- check consistency between OPWARMI and model parameters 32ce3e9e96 Mart*1821 | 6997d81055 gael*1822 |---- >>> if COLD start: <<< 1823 | | first simulation with f.g. xx_0; output: first ff_0, gg_0 1824 | | set first preconditioner value xdiff_0 to 1 1825 | | store xx(0), gg(0), xdiff(0) to OPWARMD (first 3 entries) 1826 | | 1827 | >>> else: WARM start: <<< 1828 | read xx(i), gg(i) from OPWARMD (first 2 entries) 1829 | for first warm start after cold start, i=0 1830 | 1831 | 1832 | 1833 |---- /// if ITMAX > 0: perform optimization (increment loop index i) 1834 | ( 1835 | )---- save current values of gg(i-1) -> gold(i-1), ff -> fold(i-1) 1836 | (---- CALL LSUPDXX 1837 | ) | 1838 | ( |---- >>> if jmax=0 <<< 1839 | ) | | first optimization after cold start: 1840 | ( | | preconditioner estimated via ff_0 - ff_(first guess) 1841 | ) | | dd(i-1) = -gg(i-1)*preco 32ce3e9e96 Mart*1842 | ( | | 6997d81055 gael*1843 | ) | >>> if jmax > 0 <<< 1844 | ( | dd(i-1) = -gg(i-1) 1845 | ) | CALL HESSUPD 1846 | ( | | 1847 | ) | |---- dd(i-1) modified via Hessian approx. 1848 | ( | 1849 | ) |---- >>> if <dd,gg> >= 0 <<< 1850 | ( | ifail = 4 1851 | ) | 1852 | ( |---- compute step size: tact(i-1) 1853 | ) |---- compute update: xdiff(i) = xx(i-1) + tact(i-1)*dd(i-1) 1854 | ( 1855 | )---- >>> if ifail = 4 <<< 1856 | ( goto 1000 1857 | ) 1858 | (---- CALL OPTLINE / LSLINE 1859 | ) | 1860 ... ... ... 1861 1862 :: 1863 1864 ... ... 1865 | ) 1866 | (---- CALL OPTLINE / LSLINE 1867 | ) | 1868 | ( |---- /// loop over simulations 32ce3e9e96 Mart*1869 | ) ( 6997d81055 gael*1870 | ( )---- CALL SIMUL 1871 | ) ( | 1872 | ( ) |---- input: xdiff(i) 1873 | ) ( |---- output: ff(i), gg(i) 1874 | ( ) |---- >>> if ONLINE <<< 1875 | ) ( runs model and adjoint 1876 | ( ) >>> if OFFLINE <<< 1877 | ) ( reads those values from file 1878 | ( ) 1879 | ) (---- 1st Wolfe test: 1880 | ( ) ff(i) <= tact*xpara1*<gg(i-1),dd(i-1)> 1881 | ) ( 1882 | ( )---- 2nd Wolfe test: 1883 | ) ( <gg(i),dd(i-1)> >= xpara2*<gg(i-1),dd(i-1)> 1884 | ( ) 1885 | ) (---- >>> if 1st and 2nd Wolfe tests ok <<< 1886 | ( ) | 320: update xx: xx(i) = xdiff(i) 1887 | ) ( | 1888 | ( ) >>> else if 1st Wolfe test not ok <<< 1889 | ) ( | 500: INTERpolate new tact: 1890 | ( ) | barr*tact < tact < (1-barr)*tact 1891 | ) ( | CALL CUBIC 1892 | ( ) | 1893 | ) ( >>> else if 2nd Wolfe test not ok <<< 1894 | ( ) 350: EXTRApolate new tact: 1895 | ) ( (1+barmin)*tact < tact < 10*tact 1896 | ( ) CALL CUBIC 1897 | ) ( 1898 | ( )---- >>> if new tact > tmax <<< 1899 | ) ( | ifail = 7 1900 | ( ) | 1901 | ) (---- >>> if new tact < tmin OR tact*dd < machine precision <<< 1902 | ( ) | ifail = 8 1903 | ) ( | 1904 | ( )---- >>> else <<< 1905 | ) ( update xdiff for new simulation 1906 | ( ) 1907 | ) \\\ if nfunc > 1: use inter-/extrapolated tact and xdiff 1908 | ( for new simulation 1909 | ) N.B.: new xx is thus not based on new gg, but 1910 | ( rather on new step size tact 32ce3e9e96 Mart*1911 | ) 6997d81055 gael*1912 | (---- store new values xx(i), gg(i) to OPWARMD (first 2 entries) 1913 | )---- >>> if ifail = 7,8,9 <<< 1914 | ( goto 1000 1915 | ) 1916 ... ... 1917 1918 :: 1919 1920 ... ... 32ce3e9e96 Mart*1921 | ) 6997d81055 gael*1922 | (---- store new values xx(i), gg(i) to OPWARMD (first 2 entries) 1923 | )---- >>> if ifail = 7,8,9 <<< 1924 | ( goto 1000 1925 | ) 1926 | (---- compute new pointers jmin, jmax to include latest values 1927 | ) gg(i)-gg(i-1), xx(i)-xx(i-1) to Hessian matrix estimate 1928 | (---- store gg(i)-gg(i-1), xx(i)-xx(i-1) to OPWARMD 1929 | ) (entries 2*jmax+2, 2*jmax+3) 1930 | ( 1931 | )---- CALL DGSCALE 1932 | ( | 1933 | ) |---- call dostore 1934 | ( | | 1935 | ) | |---- read preconditioner of previous iteration diag(i-1) 1936 | ( | from OPWARMD (3rd entry) 1937 | ) | 1938 | ( |---- compute new preconditioner diag(i), based upon diag(i-1), 1939 | ) | gg(i)-gg(i-1), xx(i)-xx(i-1) 1940 | ( | 1941 | ) |---- call dostore 1942 | ( | 1943 | ) |---- write new preconditioner diag(i) to OPWARMD (3rd entry) 1944 | ( 1945 |---- \\\ end of optimization iteration loop 1946 | 1947 | 1948 | 1949 |---- CALL OUTSTORE 1950 | | 1951 | |---- store gnorm0, ff(i), current pointers jmin, jmax, iterabs to OPWARMI 1952 | 1953 |---- >>> if OFFLINE version <<< 1954 | xx(i+1) needs to be computed as input for offline optimization 1955 | | 1956 | |---- CALL LSUPDXX 1957 | | | 1958 | | |---- compute dd(i), tact(i) -> xdiff(i+1) = x(i) + tact(i)*dd(i) 1959 | | 1960 | |---- CALL WRITE_CONTROL 1961 | | | 1962 | | |---- write xdiff(i+1) to special file for offline optim. 1963 | 1964 |---- print final information 1965 | 1966 O 1967 1968 .. [1] 1969 ecco_check may be missing a test for conflicting names... 1970 1971 .. [2] 1972 The quadratic option in fact does not yet exist in 1973 ``cost_gencost_boxmean.F``... 1974 1e31f50494 Mart*1975 1976 .. _subsectionoptimm1qn3: 1977 1978 Alternative code to :filelink:`optim` and :filelink:`lsopt` 1979 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1980 1981 The non-MITgcm package `optim_m1qn3 1982 <https://github.com/mjlosch/optim_m1qn3>`_ is based on the same 1983 quasi-Newton variable storage method (BFGS) :cite:`gil-lem:89` as the 1984 package in subdirectory ``lsopt``, but it uses a reverse communication 1985 version of the latest (and probably last) release of the subroutine 1986 `m1qn3 1987 <https://who.rocq.inria.fr/Jean-Charles.Gilbert/modulopt/optimization-routines/m1qn3/m1qn3.html>`_. 1988 This avoids having to define a dummy subroutine ``simul`` and also 1989 simplifies the code structure. As a consequence this package is 1990 simple(r) to compile and use, because ``m1qn3.f`` contains all necessary 1991 subroutines and only one extra routine (``ddot``, which was copied 1992 from `BLAS <http://www.netlib.org/blas/>`_) is required. 1993 1994 The principle of reverse communication is outlined in this example:: 1995 1996 external simul_rc 1997 ... 1998 reverse = .true. 1999 do while (.true.) 2000 call m1qn3 (simul_rc,...,x,f,g,...,reverse,indic,...) 2001 if (reverse) break 2002 call simul (indic,n,x,f,g) 2003 end while 2004 42e9685482 Mart*2005 ``simul_rc`` is an empty ''model simulator'', and ``simul`` generates a 1e31f50494 Mart*2006 new state based on the value of ``indic``. 2007 2008 The original ``m1qn3`` has been modified to work "offline", i.e. the 2009 simulator and the driver of ``m1qn3_offline`` are separate programs 2010 that are called alternatingly from a (shell-)script. This requires 2011 that the "state" of ``m1qn3`` is saved before this program 2012 terminates. This state is saved in a single file ``OPWARM.optXXX`` per 2013 simulation, where ``XXX`` is the simulation number. Communication with 2014 the routine, writing and restoring the state of ``m1qn3`` is achieved 2015 via three new common-blocks that are contained in three header 2016 files. ``simul`` is replaced by reading and storing the model state 2017 and gradient vectors. Schematically the driver routine ``optim_sub`` 2018 does the following: :: 2019 2020 external simul_rc 2021 ... 2022 2023 call optim_readdata( nn, ctrlname, ..., xx ) ! read control vector 2024 call optim_readdata( nn, costname, ..., adxx ) ! read gradient vector 2025 call optim_store_m1qn3( ..., .false. ) ! read state of m1qn3 2026 reverse = .true. 2027 call m1qn3 (simul_rc,...,xx,objf,adxx,...,reverse,indic,...) 2028 call optim_store_m1qn3( ..., .true. ) ! write state of m1qn3 2029 call optim_writedata( nn, ctrlname, ..., xx ) ! write control vector 32ce3e9e96 Mart*2030 1e31f50494 Mart*2031 The optimization loop is executed outside of this program within a script. 2032 13d362b8c1 Ou W*2033 The code can be obtained at https://github.com/mjlosch/optim_m1qn3. The `README 2034 <https://github.com/mjlosch/optim_m1qn3/blob/master/README.md>`__ contains 2035 short instructions how to build and use the code in combination with the 2036 :filelink:`verification/tutorial_global_oce_optim` experiment. The usage is 2037 very similar to the :filelink:`optim` package. 1e31f50494 Mart*2038 3220fe4136 gael*2039 .. _sec:exp:llc: 2040 2041 ae0678bf0e gael*2042 Test Cases For Estimation Package Capabilities 2043 ---------------------------------------------- 3220fe4136 gael*2044 d5e41ea118 Jeff*2045 First, if you have not done so already, download the model as explained 2046 in :ref:`chap_getting_started` via the `MITgcm git repository <https://github.com/MITgcm/MITgcm>`_: :: 3220fe4136 gael*2047 d5e41ea118 Jeff*2048 % git clone https://github.com/MITgcm/MITgcm.git 3220fe4136 gael*2049 d5e41ea118 Jeff*2050 Then, download the setup from the `MITgcm 2051 verification_other git repository <https://github.com/MITgcm/verification_other>`_: :: 3220fe4136 gael*2052 d5e41ea118 Jeff*2053 % cd MITgcm 2054 % git clone https://github.com/MITgcm/verification_other 3220fe4136 gael*2055 d5e41ea118 Jeff*2056 and follow the additional directions provided for `global_oce_cs32 2057 <https://github.com/MITgcm/verification_other/tree/master/global_oce_cs32>`_ 2058 or for `global_oce_llc90 2059 <https://github.com/MITgcm/verification_other/tree/master/global_oce_llc90>`_. 13d362b8c1 Ou W*2060 These model configurations are used for daily regression tests to ensure 2061 continued availability of the tested estimation package features discussed in 2062 :ref:`chap_state_estimation`. Daily results of these tests, which currently d5e41ea118 Jeff*2063 run on the `glacier` cluster, are reported on https://mitgcm.org/testing-summary. 2064 To this end, one sets a `crontab 13d362b8c1 Ou W*2065 job <https://www.computerhope.com/unix/ucrontab.htm>`__ that typically executes 2066 the script reported below. The various commands can also be used to run these d5e41ea118 Jeff*2067 examples outside of crontab, directly at the command line via the :ref:`testreport 2068 capability <testreport_utility>`. 3220fe4136 gael*2069 2070 .. note:: 2071 d5e41ea118 Jeff*2072 Users are advised against running `global_oce_llc90 2073 <https://github.com/MITgcm/verification_other/tree/master/global_oce_llc90>`_ 2074 tests with fewer than 12 cores (96 for adjoint tests) to avoid potential memory 2075 overloads. `global_oce_llc90 2076 <https://github.com/MITgcm/verification_other/tree/master/global_oce_llc90>`_ 13d362b8c1 Ou W*2077 (595M) uses the same LLC90 grid as the production `ECCO version 4` setup d5e41ea118 Jeff*2078 :cite:`for-eta:15`. The much coarser resolution `global_oce_cs32 2079 <https://github.com/MITgcm/verification_other/tree/master/global_oce_cs32>`_ 13d362b8c1 Ou W*2080 (614M) uses the CS32 grid and can run on any modern laptop. 3220fe4136 gael*2081 2082 :: 2083 2084 % #!/bin/csh -f 2085 % setenv PATH ~/bin:$PATH 2086 % setenv MODULESHOME /usr/share/Modules 2087 % source /usr/share/Modules/init/csh 2088 % module use /usr/share/Modules 2089 % module load openmpi-x86_64 2090 % setenv MPI_INC_DIR $MPI_INCLUDE 32ce3e9e96 Mart*2091 % 3220fe4136 gael*2092 % cd ~/MITgcm 2093 % #mkdir gitpull.log 2094 % set D=`date +%Y-%m-%d` 2095 % git pull -v > gitpull.log/gitpull.$D.log 2096 % 2097 % cd verification 2098 % 2099 % #ieee case: 2100 % ./testreport -clean -t 'global_oce_*' ae0678bf0e gael*2101 % ./testreport -of=../tools/build_options/linux_amd64_gfortran -MPI 24 -t 'global_oce_*' -addr username@something.whatever 2102 % ../tools/do_tst_2+2 -t 'global_oce_*' -mpi -exe 'mpirun -np 24 ./mitgcmuv' -a username@something.whatever 3220fe4136 gael*2103 % 2104 % #devel case: 2105 % ./testreport -clean -t 'global_oce_*' ae0678bf0e gael*2106 % ./testreport -of=../tools/build_options/linux_amd64_gfortran -MPI 24 -devel -t 'global_oce_*' -addr username@something.whatever 2107 % ../tools/do_tst_2+2 -t 'global_oce_*' -mpi -exe 'mpirun -np 24 ./mitgcmuv' -a username@something.whatever 3220fe4136 gael*2108 % 2109 % #fast case: 2110 % ./testreport -clean -t 'global_oce_*' ae0678bf0e gael*2111 % ./testreport -of=../tools/build_options/linux_amd64_gfortran -MPI 24 -t 'global_oce_*' -fast -addr username@something.whatever 2112 % ../tools/do_tst_2+2 -t 'global_oce_*' -mpi -exe 'mpirun -np 24 ./mitgcmuv' -a username@something.whatever 3220fe4136 gael*2113 % 2114 % #adjoint case: 2115 % ./testreport -clean -t 'global_oce_*' ae0678bf0e gael*2116 % ./testreport -of=../tools/build_options/linux_amd64_gfortran -MPI 24 -ad -t 'global_oce_*' -addr username@something.whatever