TALK=f;RUN(1,1) 
  DISPLAY
  1. "Bent of Solid Plate" model.
  2.  Flutter of flags.
  ENDDIS

  PHOTON USE
  p;;;;
  
  
  msg
  msg P1 contours
  msg
  GR OU Z 1; 
  cont P1 z 1 fil;.0001
  GR OU  Y 10 X 18 52 Z 1 1 COL 1 
  pause
  
  cl
  msg
  msg 
  msg Velocity vector
  GR OU Z 1; 
  GR OU  Y 10 X 18 52 Z 1 1 COL 1 
  vec z 1 SH DASH 0
  pause

  cl
  msg
  msg 
  msg Deflection plate vector
  GR OU Z 1; 
  GR OU  Y 10 X 18 52 Z 1 1 COL 1 
  SET VEC COMP - - -
  SET VEC COMP - STDP -
  SET VEC RE 0.2
  VECT IZ 1 SH DASH 0
  pause

  ENDUSE
 
 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
TEXT(2D  Flow Past A Bent Solid Plate; S402       
TITLE
 
integer(caseNO)

label ask
mesg(:title:
mesg( Variant of calculation:
mesg( caseno=1 : fixed pressure & exact solution for STDP and STMO         
mesg( caseno=2 : Free wave of Plate
mesg( caseno=3 : Flutter of flags
       
mesg(Enter 1, 2, 3 or blank (default = 1)
readvdu(caseno,int,1)
if(caseno.lt.1) then
 goto ask
endif  
if(caseno.gt.3) then
 goto ask
endif 
caseno
 
real(PBENT)
PBENT = 0.5  ! Pa
 
real(HPLATE,YOUNG,POISSON,RHOPLT)
HPLATE=3.e-3         !   h = 3 μμ, L = 6.6 m
YOUNG = 2.e11
POISSON = 0.3  
RHOPLT = 2.e3
 
 ************************************************************
  Group 2. Time dependence
 ************************************************************
if(caseno.eq.1) then 
 STEADY  =    T
else
 STEADY  =    F
 RSET(U,0.0,10,40)
endif

 ************************************************************
  Group 3. X-Direction Grid Spacing
 ************************************************************
CARTES  =    T
GRDPWR(X,70,14.,1.)
 ************************************************************
  Group 4. Y-Direction Grid Spacing
 ************************************************************
GRDPWR(Y,20,4.0,1.0)

 ************************************************************
  Group 5. Z-Direction Grid Spacing
 ************************************************************
 NZ=1
 ZWLAST  = 1.0

 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ************************************************************
SOLVE(P1,V1,U1)
SOLUTN(P1,Y,Y,Y,N,N,N)
STORE(EPOR,NPOR,VPOR)

   ***** BSP *****
STORE(STDP,STMO)
if(caseno.ge.2) then
 STORE(SDO1,SDO2)
 
 FIINIT(SDO1)=0.0
 FIINIT(SDO2)=0.0

 char(formt,xxp)
 xxp=(XG-3.4)/6.6
 real(dddt)
endif

if(caseno.eq.2) then
 patch(ZZZZ,CELL,1,NX,1,NY,1,1,1,LSTEP)
 COVAL(ZZZZ,P1,FIXVAL,0.0)
 dddt = 0.002/0.2
 formt=:dddt:*SIN(3.14*:xxp:)
 PATCH(PLTBENT,INIVAL,18,50,10,10,1,1,1,1)
 (initial of SDO1 at PLTBENT is :formt:) 
endif 

if(caseno.eq.3) then
 dddt = 0.00    
 formt=:dddt:*:xxp:
 PATCH(PLTBENT,INIVAL,18,50,10,10,1,1,1,1)
 (initial of SDO1 at PLTBENT is :formt:) 
 (initial of SDO2 at PLTBENT is :formt:) 
endif


SPEDAT(SET,HPLATE,PLT*1,R,HPLATE)
SPEDAT(SET,YOUNG,PLT*1,R,YOUNG)
SPEDAT(SET,POISSON,PLT*1,R,POISSON)
SPEDAT(SET,FIXEDEDGE,PLT*1,C,Beg)
SPEDAT(SET,DENSPLAT,PLT*1,R,RHOPLT)

if(caseNO.EQ.1) then
STORE(DPTH,MOTH,DP/T,MO/T)
FIINIT(DPTH)=0.0
FIINIT(MOTH)=0.0
FIINIT(DP/T)=0.0
FIINIT(MO/T)=0.0
endif
   ***** BSP *****
 
 ************************************************************
    GROUP 9. Properties of the medium (or media)
 ************************************************************

REAL(REYNO,U1IN);
U1IN=1.0
if(caseNO.EQ.3) then
 RHO1=100.0
 REYNO=100.0
else
 RHO1=1.0
 REYNO=100.0
endif
ENUL=U1IN*YVLAST/REYNO
 
 ************************************************************
    GROUP 11. Initialization of variable or porosity fields
 ************************************************************
FIINIT(U1)=U1IN
FIINIT(STDP)=0.0
FIINIT(STMO)=0.0

if(caseNO.EQ.1) then
 FIINIT(P1)=0.0
 ****** fixed P1 ******
 patch(BEFORE,CELL,1,NX,1,10,1,1,1,1)
 COVAL(BEFORE,P1,FIXVAL,PBENT)
 patch(AFTER,CELL,1,NX,11,NY,1,1,1,1)
 COVAL(AFTER,P1,FIXVAL,0.0)
endif




 
 ************************************************************
    GROUP 13. Boundary conditions and special sources
 ************************************************************

   **INLET boundary
INLET(IN,WEST,1,1,1,NY,1,1,1,LSTEP)
VALUE(IN,P1,RHO1*U1IN)
VALUE(IN,U1,U1IN)

   **OUTLET boundary
PATCH(OUT,EAST,NX,NX,1,NY,1,1,1,LSTEP)
COVAL(OUT,P1,1.E5,0.0); 
COVAL(OUT,U1,ONLYMS,U1IN)

   **TOP/Bottom  boundary 
PATCH(TOP,NORTH,1,NX,NY,NY,1,1,1,LSTEP)
     COVAL(TOP,V1,FIXVAL,0.)   
COVAL(TOP,P1,1.E5,0.); COVAL(TOP,U1,ONLYMS,U1IN)
     
PATCH(BOTTOM,SOUTH,1,NX,1,1,1,1,1,LSTEP)
     COVAL(BOTTOM,V1,FIXVAL,0.)   
COVAL(BOTTOM,P1,1.E5,0.); COVAL(BOTTOM,U1,ONLYMS,U1IN)
 
  
   **Plate
PATCH(PLT*1,NWALL,18,50,10,10,1,1,1,LSTEP)
SPEDAT(SET,POROSITY,PLT*1,R,0.0)

 ************************************************************
    GROUP 15. Termination of sweeps
 ************************************************************
LSWEEP=100
RESREF(P1)=1.E-6*RHO1*U1IN*YVLAST
ISG52   =    3   !   probe & res
TSTSWP = - 1     ! graphic-mode

if(caseNO.EQ.1) then
LSWEEP=4
endif
 
 ************************************************************
    GROUP 16. Termination of iterations
 ************************************************************
LITER(P1)=-50
 
 ************************************************************
    GROUP 17. Under-relaxation devices
 ************************************************************
RELAX(V1,FALSDT,1.0); RELAX(U1,FALSDT,1.0)
 
 ************************************************************
    GROUP 21. Print-out of variables
 ************************************************************
 
 ************************************************************
    GROUP 22. Spot-value print-out
 ************************************************************
IYMON=12; IXMON=25
 
 ************************************************************
    GROUP 23. Field print-out and plot control
 ************************************************************
NYPRIN=1; NXPRIN=1; IXPRF=17; IXPRL=52;
IYPRF=6; IYPRL=14;

if(caseNO.GE.2) then
 IDISPA = 1
 csg1=p
endif

if(caseNO.EQ.2) then
 LSWEEP=2
endif

  inform7begin       

if(caseNO.EQ.1) then
 real(DPLATE,CODD,LP,LP2,COMM)
 DPLATE = YOUNG*HPLATE**3/12/(1-POISSON**2)
 
 DPLATE
 
 CODD = PBENT/DPLATE/24
 LP=10.0 - 3.4
 LP2=LP**2
 char(formD,formM, xxG)
 xxG=(XG-3.4)
 formD=(XXG^4-4*XXG^3*:LP:+6*XXG^2*:LP2:)
 COMM=-PBENT/2
 formM=(LP-XXG)^2
 (STORED VAR DPTH AT PLT*1 IS :CODD:*:formD:)
 (STORED VAR MOTH AT PLT*1 IS :COMM:*:formM:)
 (STORED VAR DP/T AT PLT*1 IS STDP/(DPTH+1.e-20))
 (STORED VAR MO/T AT PLT*1 IS STMO/(MOTH+1.e-20))
endif

  inform7end
STOP