Home Contact Us Site Map  
 
       
    next up previous contents
Next: 3.18.3 Code Configuration Up: 3.18 Global Ocean State Previous: 3.18.1 Overview   Contents

Subsections

3.18.2 Implementation of the control variable and the cost function

One of the goal of this tutorial is to illustrate how to implement a new control variable. Most of this is fairly generic and is done in the ctrl and cost packages found in the pkg/ directory. The modifications can be tracked by the CPP option ALLOW_HFLUXM_CONTROL or the comment cHFLUXM_CONTROL. The more specific modifications required for the experiment are found in verification/tutorial_global_oce_optim/code_ad. Here follows a brief description of the implementation.

3.18.2.1 The control variable

The adjustment $ Q_\mathrm{netm}$ is activated by setting ALLOW_HFLUXM_CONTROL to "define" in ECCO_OPTIONS.h.

It is first implemented as a ``normal'' forcing variable. It is defined in FFIELDS.h, initialized to zero in ini_forcing.F, and then used in external_forcing_surf.F. $ Q_\mathrm{netm}$ is made a control variable in the ctrl package by modifying the following subroutines:

  • ctrl_init.F where $ Q_\mathrm{netm}$ is defined as the control variable number 24,

  • ctrl_pack.F which writes, at the end of each iteration, the sensitivity of the cost function $ \partial J/\partial Q_\mathrm{netm}$ in to a file to be used by the line-search algorithm,

  • ctrl_unpack.F which reads, at the start of each iteration, the updated adjustment as provided by the line-search algorithm,

  • ctrl_map_forcing.F in which the updated adjustment is added to the first guess $ Q_\mathrm{netm}$ .

Note also some minor changes in ctrl.h, ctrl_readparams.F, and ctrl_dummy.h (xx_hfluxm_file, fname_hfluxm, xx_hfluxm_dummy).

3.18.2.2 Cost functions

The cost functions are implemented using the cost package.

  • The temperature cost function $ J_1$ which measures the drift of the mean model temperature from the Levitus climatology is implemented in cost_temp.F. It is activated by ALLOW_COST_TEMP in ECCO_OPTIONS.h. It requires the mean temperature of the model which is obtained by accumulating the temperature in cost_tile.F (called at each time step). The value of the cost function is stored in objf_temp and its weight $ \lambda_1$ in mult_temp.

  • The heat flux cost function, penalizing the departure of the surface heat flux from observations is implemented in cost_hflux.F, and activated by the key ALLOW_COST_HFLUXM in ECCO_OPTIONS.h. The value of the cost function is stored in objf_hfluxm and its weight $ \lambda_2$ in mult_hfluxm.

  • The subroutine cost_final.F calls the cost_functions subroutines and make the (weighted) sum of the various contributions.

  • The various weights used in the cost functions are read in cost_weights.F. The weight of the cost functions are read in cost_readparams.F from the input file data.cost.


next up previous contents
Next: 3.18.3 Code Configuration Up: 3.18 Global Ocean State Previous: 3.18.1 Overview   Contents
mitgcm-support@mitgcm.org
Copyright © 2006 Massachusetts Institute of Technology Last update 2018-01-23