TALK=f;RUN(1,1)
  DISPLAY
  A plate consisting of two materials has its temperature raised.
  Becuse the thermal expansion coefficients of the two materials 
  differ by a factor of 10, the plate distorts. its radius of 
  curvature being proportional to the width of the plate in the 
  direction normal to the line of separation between the materials, 
  divided by the differences in thermal strain.
  
  The opportunity is provided for the plate to be held either at its 
  high-y or low-y edges.
  
  ENDDIS
  PHOTON USE
  p;;;;
  
  

  set prop off
  cl
  msg prps distribution
  gr ou z 1
  cont prps z 1 fil;.0001
  pause
  cl
  msg x-displacement distribution
  gr ou z 1
  cont U1 z 1 fil;.0001
  vec z 1  col 1
  pause
  cl
  msg y-displacement distribution
  gr ou z 1
  cont V1 z 1 fil;.0001
  vec z 1  col 1
  pause
  cl
  msg reciprocal of radius of curvature
  gr ou z 1
  cont curv z 1 fil;.0001
  vec z 1  col 1
  pause
  cl
  msg epsy distribution
  gr ou z 1
  cont epsy z 1 fil;.0001
  vec z 1  col 1
  dump epsy
  pause
  cl
  msg epsx distribution
  gr ou z 1
  cont epsx z 1 fil;.0001
  vec z 1  col 1
  dump epsx
  ENDUSE
 
 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
 TEXT(2D xy Plate of two materials & TEM; s210
libref=210 
TITLE
integer(caseno)     
mesg(caseno = 1 : z free
mesg(caseno = 2 : z fixed
caseno=1
label ask
mesg(caseno=:caseno: Enter 1, 2 or blank
readvdu(caseno,int,1)
if(caseno.lt.1) then
 goto ask
endif  
if(caseno.gt.2) then
 goto ask
endif 
caseno
libref=caseno 
boolean(top)
top=t ! means hold at top (iy=ny), otherwise at bottom (iy=1) 
mesg(logical (hold at) top is true. OK? (Y/n)
readvdu(ans,char,y)
if(:ans:.eq.n) then
top=f
endif  
top
  
  Declarations and settings
REAL(FY,LX,LY,POISSON,YOUNG) 
FY= 40.0e6  ! H/m^2 = 40 N/mm^2
fy=0
LX=90.e-3
LY=120.e-3 
  lx=ly/100.
INTEGER(NXBODY,NYBODY)

 ************************************************************
  Group 2. Time dependence
 STEADY  =    T
 ************************************************************
  Group 3. X-Direction Grid Spacing
 CARTES  =    T
 NXBODY = 18
 GRDPWR(X,NXBODY,LX,1)  

 ************************************************************
  Group 4. Y-Direction Grid Spacing
 NYBODY = 18
 GRDPWR(Y,NYBODY,LY,1)  
 ************************************************************
  Group 5. Z-Direction Grid Spacing
 NZ=1
 ZWLAST  = 0.001
 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ONEPHS  =    T
 SOLVE(P1,V1,U1)
 SOLUTN(P1  ,Y,Y,Y,N,N,N)
 SOLUTN(U1  ,Y,Y,Y,N,N,Y)
 SOLUTN(V1  ,Y,Y,Y,N,N,Y)
 
 STORE(PRPS,DVO1,DRH1,EPST)
 STORE(STRX,STRY,STRZ,STXY)
 STORE(EPSY,EPSX,EPSZ)
 STORE(TEM1)  
 (stored var curv is (epsy-epst-epsy[-1,,]+epst[-1,,])/dxg$
 with if(ix.gt.1))
 ************************************************************
  GROUP 8. ITERATION NUMBERS ETC
RESFAC=1.e-7
RESREF(V1)=0.0 
RESREF(U1)=0.0
LITER(V1) = 50
LITER(U1) = 50 
LITER(P1) = 50 

 ************************************************************
  GROUP 9. PROPERTIES
  
 CSG10='Q1'                  ! materials with various POISSON ratios
  MATFLG=T;NMAT=2         
  160    7800.0    0.3       473.0   43.0      1.0e-5   0.5e-11 
  161    7800.0    0.3       473.0   43.0      1.0e-4   0.5e-11
 
 ************************************************************
  GROUP 11. INITIAL VALUES
fiinit(p1)=0.0
fiinit(u1)=0.0
fiinit(v1)=0.0
 
fiinit(TEM1)=10.0
 
 
 FIINIT(PRPS)=160
 PATCH(BODY2,INIVAL,NX/2+1,NX,1,NY,1,1,1,1)
 INIT(BODY2,PRPS,FIXVAL,161)
 ************************************************************
  GROUP 13. BOUNDARY & SPECIAL SOURCES
if(top) then 
PATCH(UPV,NWALL,1,NX,NY-1,NY-1,1,1,1,1) ! top - fixed 
PATCH(UPU,CELL,nx/2,nx/2,NY,NY,1,1,1,1)
  PATCH(UPV,cell,1,NX,NY-1,NY-1,1,1,1,1) ! top - fixed 
  COVAL(UPV,V1,fixval,0.0)
else
PATCH(UPV,NWALL,1,NX,1,1,1,1,1,1) ! bottom - fixed 
PATCH(UPU,CELL,nx/2,nx/2,1,1,1,1,1,1)
endif

COVAL(UPV,V1,1,0.0)
COVAL(UPU,U1,FIXVAL,0)


IF(CASENO.EQ.2) THEN
SPEDAT(BOUNDARY,ZCONST,R,1.e20)
ELSE
SPEDAT(BOUNDARY,ZCONST,R,0.0)
ENDIF 
 ************************************************************
  GROUP 15. TERMINATE SWEEPS
 LSWEEP  =      50000
 ISG21=LSWEEP
 ************************************************************
  GROUP 17. RELAXATION
     #CONPROM
 RELAX(P1  ,LINRLX, 1.000000E+00)

 ************************************************************
  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
NYPRIN = 1
NXPRIN = 1;ixprf=nx/2-2;ixprl=nx/2+2
IXMON = NX/2
IYMON = 2
IZMON = 1
#maxmin
#endpause
#$s003    
   ************************************ 
  restrt(all)
lsweep=10000
  nprint=lsweep/10
     
STOP