!-------------------------------------- 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 --------------------------------------
***s/r hdif_phy_tl - TLM of hdif_phy 
*
#include "model_macros_f.h"
*

      subroutine hdif_phy_tl () 1,11
*
      implicit none
*
*author M.Tanguay
*
*revision
* v3_03 - Tanguay M.        - initial MPI version
* v3_20 - Tanguay M.        - Remove V4dg_oktrtl_L
* v3_30 - Tanguay M.        - adapt to bcs
* v3_31 - Tanguay M.        - add rwnd_L 
* v3_31 - Tanguay M.        - Control BC  
*
*object
*     see id section
*
*arguments
*
*implicits
#include "glb_ld.cdk"
#include "schm.cdk"
#include "lctl.cdk"
#include "v4dg.cdk"
#include "ifd.cdk"
#include "hspng.cdk"
*
         if (Hspng_nj.ge.1) call gem_stop ('HSNPG TL-AD not up to date',-1)
*
*        Physics timestep & Horizontal diffusion & Vertical sponge
*        ---------------------------------------------------------
*
         if (Schm_hdlast_L) then
*
            if ( Schm_phyms_L ) call p_main_tl (Lctl_step)
*
*           Recover TRAJ PIPT1,QPT1M (No Hyd) before HZD diffusion
*           ------------------------------------------------------
            call v4d_rwtraj (2) 
*
            call   hzd_main_tl ()
            call vspng_main_tl ()
*
         else
*
*           Recover TRAJ PIPT1,QPT1M (No Hyd) before HZD diffusion
*           ------------------------------------------------------
            call v4d_rwtraj (2) 
*
            call   hzd_main_tl ()
            call vspng_main_tl ()
*
            if ( Schm_phyms_L ) call p_main_tl (Lctl_step)
*
         endif
*
      if (G_lam .and. ifd_ftype.ne.'BMF') then
* Update Lateral BCs with data that has seen physics
          call nest_update
* Impose Lateral BCs within Pil regions
          call v4d_nest_bcs
      endif
*
      return
      end