TALK=f;RUN(1,1) 
  DISPLAY
     A fluid (liquid steel) flows steadily in a direction normal to a
  thick plate in channel. The Reynolds Number (i.e. velocity times
  channel width divided by kinematic viscosity) equals 10.
  For calculation deformation of plate is used CDM or SDM models.
  ENDDIS

  PHOTON USE
  p;phi 
  0.4 1 1

  
  
  set prop off
  msg
  msg PRPS contours
  msg
  cont PRPS z 1 fil;.0001
  gr OU Z 1
  pause

  msg
  msg P1 contours
  msg
  GR OU Z 1; 
  cont P1 z 1 fil;.0001
  pause
  
  cl
  msg
  msg 
  msg Velocity vector
  GR OU Z 1; 
  vec z 1 SH DASH 0
  pause

  cl
  msg
  msg U1 contours
  msg
  GR OU Z 1; 
  cont U1 z 1 fil;.0001
  pause

  cl
  msg
  msg V1 contours
  msg
  GR OU Z 1; 
  cont V1 z 1 fil;.0001
  pause

  cl
  msg
  msg EPSX contours
  msg
  GR OU Z 1; 
  cont EPSX z 1 x 11 20 y 1 20 fil;.0001
  pause

  cl
  msg
  msg EPSY contours
  msg
  GR OU Z 1; 
  cont EPSY z 1 x 11 20 y 1 20 fil;.0001
  pause

  cl
  msg
  msg STRX contours
  msg
  GR OU Z 1; 
  cont STRX z 1 x 11 20 y 1 20 fil;.0001
  pause

  cl
  msg
  msg STRY contours
  msg
  GR OU Z 1; 
  cont STRY z 1 x 11 20 y 1 20 fil;.0001
  pause

  cl
  set prop off
  msg
  msg X-displacement contours
  msg
  GR OU Z 1; 
  cont D_X z 1 x 11 20 y 1 20 fil;.0001
  pause

  cl
  set prop off
  msg
  msg Y-displacement contours
  msg
  GR OU Z 1; 
  cont D_Y z 1 x 11 20 y 1 20 fil;.0001
  pause

  cl
  set prop off
  msg
  msg Displacements vector
  msg
  GR OU Z 1; 
  SET VEC COMP - - -
  SET VEC COMP D_X D_Y -
  VECT z 1 x 11 20 y 1 20 SH DASH 0
  pause

  ENDUSE
 
 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
TEXT(2D Fluid flow around an beam; S801       
STRA    =  T

integer(caseNO)
label ask
mesg(:title:
mesg( Variant of calculation:
mesg( caseno=1 : Staggered DM model 
mesg( caseno=2 :  Collocated DM model      
mesg(Enter 1, 2 or blank (default = 1)
readvdu(caseno,int,1)
if(caseno.lt.1) then
 goto ask
endif  
if(caseno.gt.2) then
 goto ask
endif 
caseno

real(H,LCH1,LCH2,LBODY,HBODY)
H = 1
HBODY = H/2
LCH1 = 2*H
LCH2 = 2*H
LBODY = 0.2*H
integer(NBX,NAX,NSX)
NBX = 10
NSX = 10
NAX = 30
integer(NSY,NFY)
NSY =20
NFY =20

real(REYIN,UXIN, ENUIN,MXIN)
REYIN = 10.0
ENUIN = 1.0  ! steel
UXIN = REYIN*ENUIN/H
MXIN = UXIN*7800.0

 
 ************************************************************
  Group 2. Time dependence
 ************************************************************
STEADY  =    T

 ************************************************************
  Group 3. X-Direction Grid Spacing
 ************************************************************
CARTES  =    T
NREGX=3
IREGX=1;GRDPWR(X,NBX,LCH1,1.0)
IREGX=2;GRDPWR(X,NSX,LBODY,1.0)
IREGX=3;GRDPWR(X,NAX,LCH2,1.0)

 ************************************************************
  Group 4. Y-Direction Grid Spacing
 ************************************************************
NREGY=2
IREGY=1;GRDPWR(Y,NSY,HBODY,1.0)
IREGY=2;GRDPWR(Y,NFY,H-HBODY,1.0)

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

 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ************************************************************
 SOLVE(P1,V1,U1)
 SOLUTN(P1,Y,Y,Y,N,N,N)
if(caseNO.EQ.2.AND.STRA) then
 SOLVE(DISX,DISY)
 TERMS (DISX  ,N,N,Y,N,Y,N)
 TERMS (DISY  ,N,N,Y,N,Y,N)
 RELAX(DISX  ,LINRLX, 1.0)
 RELAX(DISY  ,LINRLX, 1.0)
endif
if(caseNO.EQ.1.AND.STRA) then
 spedat(rlxfac,rlxu1d,r,0.5)  
 spedat(rlxfac,rlxv1d,r,0.5)  
endif

STORE(PRPS)
STORE(STRX,STRY,STXY)
STORE(EPSY,EPSX,EPSZ)
store(DEN1,ENUL,DVO1,DRH1)
store(D_X,D_Y)
 ************************************************************
    GROUP 9. Properties of the medium (or media)
 ************************************************************
 CSG10='Q1'           ! signal use of the following properties line
                      ! which correspond to steel
  MATFLG=T;NMAT=2
  99     7800.0     1.0       473.0   43.0      0.0    0.0 
  100    2700.0     0.35      896.0     204.0 2.35e-5  1.47e-11


 ************************************************************
    GROUP 11. Initialization of variable or porosity fields
 ************************************************************
if (caseno.eq.2) then
 FIINIT(U1)=UXIN
endif 
FIINIT(PRPS)=99     ! solid (steel) treated as high-viscosity incompressible fluid
FIINIT(D_X)=0
FIINIT(D_Y)=0

patch(BODY,inival,NBX+1,NBX+NSX,1,NSY,1,1,1,1)
coval(BODY,PRPS,1.0,100)
 
 ************************************************************
    GROUP 13. Boundary conditions and special sources
 ************************************************************

   **INLET boundary
PATCH(IN1,WEST,1,1,1,NY,1,1,1,1)
COVAL(IN1,P1,FIXFLU,MXIN)
COVAL(IN1,U1,ONLYMS,UXIN)
COVAL(IN1,V1,ONLYMS,0)



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

   **TOP/Bottom  boundary : WALL
PATCH(TOP,NWALL,1,NX,NY,NY,1,1,1,1)
COVAL(TOP,V1,1,0.)   
COVAL(TOP,U1,1,0.)   
PATCH(BOTTOM1,SWALL,1,nbx,1,1,1,1,1,1)
COVAL(BOTTOM1,V1,1,0.)   
COVAL(BOTTOM1,U1,1,0.)   
PATCH(BOTTOM2,SWALL,nbx+nsx+1,nx,1,1,1,1,1,1)
COVAL(BOTTOM2,V1,1,0.)   
COVAL(BOTTOM2,U1,1,0.)   
  
   ** Plate **
if (caseno.eq.1) then
PATCH(BODYFIX,CELL,NBX+1,NBX+NSX,1,1,1,1,1,1)
 COVAL(BODYFIX,U1,1.e5,0.0)
 COVAL(BODYFIX,V1,1.e5,0.0)
else
 PATCH(BODYFIX,SWALL,NBX+1,NBX+NSX,1,1,1,1,1,1)
 COVAL(BODYFIX,DISX,1,0.0)
 COVAL(BODYFIX,DISY,1,0.0)
endif

 ************************************************************
    GROUP 15. Termination of sweeps
 ************************************************************
LSWEEP=4000
ISG52   =    3   !   probe & res
TSTSWP = - 1     ! graphic-mode
 
 ************************************************************
    GROUP 16. Termination of iterations
 ************************************************************
 
 ************************************************************
    GROUP 17. Under-relaxation devices
 ************************************************************
 RELAX(V1,FALSDT,100.0); RELAX(U1,FALSDT,100.0)
 RELAX(P1  ,LINRLX, 1)
if(caseno.eq.1) then
 RESFAC=1.e-7 
 RESREF(V1)=0.0  ! to prevent premature exit
 LITER(V1) = 100 ! from solver
 RESREF(U1)=0.0; 
 LITER(U1) = 100
endif 
 ************************************************************
  GROUP 19. DATA TRANSMITTED TO GROUND
 ************************************************************

 
 ************************************************************
    GROUP 21. Print-out of variables
 ************************************************************
 
 ************************************************************
    GROUP 22. Spot-value print-out
 ************************************************************
 IYMON=18; IXMON=12

 ************************************************************
    GROUP 23. Field print-out and plot control
 ************************************************************
 NYPRIN=1; NXPRIN=1; 
 IXPRF=8; IXPRL=22;
 IYPRF=1; IYPRL=22;

  inform7begin
   
if(caseno.eq.1) then
 (stored var D_X is U1 with imat>99)
 (stored var D_Y is V1 with imat>99)
else
 (stored var D_X is DISX with imat>99)
 (stored var D_Y is DISY with imat>99)
endif 
  inform7end
STOP