In time-dependent cases (STEADY=F), it is often required to specify boundary conditions which vary as functions of time. This, like most things in PHOENICS, can be done in several ways, namely:
This is the most flexible method. It is recommended.
1. Turning Sources and Boundary Conditions On and Off
The last two arguments of the PATCH command set the first and last time-step the PATCH is to be active.
PATCH(MYSOURCE, VOLUME, ixf,ixl, iyf,iyl, izf,izl, itf, itl)
sets a PATCH over the block of cells from IX=ixf to IX=ixl, IY=iyf to IY=iyl and IZ=izf to izl. The first time step at which the PATCH is active is itf, and the last is itl. Outside this range, the PATCH is inactive.
Simple time functions can be made by generating a sequence of PATCH commands which together approximate the required source. For example, a heat source which increases then decreases linearly with time might be set as:
PATCH(HEAT1, VOLUME, ixf,ixl, iyf,iyl, izf,izl, 1,LSTEP) COVAL(HEAT1, TEM1, FIXFLU, 5.0)
PATCH(HEAT2, VOLUME, ixf,ixl, iyf,iyl, izf,izl, 6,LSTEP-5) COVAL(HEAT2, TEM1, FIXFLU, 5.0)
PATCH(HEAT3, VOLUME, ixf,ixl, iyf,iyl, izf,izl, 11,LSTEP-10) COVAL(HEAT3, TEM1, FIXFLU, 5.0)
If LSTEP were 25, the resulting heat source would be:
More complicated functions can be set in this way by using PIL DO loops to generate the PATCH commands.
Note that the actual time the sources are active for is controlled by the size of the individual time steps - the PATCH limits refer to time step numbers, not times. If the time-steps are non-uniform, the resulting time variation may not be quite as expected.
2. Using Built-in Time Variations
Although simple in concept, the above method can be tedious in practice as it involves hand-editing the Q1 file. Several common forms of time-variation are provided as built-in options. In PHOENICS-VR, these are available as heat sources. From PIL, they can be applied to any SOLVEd variable.
The available source forms are:
Note that the variation is with time, not time-step number. The shorter the time-steps, the better the representation will be.
The PIL settings for these sources are:
PATCH(TIMabcde, type, ixf,ixl, iyf,iyl, izf,izl, itf, itl) COVAL(TIMabcde, phi, CO, VAL)
where:
The patch name must start with 'TIM'. The remaining 'abcde' characters are at the user's discretion.
type can be VOLUME for a volumetric source, or NORTH, SOUTH, EAST,WEST,HIGH or LOW for a source per unit area.
phi is the variable
CO can be FIXVAL if the value is to change with time or FIXFLU if the source is to change with time. For FIXVAL, the time t used in the built-in options is taken as the current time level, i.e. t=t+ (=TIM in PHOENICS). For FIXFLU, t is taken as the average of the current and previous time levels, i.e. t = 0.5*(t+ + t-) where t+ = t- + Dt and Dt id the current time step.
VAL can be:
GRND4 - Linear source
GRND10 - Sine
GRND6 - Cosine
GRND7 - Step (battlement)
GRND8 - Increasing Saw-tooth
GRND9 - Decreasing Saw-tooth
The figure shows the general form of the source applied, and defines the nomenclature used. Several additional variables must be passed to EARTH. This is done using the SPEDAT command.
For a Linear source (GRND4) the formula used is
VAL = Fs + ( Fe - Fs)*(t - ts)/(te - ts)
and the additional settings are: SPEDAT(TIMabcde,STARTphi, R, Phi value at start of cycle Fs) SPEDAT(TIMabcde,ENDphi, R, Phi value at end of cycle Fe) SPEDAT(TIMabcde,TSTARTphi, R, Start time ts) SPEDAT(TIMabcde,TENDphi, R, End time te)
For sine and cosine sources (GRND10 & GRND6) the formula used is:
VAL = A sin(or cos) [ {2p/Tp} t' ] + M
where
t' = t - ts + goff * Tp
and the extra settings are:
SPEDAT(TIMabcde,PERIODphi, R, Time period for one cycle Tp) SPEDAT(TIMabcde,AMPLITUDEphi, R, Amplitude of cycle in cycle A) SPEDAT(TIMabcde,MEANphi, R, Mean value of phi in cycle M) SPEDAT(TIMabcde,TSTARTphi, R, Start time for offset ts) SPEDAT(TIMabcde,OFFSETphi, R, Dimensionless time offset goff )
Once active, the source will continue until time-step itl.
Example 1
A heat-source varying as a sine-function of time, with an amplitude of 25W/m3, a mean value of 50W/m3, and the time for one cycle is 5 minutes.
PATCH(TIM-1, VOLUME, ixf,ixl, iyf,iyl, izf,izl, itf, itl) COVAL(TIM-1, TEM1, FIXFLU, GRND10)
SPEDAT(TIM-1,PERIODTEM1, R, 300.0) SPEDAT(TIM-1,AMPLITUDETEM1, R, 25.0) SPEDAT(TIM-1,MEANTEM1, R, 50.0) SPEDAT(TIM-1,TSTARTTEM1, R, 0.0) SPEDAT(TIM-1,OFFSETTEM1, R, 0.0)
Example 2
A fluid enters with a density RHO1, an inlet velocity of 2m/s, and an inlet temperature that is a sine-function of time, with an amplitude of 5 deg C, a mean value of 15 deg C, and a period of 10 seconds.
PATCH(TIMINL, LOW, ixf,ixl, iyf,iyl, izf,izl, itf, itl) COVAL(TIMINL, P1, FIXFLU, RHO1*2.0) COVAL(TIMINL, W1, ONLYMS, 2.0) COVAL(TIMINL, TEM1, ONLYMS, GRND10)
SPEDAT(TIMINL,PERIODTEM1, R, 10.0) SPEDAT(TIMINL,AMPLITUDETEM1, R, 5.0) SPEDAT(TIMINL,MEANTEM1, R, 15.0) SPEDAT(TIMINL,TSTARTTEM1, R, 0.0) SPEDAT(TIMINL,OFFSETTEM1, R, 0.0)