#cls
TEXT(Slabwise-averaging and display
libref=363
TITLE 
  DISPLAY
  
  The tasks are, for a 3D transient heat-conduction problem: 
  
  1. to compute slab-wise averages of temperature;
  2. to place them into a 3D variable for ease of display.
  
  It uses the In-Form functions:
      MAKE, STORE1, STORED, SSUM and PRINT .
  When SSUM function is used, no need a IZ DO loop (see 362 case).
  
  Variables introduced are:
    * single variables: ASUM to sum the area, and
                        TSUM to sum the temperature;
    * 3D variable:      TAVE to store TSUM/ASUM.

  The Q1 contains PHOTON USE commands
  ENDDIS
    GROUP 1. Run title and other preliminaries
TEXT(Slabwise-averaging and display
    
    GROUP 2. Transient
STEADY=F
GRDPWR(T,10,4000.0, 1.0)                  ! uniform time steps
    
    GROUPS 3, 4 and 5
NX=10; NY=NX; NZ=NX                       ! 50 * 50 * 50 grid
XULAST=1.0; YVLAST=XULAST; ZWLAST=XULAST  ! 1 m cube
#unigrid                                  ! uniform-grid macro

    GROUP 7. Variables stored, solved & named
SOLVE(TEM1)
STORE(PRPS)

    
    GROUP 11. Initialization of variable or porosity fields
FIINIT(TEM1)=0.
FIINIT(PRPS)= 111.0                       ! cube material is steel

    GROUP 13  Boundary conditions
PATCH(HEATER,HIGH,1,NX/2,1,NY/2,NZ,NZ,1,LSTEP)
COVAL(HEATER,TEM1,FIXFLU, 1000.)          ! 1 kilowatt per square m

    GROUP 15. Termination of sweeps
LSWEEP=50
SPEDAT(SET,GXMONI,TRANSIENT,L,F)
  INFORM7BEGIN
  ** Declaration of auxiliary In-Form variables: TSUM and ASUM
(MAKE TSUM is 0.)
(MAKE ASUM is 0.)

PATCH(PATCH1,CELL,1,NX,1,NY,1,NZ,1,LSTEP) ! One PATCH per whole domain
  
  ** Summation of HIGH area for each IZ slab
(STORE1 ASUM at PATCH1 is SSUM(AHIGH))

  ** Summation of temperature multiplied by HIGH area for each IZ slab
(STORE1 TSUM at PATCH1 is SSUM(AHIGH*TEM1))

  ** Determination of average temperature for each IZ slab
     and storage inside 3D variable TSLB
(STORED TAVE at PATCH1 is TSUM/ASUM)

  
  ** Print-out into INFOROUT file for last IZ slab
(PRINT of Whole_high_area is ASUM)
(PRINT of IZ=NZ__Sum_TEM1 is TSUM)

NTPRIN=1
  
  ** Profile of average temperature at time
patch(prof,profil,1,1,1,1,1,1,1,lstep)
(PRINT of T_average at prof is TSUM/ASUM)

  INFORM7END

libref=363
DISTIL=T; EX(TAVE)=2.710E-01; EX(PRPS)=1.110E+02; EX(TEM1)=2.710E-01
  photon use
  p;; 
 
  set prop off
  vi x
  msg local temperature distribution
  con TEM1 x 3 fi;.0001
  pause
  con off;red
  msg slabwise-average temperature distribution
  con TAVE x 3 fi;.0001
  enduse
STOP