!-------------------------------------- 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 hzd_bfct_1d - Same as hzd_bfct for 1d diffusion
*                    (based on HZD_BFCT, A.Qaddouri)
*
#include "model_macros_f.h"
*

      subroutine hzd_bfct_1d (F_a_8,F_b_8,F_c_8,F_deltainv_8,F_pwr,gni,nx3) 1,2
*
#include "impnone.cdk"
*
      integer F_pwr,gni,nx3
      real*8    F_a_8(1:F_pwr,1:F_pwr,1:gni,nx3),
     $          F_c_8(1:F_pwr,1:F_pwr,1:gni,nx3),
     $          F_b_8(1:F_pwr,1:F_pwr,1:gni,nx3),
     $   F_deltainv_8(1:F_pwr,1:F_pwr,1:gni,nx3)
*
*Author
*     M.Tanguay
*
*revision
* v3_20 - Tanguay M.       - initial version
*
*object
*     see id section
*
*arguments
*
*  Name        I/O        Description
*----------------------------------------------------------------
*  F_deltainv_8    0      diagonal(block) part of LU     
*----------------------------------------------------------------
*
#include "glb_ld.cdk"
#include "glb_pil.cdk"
**
      integer i,j,o1,o2,l_pil_w,l_pil_e
      real*8 wrk_8  (1:F_pwr,1:F_pwr)
      real*8 delta_8(1:F_pwr,1:F_pwr,1:gni,nx3)
*
*     __________________________________________________________________
*
*  The I vector lies on the Y processor so, l_pil_w and l_pil_e will
*  represent the pilot region along I
*
      l_pil_w=0
      l_pil_e=0
      if (l_south) l_pil_w= Lam_pil_w
      if (l_north) l_pil_e= Lam_pil_e
*
* factorization
*
      j = 1+Lam_pil_s
      do i = 1,gni
         do o1 = 1,F_pwr
         do o2 = 1,F_pwr
              delta_8(o1,o2,i,j)=F_b_8(o1,o2,i,j)
            enddo
         enddo
         call inverse(F_deltainv_8(1,1,i,j),delta_8(1,1,i,j),F_pwr,1)
      enddo
*
      do j = 2+Lam_pil_s ,nx3-Lam_pil_n
          do i = 1,gni
             call mxma8( F_deltainv_8(1,1,i,j-1), 1,F_pwr,
     %                          F_C_8(1,1,i,j-1), 1,F_pwr,
     %                   wrk_8, 1,F_pwr,F_pwr,F_pwr,F_pwr)
             call mxma8( F_a_8(1,1,i,j), 1,F_pwr,
     %                   wrk_8         , 1,F_pwr,
     %                   delta_8(1,1,i,j), 1,F_pwr,F_pwr,F_pwr,F_pwr)
             do o1= 1,F_pwr
             do o2=1,F_pwr
                delta_8(o1,o2,i,j)=F_b_8(o1,o2,i,j)-delta_8(o1,o2,i,j)
             enddo
             enddo
             call inverse (F_deltainv_8(1,1,i,j),delta_8(1,1,i,j),
     $                                                   F_pwr,1)
          enddo
      enddo
*
*     __________________________________________________________________
*
      return
      end