TALK=T;RUN( 1, 1)
 
 ************************************************************
   Q1 created by VDI menu, Version 3.6, Date 12/09/05
 CPVNAM=VDI;SPPNAM=Core
  Echo DISPLAY / USE settings
  DISPLAY
  This one-dimensional heat conduction problem tests 
  the correctness of NEWPARSOL solver which gives correct
  result at one iteration.

  The domain is XLENG [m] long in y; object BLOCK is on the right
  side of the domain. The domain material is air, the object
  is steel.
  The object does not fit the grid.
          k1             k2 
      |-------!---|---!-------|
      |       !   |///!///////|
      |   1   ! 2 |///!///3///|
      |       !   |///!///////|
      |-------!---|---!-------|
     z=0        z1=1.5      z2=YLENG

  This case containts several tasks selected by CASENO.
  CASENO=1 - set tem1 0 and flux=1 at west and east boundaries.
  CASENO=2 - fix zero values in left and right,
             set volume source 1 at sunny sub-cell.
  CASENO=3 - fix zero values in left and right,
             set volume source 1 at dark sub-cell.
  CASENO=4 - fix zero values in left and right,
             set volume source 1 at sunny and dark sub-cells.
  CASENO=5 - set value 0 at low and high boundaries,
             fix value at sunny sub-cell.
  CASENO=6 - set value 0 at low and high boundaries,
             fix value at dark sub-cell.
  CASENO=7 - set value 0 at low and high boundaries,
             fix value at sunny and dark sub-cell.
  CASENO=8 - unsteady, fix zero values in left and right,
             initial value 1.
  CASENO=9 - set tem1 0 and 1 at low and high boundaries,
             set volume source 1 at sunny sub-cell.
  CASENO=10- set tem1 0 and 1 at low and high boundaries,
             set volume source 1 at dark sub-cell.
  CASENO=11- set tem1 0 and 1 at low and high boundaries,
             set volume source 1 at sunny dark sub-cell.
  ENDDIS
 ************************************************************
 IRUNN   =         1 ;LIBREF =       705
 ************************************************************
 INTEGER(CASENO)
 
mesg(CASENO=1 - set tem1 0 and flux=1 at west and east boundaries.
mesg(CASENO=2 - fix zero values in left and right,
mesg(             set volume source 1 at sunny sub-cell.
mesg(CASENO=3 - fix zero values in left and right,
mesg(             set volume source 1 at dark sub-cell.
mesg(CASENO=4 - fix zero values in left and right,
mesg(             set volume source 1 at sunny and dark sub-cells.
mesg(CASENO=5 - fix zero values in left and right,
mesg(             fix value at sunny sub-cell.
mesg(CASENO=6 - fix zero values in left and right,
mesg(             fix value at dark sub-cell.
mesg(CASENO=7 - fix zero values in left and right,
mesg(             fix value at sunny and dark sub-cell.
mesg(CASENO=8 - unsteady, fix zero values in left and right,
mesg(           initial value 1.
mesg(CASENO=9 - set tem1 0 and 1 at low and high boundaries,
mesg(           set volume source 1 at sunny sub-cell.       
mesg(CASENO=10- set tem1 0 and 1 at low and high boundaries,
mesg(           set volume source 1 at dark sub-cell.        
mesg(CASENO=11- set tem1 0 and 1 at low and high boundaries,
mesg(           set volume source 1 at sunny dark sub-cell.  
 CASENO=1
mesg(caseno=:caseno: ok? If not, insert required value
readvdu(caseno,int,:caseno:)
caseno
 INTEGER(NCEL,ICUT)
 NCEL=3
mesg(number of cells is :ncel: OK? If not, set other UNEVEN number
readvdu(ncel,int,:ncel:)
ncel
 ICUT=NCEL/2+1 ! Currect number of cut-cell
 REAL(TIMELAST);TIMELAST=1000. ! time, seconds
 REAL(TIMESTEP);TIMESTEP=1.    ! last time step
 REAL(Z1,Z2,ZLENG,ZHALF,Z4,K1,K2)
 ZLENG=3.             ! z size of domain
 Z1=0.5*ZLENG         ! z position of middle
 Z2=ZLENG
 ZHALF=0.5*ZLENG/NCEL ! Half size of cell
 Z4=0.5*ZHALF
 REAL(DEL);DEL=1.5*ZHALF
 K1=0.0258
 k2=43.
 REAL(FLX); FLX=1.0 ! flux at boundary ix=nx
 REAL(LINK); LINK=1./(.5*ZHALF/K1+.5*ZHALF/K2)
 REAL(TEM0);TEM0=0.0
 INTEGER(NUMMAT);NUMMAT=111
 REAL(SOURC,SSOURC,DSOURC); sourc=1.0  ! source value
 ssourc=sourc*zhalf; dsourc=sourc*zhalf ! source value in sub-cells
 REAL(SVAL,DVAL);SVAL=1.;DVAL=1.
 IF(CASENO.EQ.5) THEN
+  SVAL=ssourc/(K1/DEL+LINK)/(1-LINK*LINK/(K1/DEL+LINK)/(K2/DEL+LINK))
+  DVAL=LINK*ssourc/((K1/DEL+LINK)*(K2/DEL+LINK)-LINK*LINK)
 ENDIF
 IF(CASENO.EQ.6) THEN
+  SVAL=dsourc/LINK/((K1/DEL/LINK+1)*(K2/DEL/LINK+1)-1)
+  DVAL=(K1/DEL/LINK+1)*dsourc/LINK/((K1/DEL/LINK+1)*(K2/DEL/LINK+1)-1)
 ENDIF
 IF(CASENO.EQ.7) THEN
+  SVAL=(ssourc*(K2/DEL+LINK)+dsourc*LINK)/((K1/DEL+LINK)$
*(K2/DEL+LINK)-LINK*LINK)
+  DVAL=(dsourc*(K1/DEL+LINK)+ssourc*LINK)/((K1/DEL+LINK)$
*(K2/DEL+LINK)-LINK*LINK)
 ENDIF
 REAL(T0OB);T0OB=TEM0  ! Initial value of dark part of sub-cell
 IF(CASENO.EQ.8) THEN
+  T0OB=1.0
 real(at,ct,f0,g0,scof,dcof)
 f0=t0ob; g0=t0ob  ! initial values at sunny and dark sub-cells
 at=1.189*1005*zhalf/(timelast-tfirst)/timestep  ! rho+s*cp_s*vol/del_time
 ct=7800*473*zhalf/(timelast-tfirst)/timestep    ! rho_d*cp_d*vol/del_time
 real(delt);delt=(tlast-tfirst)/lstep
 scof=k1/del+link+at
 dcof=k2/del+link+ct
+ SVAL=(at*f0*dcof+ct*g0*link)/(scof*dcof-link*link)
+ DVAL=(ct*g0*scof+at*f0*link)/(scof*dcof-link*link)
 ENDIF
  Group 1. Run Title
 TEXT(NEWPARSOL, 1D heat-conduction in z dir
 ************************************************************
  Group 2. Transience
 STEADY  =    T
 IF(CASENO.EQ.8) THEN
+  STEADY=F
 ENDIF
    * Set overall time and no. of steps
 RSET(U,0.000000E+00,TIMELAST,TIMESTEP)
 ************************************************************
  Groups 3, 4, 5  Grid Information
    * Overall number of cells, RSET(M,NX,NY,NZ,tolerance)
 RSET(M,1,1,NCEL)
 ************************************************************
  Group 6. Body-Fitted coordinates
 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ONEPHS  =    T
    * Non-default variable names
 NAME(148) =TEM1 ; NAME(150) =PRPS
    * Solved variables list
 SOLVE(TEM1)
    * Stored variables list
 STORE(PRPS,KOND)
 STORE(DVAR,DRES,DCOR) ! newparsol solution at dark
 STORE(RST1,CRT1,APT1,AET1,AWT1)
 STORE(S_EX,D_EX) ! exact solution at sunny and dark
 STORE(SE/S,DE/D) ! exact/newparsol_solution for sunny and dark
    * Additional solver options
 SOLUTN(TEM1,Y,Y,Y,N,N,Y)
  inform7begin
 (stored var rst1 is resi(tem1))
 (stored var crt1 is corr(tem1))
 (stored var apt1 is apco(tem1))
 (stored var aet1 is aeco(tem1))
 (stored var awt1 is awco(tem1))

 if(caseno.eq.1) then
 (stored s_ex is zg*flx/k1 with if(zg<=z1))
 (stored s_ex is (zg-z1)*flx/k2+flx*z1/k1 with if(zg>z1))
 patch(sunycell,cell,1,nx,1,ny,icut,icut,1,1)
 (stored s_ex at sunycell is .5*(z1+zw[,,-1])*flx/k1) ! sunny part of cut-cell
 (stored d_ex at sunycell is zhalf*flx/k2+flx*z1/k1) ! dark part of cut-cell
 endif
 if(caseno.eq.2) then
 (stored s_ex is ssourc/(K1/DEL+LINK)/(1.-LINK*LINK/(K1/DEL+LINK)/$
(K2/DEL+LINK)) with if(iz=icut))
 (stored d_ex is LINK*ssourc/((K1/DEL+LINK)*(K2/DEL+LINK)-LINK*LIN$
K) with if(iz=icut))
 endif
 if(caseno.eq.3) then
 (stored s_ex is dsourc/LINK/((K1/DEL/LINK+1)*(K2/DEL/LINK+1)-1.) $
with if(iz=icut))
 (stored d_ex is (K1/DEL/LINK+1)*dsourc/LINK/((K1/DEL/LINK+1)*(K2/$
DEL/LINK+1)-1.) with if(iz=icut))
 endif
 if(caseno.eq.4) then
 (stored s_ex is (ssourc*(K2/DEL+LINK)+dsourc*LINK)/((K1/DEL+LINK)$
*(K2/DEL+LINK)-LINK*LINK) with if(iz=icut))
 (stored d_ex is (dsourc*(K1/DEL+LINK)+ssourc*LINK)/((K1/DEL+LINK)$
*(K2/DEL+LINK)-LINK*LINK) with if(iz=icut))
 endif
 if(caseno.eq.5) then
 (stored s_ex is sval with if(iz=icut))
 (stored d_ex is dval with if(iz=icut))
 endif
 if(caseno.eq.6) then
 (stored s_ex is sval with if(iz=icut))
 (stored d_ex is dval with if(iz=icut))
 endif
 if(caseno.eq.7) then
 (stored s_ex is sval with if(iz=icut))
 (stored d_ex is dval with if(iz=icut))
 endif
 if(caseno.eq.8) then
 (stored s_ex is sval with if(iz=icut))
 (stored d_ex is dval with if(iz=icut))
 endif
 if(caseno.ge.9.and.caseno.le.11) then
+ if(caseno.eq.9) then
+   dsourc=0.
+ endif
+ if(caseno.eq.10) then
+   ssourc=0.
+ endif
 real(scut,dcut)
 scut=ssourc+link*(dsourc+k2/(z1-z4))/(link+k2/(z1-z4))
 scut=scut/(link+k1/(z1-z4)-link*link/(link+k2/(z1-z4)))
 dcut=(scut*link+dsourc+k2/(z1-z4))/(link+k2/(z1-z4))
 (stored d_ex is dcut with if(iz=icut))
 flx=scut*k1/(z1-z4)
 (stored s_ex is flx*zg/k1 with if(zg<=z1))
 flx=(dcut-1.)*k2/(z1-z4)
 (stored s_ex is dcut-flx*(zg-z1-z4)/k2 with if(zg>z1))
 (stored s_ex is scut with if(iz=icut))
 endif

 (stored var SE/S is s_ex/tem1 with if(tem1!=0.)!swpfin)
 (stored var DE/D is d_ex/dvar with if(dvar!=0.)!swpfin)
  inform7end
 ************************************************************
  Group 8. Terms & Devices
 ************************************************************
  Group 9. Properties
 PRESS0  = 1.000000E+05 ;TEMP0  = 2.730000E+02
 
   * Domain material is: 0   Air at 20 deg C, 1 atm, treated as i
 SETPRPS(1, 0)
 ENUT    = 0.000000E+00
 DVO1DT  = 3.410000E-03
 PRNDTL(TEM1) = -K1
 ************************************************************
  Group 10.Inter-Phase Transfer Processes
 ************************************************************
  Group 11.Initialise Var/Porosity Fields
 FIINIT(PRPS) = -1.000000E+00
 FIINIT(TEM1) = TEM0
 FIINIT(DVAR) = -1.234E-11
 FIINIT(DRES) = -1.234E-11
 FIINIT(DCOR) = -1.234E-11
 FIINIT(S_EX) = 0.; FIINIT(D_EX) = 0.
 FIINIT(SE/S) = 0.; FIINIT(DE/D) = 0.

 IF(CASENO.EQ.8) THEN
+  PATCH(INIT1,INIVAL,1,nx,1,ny,icut,icut,1,1)
+  COVAL(INIT1,TEM1, 1.000000E+00, T0OB)
 ENDIF

 INIADD  =    F
 ************************************************************
  Group 12. Convection and diffusion adjustments
   No PATCHes used for this Group
 ************************************************************
  Group 13. Boundary & Special Sources
  ! Set values 0 and 1 at west and east boundaries
 IF(CASENO.EQ.1) THEN
+ PATCH(LWAL    ,LWALL ,1,nx,1,ny,1,1,1,1)
+ COVAL(LWAL    ,TEM1, 1.000000E+00, 0.000000E+00)
+ PATCH(HFLUX   ,HIGH  ,1,nx,1,ny,nz,nz,1,1)
+ COVAL(HFLUX   ,TEM1, FIXFLU, 1.000000E+00)
 ENDIF
 IF(CASENO.GT.1.AND.CASENO.LE.8) THEN ! Fix zero values in 1 and nx cells
+ PATCH(lfix    ,VOLUME,1,nx,1,ny,1,icut-1,1,LSTEP)
+ COVAL(lfix    ,TEM1, FIXval      , 0.0)
+ PATCH(hfix    ,VOLUME,1,nx,1,ny,icut+1,nz,1,LSTEP)
+ COVAL(hfix    ,TEM1, FIXval      , 0.0)
 ENDIF
 IF(CASENO.EQ.2.OR.CASENO.EQ.4) THEN ! Set source in sunny sub-cell
+ PATCH(SNYFLUX ,VOLUME,1,nx,1,ny,icut,icut,1,LSTEP)
+ COVAL(SNYFLUX ,TEM1, FIXFLU      , SVAL)
 ENDIF
 IF(CASENO.EQ.5) THEN ! Fix value in sunny sub-cell
+ PATCH(SNYFLUX ,VOLUME,1,nx,1,ny,icut,icut,1,LSTEP)
+ COVAL(SNYFLUX ,TEM1, FIXVAL      , SVAL)
 ENDIF
 IF(CASENO.EQ.7) THEN ! Fix value in sunny sub-cell
+ PATCH(SNYFLUX ,VOLUME,1,nx,1,ny,icut,icut,1,LSTEP)
+ COVAL(SNYFLUX ,TEM1, FIXVAL      , SVAL)
 ENDIF
 IF(CASENO.GE.9.AND.CASENO.LE.11) THEN ! Set boundary conditions
+ PATCH(LWAL    ,LWALL ,1,nx,1,ny,1,1,1,1)
+ COVAL(LWAL    ,TEM1, 1.000000E+00, 0.000000E+00)
+ PATCH(HWAL    ,HWALL ,1,nx,1,ny,nz,nz,1,1)
+ COVAL(HWAL    ,TEM1, 1.000000E+00, 1.000000E+00)
 ENDIF
 IF(CASENO.EQ.9.OR.CASENO.EQ.11) THEN ! Set source in sunny sub-cell
+ PATCH(SNYFLUX ,VOLUME,1,nx,1,ny,icut,icut,1,LSTEP)
+ COVAL(SNYFLUX ,TEM1, FIXFLU      , SVAL)
 ENDIF
 EGWF    =    T
 ************************************************************
  Group 14. Downstream Pressure For PARAB
 ************************************************************
  Group 15. Terminate Sweeps
 LSWEEP  =        1
 RESFAC  = 1.000000E-03
 ************************************************************
  Group 16. Terminate Iterations
 LITER (TEM1) = 1
 IF(CASENO.EQ.1) THEN
+ LITER (TEM1) = 2
 ENDIF
 IF(CASENO.EQ.3.OR.CASENO.EQ.4) THEN
+ LITER (TEM1) = 2
 ENDIF
 IF(CASENO.EQ.6.OR.CASENO.EQ.7.OR.CASENO.EQ.8) THEN
+ LITER (TEM1) = 2
 ENDIF
 IF(CASENO.EQ.10.OR.CASENO.EQ.11) THEN
+ LITER (TEM1) = 2
 ENDIF
 ************************************************************
  Group 17. Relaxation
 relax(tem1,falsdt,1.E10)
 ************************************************************
  Group 18. Limits
 ************************************************************
  Group 19. EARTH Calls To GROUND Station
 USEGRD  =    T  ;USEGRX =    T
 ASAP    =    T
 PARSOL  =    T
 SPEDAT(SET,GXMONI,TRANSIENT,L,F)
 ************************************************************
  Group 20. Preliminary Printout
 ECHO    =    T
 DISTIL  =    T  ;NULLPR =    F
 NDST    =         0
 DSTTOL  = 1.000000E-02
 EX    (TEM1) =  0.000000E+00 ;EX    (PRPS) =  3.354000E+00
 ************************************************************
  Group 21. Print-out of Variables
 ************************************************************
  Group 22. Monitor Print-Out
 IXMON   =         1 ;IYMON  =         1 ;IZMON  =        -3
 NPRMON  =    100000
 NPRMNT  =         1
 TSTSWP  =        -1
 ************************************************************
  Group 23.Field Print-Out & Plot Control
 NPRINT  =    100000
 NTPRIN  =       100 ;ISTPRF =         1 ;ISTPRL =     10000
 NXPRIN  =         1
 ISWPRF  =         1 ;ISWPRL =    100000
 
 PATCH (PLOT    ,PROFIL,1,NX,1,1,1,1,1,1)
 PLOT(PLOT    ,TEM1, 0.000000E+00, 0.000000E+00)
 ************************************************************
  Group 24. Dumps For Restarts
 
 GVIEW(P,0.000000E+00,0.000000E+00,1.000000E+00)
 GVIEW(UP,0.000000E+00,1.000000E+00,0.000000E+00)
 
> DOM,    SIZE,        1.000000E+00, 1.000000E+00, Z2
> DOM,    MONIT,       1.000000E+00, 1.000000E+00, Z1
> DOM,    SCALE,       1.000000E+00, 1.000000E+00, 1.000000E+00
> DOM,    SNAPSIZE,    1.000000E-02
> GRID,   RSET_X_1,      1, 1.000000E+00
> GRID,   RSET_Y_1,      1, 1.000000E+00
> GRID,   RSET_Z_1,      NCEL, 1.000000E+00

> OBJ,    NAME,        BLOCK
> OBJ,    POSITION,    0.000000E+00, 0.000000E+00, Z1
> OBJ,    SIZE,        1.000000E+00, 1.000000E+00, ZHALF
> OBJ,    GEOMETRY,    cube4
> OBJ,    ROTATION24,        1
> OBJ,    GRID,        NO
> OBJ,    TYPE,        BLOCKAGE
> OBJ,    MATERIAL,    NUMMAT
> OBJ,    TIME_LIMITS,   ALWAYS_ACTIVE
> OBJ,    INI_TEMP,    T0OB
 IF(CASENO.EQ.3.OR.CASENO.EQ.4) THEN
> OBJ,    HEAT_FLVX,    0.000000E+00, DVAL
 ENDIF
 IF(CASENO.EQ.6.OR.CASENO.EQ.7) THEN
> OBJ,    FIXED_TMP,    0.000000E+00, DVAL
 ENDIF
 IF(CASENO.EQ.10.OR.CASENO.EQ.11) THEN
> OBJ,    HEAT_FLVX,    0.000000E+00, DVAL
 ENDIF
  
> OBJ,    NAME,        BLOCK2
> OBJ,    POSITION,    0.000000E+00, 0.000000E+00, Z1+ZHALF
> OBJ,    SIZE,        1.000000E+00, 1.000000E+00, Z2-Z1-ZHALF
> OBJ,    GEOMETRY,    cube4
> OBJ,    ROTATION24,        1
> OBJ,    GRID,        NO
> OBJ,    TYPE,        BLOCKAGE
> OBJ,    MATERIAL,    NUMMAT
> OBJ,    TIME_LIMITS,   ALWAYS_ACTIVE
> OBJ,    INI_TEMP,    0.

  PHOTON USE
  AUTOPLOT USE
  file                                                                            
  phi 5

  d 1 tem1;d 1 dvar;Col1 1;Col2 2;blb4 1;blb2 2;Redr
  text
  1
  1
  Temperature in structured storage
   0.9E+03 0.28E+04 CR
  text
  1
  2
  Temperature in dark sub-cells
   0.9E+03 0.27E+04 CR
  msg Press any key to END
  pause
  ENDUSE
STOP                                                              
 isg60=1      ! set active NewParsol