TALK=F;RUN( 1, 1)

  PHOTON USE
  p
 
 
 
  up y
  VIEW 1 1 1
  red
  msg pressure contours at ground level
  con p1 y 1 fi;0.1
  set por off
  pause
  gr ou x 1
  gr ou y 1
  gr z 1
  pause
  msg a smoke plume
  surf smok y; 0.005
  surf smok x; 0.005
  surf smok z; 0.005
  msg press return to view from the top
  pause
  gr off
  view y
  msg press return to view from the side
  pause
  con off
  view x
  msg press return to view from the end
  pause
  con off
  view z
  enduse
 
INTEGER(GRD)
MESG(
MESG(
MESG(
MESG(       3D FLOW AROUND A GROUP OF BUILDINGS
MESG(
MESG(
MESG( This case illustrates the large speed-up that MIGAL  
MESG( produces for 3D flows when the number of cells increases.
MESG( From library case 607.
MESG(
MESG(
MESG(
MESG( Enter required grid ID :  1 - 15x10x48 (default)
MESG(                           2 - 30x20x48 
MESG(                           3 - 30x20x96 
MESG(                           4 - 30x20x192 
MESG(
READVDU(GRD,INT,1)
INTEGER(NPLA)
CASE GRD
WHEN 1
+ NX=15 
+ NY=10 
+ NZ=48 
WHEN 2
+ NX=30 
+ NY=20 
+ NZ=48 
WHEN 3
+ NX=30 
+ NY=20 
+ NZ=96 
WHEN 4
+ NX=30 
+ NY=20 
+ NZ=192 
WHEN 5
+ NX=60 
+ NY=40 
+ NZ=48 
ENDCASE

INTEGER(SLV)
MESG( Enter required solver ID :  1 - MIGAL (default)
MESG(                             2 - SIMPLEST 
MESG(
READVDU(SLV,INT,1)
 
IF(SLV.EQ.1) THEN
+ TEXT(Flow Around Buildings : MIGAL
ENDIF
IF(SLV.EQ.2) THEN
+ TEXT(Flow Around Buildings : SIMPLEST
ENDIF

  Groups 3, 4, 5  Grid Information

    * Overall number of cells, RSET(M,NX,NY,NZ,tolerance)
 RSET(M,NX,NY,NZ)
    * Overall domain extent, RSET(D,name,XULAST,YVLAST,ZWLAST)
 RSET(D,CHAM,1.5E+01,1.0E+01,4.8E+01)
    * Set objects: name  x0       y0        z0
    *                    dx       dy        dz
 RSET(B,X1, 2, 0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E+01, 1.E+01, 0.0)
 RSET(B,Z11     , 0.0, 0.0, 3.2E+01  ,1.5E+01, 1.E+01, 0.0)
 RSET(B,Z12     , 0.0, 0.0, 3.6E+01  , 1.5E+01, 1.E+01, 0.0)
 RSET(B,Z13     , 0.0, 0.0, 4.E+01  ,    1.5E+01, 1.E+01, 0.0)
 RSET(B,Z14     , 0.0, 0.0, 4.2E+01  , 1.5E+01, 1.E+01, 0.0)
 RSET(B,Z15     , 0.0, 0.0, 4.4E+01  , 1.5E+01, 1.E+01, 0.0)
 RSET(B,GROUND  , 0.0, 0.0, 0.0  ,    1.5E+01, 0.0, 4.8E+01)
 RSET(B,SKY     , 0.0, 1.E+01, 0.0  ,    1.5E+01, 0.0, 4.8E+01)
 RSET(B,LOWIN1  , 0.0, 0.0, 0.0  ,    1.5E+01, 1.E+01, 0.0)
 RSET(B,WESTIN2 , 0.0, 0.0, 0.0  ,    0.0, 1.E+01, 4.8E+01)
 RSET(B,HIGHOT1 , 0.0, 0.0, 4.8E+01  , 1.5E+01, 1.E+01, 0.0)
 RSET(B,EASTOT2 , 1.5E+01, 0.0, 0.0  , 0.0, 1.E+01, 4.8E+01)
 RSET(B,SUBD-Z1 , 0.0, 0.0, 0.0  ,    1.5E+01, 1.E+01, 1.2E+01)
 RSET(B,SUBD-Z2 , 0.0, 0.0, 1.2E+01  , 1.5E+01, 1.E+01, 1.2E+01)
 RSET(B,SUBD-Z3 , 0.0, 0.0, 2.4E+01  , 1.5E+01, 1.E+01, 1.2E+01)
 RSET(B,SUBD-Z4 , 0.0, 0.0, 3.6E+01  , 1.5E+01, 1.E+01, 1.2E+01)
    * Modify default grid
 
CASE GRD
WHEN 1
+ RSET(X,1,2,1.0)
+ RSET(X,2,1,1.0)
+ RSET(X,3,1,1.0)
+ RSET(X,4,2,1.0)
+ RSET(X,5,2,1.0)
+ RSET(X,6,2,1.0)
+ RSET(X,7,1,1.0)
+ RSET(X,8,2,1.0)
+ RSET(X,9,2,1.0)
+ RSET(Y,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,4,8,1.0)
+ RSET(X,5,8,1.0)
+ RSET(X,6,8,1.0)
+ RSET(X,7,4,1.0)
+ RSET(X,8,8,1.0)
+ RSET(X,9,8,1.0)
+ RSET(Y,1,12,1.0)
+ RSET(Y,2,4,1.0)
+ RSET(Y,3,4,1.0)
+ RSET(Y,4,12,1.0)
+ RSET(Y,5,8,1.0)
+ RSET(Z,1,4,1.0)
+ RSET(Z,2,2,1.0)
+ RSET(Z,3,2,1.0)
+ RSET(Z,4,4,1.0)
+ RSET(Z,5,4,1.0)
+ RSET(Z,6,2,1.0)
+ RSET(Z,7,2,1.0)
+ RSET(Z,8,4,1.0)
+ RSET(Z,9,4,1.0)
+ RSET(Z,10,2,1.0)
+ RSET(Z,11,2,1.0)
+ RSET(Z,12,4,1.0)
+ RSET(Z,13,4,1.0)
+ RSET(Z,14,2,1.0)
+ RSET(Z,15,2,1.0)
+ RSET(Z,16,4,1.0)
ENDCASE

 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ONEPHS  =    T
    * Solved variables list
 SOLVE(P1  ,U1  ,V1  ,W1  ,smok)
    * Stored variables list
 STORE(VPOR)
    * Additional solver options
 SOLUTN(P1  ,Y,Y,Y,N,N,N)
 SOLUTN(SMOK,Y,Y,Y,N,N,N)
  Group 8. Terms & Devices
  Group 9. Properties
 RHO1    = 1.0
 PRESS0  = 1.E+05
 ENUL    = 1.E-05 ;ENUT   = 1.0
  Group 11.Initialise Var/Porosity Fields
 FIINIT(U1  ) =  5. ;FIINIT(V1  ) =  0.0
 FIINIT(W1  ) =  5. ;FIINIT(VPOR) =  1.0
 
 CONPOR(S1B1    ,  0.00,CELL  ,#3,#4,#1,#2,#2,#2)
 CONPOR(S1B2    ,  0.00,CELL  ,#2,#3,#1,#3,#3,#3)
 CONPOR(S1B3    ,  0.00,CELL  ,#6,#7,#1,#2,#2,#2)
 CONPOR(S1B4    ,  0.00,CELL  ,#7,#8,#1,#3,#3,#3)
 CONPOR(S2B1    ,  0.00,CELL  ,#5,#5,#1,#4,#5,#5)
 CONPOR(S2B2    ,  0.00,CELL  ,#4,#6,#1,#2,#6,#6)
 CONPOR(S3B1    ,  0.00,CELL  ,#2,#3,#1,#1,#8,#8)
 CONPOR(S3B2    ,  0.00,CELL  ,#7,#8,#1,#1,#8,#8)
 CONPOR(S34B1   ,  0.00,CELL  ,#2,#2,#1,#1,#9,#11)
 CONPOR(S34B2   ,  0.00,CELL  ,#8,#8,#1,#1,#9,#11)
 CONPOR(S34B3   ,  0.00,CELL  ,#5,#5,#1,#4,#10,#10)
 CONPOR(S4B1    ,  0.00,CELL  ,#2,#3,#1,#1,#12,#12)
 CONPOR(S4B2    ,  0.00,CELL  ,#7,#8,#1,#1,#12,#12)
 
 INIADD  =    F
  Group 13. Boundary & Special Sources
 
 PATCH (GROUND  ,SOUTH ,#1,#9,#1,#1,#1,#16,1,1)
 
 PATCH (SKY     ,NORTH ,#1,#9,#5,#5,#1,#16,1,1)
 COVAL (SKY     ,P1  , 1.0, 0.0)
 
 INLET (LOWIN1  ,LOW   ,#1,#9,#1,#5,#1,#1,1,1)
 VALUE (LOWIN1  ,P1  , 7.070)
 VALUE (LOWIN1  ,U1  , 5.)
 VALUE (LOWIN1  ,W1  , 5.)
 
 INLET (WESTIN2 ,WEST  ,#1,#1,#1,#5,#1,#16,1,1)
 VALUE (WESTIN2 ,P1  , 7.070)
 VALUE (WESTIN2 ,U1  , 5.)
 VALUE (WESTIN2 ,W1  , 5.)
 
 PATCH (HIGHOT1 ,HIGH  ,#1,#9,#1,#5,#16,#16,1,1)
 COVAL (HIGHOT1 ,P1  , 1.0, 0.0)
 
 PATCH (EASTOT2 ,EAST  ,#9,#9,#1,#5,#1,#16,1,1)
 COVAL (EASTOT2 ,P1  , 1.0,0.0)
 
 patch(chimney,cell,1,1,ny/2,ny/2,1,1,1,1)
 coval(chimney,smok,fixval,1.0)
 
  Group 15. Terminate Sweeps
CASE GRD
WHEN 1
+ LSWEEP = 200
WHEN 2
+ LSWEEP = 280 
WHEN 3
+ LSWEEP = 400 
WHEN 4
+ LSWEEP = 1000 
ENDCASE

RESFAC  = 1.E-02

selref=F;
resref(P1)=1.E-1;
resref(U1)=1.E-1;
resref(V1)=1.E-1;
resref(W1)=1.E-1;
resref(SMOKE)=1.E-4;

  Group 16. Terminate Iterations
LITER(P1)=100
  Group 17. Relaxation
RELAX(P1  ,LINRLX, 1.0) 
CASE GRD
WHEN 1
+ RELAX(U1  ,FALSDT, 1.E+5)
+ RELAX(V1  ,FALSDT, 1.E+5)
+ RELAX(W1  ,FALSDT, 1.E+5)
WHEN 2
+ RELAX(U1  ,FALSDT, 1.E+5)
+ RELAX(V1  ,FALSDT, 1.E+5)
+ RELAX(W1  ,FALSDT, 1.E+5)
WHEN 3
+ RELAX(U1  ,FALSDT, 1.E+3)
+ RELAX(V1  ,FALSDT, 1.E+3)
+ RELAX(W1  ,FALSDT, 1.E+3)
WHEN 4
+ RELAX(U1  ,FALSDT, 1.E+3)
+ RELAX(V1  ,FALSDT, 1.E+3)
+ RELAX(W1  ,FALSDT, 1.E+3)
ENDCASE
  Group 21. Print-out of Variables
 OUTPUT(VPOR,N,N,N,Y,N,N)
  Group 22. Monitor Print-Out
CASE GRD
WHEN 1
+ IXMON = 8
+ IYMON = 6
+ IZMON = 10
WHEN 2
+ IXMON = 16
+ IYMON = 12
+ IZMON = 10
WHEN 3
+ IXMON = 16
+ IYMON = 12
+ IZMON = 20
WHEN 4
+ IXMON = 16
+ IYMON = 12
+ IZMON = 40
WHEN 5
+ IXMON = 32
+ IYMON = 24
+ IZMON = 10
ENDCASE
TSTSWP=-1
  Group 23.Field Print-Out & Plot Control
 NZPRIN  =       1
 NPLT    =       1
   No PATCHes used for this Group
  Group 24. Dumps For Restarts
 LIBREF=607
ITABL=3


IF(SLV.EQ.1) THEN
+ relax(u1,falsdt,1.E+10) 
+ relax(v1,falsdt,1.E+10)
+ relax(w1,falsdt,1.E+10)
+ spedat(MIGAL,SOLVED1, c, HYDRO)
+ spedat(MIGAL,LINRLX1, r, 1.)
+ spedat(MIGAL,RELAX1,  r, 0.98)

   Just active these lines to solve the scalar with MIGAL
   + spedat(MIGAL,SOLVED2, c, SMOK)
   + spedat(MIGAL,LINRLX2, r, 1.)
ENDIF

IF(SLV.EQ.1.AND.GRD.EQ.1) THEN
+ spedat(MIGAL,RELAX1,  r, 0.95)
+ spedat(MIGAL,NBGRID1,  i, 1)
+ spedat(MIGAL,LITER1,  i, 1)
+ LSWEEP=30
ENDIF
IF(SLV.EQ.1.AND.GRD.EQ.2) THEN
+ spedat(MIGAL,RELAX1,  r, 0.95)
+ spedat(MIGAL,NBGRID1,  i, 2)
+ spedat(MIGAL,LITER1,  i, 1)
+ LSWEEP=30
ENDIF
IF(SLV.EQ.1.AND.GRD.EQ.3) THEN
+ spedat(MIGAL,RELAX1,  r, 0.95)
+ spedat(MIGAL,NBGRID1, i, 2)
+ spedat(MIGAL,LITER1,  i, 1)
+ LSWEEP=40
ENDIF
IF(SLV.EQ.1.AND.GRD.EQ.4) THEN
+ spedat(MIGAL,RELAX1,  r, 0.95)
+ spedat(MIGAL,NBGRID1,  i, 2)
+ spedat(MIGAL,LITER1,  i, 1)
+ LSWEEP=55
ENDIF
IF(SLV.EQ.1.AND.GRD.EQ.5) THEN
+ spedat(MIGAL,RELAX1,  r, 0.95)
+ spedat(MIGAL,NBGRID1,  i, 2)
+ spedat(MIGAL,LITER1,  i, 1)
+ LSWEEP=45
ENDIF