TALK=F;RUN( 1, 1)
CPVNAM=VDI;SPPNAM=Core
TEXT(XY Duct, USP Test )

title
  DISPLAY 
    This case solves a two-dimensional steady hydrodynamics
    problem about laminar flow in plane channel.
    This task has well-known solution as Poiseuille's law
    Length of channel is 1 m, height of channel is 0,02 m
  ENDDIS
  save1begin  
REAL(X1,X2,Y1,Y2,DTF,VISC,UAVE,RHO)
REAL(REYNO)
NX = 100
NY = 20
NZ = 1
X1=0.;X2=1.0
Y1=0.;Y2=0.02
VISC = 1.E-5
UAVE = 0.01
RHO = 1.
REYNO = UAVE*Y2/VISC

REYNO = 200.

UAVE = REYNO*VISC/Y2
  save1end

LSWEEP=3000
mesg(U average = :UAVE:
BOOL(log1)
log1 = F
mesg(Do you want to use exact solution as inital one? (y/n)
readvdu(ans,char,n)
if(:ans:.eq.y)then
log1 = T
endif


RSET(M,NX,NY,NZ)
RSET(D,DOM,X2,Y2,1.)
 
ENUL=VISC
RHO1=RHO
SOLVE(P1,U1,V1)
STORE(EXP1,EXU1)

TERMS (U1 ,Y,Y,Y,N,N,N)
TERMS (V1 ,Y,Y,Y,N,N,N)

  save2begin
REAL(XCOR,DXC,YCOR,DYC,U1C,P1C,HY,P1AVE)
DYC=2./NY
DXC=X2/NX
HY=Y2*0.5


    Following commands set the initial fields and inlet boundary source
DO JJ=1,NY
+ YCOR=0.5*DYC+(JJ-1)*DYC-1
+ U1C = 1.5*UAVE*(1-YCOR*YCOR)
+ PATCH(IV:JJ:,INIVAL,1,NX,:JJ:,:JJ:,1,NZ,1,1)
+IF(log1)THEN
+ INIT(IV:JJ:,U1,0.0,U1C)
+ INIT(IV:JJ:,V1,0.0,0.0)
+ENDIF
+ INIT(IV:JJ:,EXU1,0.0,U1C)
+ PATCH(IN:JJ:,WEST,1,1,:JJ:,:JJ:,1,NZ,1,1)
+ COVAL(IN:JJ:,P1,FIXFLU,U1C*RHO)
+ COVAL(IN:JJ:,U1,ONLYMS,U1C)
+ COVAL(IN:JJ:,V1,ONLYMS,0.)
ENDDO

P1AVE = 1.5*RHO*VISC*UAVE*X2/(HY*HY)
DO II=1,NX
+ XCOR=0.5*DXC+(II-1)*DXC
+ P1C = 3*RHO*VISC*UAVE*(X2-XCOR)/(HY*HY)
+ PATCH(IP:II:,INIVAL,:II:,:II:,1,NY,1,NZ,1,1)
+IF(log1)THEN
+ INIT(IP:II:,P1,0.0,P1C)
+ENDIF
+ INIT(IP:II:,EXP1,0.0,P1C)
ENDDO
  save2end
PARSOL = F
  SAVE7BEGIN
 
    ******** Test In-Form ******
(STORED of EXU1 is 1.5*UAVE*(1-((YG-HY)/HY)^2))
(STORED of EXP1 is 3*RHO*VISC*UAVE*(X2-XG)/(HY*HY))
(STORED of DU1 is EXU1-U1)
 
  SAVE7END

PATCH(OUTLET,EAST,NX,NX,1,NY,1,1,1,1)
COVAL(OUTLET,P1, 1.0E+3 ,0.0)
NONORT=T
     ========= Walls =====================
PATCH(WALL1,SWALL,1,NX,1,1,1,1,1,1)
COVAL(WALL1,U1,1.,0.0)
COVAL(WALL1,V1,1.,0.0)

PATCH(WALL2,NWALL,1,NX,NY,NY,1,1,1,1)
COVAL(WALL2,U1,1.,0.0)
COVAL(WALL2,V1,1.,0.0)

     ========= Relaxations =====================
DTF=1.E+05
RELAX(P1,LINRLX,0.8)

RELAX(U1,FALSDT,DTF)
RELAX(V1,FALSDT,DTF)

SELREF = T; RESFAC =1.0E-6
ECHO=F;IXMON=NX-1;IYMON=NY/2
TSTSWP=-1
NXPRIN= 1; NYPRIN=1

      Usp related variables

INTEGER(LEVEL)
LEVEL = 0
mesg(Level of coarsening is :LEVEL:
mesg(Do you want to change it? (y/n)
readvdu(ans,char,n)
if(:ans:.eq.y)then
 mesg(Enter level of coarsening
 readvdu(LEVEL,int,LEVEL)
 mesg(New level of coarsening is :LEVEL:
endif

USP    = T
UAUTO  = F
USPDBG = F
UTCPLT = F
USPVTK= T
USPIMB = F
MXLEV  = LEVEL 
MYLEV  = LEVEL
MZLEV  = LEVEL
DOMAT  = -1
MINPRP = -1
MAXPRP = 250
CELLST = 10
FACEST = 10
USPREL = 0.6
UGRITR = 5
UMXLEV = 0
PARSOL = F
ISG62 = 0
ISG60 = 1
mesg(Do you want to use collocated arrangement (y) or staggered one (n)? (y/n)
readvdu(ans,char,n)
if(:ans:.eq.y)then
 SPEDAT(SET,USP,METHOD,I,1)
 RELAX(P1  ,LINRLX, 4.000000E-01)
 RELAX(U1  ,FALSDT, 1.000000E-01)
 RELAX(V1  ,FALSDT, 1.000000E-01)
mesg(Do you want to use SIMPLEST (y) or SIMPLE (n)? (y/n)
readvdu(ans,char,n)
if(:ans:.eq.y)then
 SPEDAT(SET,USP,SIMPLEST,L,T)
endif

endif

SPEDAT(SET,USPVTK,GRADOUT,C,U1)

mesg(Do you want to view results in the centres of cells? (y/n)
readvdu(ans,char,n)
if(:ans:.eq.y)then
SPEDAT(SET,USPIO,VERTCENT,L,F)
endif



> DOM,    SIZE,        X2, Y2, 1.000000E+00
> DOM,    MONIT,       9.000000E-01, 0.100000E+00, 5.000000E-01
> DOM,    SCALE,       1.000000E+00, 1.000000E+00, 1.000000E+00
> DOM,    SNAPSIZE,    1.000000E-02

if(LEVEL.gt.0)then
> OBJ,    NAME,        B1
> OBJ,    POSITION,    3.000000E-01, 0.000000E+00, 0.000000E+00
> OBJ,    SIZE,        3.200000E-01, 1.600000E-02, 1.000000E+00
> OBJ,    GEOMETRY,    fine
> OBJ,    ROTATION24,        1
> OBJ,    TYPE,        FINE_GRID_VOL
> OBJ,    LEVELS,       0.000000E+00, 0.000000E+00, 0.000000E+00
> OBJ,    AXES,        IXY
endif

if(LEVEL.gt.1)then
> OBJ,    NAME,        B2
> OBJ,    POSITION,    3.600000E-01, 0.000000E+00, 0.000000E+00
> OBJ,    SIZE,        1.600000E-01, 0.800000E-02, 1.000000E+00
> OBJ,    GEOMETRY,    fine
> OBJ,    ROTATION24,        1
> OBJ,    TYPE,        FINE_GRID_VOL
> OBJ,    LEVELS,       1.000000E+00, 1.000000E+00, 1.000000E+00
> OBJ,    AXES,        IXY
endif
STOP