!-------------------------------------- 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 set_prec- Computes  variable associated 
*                 with preconditioning for elliptic problem 
*
#include "model_macros_f.h"
*

      subroutine set_prec 1,2
      implicit none
*
*author
*     Abdessamad Qaddouri  - initial version _ Decembre 2006 
*
*revision
* v3_30 - Qaddouri A.       - initial version
*
*object
*     see ID section above
*
*arguments
*     None
*
*implicits
#include "glb_ld.cdk"
#include "opr.cdk"
#include "prec.cdk"
#include "sol.cdk"
#include "cstv.cdk"
#include "schm.cdk"
*
      integer k,k0
      real*8  wk(G_nk)
*
*     ---------------------------------------------------------------
*
      sol_pil_w=pil_w
      sol_pil_e=pil_e
      sol_pil_s=pil_s
      sol_pil_n=pil_n
*
      sol_niloc = (l_ni-pil_e)-(1+pil_w)+1
      sol_njloc = (l_nj-pil_n)-(1+pil_s)+1
      sol_nloc  = sol_niloc*sol_njloc*Schm_nith
*
*  Sub-domains multicoloring 
*
      if (sol_precond_S.eq.'MULTICOL') 
     $    call multicl_dom (Prec_ncol,Prec_mycol)
*
*  Compute eigenvalues and eigenvector
*
      allocate (Prec_xevec_8(sol_niloc*sol_niloc),
     $          Prec_xeval_8(sol_niloc),Prec_ai_8(sol_nloc),
     $          Prec_bi_8(sol_nloc),Prec_ci_8(sol_nloc))
*                  
      do k =1,G_nk
         do k0=1,G_nk
            wk(k) = Opr_zevec_8 ((k-1)*G_nk+k0)
         enddo
         if ( k .le. Schm_nith )
     $        wk(k)= (Cstv_hco1_8+Cstv_hco0_8*Opr_zeval_8(k))
      enddo
*
      call eigenabc_local (Prec_xeval_8,Prec_xevec_8,Prec_ai_8,
     $                     Prec_bi_8,Prec_ci_8,l_ni,l_nj,
     $                     sol_niloc,sol_njloc,Schm_nith,l_i0,l_j0,wk)
*     
*     ---------------------------------------------------------------
*
      return
      end