TEXT(Wave Propagation - 1D Scalar      
TITLE
 
  DISPLAY
    Example to show the differences between implicit
    and explicit formulation of a transient problem.
    (The boolean variable IMPLICIT may be used to
    switch between the two cases)
  ENDDIS
 
    Run 1. X direction
REAL(VEL);BOOLEAN(IMPLICIT);IMPLICIT=F;VEL=1.0
    GROUP 2,3,4,5. Transience and grid specification
STEADY=F;LSTEP=1;NX=20;XULAST=1
  For stability: deltaT*velocity/deltaX .LE. 1
  deltaT = tlast/lstep and deltaX = xulast/nx
TLAST=(XULAST*LSTEP)/(NX*VEL)
GRDPWR(T,LSTEP,TLAST,1.0);GRDPWR(X,NX,XULAST,1.0)
    GROUP 7. Variables stored, solved and named
STORE(P1,U1);SOLVE(SCAL)
IF(IMPLICIT) THEN
+ SOLUTN(SCAL,P,P,Y,P,N,P)
ELSE
+ SOLUTN(SCAL,P,P,Y,P,Y,P)
ENDIF
    GROUP 8. Terms (in differential equations) & devices
TERMS(SCAL,P,P,N,P,P,P)
    GROUP 11. Initialization of variable or porosity fields
FIINIT(SCAL)=0.0;FIINIT(P1)=0.0;FIINIT(U1)=VEL
PATCH(INI1,INIVAL,5,10,1,NY,1,1,1,LSTEP);INIT(INI1,SCAL,ZERO,1.0)
    GROUP 15. Termination of sweeps
LSWEEP=5
SPEDAT(SET,GXMONI,TRANSIENT,L,F)
    GROUP 21. Spot-value print-out
TSTSWP=1
    GROUP 23. Field print-out and plot control
NTPRIN=1
PATCH(OUTP,PROFIL,1,NX,1,1,1,1,1,LSTEP);PLOT(OUTP,SCAL,0.0,0.0)