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

  PHOTON USE 
  p;parphi 
  1 1 0.01
  

  clear
  set prop off
  gr ou z 10
  VECT IZ 10 SH DASH 0

  gr ou z 40
  VECT IZ 40 SH DASH 0

  gr ou z 90
  VECT IZ 90 SH DASH 0

  msg Velocity vector
  pause

  clear
  gr ou z 10
  SET VEC COMP - - -
  SET VEC COMP DISX DISY -
  VECT IZ 10 SH DASH 0

  gr ou z 40
  VECT IZ 40 SH DASH 0

  gr ou z 90
  VECT IZ 90 SH DASH 0

  msg Displacement vector
  pause



  autoplot 
  FILE 
  parphi 5 

  clear
  data 1                                                                          
  DISY X 1 Y 16 Z 1 m                                                                 
  colA 1          
  scale
  plot 1                                                                      
  msg DISY(Time) for X=0 and Bottom Membrane 
  pause

  clear
  data 1                                                                          
  VPO1 X 1 Y 15 Z 1 m                                                                 
  colA 1          
  scale
  plot 1                                                                      
  msg (1-VPOR)(Time) for X=0 and Bottom Membrane 
  pause

  clear
  data 1                                                                          
  V1 X 1 Y 1 Z 1 m                                                                 
  colA 1          
  scale
  plot 1                                                                      
  msg V1(Time) for X=0 and Bottom Bore 
  pause


  ENDUSE 

 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
TEXT(Transient 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

real(TimeMax,TimCO)
TimeMax = 1.0/50.0/4.0
TimCO = 6.28*50     ! 50 Hz

 ************************************************************
  Group 2. Time dependence
 STEADY  =    F
 RSET(U,0,TimeMax,100)

 ************************************************************
  Group 3. X-Direction Grid Spacing
 CARTES  =    T
 NREGY=4
 IREGY=1;GRDPWR(Y,NYPO,LYPO,1)
 IREGY=2;GRDPWR(Y,NYCHA,LYCHA,1)
 IREGY=3;GRDPWR(Y,NYCO,LYCO,1)  
 IREGY=4;GRDPWR(Y,NYPZT,LYPZT,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)
 SOLVE(DISY,DISX)
 STORE(VDSY,VDSX)
 
 TERMS (DISY,N,N,Y,Y,Y,N)
 TERMS (DISX,N,N,Y,Y,Y,N)
 
 STORE(PRPS,DEN1,ENUL,DVO1,DRH1)
 STORE(EPSY,EPSX,EPSZ,STRX)
 STORE(VPOR,EPOR,NPOR)
 
 STORE(VPO1)
 
 ************************************************************
  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(DISY)=0.0
FIINIT(VDSY)=0.0
FIINIT(DISX)=0.0
FIINIT(VDSX)=0.0
FIINIT(PRPS)=67
FIINIT(P1)=0.0
FIINIT(U1)=0.0
FIINIT(V1)=0.0

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

integer(IXB,IYB)
IYB = NYPO+NYCHA+NYCO+1
  *****  PZT ****
PATCH(PZT1,INIVAL,1,NX,IYB,NY,1,1,1,1)
INIT(PZT1,PRPS,FIXVAL,101)

  *****  CUpper ****  
IYB = NYPO+NYCHA+1
PATCH(CU_M,INIVAL,1,NX,IYB,IYB+NYCO-1,1,1,1,1)
INIT(CU_M,PRPS,FIXVAL,160)

  *****  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
 
IYB = NYPO+NYCHA+NYCO+1
PATCH(LeftS,WWALL,1,1,IYB,NY,1,1,1,LSTEP)    ! Left end is symmetrical
COVAL(LeftS,DISX,1,0)
PATCH(LeftF,WWALL,1,1,1,IYB-1,1,1,1,LSTEP)
COVAL(LeftF,U1,1,0)

PATCH(RightS1,CELL,NX,NX,IYB,IYB,1,1,1,LSTEP)    ! Right end PZT is fixed
COVAL(RightS1,DISX,FIXVAL,0)
COVAL(RightS1,DISY,FIXVAL,0)

PATCH(RightS2,EWALL,NX,NX,1,NYPO,1,1,1,LSTEP)    ! Right end POliemyde is fixed
COVAL(RightS2,DISX,1,0)
COVAL(RightS2,DISY,1,0)

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

  *** Electrilal Stresses ****
 PATCH(FORCER,EAST,NX,NX,NY-NYPZT,NY,1,1,1,LSTEP)
 (SOURCE of DISX at FORCER is COVAL(FIXFLU,:StrXR:*SIN(:TimCO:*TIM)))

  *** FSI Zones: solid cells & interface face ****
 IYB = NYPO+NYCHA+1 
 PATCH(FSI#1,SOUTH,1,NX,IYB,IYB,1,1,1,LSTEP)


  *** Bore ****
PATCH(BORE,SOUTH,1,NXBORE,1,1,1,1,1,LSTEP)
COVAL(BORE,P1,1.E3,0.0) 
COVAL(BORE,U1,ONLYMS,0)
COVAL(BORE,V1,ONLYMS,0)
  
  
 ************************************************************
  GROUP 15. TERMINATE SWEEPS
 LSWEEP  =    800
 ISG21=LSWEEP
  
 
 ************************************************************
  GROUP 17. RELAXATION
 RELAX(P1  ,LINRLX, 1.000000E+00)
 RELAX(DISY,LINRLX, 1.000000E+00)
 RELAX(DISX,LINRLX, 1.000000E+00)
 SPEDAT(SET,GXMONI,TRANSIENT,L,F)
 ************************************************************
  GROUP 19. DATA TRANSMITTED TO GROUND
 STRA    =    T
 PARSOL  =    F
 ISG52   =    3   !   probe & res

 ************************************************************
  GROUP 23.FIELD PRINT-OUT & PLOT CONTROL
TSTSWP = - 1   ! graphic-mode
IXMON = 1
    IYMON = NYPO+NYCHA+NYCO+1
IYMON = 1    
IZMON = 1
NYPRIN=1

IDISPA = 1

  inform7begin

(STORED VAR VPO1 IS (1.0-VPOR))

 
  inform7end
  
STOP