PHOTON USE
  p
 
 
 
  4. 1. 1.
 
 
  gr ou z 1
  vec z 1 sh
  msg                    Velocity distribution:
  msg
  msg Press Enter to continue
  pause;cl
  msg                  Concentration distribution :
  msg                     Numerical solution
  con c1 z 1 fil;0.01
  msg Press Enter to continue
  pause;con off;red
  msg                  Concentration distribution :
  msg                     Exact solution
  con exac z 1 fil;0.01
  msg Press e to END
  ENDUSE
 
TEXT(COMPLEX CONVECTION DEPENDENT SOURCE:112

  DISPLAY 
   PLANT is activated  to  introduce  the  complex  source  and  to
   calculate  the exact solution for output purposes to be compared
   against  numerical  one.  Two  alternatives  are  used  for  it:
   FIXVALing  of SOLVEd variable EXCT and re-calculation at the end
   of solution procedure.  The latter is performed in Group 21. 
  ===================================================
     Convection-diffusion problem:
        dF/dx=1/Pe*d(dF/dx)/dx+S, where
        S= 1-2/Pe+2x+pi*cos(pi*x)+pi^2*sin(pi*x)/Pe
     Boundary conditions:
        x=0, F=1+exp(-Pe)
        x=1, F=4
     Exact solution:
        F=1+x+x^2+exp(-Pe(1-x))+sin(pi*x)
  ===================================================
  ENDDIS

REAL(PI,INL,OUT,PE,VEL,EM)
PE=1.;RG(1)=PE
PI=3.14159;RG(2)=PI
INL=1.+1./EXP(PE)
OUT=4.
EM=1./PE
VEL=1.
    GROUP 3. X-direction grid specification
GRDPWR(X,10,1.,1.)
    GROUP 4. Y-direction grid specification
GRDPWR(Y,2,1.,1.)
    GROUP 7. Variables stored, solved & named
SOLVE(C1,EXCT,AUX1,AUX2,AUX3);STORE(U1,V1)
    GROUP 8. Terms (in differential equations) & devices
TERMS(C1,N,Y,Y,Y,P,N);TERMS(EXCT,N,N,N,Y,P,N)
TERMS(AUX1,N,N,N,Y,P,N);TERMS(AUX2,N,N,N,Y,P,N)
TERMS(AUX3,N,N,N,Y,P,N)
    GROUP 9. Properties of the medium (or media)
ENUL=EM
    GROUP 11. Initialization of variable or porosity fields
FIINIT(U1)=VEL;FIINIT(C1)=INL
FIINIT(V1)=0.0
    GROUP 13. Boundary conditions and special sources
PATCH(ICON,WEST,1,1,1,NY,1,NZ,1,LSTEP)
COVAL(ICON,C1,VEL,INL)
PATCH(IDIF,WWALL,1,1,1,NY,1,NZ,1,LSTEP)
COVAL(IDIF,C1,1.,INL)
PATCH(ODIF,EWALL,NX,NX,1,NY,1,NZ,1,LSTEP)
COVAL(ODIF,C1,1.,OUT)

  PLANTBEGIN 
    * Composite source specification
  S= 1-2/Pe+2x+pi*cos(pi*x)+pi^2*sin(pi*x)/Pe
 
PATCH(SORC1,VOLUME,1,NX,1,NY,1,NZ,1,1)
   VAL=1.-2./RG(1)+2.*XG2D
COVAL(SORC1,C1,FIXFLU,GRND)
 
PATCH(SORC2,VOLUME,1,NX,1,NY,1,NZ,1,1)
   VAL=RG(2)*COS(RG(2)*XG2D)
COVAL(SORC2,C1,FIXFLU,GRND)
 
PATCH(SORC3,VOLUME,1,NX,1,NY,1,NZ,1,1)
   VAL=RG(2)**2*SIN(RG(2)*XG2D)/RG(1)
COVAL(SORC3,C1,FIXFLU,GRND)
 
      * Exact solution for output
PATCH(EXACT,CELL,1,NX,1,NY,1,NZ,1,1)
   VAL=1.+XG2D+(XG2D)**2
COVAL(EXACT,AUX1,FIXVAL,GRND)
   VAL=EXP(-RG(1)*(1.-XG2D))
COVAL(EXACT,AUX2,FIXVAL,GRND)
   VAL=SIN(RG(2)*XG2D)
COVAL(EXACT,AUX3,FIXVAL,GRND)
   VAL=AUX1+AUX2+AUX3
COVAL(EXACT,EXCT,FIXVAL,GRND)
      * Exact solution for output
STORE(EXAC)
   EXAC=1.+XG2D+(XG2D)**2+EXP(-RG(1)*(1.-XG2D))+$
    SIN(RG(2)*XG2D)
  PLANTEND

    GROUP 15. Termination of sweeps
LSWEEP=10
    GROUP 16. Termination of iterations
RESREF(C1)=1.e-02
    GROUP 19. Data communicated by satellite to GROUND
NAMSAT=MOSG
    GROUP 20. Preliminary print-out
    GROUP 21. Print-out of variables
OUTPUT(EXCT,Y,N,N,N,N,N)
OUTPUT(AUX1,N,N,N,N,N,N)
OUTPUT(AUX2,N,N,N,N,N,N)
OUTPUT(AUX3,N,N,N,N,N,N)
    GROUP 22. Spot-value print-out
IXMON=12
    GROUP 24. Dumps for restarts
tstswp=-1
dmpstk=t
DISTIL=T
EX(U1)=1.000E+00; EX(C1)=3.107E+00
EX(EXAC)=3.104E+00; EX(EXCT)=3.104E+00
 LIBREF=112
STOP