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       
TITLE

STRA    =  T

boolean(FixPres1)
FixPres1 = F



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)  ! ALUMINIUM 
 
 ************************************************************
    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(stra) then   
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
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.and.stra) 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
 ************************************************************
if(Stra) then 
 IYMON=18; IXMON=12
else
 IYMON=NX/3; IXMON=NBX+NSX+10
endif 
 ************************************************************
    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 u1ap is apco(U1))
   (stored var u1an is anco(U1))
   (stored var u1as is asco(U1))
   (stored var u1rs is resi(U1))
   (stored var u1aw is awco(U1))
   (stored var u1ae is aeco(U1))
endif
if(caseNO.EQ.2.AND.STRA) then
   (stored var u1ap is apco(U1))
   (stored var u1an is anco(U1))
   (stored var u1as is asco(U1))
   (stored var u1rs is resi(U1))
   (stored var u1aw is awco(U1))
   (stored var u1ae is aeco(U1))

  (stored var DXap is apco(DISX))
  (stored var DXan is anco(DISX))
  (stored var DXas is asco(DISX))
  (stored var DXrs is resi(DISX))
  (stored var DXaw is awco(DISX))
  (stored var DXae is aeco(DISX))
endif

if(FixPres1) then
 IYMON=18; IXMON=12
  
 FIINIT(P1)=0.0
 FIINIT(U1)=0.0
 FIINIT(V1)=0.0
 if(caseno.eq.1) then
 patch(BEFORE1,INIVAL,1,10,1,NY,1,1,1,1)
 INIT(BEFORE1,P1,FIXVAL,1.e6)
 COVAL(BEFORE1,V1,FIXVAL,0)

 ****** fixed P1 ******
 patch(BEFORE,CELL,1,10,1,NY,1,1,1,1)
 COVAL(BEFORE,P1,FIXVAL,1.e6)

 patch(AFTER,CELL,11,NX,21,NY,1,1,1,1)
 COVAL(AFTER,P1,FIXVAL,0.0)
 COVAL(AFTER,U1,FIXVAL,0.0)
 COVAL(AFTER,V1,FIXVAL,0.0)
 
 patch(AFTER1,CELL,21,NX,1,20,1,1,1,1)
 COVAL(AFTER1,P1,FIXVAL,0.0)
 COVAL(AFTER1,U1,FIXVAL,0.0)
 COVAL(AFTER1,V1,FIXVAL,0.0)

 patch(UBEFORE,CELL,1,9,1,NY,1,1,1,1)
 COVAL(UBEFORE,U1,FIXVAL,0)
else
 patch(BEFORE1,INIVAL,1,10,1,NY,1,1,1,1)
 INIT(BEFORE1,P1,FIXVAL,1.e6)

 patch(BEFORE,CELL,1,10,1,NY,1,1,1,1)
 COVAL(BEFORE,P1,FIXVAL,1.e6)
 patch(AFTER,CELL,11,NX,1,NY,1,1,1,1)
 COVAL(AFTER,P1,FIXVAL,0.0)

 patch(ALLDOM,CELL,1,NX,1,NY,1,1,1,1)
 COVAL(ALLDOM,V1,FIXVAL,0)
 COVAL(ALLDOM,U1,FIXVAL,0)

endif
endif
if(stra) then
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 
endif
  inform7end
STOP