TALK=F;RUN(1,1)                                           
  DISPLAY
   Steady Test 2DXY Piezoelectric + Flow Water.
  ENDDIS

  PHOTON USE 
  p
  
  1 1 0.01
  

  clear
  set prop off
  gr ou z 1
  VECT IZ 1 SH DASH 0
  msg Velocity vector
  pause


  ENDUSE 

 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
TEXT(Steady 2DXY Piezoelectric; S903
libref=903
TITLE
integer(caseno)
mesg(caseno 1 : Bore - 15*1000 mkM 
mesg(caseno 2 : Bore - 15*15 mkM
caseno=1
mesgm(caseno = :caseno: Enter another if not OK
readvdu(caseno, int, 1)
caseno 

  Declarations and settings
REAL(LYPZT,LYCO,LYCHA,LYPO)
LYPZT=4.75e-6
LYCO =0.25e-6
LYCHA =30.0e-6
LYPO = 50.0e-6

REAL(LXPZT,LXPZT2,LXBORE) 
LXPZT=60.e-6
LXBORE =7.5e-6
LXPZT2=LXPZT/2.0 
real(LZ)
LZ = 1000.0e-6
                    
INTEGER(NYPZT,NYCO,NYCHA,NYPO)
NYPZT = 6
NYCO  =  2
NYCHA = 10
NYPO  = 5

INTEGER(NXPZT2,NXBORE)
NXPZT2 = 16
NXBORE = 5

real(StrXR, E21, V0, EY0 ,StrXL)
E21 =  6.75      ! Cuol/m**2
   
V0  = -6.7    ! Volt
EY0 = V0/LYPZT 
StrXR = E21*EY0
StrXL = -StrXR

 ************************************************************
  Group 2. Time dependence
 STEADY  =    T
 
 ************************************************************
  Group 3. X-Direction Grid Spacing
 CARTES  =    T
 NREGY=2
 IREGY=1;GRDPWR(Y,NYPO,LYPO,1)
 IREGY=2;GRDPWR(Y,NYCHA,LYCHA,1)

 ************************************************************
  Group 4. Y-Direction Grid Spacing
 NREGX=2
 IREGX=1;GRDPWR(X,NXBORE,LXBORE,1)
 IREGX=2;GRDPWR(X,NXPZT2-NXBORE,LXPZT2-LXBORE,1)  
 
 ************************************************************
  Group 5. Z-Direction Grid Spacing
 NZ=1
 ZWLAST  = LZ
 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ONEPHS  =    T
 SOLVE(P1,U1,V1)
 
 STORE(PRPS,DEN1,ENUL,DVO1,DRH1)
 STORE(EPSY,EPSX,EPSZ,STRX)
 STORE(VPOR,NPOR)
 
 ************************************************************
  GROUP 8. ITERATION NUMBERS ETC

 ************************************************************
  GROUP 9. PROPERTIES
  
  ** COpper 160   : E = 1.1e11,  1/E = 0.91e-11,  P = 0.3 
  ** POlimide 120 : E = 7.5e09,  1/E = 13.3e-11,  P = 0.35
  ** PZT  101     : E = 6.06e10, 1/E = 1.65e-11,  P = 0.29
  ** WATER at 20 C - 67
  
 CSG10='Q1'                  ! materials with various POISSON ratios
  MATFLG=T;NMAT=4
  67    998.23    1.006E-6   4181.8    0.597    1.18E-4 
  101    7500.0    0.29  473.0   43.0    1.0e-5   1.65e-11 
  120    8900.0    0.35  473.0   43.0    1.0e-5   13.3e-11 
  160    1000.0    0.30  473.0   43.0    1.0e-5   0.91e-11 
   
 ************************************************************
  GROUP 11. INITIAL VALUES

FIINIT(PRPS)=67
FIINIT(P1)=0.0
FIINIT(U1)=0.0
FIINIT(V1)=0.0

FIINIT(VPOR)=1.0
FIINIT(NPOR)=1.0

  *****  POlimide ****  
PATCH(PO1,INIVAL,NXBORE+1,NX,1,NYPO,1,1,1,1)
INIT(PO1,PRPS,FIXVAL,120)

  *****  Bore ****
if(caseno.EQ.2) then 
real(VVPOR)
VVPOR = 2*LXBORE/LZ    
PATCH(BORE1,INIVAL,1,NXBORE,1,NYPO,1,1,1,1)
INIT(BORE1,VPOR,FIXVAL,VVPOR)
INIT(BORE1,NPOR,FIXVAL,VVPOR)
endif


 ************************************************************
  GROUP 13. BOUNDARY & SPECIAL SOURCES
 
PATCH(LeftF,WWALL,1,1,1,NY,1,1,1,1)
COVAL(LeftF,U1,1,0)

PATCH(RightF,EWALL,NX,NX,NYPO+1,NY,1,1,1,1)    ! Right end of flow is wall
COVAL(RightF,U1,1,0)
COVAL(RightF,V1,1,0)

  *** Bore ****
PATCH(BORE,SOUTH,1,NXBORE,1,1,1,1,1,1)
COVAL(BORE,P1,1.E3,0.0) 
COVAL(BORE,U1,ONLYMS,0)
COVAL(BORE,V1,ONLYMS,0)
  
INLET(IN,NORTH,1,NX,NY,NY,1,1,1,1)
VALUE(IN,P1,1.0*998) 
VALUE(IN,U1,0)
VALUE(IN,V1,-1)
  
 ************************************************************
  GROUP 15. TERMINATE SWEEPS
 LSWEEP  =    800
 ISG21=LSWEEP
  
 
 ************************************************************
  GROUP 17. RELAXATION
 RELAX(P1  ,LINRLX, 1.000000E+00)
 
 ************************************************************
  GROUP 19. DATA TRANSMITTED TO GROUND
 STRA    =    T
 store(DISX,DISY)
 
 PARSOL  =    F
 ISG52   =    3   !   probe & res
 ************************************************************
  GROUP 23.FIELD PRINT-OUT & PLOT CONTROL
TSTSWP = - 1   ! graphic-mode
IXMON = 1
IYMON = 1    
IZMON = 1
NYPRIN=1

  inform7begin


  inform7end
  
STOP