TALK=f;RUN(1,1) 
  DISPLAY
     Thermal Stress In  Heated/Cooled Block:
     Fluid - Water, Re = 10 000;
     Block - UO2 with heat source and Glass shell
  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; 
  GR OUT z 1 x 11 27 y 1 24;
  pause

  cl
  msg
  msg P1 contours
  msg
  cont P1 z 1 fil;.0001
  GR OU Z 1; 
  GR OUT z 1 x 11 27 y 1 24;
  pause
  
  cl
  msg
  msg TEM1 contours
  msg
  cont TEM1 z 1 fil;.0001
  GR OU Z 1; 
  GR OUT z 1 x 11 27 y 1 24;
  pause

  cl
  msg
  msg 
  msg Velocity vector
  vec z 1 SH DASH 0
  GR OU Z 1; 
  GR OUT z 1 x 11 27 y 1 24;
  pause

  cl
  msg
  msg EPSX contours
  msg
  cont EPSX z 1 x 11 28 y 1 24 fil;.0001
  GR OU Z 1; 
  GR OUT z 1 x 11 27 y 1 24;
  pause

  cl
  msg
  msg EPSY contours
  msg
  cont EPSY z 1 x 11 28 y 1 24 fil;.0001
  GR OU Z 1; 
  GR OUT z 1 x 11 27 y 1 24;
  pause

  cl
  msg
  msg STRX contours
  msg
  cont STRX z 1 x 11 28 y 1 24 fil;.0001
  GR OU Z 1; 
  GR OUT z 1 x 11 27 y 1 24;
  pause

  cl
  msg
  msg STRY contours
  msg
  cont STRY z 1 x 11 28 y 1 24 fil;.0001
  GR OU Z 1; 
  GR OUT z 1 x 11 27 y 1 24;
  pause

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

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

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

  ENDUSE
 
 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
TEXT(Thermal Stress In  Heated/Cooled Block; S802
TITLE

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 = 0.05
HBODY = H/2
LCH1 = 2*H
LCH2 = 5*H
LBODY = H
integer(NBX,NAX,NSX)
NBX = 10
NSX = 18
NAX = 30
integer(NSY,NFY)
NSY =24
NFY =20

real(REYIN,UXIN, ENUIN,MXIN)
REYIN = 1.0e4
ENUIN = 1.006E-6  ! WATER
UXIN = REYIN*ENUIN/H
MXIN = UXIN*998.23

 
 ************************************************************
  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,TEM1)
 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,EPST)
STORE(DEN1,ENUL,DVO1,DRH1,enut,kond) 
store(D_X,D_Y)

turmod(lvel)

 ************************************************************
    GROUP 9. Properties of the medium (or media)
 ************************************************************
 CSG10='Q1'           ! signal use of the following properties line
                      ! which correspond to AIR/Water and GLASS+UO2
  MATFLG=T;NMAT=4
  70   1.189  1.544E-05   1005.0 0.0258  3.41E-3   0.0
  71   998.23    1.006E-6   4181.8    0.597    1.18E-4
  101  2700.0 0.23  840.0 0.78 0.58e-5 0.145e-10
  161 10960.0  0.3  473.0  6.6   0.2e-5    0.5e-11 

 ************************************************************
    GROUP 11. Initialization of variable or porosity fields
 ************************************************************
if (caseno.eq.2) then
 FIINIT(U1)=UXIN
endif 
FIINIT(PRPS)=71    ! WATER
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,101)  ! GLASS 

patch(BODY1,inival,NBX+4,NBX+NSX-4,1,NSY-4,1,1,1,1)
coval(BODY1,PRPS,1.0,161)  ! STEEL 

 
 ************************************************************
    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)
COVAL(IN1,TEM1,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  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.)   
PATCH(BOTTOM2,SWALL,nbx+nsx,nx,1,1,1,1,1,1)
COVAL(BOTTOM2,V1,1,0.)   

patch(TBODY,VOLUME,NBX+4,NBX+NSX-4,1,NSY-4,1,1,1,1)
COVAL(TBODY,TEM1,FIXFLU,1.0e6)   


  
   ** Plate **
if(stra) then   
PATCH(BODYFIXY,SWALL,NBX+1,NBX+NSX,1,1,1,1,1,1)
PATCH(BODYFIXX,CELL,NBX+1,NBX+1,1,1,1,1,1,1)
if (caseno.eq.1) then
 COVAL(BODYFIXX,U1,FIXVAL,0.0)
 COVAL(BODYFIXY,V1,1,0.0)
else
 COVAL(BODYFIXX,DISX,FIXVAL,0.0)
 COVAL(BODYFIXY,DISY,1,0.0)
endif
endif
 ************************************************************
    GROUP 15. Termination of sweeps
 ************************************************************
LSWEEP=1000
ISG52   =    3   !   probe & res
TSTSWP = - 1     ! graphic-mode
 
 ************************************************************
    GROUP 16. Termination of iterations
 ************************************************************
 
 ************************************************************
    GROUP 17. Under-relaxation devices
 ************************************************************
 RELAX(V1,FALSDT,0.1); RELAX(U1,FALSDT,0.1)
 RELAX(P1  ,LINRLX, 0.8)
 liter(tem1)=100
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=30;
 IYPRF=1; IYPRL=26;

  inform7begin       

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)
 (stored var DISP is (DISX^2+DISY^2) with imat>99)
 
endif 
endif

  inform7end
STOP