!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer, 
!                     version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms 
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer 
!version 3 or (at your option) any later version that should be found at: 
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html 
!
!This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
!without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
!See the above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software; 
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec), 
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------
#if defined (DOC)
*
***comdeck v4dj.cdk
*
*revision
* v2_10 - Tanguay M.        - initial MPI version
* v2_31 - Tanguay M.        - adapt for tracers in tr3d  
* v3_03 - Tanguay M.        - Adjoint NoHyd configuration
*______________________________________________________________________
*                                                                      |
* VARIABLES ASSOCIATED to 4D-Var: COST FUNCTION section                |
*______________________________________________________________________|
*                    |                                                 |
* NAME               | DESCRIPTION                                     |
*--------------------|-------------------------------------------------|
* V4dj_jb            | Cost JB (if 1) Cost JA (if 0)                   |
* V4dj_kdcst         | Kind of cost function (Energy=2)                |
* V4dj_locob         | Set type of obs. location (Full=100)            |
* V4dj_uvwt          | Weight for winds in cost J                      |
* V4dj_tpwt          | Weight for temp. in cost J                      |
* V4dj_spwt          | Weight for surf. press. in cost J               |
* V4dj_fipwt         | Weight for phi' in cost J                       |
* V4dj_trwt          | Weight for tracer 3D    in cost J               |
* V4dj_invarea       | Inverse of total area                           |
* V4dj_pj            | Intermediate value of cost J                    |
* V4dj_thickx        | Linked to integral over x scalar grid           |
* V4dj_thickxu       | Linked to integral over x u wind grid           |
* V4dj_thicky        | Linked to integral over y scalar grid           |
* V4dj_thickyv       | Linked to integral over y v wind grid           |
* V4dj_thickz        | Linked to integral over z grid                  |
* V4dj_mask_L        | Read mask on stdfile if .T.                     |
*--------------------|-------------------------------------------------|
*
#endif
*
*     ---------------------
*     COST FUNCTION section 
*     ---------------------
*
      integer V4dj_jb, V4dj_kdcst, V4dj_locob
*
      MARK_COMMON_BEG (V4d_jcst_i)
      common / V4d_jcst_i / V4dj_jb, V4dj_kdcst, V4dj_locob
      MARK_COMMON_END (V4d_jcst_i)
*
      real V4dj_uvwt,V4dj_tpwt,V4dj_spwt,V4dj_trwt(MAXTR3D),V4dj_fipwt,
     %     V4dj_invarea,V4dj_pj
      real V4dj_thickx (*),V4dj_thickxu(*),V4dj_thicky (*),V4dj_thickyv(*),
     %     V4dj_thickz (*)
      pointer (V4dj_thickx_  , V4dj_thickx  ),
     %        (V4dj_thickxu_ , V4dj_thickxu ),
     %        (V4dj_thicky_  , V4dj_thicky  ),
     %        (V4dj_thickyv_ , V4dj_thickyv ),
     %        (V4dj_thickz_  , V4dj_thickz  )
*
      MARK_COMMON_BEG (V4d_jcst_r)
      common / V4d_jcst_r / V4dj_uvwt,V4dj_tpwt,V4dj_spwt,V4dj_trwt,V4dj_fipwt, 
     %                      V4dj_invarea,V4dj_pj
      common / V4d_jcst_p / V4dj_thickx_,V4dj_thickxu_,V4dj_thicky_,
     %                      V4dj_thickyv_,V4dj_thickz_
      MARK_COMMON_END (V4d_jcst_r)
*
      logical V4dj_mask_L
*
      MARK_COMMON_BEG (V4d_jcst_l)
      common / V4d_jcst_l / V4dj_mask_L 
      MARK_COMMON_END (V4d_jcst_l)