TALK=T;RUN( 1, 5)                                                  
 ** LOAD(859) from the PHOENICS Input Library                       
                                                                    
                                                                    
  Echo DISPLAY / USE settings                                       
  DISPLAY                                                           
  The purpose of creation of this case is a demonstration           
  of transfer objects feature.                                      
                                                                    
  This example explores the unsteady distribution of pollution      
  on a reasonably large region of ground.                           
                                                                    
  The pollution source is set in the west-low corner and            
  acts only at the first time step. Further the pollution           
  cloud will be distributed by wind.                                
                                                                    
  Use of transfer objects permits the calculation of unidirectional 
  flow on small parts one after another. The solved area in this    
  example is divided into four parts. The solution in each part is  
  made in separate runs.                                            
                                                                    
               ---------------------                                
               !         !         !                                
               !         !         !                                
               ! 3rd run ! 4th run !                                
               !         !         !                                
       W1      !         !         !                                
       -->     ----------+----------                                
               !         !         !                                
               !         !         !                                
               ! 1st run ! 2nd run !                                
               !         !         !                                
        X !    !         !         !                                
          !    ---------------------                                
          !              ^                                          
          !----- Z      /!\                                         
                         !                                          
                         !U1                                        
                                                                    
  The HTR$
O1.. and ETRO1.. transfer objects on the high                   
  and east boundaries are formed at the end of each time step of the
  first run by means of two '(export' In-Form statements. They store
  the values of outlet mass flux and concentration on these         
  boundaries in order to transfer them to the second and third runs.
                                                                    
  The second run reads the information at the low boundary from the 
  HTRO1..$
 objects at the start of each time step by means of '(import    
  In-Form statements and at the end of each time step dumps it at   
  the east boundary in the ETRO2 object.                                 
                                                                    
  The third run reads from the ETRO1 object and writes from the          
  HTRO3 object.                                                          
                                                                    
  The fourth run reads the information from HTRO3 and ETRO2              
  import transfer objects at the low and west boundaries.           
                                                                    
  The wind profile at the inlet boundaries is set by means of       
  In-For$
m statements as a logarithmic velocity profile.                 
                                                                    
  The ground relief (HIG variable) is calculated by an              
  I$
n-Form formula.                                                 
                                                                    
  The MARK variable defined by In-Form is used for the                   
  image of the ground relief in Photon.                             
                                                                    
  The ground roughness is simulated by a change in air density      
  with height in an atmospheric layer. The density of the air is ca$
lculated                                                            
  from a b$
arometric formula by means of In-Form.                          
                                                                    
  The fifth and last run simulates the flow in the whole region     
  without partitioning. It will be useful to compare with the previ$
ous runs.                                                           
                                                                    
  The Q1 contains PHOTON USE commands                               
  ENDDIS                                                            
  PHOTON USE                                                        
  p                                                                 
  110                                                               
  1 5 1;;                                                           
                                                                    
  VI -1 1 1                                                         
  gr ou y 1                                                         
  SURF MARK Y .99                                                   
  SURF MARK X .99                                                   
  SURF MARK Z .99                                                   
  msg First run: ground geometry                                    
  pause                                                             
  p                                                                 
  110;;;                                                            
                                                                    
  vi y                                                              
  gr ou y 1                                                         
  con rho1 y m fi;.001                                              
  msg density contours                                              
  pause                                                             
  con cl;red                                                        
  ve y 1 sh                                                         
  msg velocity vectors                                              
  pause                                                             
  con cl;red                                                        
  set con scale range on                                            
  con conc y 1 fi;0 0.01;.001                                       
  set con scale range off                                           
  msg concentration contours                                        
  pause                                                             
  p                                                                 
  210                                                               
  1 5 1;;                                                           
                                                                    
  VI -1 1 1                                                         
  gr ou y 1                                                         
  SURF MARK Y .99                                                   
  SURF MARK X .99                                                   
  SURF MARK Z .99                                                   
  msg Second run: ground geometry                                   
  pause                                                             
  p                                                                 
  210;;;                                                            
                                                                    
  vi y                                                              
  gr ou y 1                                                         
  con rho1 y m fi;.001                                              
  msg density contours                                              
  pause                                                             
  con cl;red                                                        
  ve y 1 sh                                                         
  msg velocity vectors                                              
  pause                                                             
  con cl;red                                                        
  set con scale range on                                            
  con conc y 1 fi;0 0.01;.001                                       
  set con scale range off                                           
  msg concentration contours                                        
  pause                                                             
  p                                                                 
  310                                                               
  1 5 1;;                                                           
                                                                    
  VI -1 1 1                                                         
  gr ou y 1                                                         
  SURF MARK Y .99                                                   
  SURF MARK X .99                                                   
  SURF MARK Z .99                                                   
  msg Third run: ground geometry                                    
  pause                                                             
  p                                                                 
  310;;;                                                            
                                                                    
  vi y                                                              
  gr ou y 1                                                         
  con rho1 y m fi;.001                                              
  msg density contours                                              
  pause                                                             
  con cl;red                                                        
  ve y 1 sh                                                         
  msg velocity vectors                                              
  pause                                                             
  con cl;red                                                        
  set con scale range on                                            
  con conc y 1 fi;0 0.01;.001                                       
  set con scale range off                                           
  msg concentration contours                                        
  pause                                                             
  p                                                                 
  410                                                               
  1 5 1;;                                                           
                                                                    
  VI -1 1 1                                                         
  gr ou y 1                                                         
  SURF MARK Y .99                                                   
  SURF MARK X .99                                                   
  SURF MARK Z .99                                                   
  msg Fourth run: ground geometry                                   
  pause                                                             
  p                                                                 
  410;;;                                                            
                                                                    
  vi y                                                              
  gr ou y 1                                                         
  con rho1 y m fi;.001                                              
  msg density contours                                              
  pause                                                             
  con cl;red                                                        
  ve y 1 sh                                                         
  msg velocity vectors                                              
  pause                                                             
  con cl;red                                                        
  set con scale range on                                            
  con conc y 1 fi;0 0.01;.001                                       
  set con scale range off                                           
  msg concentration contours                                        
  pause                                                             
  p                                                                 
  510                                                               
  1 5 1;;                                                           
                                                                    
  VI -1 1 1                                                         
  gr ou y 1                                                         
  SURF MARK Y .99                                                   
  SURF MARK X .99                                                   
  SURF MARK Z .99                                                   
  msg First run: ground geometry                                    
  pause                                                             
  p                                                                 
  510;;;                                                            
                                                                    
  vi y                                                              
  gr ou y 1                                                         
  con rho1 y m fi;.001                                              
  msg density contours                                              
  pause                                                             
  con cl;red                                                        
  ve y 1 sh                                                         
  msg velocity vectors                                              
  pause                                                             
  con cl;red                                                        
  set con scale range on                                            
  con conc y 1 fi;0 0.01;.001                                       
  set con scale range off                                           
  msg concentration contours                                        
  ENDUSE                                                            
                                                                    
    First run                                                       
    ---------                                                       
                                                                    
  Group 1. Run Title and Number                                     
 TEXT(ATMOSPHERIC B.L., first run             )                     
  Group 1. T-Direction Grid Spacing                                 
STEADY=F;GRDPWR(T,10,5.E3,1)                                        
  Group 3. X-Direction Grid Spacing                                 
GRDPWR(X,20,5000,1)                                                 
  Group 4. Y-Direction Grid Spacing                                 
GRDPWR(Y,20,1000,2.0)                                               
  Group 5. Z-Direction Grid Spacing                                 
GRDPWR(Z,20,5000,1)                                                 
  Group 7. Variables: STOREd,SOLVEd,NAMEd                           
SOLVE(P1,U1,V1,W1,CONC)                                             
STORE(EPKE,ENUT,EL1,HIG,MARK,RHO1)                                  
SOLUTN(P1,Y,Y,Y,N,N,Y)                                              
TURMOD(KEMODL)                                                      
  Group 9. Properties                                               
PRESS0= 1.000000E+05; TEMP0= 2.730000E+02                           
SETPRPS(1,  0) ! Domain material is: 0   Air at 20 deg C, 1 atm     
DVO1DT= 3.410000E-03                                                
PRT(EP)=  1.314000E+00                                              
  Group 11.Initialise Var/Porosity Fields                           
FIINIT(CONC)=0.0                                                    
  Group 13. Boundary & Special Sources                              
                                                                    
     ! outlets                                                      
PATCH(HOUT,HIGH,1,NX,1,NY,NZ,NZ,1,LSTEP)                            
COVAL(HOUT,P1,1.,0.)                                                
                                                                    
PATCH(EOUT,EAST,NX,NX,1,NY,1,NZ,1,LSTEP)                            
COVAL(EOUT,P1,1.,0.)                                                
                                                                    
PATCH(NOUT,NORTH,1,NX,NY,NY,1,NZ,1,LSTEP)                           
COVAL(NOUT,P1,1.,0.)                                                
                                                                    
     ! pollution source                                             
PATCH(SOURCE,CELL,1,7,1,1,1,4,1,1)                                  
COVAL(SOURCE,CONC,FIXFLU,1.E5)                                      
                                                                    
     ! ground bourndary                                             
PATCH(GROUND,SWALL,1,NX,1,1,1,NZ,1,LSTEP)                           
COVAL(GROUND,U1,GRND5,0.)                                           
COVAL(GROUND,W1,GRND5,0.)                                           
COVAL(GROUND,KE,GRND5,GRND5)                                        
COVAL(GROUND,EP,GRND5,GRND5)                                        
WALLA   = 2.000000E-02 ;WALLB  = 0.000000E+00                       
EGWF    =    T                                                      
WALLCO  = GRND5                                                     
                                                                    
                                                                    
  !inlets by power-law form:Uy=Uh*(y/h)**alfa
REAL(VELX,VELZ,REFH,ALPHA,RHOIN)                                    
REAL(AK,ZO,HO,QREF,QTAU,QTAU2,GKEIN,GEPCON,CONST,VEL2,RH)           
VELX=1.0   ! x component of inlet velocity                          
VELZ=1.0   ! z component of inlet velocity                          
REFH=10.   ! reference height for wind reference velocity           
ALPHA=0.21 !                                                        
RHOIN=RHO1 ! inlet density                                          
AK=0.41    ! constant                                               
ZO=0.022   ! effective roughness length                             
HO=0.0     ! height of boundary-layer origin above domain origin    
VEL2=VELX*VELX+VELZ*VELZ                                            
QREF=SQRT(VEL2) ! inlet velocity                                    
RH=REFH/ZO                                                          
QTAU=AK*QREF/(LOG(RH))                                              
QTAU2=QTAU*QTAU                                                     
GKEIN=QTAU2/0.3       ! inlet k                                     
GEPCON=QTAU2*QTAU/AK                                                
                                                                    
PATCH(LINLET,LOW,1,NX,1,NY,1,1,1,LSTEP)                             
CONST=RHOIN*ABS(VELZ)/REFH**ALPHA                                   
(SOURCE of P1 at LINLET is CONST*YG^ALPHA)                          
CONST=VELX/REFH**ALPHA                                              
(SOURCE of U1 at LINLET is CONST*YG^ALPHA with ONLYMS)              
CONST=VELZ/REFH**ALPHA                                              
(SOURCE of W1 at LINLET is CONST*YG^ALPHA with ONLYMS)              
(SOURCE of KE at LINLET is GKEIN with ONLYMS)                       
(SOURCE of EP at LINLET is GEPCON/(YG-HO) with ONLYMS)              
                                                                    
PATCH(WINLET,WEST,1,1,1,NY,1,NZ,1,LSTEP)                            
CONST=RHOIN*ABS(VELX)/REFH**ALPHA                                   
(SOURCE of P1 at WINLET is CONST*YG^ALPHA)                          
CONST=VELX/REFH**ALPHA                                              
(SOURCE of U1 at WINLET is CONST*YG^ALPHA with ONLYMS)              
CONST=VELZ/REFH**ALPHA                                              
(SOURCE of W1 at WINLET is CONST*YG^ALPHA with ONLYMS)              
(SOURCE of KE at WINLET is GKEIN with ONLYMS)                       
(SOURCE of EP at WINLET is GEPCON/(YG-HO) with ONLYMS)              
                                                                    
     ! initial by power-law form:  Uy=Uh*(y/h)**alfa                
PATCH(INIT,INIVAL,1,NX,1,NY,1,NZ,1,1)                               
CONST=VELX/REFH**ALPHA                                              
(INITIAL of U1 at INIT is CONST*YG^ALPHA)                           
CONST=VELZ/REFH**ALPHA                                              
(INITIAL of W1 at INIT is CONST*YG^ALPHA)                           
(INITIAL of KE at INIT is GKEIN)                                    
(INITIAL of EP at INIT is GEPCON/(YG-HO))                           
                                                                    
REAL(XSIZE,ZSIZE,X0,Z0)                                             
XSIZE=2*XULAST; ZSIZE=2*ZWLAST ! size of explored area              
X0=0; Z0=0 ! coordinates of origin on explored area                 
                                                                    
   ! ground relief                      
(STORED HIG AT GROUND IS 100.*(1-(X0+XG)/XSIZE)*(1-(Z0+ZG)/ZSIZE)*($
2.+SIN(6*(X0+XG)/XSIZE)+SIN(24*(Z0+ZG)/ZSIZE)) WITH TSTSTR)         
                                                                    
         ! geometry marker                    
(STORED MARK IS 1 WITH IF(YG.GT.HIG[,1])!TSTSTR)                    
                                                                    
          ! air density                        
(PROPERTY RHO1 IS 1.189*EXP((YG+HIG[,1])/(-8000)))                  
                                                                    
   ! create export transfer objects            
DO II=1,LSTEP                                                       
 PATCH(HPAT:II:,HIGH,1,NX,1,NY,NZ,NZ,:II:,:II:)                     
 (EXPORT in HTRO1:II: at HPAT:II:)                                  
                                                                    
 PATCH(EPAT:II:,EAST,NX,NX,1,NY,1,NZ,:II:,:II:)                     
 (EXPORT in ETRO1:II: at EPAT:II:)                                  
ENDDO                                                               
  Group 15. Terminate Sweeps                                        
LSWEEP=50                                                           
  Group 18. Limits                                                  
VARMIN(CONC)=0.                                                     
  Group 22. Monitor Print-Out                                       
IXMON=NX/2;IYMON=NY/2;IZMON=NZ-2                                    
  Group 24. Dumps For Restarts                                      
IDISPA=1; IDISPB=1; IDISPC=10; CSG1='1'                             
TSTSWP=-1                                                           
DISTIL=T                                                            
EX(P1  )=6.653E-01                                                  
EX(U1  )=1.872E+00                                                  
EX(V1  )=2.486E-02                                                  
EX(W1  )=1.874E+00                                                  
EX(KE  )=6.406E-02                                                  
EX(EP  )=2.039E-04                                                  
EX(RHO1)=1.120E+00                                                  
EX(MARK)=6.183E-01                                                  
EX(HIG )=7.655E+00                                                  
EX(EL1 )=1.250E+02                                                  
EX(ENUT)=1.614E+01                                                  
EX(EPKE)=1.000E-10                                                  
EX(CONC)=1.080E-02                                                  
LSG57=T;ISG52=2                                                     
PARSOL=F;ntprin=1                                                   
 LIBREF  =       859                                                
STOP                                                                
                                                                    
                                                                    
    Second run                                                      
    ----------                                                      
                                                                    
  Group 1. Run Title and Number                                     
 TEXT(ATMOSPHERIC B.L., second run             )                    
  Group 1. T-Direction Grid Spacing                                 
STEADY=F;GRDPWR(T,10,5.E3,1)                                        
  Group 3. X-Direction Grid Spacing                                 
GRDPWR(X,20,5000,1)                                                 
  Group 4. Y-Direction Grid Spacing                                 
GRDPWR(Y,20,1000,2.0)                                               
  Group 5. Z-Direction Grid Spacing                                 
GRDPWR(Z,20,5000,1)                                                 
  Group 7. Variables: STOREd,SOLVEd,NAMEd                           
SOLVE(P1,U1,V1,W1,CONC)                                             
STORE(EPKE,ENUT,EL1,HIG,MARK,RHO1)                                  
SOLUTN(P1,Y,Y,Y,N,N,Y)                                              
TURMOD(KEMODL)                                                      
  Group 9. Properties                                               
PRESS0= 1.000000E+05; TEMP0= 2.730000E+02                           
SETPRPS(1,  0) ! Domain material is: 0   Air at 20 deg C, 1 atm     
DVO1DT= 3.410000E-03                                                
PRT(EP)=  1.314000E+00                                              
  Group 11.Initialise Var/Porosity Fields                           
FIINIT(CONC)=0.0                                                    
  Group 13. Boundary & Special Sources                              
                                                                    
     ! outlets                                                      
PATCH(HOUT,HIGH,1,NX,1,NY,NZ,NZ,1,LSTEP)                            
COVAL(HOUT,P1,1.,0.)                                                
                                                                    
PATCH(EOUT,EAST,NX,NX,1,NY,1,NZ,1,LSTEP)                            
COVAL(EOUT,P1,1.,0.)                                                
                                                                    
PATCH(NOUT,NORTH,1,NX,NY,NY,1,NZ,1,LSTEP)                           
COVAL(NOUT,P1,1.,0.)                                                
                                                                    
     ! ground bourndary                                             
PATCH(GROUND,SWALL,1,NX,1,1,1,NZ,1,LSTEP)                           
COVAL(GROUND,U1,GRND5,0.)                                           
COVAL(GROUND,W1,GRND5,0.)                                           
COVAL(GROUND,KE,GRND5,GRND5)                                        
COVAL(GROUND,EP,GRND5,GRND5)                                        
WALLA   = 2.000000E-02 ;WALLB  = 0.000000E+00                       
EGWF    =    T                                                      
WALLCO  = GRND5                                                     
                                                                    
     ! inlets by power-law form:  Uy=Uh*(y/h)**alfa                 
REAL(VELX,VELZ,REFH,ALPHA,RHOIN)                                    
REAL(AK,ZO,HO,QREF,QTAU,QTAU2,GKEIN,GEPCON,CONST,VEL2,RH)           
VELX=1.0   ! x component of inlet velocity                          
VELZ=1.0   ! z component of inlet velocity                          
REFH=10.   ! reference height for wind reference velocity           
ALPHA=0.21 !                                                        
RHOIN=RHO1 ! inlet density                                          
AK=0.41    ! constant                                               
ZO=0.022   ! effective roughness length                             
HO=0.0     ! height of boundary-layer origin above domain origin    
VEL2=VELX*VELX+VELZ*VELZ                                            
QREF=SQRT(VEL2) ! inlet velocity                                    
RH=REFH/ZO                                                          
QTAU=AK*QREF/(LOG(RH))                                              
QTAU2=QTAU*QTAU                                                     
GKEIN=QTAU2/0.3       ! inlet k                                     
GEPCON=QTAU2*QTAU/AK                                                
                                                                    
PATCH(WINLET,WEST,1,1,1,NY,1,NZ,1,LSTEP)                            
CONST=RHOIN*ABS(VELX)/REFH**ALPHA                                   
(SOURCE of P1 at WINLET is CONST*YG^ALPHA)                          
CONST=VELX/REFH**ALPHA                                              
(SOURCE of U1 at WINLET is CONST*YG^ALPHA with ONLYMS)              
CONST=VELZ/REFH**ALPHA                                              
(SOURCE of W1 at WINLET is CONST*YG^ALPHA with ONLYMS)              
(SOURCE of KE at WINLET is GKEIN with ONLYMS)                       
(SOURCE of EP at WINLET is GEPCON/(YG-HO) with ONLYMS)              
                                                                    
     ! initial by power-law form:  Uy=Uh*(y/h)**alfa                
PATCH(INIT,INIVAL,1,NX,1,NY,1,NZ,1,1)                               
CONST=VELX/REFH**ALPHA                                              
(INITIAL of U1 at INIT is CONST*YG^ALPHA)                           
CONST=VELZ/REFH**ALPHA                                              
(INITIAL of W1 at INIT is CONST*YG^ALPHA)                           
(INITIAL of KE at INIT is GKEIN)                                    
(INITIAL of EP at INIT is GEPCON/(YG-HO))                           
                                                                    
REAL(XSIZE,ZSIZE,X0,Z0)                                             
XSIZE=2*XULAST; ZSIZE=2*ZWLAST  ! size of explored area             
X0=0; Z0=ZWLAST ! coordinates of origin on explored area            
                                                                    
   ! ground relief                     
(STORED HIG AT GROUND IS 100.*(1-(X0+XG)/XSIZE)*(1-(Z0+ZG)/ZSIZE)*($
2.+SIN(6*(X0+XG)/XSIZE)+SIN(24*(Z0+ZG)/ZSIZE)) WITH TSTSTR)         
                                                                    
         ! geometry marker                   
(STORED MARK IS 1 WITH IF(YG.GT.HIG[,1])!TSTSTR)                    
                                                                    
          ! air density                       
(PROPERTY RHO1 IS 1.189*EXP((YG+HIG[,1])/(-8000)))                  
                                                                    
DO II=1,LSTEP                                                       
   ! read exist transfer objects               
 PATCH(LPAT:II:,LOW,1,NX,1,NY,1,1,:II:,:II:)                        
 (IMPORT from HTRO1:II: at LPAT:II:)                                
   ! create transfer objects                   
 PATCH(EPAT:II:,EAST,NX,NX,1,NY,1,NZ,:II:,:II:)                     
 (EXPORT in ETRO2:II: at EPAT:II:)                                  
ENDDO                                                               
  Group 15. Terminate Sweeps                                        
LSWEEP=50                                                           
  Group 18. Limits                                                  
VARMIN(CONC)=0.                                                     
  Group 22. Monitor Print-Out                                       
IXMON=NX/2;IYMON=NY/2;IZMON=NZ-2                                    
  Group 24. Dumps For Restarts                                      
IDISPA=1; IDISPB=1; IDISPC=10; CSG1='2'                             
TSTSWP=-1                                                           
DISTIL=T                                                            
EX(P1  )=6.024E-01                                                  
EX(U1  )=1.866E+00                                                  
EX(V1  )=1.863E-02                                                  
EX(W1  )=1.850E+00                                                  
EX(KE  )=7.773E-02                                                  
EX(EP  )=2.190E-04                                                  
EX(RHO1)=1.134E+00                                                  
EX(MARK)=7.909E-01                                                  
EX(HIG )=2.626E+00                                                  
EX(EL1 )=1.151E+02                                                  
EX(ENUT)=1.671E+01                                                  
EX(EPKE)=1.000E-10                                                  
EX(CONC)=4.890E-03                                                  
LSG57=T;ISG52=2                                                     
PARSOL=F;ntprin=1                                                   
STOP                                                                
                                                                    
                                                                    
                                                                    
    Third run                                                       
    ---------                                                       
                                                                    
  Group 1. Run Title and Number                                     
TEXT(ATMOSPHERIC B.L., Third run             )                      
  Group 2. T-Direction Grid Spacing                                 
STEADY=F;GRDPWR(T,10,5.E3,1)                                        
  Group 3. X-Direction Grid Spacing                                 
GRDPWR(X,20,5000,1)                                                 
  Group 4. Y-Direction Grid Spacing                                 
GRDPWR(Y,20,1000,2.0)                                               
  Group 5. Z-Direction Grid Spacing                                 
GRDPWR(Z,20,5000,1)                                                 
  Group 7. Variables: STOREd,SOLVEd,NAMEd                           
SOLVE(P1,U1,V1,W1,CONC)                                             
STORE(EPKE,ENUT,EL1,HIG,MARK,RHO1)                                  
SOLUTN(P1,Y,Y,Y,N,N,Y)                                              
TURMOD(KEMODL)                                                      
  Group 9. Properties                                               
PRESS0= 1.000000E+05; TEMP0= 2.730000E+02                           
SETPRPS(1,  0) ! Domain material is: 0   Air at 20 deg C, 1 atm     
DVO1DT= 3.410000E-03                                                
PRT(EP)=  1.314000E+00                                              
  Group 11.Initialise Var/Porosity Fields                           
FIINIT(CONC)=0.0                                                    
  Group 13. Boundary & Special Sources                              
                                                                    
     ! outlets                                                      
PATCH(HOUT,HIGH,1,NX,1,NY,NZ,NZ,1,LSTEP)                            
COVAL(HOUT,P1,1.,0.)                                                
                                                                    
PATCH(EOUT,EAST,NX,NX,1,NY,1,NZ,1,LSTEP)                            
COVAL(EOUT,P1,1.,0.)                                                
                                                                    
PATCH(NOUT,NORTH,1,NX,NY,NY,1,NZ,1,LSTEP)                           
COVAL(NOUT,P1,1.,0.)                                                
                                                                    
     ! ground bourndary                                             
PATCH(GROUND,SWALL,1,NX,1,1,1,NZ,1,LSTEP)                           
COVAL(GROUND,U1,GRND5,0.)                                           
COVAL(GROUND,W1,GRND5,0.)                                           
COVAL(GROUND,KE,GRND5,GRND5)                                        
COVAL(GROUND,EP,GRND5,GRND5)                                        
WALLA   = 2.000000E-02 ;WALLB  = 0.000000E+00                       
EGWF    =    T                                                      
WALLCO  = GRND5                                                     
                                                                    
     ! inlets by power-law form:  Uy=Uh*(y/h)**alfa                 
REAL(VELX,VELZ,REFH,ALPHA,RHOIN)                                    
REAL(AK,ZO,HO,QREF,QTAU,QTAU2,GKEIN,GEPCON,CONST,VEL2,RH)           
VELX=1.0   ! x component of inlet velocity                          
VELZ=1.0   ! z component of inlet velocity                          
REFH=10.   ! reference height for wind reference velocity           
ALPHA=0.21 !                                                        
RHOIN=RHO1 ! inlet density                                          
AK=0.41    ! constant                                               
ZO=0.022   ! effective roughness length                             
HO=0.0     ! height of boundary-layer origin above domain origin    
VEL2=VELX*VELX+VELZ*VELZ                                            
QREF=SQRT(VEL2) ! inlet velocity                                    
RH=REFH/ZO                                                          
QTAU=AK*QREF/(LOG(RH))                                              
QTAU2=QTAU*QTAU                                                     
GKEIN=QTAU2/0.3       ! inlet k                                     
GEPCON=QTAU2*QTAU/AK                                                
                                                                    
PATCH(LINLET,LOW,1,NX,1,NY,1,1,1,LSTEP)                             
CONST=RHOIN*ABS(VELZ)/REFH**ALPHA                                   
(SOURCE of P1 at LINLET is CONST*YG^ALPHA)                          
CONST=VELX/REFH**ALPHA                                              
(SOURCE of U1 at LINLET is CONST*YG^ALPHA with ONLYMS)              
CONST=VELZ/REFH**ALPHA                                              
(SOURCE of W1 at LINLET is CONST*YG^ALPHA with ONLYMS)              
(SOURCE of KE at LINLET is GKEIN with ONLYMS)                       
(SOURCE of EP at LINLET is GEPCON/(YG-HO) with ONLYMS)              
                                                                    
     ! initial by power-law form:  Uy=Uh*(y/h)**alfa                
PATCH(INIT,INIVAL,1,NX,1,NY,1,NZ,1,1)                               
CONST=VELX/REFH**ALPHA                                              
(INITIAL of U1 at INIT is CONST*YG^ALPHA)                           
CONST=VELZ/REFH**ALPHA                                              
(INITIAL of W1 at INIT is CONST*YG^ALPHA)                           
(INITIAL of KE at INIT is GKEIN)                                    
(INITIAL of EP at INIT is GEPCON/(YG-HO))                           
                                                                    
REAL(XSIZE,ZSIZE,X0,Z0)                                             
XSIZE=2*XULAST; ZSIZE=2*ZWLAST  ! size of explored area             
X0=XULAST; Z0=0 ! coordinates of origin on explored area            
                                                                    
   ! ground relief                     
(STORED HIG AT GROUND IS 100.*(1-(X0+XG)/XSIZE)*(1-(Z0+ZG)/ZSIZE)*($
2.+SIN(6*(X0+XG)/XSIZE)+SIN(24*(Z0+ZG)/ZSIZE)) WITH TSTSTR)         
                                                                    
         ! geometry marker                   
(STORED MARK IS 1 WITH IF(YG.GT.HIG[,1])!TSTSTR)                    
                                                                    
          ! air density                       
(PROPERTY RHO1 IS 1.189*EXP((YG+HIG[,1])/(-8000)))                  
                                                                    
DO II=1,LSTEP                                                       
   ! read transfer object                      
 PATCH(WPAT:II:,WEST,1,1,1,NY,1,NZ,:II:,:II:)                       
 (IMPORT from ETRO1:II: at WPAT:II:)                                
   ! create transfer object                    
 PATCH(HPAT:II:,HIGH,1,NX,1,NY,NZ,NZ,:II:,:II:)                     
 (EXPORT in HTRO3:II: at HPAT:II:)                                  
ENDDO                                                               
  Group 15. Terminate Sweeps                                        
LSWEEP=50                                                           
  Group 18. Limits                                                  
VARMIN(CONC)=0.                                                     
  Group 22. Monitor Print-Out                                       
IXMON=NX/2;IYMON=NY/2;IZMON=NZ-2                                    
  Group 24. Dumps For Restarts                                      
IDISPA=1; IDISPB=1; IDISPC=10; CSG1='3'                             
TSTSWP=-1                                                           
DISTIL=T                                                            
EX(P1  )=6.093E-01                                                  
EX(U1  )=1.849E+00                                                  
EX(V1  )=1.861E-02                                                  
EX(W1  )=1.866E+00                                                  
EX(KE  )=7.800E-02                                                  
EX(EP  )=2.191E-04                                                  
EX(RHO1)=1.137E+00                                                  
EX(MARK)=8.582E-01                                                  
EX(HIG )=1.407E+00                                                  
EX(EL1 )=1.149E+02                                                  
EX(ENUT)=1.671E+01                                                  
EX(EPKE)=1.000E-10                                                  
EX(CONC)=8.269E-03                                                  
LSG57=T;ISG52=2                                                     
PARSOL=F;ntprin=1                                                   
STOP                                                                
                                                                    
                                                                    
    fourth run                                                      
    ----------                                                      
                                                                    
  Group 1. Run Title and Number                                     
TEXT(ATMOSPHERIC B.L., fourth run            )                      
  Group 2. T-Direction Grid Spacing                                 
STEADY=F;GRDPWR(T,10,5.E3,1)                                        
  Group 3. X-Direction Grid Spacing                                 
GRDPWR(X,20,5000,1)                                                 
  Group 4. Y-Direction Grid Spacing                                 
GRDPWR(Y,20,1000,2.0)                                               
  Group 5. Z-Direction Grid Spacing                                 
GRDPWR(Z,20,5000,1)                                                 
  Group 7. Variables: STOREd,SOLVEd,NAMEd                           
SOLVE(P1,U1,V1,W1,CONC)                                             
STORE(EPKE,ENUT,EL1,HIG,MARK,RHO1)                                  
SOLUTN(P1,Y,Y,Y,N,N,Y)                                              
TURMOD(KEMODL)                                                      
  Group 9. Properties                                               
PRESS0= 1.000000E+05; TEMP0= 2.730000E+02                           
SETPRPS(1,  0) ! Domain material is: 0   Air at 20 deg C, 1 atm     
DVO1DT= 3.410000E-03                                                
PRT(EP)=  1.314000E+00                                              
  Group 11.Initialise Var/Porosity Fields                           
FIINIT(CONC)=0.0                                                    
  Group 13. Boundary & Special Sources                              
                                                                    
     ! outlets                                                      
PATCH(HOUT,HIGH,1,NX,1,NY,NZ,NZ,1,LSTEP)                            
COVAL(HOUT,P1,1.,0.)                                                
                                                                    
PATCH(EOUT,EAST,NX,NX,1,NY,1,NZ,1,LSTEP)                            
COVAL(EOUT,P1,1.,0.)                                                
                                                                    
PATCH(NOUT,NORTH,1,NX,NY,NY,1,NZ,1,LSTEP)                           
COVAL(NOUT,P1,1.,0.)                                                
                                                                    
     ! ground bourndary                                             
PATCH(GROUND,SWALL,1,NX,1,1,1,NZ,1,LSTEP)                           
COVAL(GROUND,U1,GRND5,0.)                                           
COVAL(GROUND,W1,GRND5,0.)                                           
COVAL(GROUND,KE,GRND5,GRND5)                                        
COVAL(GROUND,EP,GRND5,GRND5)                                        
WALLA   = 2.000000E-02 ;WALLB  = 0.000000E+00                       
EGWF    =    T                                                      
WALLCO  = GRND5                                                     
                                                                    
     ! initial by power-law form:  Uy=Uh*(y/h)**alfa                
REAL(VELX,VELZ,REFH,ALPHA,RHOIN)                                    
REAL(AK,ZO,HO,QREF,QTAU,QTAU2,GKEIN,GEPCON,CONST,VEL2,RH)           
VELX=1.0   ! x component of inlet velocity                          
VELZ=1.0   ! z component of inlet velocity                          
REFH=10.   ! reference height for wind reference velocity           
ALPHA=0.21 !                                                        
RHOIN=RHO1 ! inlet density                                          
AK=0.41    ! constant                                               
ZO=0.022   ! effective roughness length                             
HO=0.0     ! height of boundary-layer origin above domain origin    
VEL2=VELX*VELX+VELZ*VELZ                                            
QREF=SQRT(VEL2) ! inlet velocity                                    
RH=REFH/ZO                                                          
QTAU=AK*QREF/(LOG(RH))                                              
QTAU2=QTAU*QTAU                                                     
GKEIN=QTAU2/0.3       ! inlet k                                     
GEPCON=QTAU2*QTAU/AK                                                
                                                                    
PATCH(INIT,INIVAL,1,NX,1,NY,1,NZ,1,1)                               
CONST=VELX/REFH**ALPHA                                              
(INITIAL of U1 at INIT is CONST*YG^ALPHA)                           
CONST=VELZ/REFH**ALPHA                                              
(INITIAL of W1 at INIT is CONST*YG^ALPHA)                           
(INITIAL of KE at INIT is GKEIN)                                    
(INITIAL of EP at INIT is GEPCON/(YG-HO))                           
                                                                    
REAL(XSIZE,ZSIZE,X0,Z0)                                             
XSIZE=2*XULAST; ZSIZE=2*ZWLAST  ! size of explored area             
X0=XULAST; Z0=ZWLAST ! coordinates of origin on explored area       
                                                                    
   ! ground relief                     
(STORED HIG AT GROUND IS 100.*(1-(X0+XG)/XSIZE)*(1-(Z0+ZG)/ZSIZE)*($
2.+SIN(6*(X0+XG)/XSIZE)+SIN(24*(Z0+ZG)/ZSIZE)) WITH TSTSTR)         
                                                                    
         ! geometry marker                   
(STORED MARK IS 1 WITH IF(YG.GT.HIG[,1])!TSTSTR)                    
                                                                    
          ! air density                       
(PROPERTY RHO1 IS 1.189*EXP((YG+HIG[,1])/(-8000)))                  
                                                                    
   ! read transfer objects                     
DO II=1,LSTEP                                                       
 PATCH(LPAT:II:,LOW,1,NX,1,NY,1,1,:II:,:II:)                        
 (IMPORT from HTRO3:II: at LPAT:II:)                                
                                                                    
 PATCH(WPAT:II:,WEST,1,1,1,NY,1,NZ,:II:,:II:)                       
 (IMPORT from ETRO2:II: at WPAT:II:)                                
ENDDO                                                               
  Group 15. Terminate Sweeps                                        
LSWEEP=50                                                           
  Group 18. Limits                                                  
VARMIN(CONC)=0.                                                     
  Group 22. Monitor Print-Out                                       
IXMON=NX/2;IYMON=NY/2;IZMON=NZ-2                                    
  Group 24. Dumps For Restarts                                      
IDISPA=1; IDISPB=1; IDISPC=10; CSG1='4'                             
TSTSWP=-1                                                           
DISTIL=T                                                            
EX(P1  )=6.545E-01                                                  
EX(U1  )=1.841E+00                                                  
EX(V1  )=2.060E-02                                                  
EX(W1  )=1.842E+00                                                  
EX(KE  )=1.175E-01                                                  
EX(EP  )=2.695E-04                                                  
EX(RHO1)=1.137E+00                                                  
EX(MARK)=9.249E-01                                                  
EX(HIG )=4.938E-01                                                  
EX(EL1 )=1.004E+02                                                  
EX(ENUT)=1.909E+01                                                  
EX(EPKE)=1.000E-10                                                  
EX(CONC)=3.404E-02                                                  
LSG57=T;ISG52=2                                                     
PARSOL=F;ntprin=1                                                   
STOP                                                                
                                                                    
    fifth run                                                       
    ----------                                                      
                                                                    
  Group 1. Run Title and Number                                     
 TEXT(ATMOSPHERIC B.L., fifth run             )                     
  Group 2. T-Direction Grid Spacing                                 
STEADY=F;GRDPWR(T,10,5.E3,1)                                        
  Group 3. X-Direction Grid Spacing                                 
GRDPWR(X,40,10000,1)                                                
  Group 4. Y-Direction Grid Spacing                                 
GRDPWR(Y,20,1000,2.0)                                               
  Group 5. Z-Direction Grid Spacing                                 
GRDPWR(Z,40,10000,1)                                                
  Group 7. Variables: STOREd,SOLVEd,NAMEd                           
SOLVE(P1,U1,V1,W1,CONC)                                             
STORE(EPKE,ENUT,EL1,HIG,MARK,RHO1)                                  
SOLUTN(P1,Y,Y,Y,N,N,Y)                                              
TURMOD(KEMODL)                                                      
  Group 9. Properties                                               
PRESS0= 1.000000E+05; TEMP0= 2.730000E+02                           
SETPRPS(1,  0) ! Domain material is: 0   Air at 20 deg C, 1 atm     
DVO1DT= 3.410000E-03                                                
PRT(EP)=  1.314000E+00                                              
  Group 11.Initialise Var/Porosity Fields                           
FIINIT(CONC) =  0.000000E+00                                        
  Group 13. Boundary & Special Sources                              
                                                                    
     ! outlets                                                      
PATCH(HOUT,HIGH,1,NX,1,NY,NZ,NZ,1,LSTEP)                            
COVAL(HOUT,P1,1.,0.)                                                
                                                                    
PATCH(EOUT,EAST,NX,NX,1,NY,1,NZ,1,LSTEP)                            
COVAL(EOUT,P1,1.,0.)                                                
                                                                    
PATCH(NOUT,NORTH,1,NX,NY,NY,1,NZ,1,LSTEP)                           
COVAL(NOUT,P1,1.,0.)                                                
                                                                    
     ! pollution source                                             
PATCH(SOURCE,CELL,1,7,1,1,1,4,1,1)                                  
COVAL(SOURCE,CONC,FIXFLU,1.E5)                                      
  PATCH(SOURCE,CELL,1,7,1,1,1,4,1,LSTEP)                            
  (SOURCE of CONC at SOURCE is COVAL(FIXFLU,10.*TIM))               
                                                                    
     ! ground bourndary                                             
PATCH(GROUND,SWALL,1,NX,1,1,1,NZ,1,LSTEP)                           
COVAL(GROUND,U1,GRND5,0.)                                           
COVAL(GROUND,W1,GRND5,0.)                                           
COVAL(GROUND,KE,GRND5,GRND5)                                        
COVAL(GROUND,EP,GRND5,GRND5)                                        
WALLA   = 2.000000E-02 ;WALLB  = 0.000000E+00                       
EGWF    =    T                                                      
WALLCO  = GRND5                                                     
                                                                    
                                                                    
     ! inlets by power-law form:  Uy=Uh*(y/h)**alfa                 
REAL(VELX,VELZ,REFH,ALPHA,RHOIN)                                    
REAL(AK,ZO,HO,QREF,QTAU,QTAU2,GKEIN,GEPCON,CONST,VEL2,RH)           
VELX=1.0   ! x component of inlet velocity                          
VELZ=1.0   ! z component of inlet velocity                          
REFH=10.   ! reference height for wind reference velocity           
ALPHA=0.21 !                                                        
RHOIN=RHO1 ! inlet density                                          
AK=0.41    ! constant                                               
ZO=0.022   ! effective roughness length                             
HO=0.0     ! height of boundary-layer origin above domain origin    
VEL2=VELX*VELX+VELZ*VELZ                                            
QREF=SQRT(VEL2) ! inlet velocity                                    
RH=REFH/ZO                                                          
QTAU=AK*QREF/(LOG(RH))                                              
QTAU2=QTAU*QTAU                                                     
GKEIN=QTAU2/0.3       ! inlet k                                     
GEPCON=QTAU2*QTAU/AK                                                
                                                                    
PATCH(LINLET,LOW,1,NX,1,NY,1,1,1,LSTEP)                             
CONST=RHOIN*ABS(VELZ)/REFH**ALPHA                                   
  CONST=ABS(VELZ)/REFH**ALPHA                                       
(SOURCE of P1 at LINLET is CONST*YG^ALPHA)                          
  (SOURCE of P1 at LINLET is RHO1*CONST*YG^ALPHA)                   
CONST=VELX/REFH**ALPHA                                              
(SOURCE of U1 at LINLET is CONST*YG^ALPHA with ONLYMS)              
CONST=VELZ/REFH**ALPHA                                              
(SOURCE of W1 at LINLET is CONST*YG^ALPHA with ONLYMS)              
(SOURCE of KE at LINLET is GKEIN with ONLYMS)                       
(SOURCE of EP at LINLET is GEPCON/(YG-HO) with ONLYMS)              
                                                                    
PATCH(WINLET,WEST,1,1,1,NY,1,NZ,1,LSTEP)                            
CONST=RHOIN*ABS(VELX)/REFH**ALPHA                                   
(SOURCE of P1 at WINLET is CONST*YG^ALPHA)                          
CONST=VELX/REFH**ALPHA                                              
(SOURCE of U1 at WINLET is CONST*YG^ALPHA with ONLYMS)              
CONST=VELZ/REFH**ALPHA                                              
(SOURCE of W1 at WINLET is CONST*YG^ALPHA with ONLYMS)              
(SOURCE of KE at WINLET is GKEIN with ONLYMS)                       
(SOURCE of EP at WINLET is GEPCON/(YG-HO) with ONLYMS)              
                                                                    
     ! initial by power-law form:  Uy=Uh*(y/h)**alfa                
PATCH(INIT,INIVAL,1,NX,1,NY,1,NZ,1,1)                               
CONST=VELX/REFH**ALPHA                                              
(INITIAL of U1 at INIT is CONST*YG^ALPHA)                           
CONST=VELZ/REFH**ALPHA                                              
(INITIAL of W1 at INIT is CONST*YG^ALPHA)                           
(INITIAL of KE at INIT is GKEIN)                                    
(INITIAL of EP at INIT is GEPCON/(YG-HO))                           
                                                                    
REAL(XSIZE,ZSIZE,X0,Z0)                                             
XSIZE=XULAST; ZSIZE=ZWLAST ! size of explored area                  
X0=0; Z0=0 ! coordinates of origin on explored area                 
                                                                    
   ! ground relief                      
(STORED HIG AT GROUND IS 100.*(1-(X0+XG)/XSIZE)*(1-(Z0+ZG)/ZSIZE)*($
2.+SIN(6*(X0+XG)/XSIZE)+SIN(24*(Z0+ZG)/ZSIZE)) WITH TSTSTR)         
                                                                    
         ! geometry marker                    
(STORED MARK IS 1 WITH IF(YG.GT.HIG[,1])!TSTSTR)                    
                                                                    
          ! air density                        
(PROPERTY RHO1 IS 1.189*EXP((YG+HIG[,1])/(-8000)))                  
                                                                    
  Group 15. Terminate Sweeps                                        
LSWEEP=50                                                           
  Group 18. Limits                                                  
VARMIN(CONC)=0.                                                     
  Group 22. Monitor Print-Out                                       
IXMON=NX/2;IYMON=NY/2;IZMON=NZ-2                                    
  Group 24. Dumps For Restarts                                      
IDISPA=1; IDISPB=1; IDISPC=LSTEP; CSG1='5'                          
TSTSWP=-1                                                           
DISTIL=T                                                            
EX(P1  )=4.700E+02                                                  
EX(U1  )=7.229E-01                                                  
EX(V1  )=1.281E-01                                                  
EX(W1  )=7.226E-01                                                  
EX(KE  )=2.945E-02                                                  
EX(EP  )=2.456E-04                                                  
EX(RHO1)=1.120E+00                                                  
EX(MARK)=7.981E-01                                                  
EX(HIG )=3.045E+00                                                  
EX(EL1 )=1.002E+02                                                  
EX(ENUT)=1.056E+01                                                  
EX(EPKE)=1.000E-10                                                  
EX(CONC)=1.338E-05                                                  
LSG57=T;ISG52=2                                                     
PARSOL=F;ntprin=1                                                   
STOP                                                                
STOP