PHOTON USE p msg Numerical solution contours msg Time=1. con C1 Z 1 fi;0.001 msg Press Enter to continue PAUSE CLEAR con EXAC Z 1 fi;0.001 msg Exact solution contours msg Time=1. msg Press e to END ENDUSE GROUP 1. Run title and other preliminaries #cls TEXT( 2D UNSTEADY DIFFUSION PROBLEM:119 TITLE LIBREF DISPLAY PLANT sets up and solves a 2D unsteady diffusion problem with time-dependent source and boundary conditions and compares the results with the exact solution. The single dependent variable is C1 The "PLANTed" formulae are: * at the west wall the value = TIM*YG2D**2 * at the east wall the value = TIM*(1.0+YG2D**2) * at the south wall the value = TIM*XG2D**2 * at the north wall the value = TIM*(1.0+XG2D**2) * within the volume the source = XG2D**2+YG2D**2-4.*TIM * the exact solution = TIM*(XG2D**2+YG2D**2) ENDDIS NX=10;NY=10 GROUP 2. Transience; time-step specification STEADY=F;GRDPWR(T,5,1.,1.0) GROUP 3. X-direction grid specification GRDPWR(X,NX,1,1.0) GROUP 4. Y-direction grid specification GRDPWR(Y,NY,1,1.0) GROUP 7. Variables stored, solved & named SOLVE(C1) GROUP 8. Terms (in differential equations) & devices TERMS(C1,N,N,Y,Y,Y,N) GROUP 9. Properties of the medium (or media) RHO1=1.0;PRNDTL(C1)=1.0;ENUL=1.0 GROUP 11. FIINIT(C1)=0.0 GROUP 13. Boundary conditions and special sources PLANTBEGIN PATCH(WEST,WWALL,1,1,1,NY,1,NZ,1,LSTEP)VAL=TIM*YG2D**2 COVAL(WEST,C1,1.,GRND) PATCH(EAST,EWALL,NX,NX,1,NY,1,NZ,1,LSTEP) VAL=TIM*(1.0+YG2D**2) COVAL(EAST,C1,1.,GRND) PATCH(SOUTH,SWALL,1,NX,1,1,1,NZ,1,LSTEP) VAL=TIM*XG2D**2 COVAL(SOUTH,C1,1.,GRND) PATCH(NORTH,NWALL,1,NX,NY,NY,1,NZ,1,LSTEP) VAL=TIM*(1.0+XG2D**2) COVAL(NORTH,C1,1.,GRND) PATCH(SOURC,VOLUME,1,NX,1,NY,1,NZ,1,LSTEP) VAL=XG2D**2+YG2D**2-4.*TIM COVAL(SOURC,C1,FIXFLU,GRND) STORE(EXAC) EXAC=TIM*(XG2D**2+YG2D**2) PLANTEND GROUP 15 Termination of sweeps LSWEEP=10 GROUP 19. NAMSAT=MOSG SPEDAT(SET,GXMONI,TRANSIENT,L,F) GROUP 20. Preliminary print-out GROUP 21. Print-out of variables tstswp=-1 dmpstk=t DISTIL=T EX(C1)=6.626E-01; EX(EXAC)=6.650E-01 LIBREF=119 STOP