*
* $Id$
*
* $Log$
* Revision 1.1  1996/04/01 15:02:17  mclareni
* Initial revision
*
*
#include "gen/pilot.h"
      SUBROUTINE ELPAHY(F,IDIM1,IDIM2,DX,DY,COEFS,IBX,BWEST,BEAST,
     1JBY,BSOUTH,BNORTH)
      DIMENSION COEFS(3)
      DIMENSION F(IDIM1,IDIM2)
      DIMENSION BWEST(IDIM2),BEAST(IDIM2),BNORTH(IDIM1),BSOUTH(IDIM1)
C------------------------------------------
C   KIND OF EQUATION AND COEFFICIENTS     I
C------------------------------------------
C   IKIND=1-ELLIPTIC ,=2-PARABOLIC ,=3-HYPERBOLIC
C
C   DX2+AD*DY2+BD*DY+CD*Y=SOURCE
C
      AD=COEFS(1)
      BD=COEFS(2)
      CD=COEFS(3)
      IF(AD) 510,511,512
 510  IKIND=3
      GO TO 513
 511  IKIND=2
      GO TO 513
 512  IKIND=1
 513  CONTINUE
C------------------------------------------
C   MESH DIVISION AND CELL SIZE           I
C------------------------------------------
C   IDIM1 DIVISIONS ALONG THE X-DIRECTION
C   IDIM2 DIVISIONS ALONG THE Y-DIRECTION
C   DX = CELL SIZE ALOND X
C   DY = CELL SIZE ALONG Y
C
      RAT=DX/DY
      RAT2=RAT*RAT
      DX2=DX*DX
      AT=RAT2*AD
      BT=RAT*DX*BD
      CT=DX2*CD
      DO 1 I=1,IDIM1
      DO 1 J=1,IDIM2
 1    F(I,J)=DX2*F(I,J)
C------------------------------------------
C   BOUNDARY CONDITIONS                   I
C------------------------------------------
C   ALONG THE WEST AND EAST BOUNDARIES
C   IBX=1-PERIODIC ,=2-DERIVATIVE ,=3-VALUE ,=4-VALUE+DERIVATIVE
C
C   ALONG THE SOUTH AND NORTH BOUNDARIES
C   JBY=1   VALUE=BSOUTH(I) ,VALUE=BNORTH(I)
C   JBY=2   DERIVATIVE=BSOUTH(I) ,DERIVATIVE=BNORTH(I)
C   JBY=3   VALUE=BSOUTH(I) ,DERIVATIVE=BNORTH(I)
C   JBY=4   DERIVATIVE=BSOUTH(I) ,VALUE=BNORTH(I)
C
      GO TO (520,521,522,523) ,JBY
 520  ALFAS=1.
      BETAS=0.
      ALFAN=1.
      BETAN=0.
      GO TO 524
 521  ALFAS=0.
      BETAS=1.
      ALFAN=0.
      BETAN=1.
      GO TO 524
 522  ALFAS=1.
      BETAS=0.
      ALFAN=0.
      BETAN=1.
      GO TO 524
 523  ALFAS=0.
      BETAS=1.
      ALFAN=1.
      BETAN=0.
 524  CONTINUE
C
C   THIS SUBROUTINE MODIFIES THE SOURCE TERM
C   AT EACH END OF THE X-RANGE ACCORDING
C   TO THE TYPE OF BOUNDARY CONDITIONS
C   CHOSEN ALONG THAT DIRECTION
C
      CALL NEWRO(IDIM1,IDIM2,IBX,DX,F,BWEST,BEAST,BSOUTH,BNORTH)
C
C   THIS SUBROUTINE PERFORMS THE APPROPRIATE
C   FOURIER ANALYSIS OF THE SOURCE TERM
C   ALONG THE X-DIRECTION USING FAST FOURIER
C   TRANSFORM TECHNIQUES
C
      CALL ELANAL(IDIM1,IDIM2,IBX,F,BWEST,BEAST,BSOUTH,BNORTH)
C
C   THIS SUBROUTINE SOLVES THE TWO-POINTS
C   OR THREE-POINTS RECURRENCE FORMULA ALONG
C   THE SECOND DIMENSION FOR EITHER ONE OF
C   THE ELLIPTIC,PARABOLIC OR HYPERBOLIC TYPE
C   OF EQUATIONS
C
      CALL ESOLVE(IDIM1,IDIM2,AT,BT,CT,DY,IBX,ALFAS,BETAS,ALFAN,BETAN,
     1F,IKIND)
C
C   THIS SUBROUTINE PERFORMS THE APPROPRIATE
C   FOURIER SYNTHESIS OF THE UNKNOWWN FUNCTION
C   ALONG THE X-DIRECTION USING FAST FOURIER
C   TRANSFORM TECHNIQUES
C
      CALL SYNT(IDIM1,IDIM2,IBX,F)
C
C
      GO TO (100,110,120,130),IBX
 100  DO 101 J=1,IDIM2
 101  F(IDIM1,J)=F(1,J)
      GO TO 110
 120  DO 121 J=1,IDIM2
      F(1,J)=BWEST(J)
 121  F(IDIM1,J)=BEAST(J)
      GO TO 110
 130  DO 131 J=1,IDIM2
 131  F(1,J)=BWEST(J)
 110  RETURN
      END
