phoenics updating order algorithm

advertisement
PHOENICS & SIMPLE ALGORITHM (2D)
1. Guess a initial pressure field (P*)
2. Solve the imperfect velocity field, the starred velocities, based on the
estimates of P*
a e u *e   a nb u *nb  b  (PP*  PE* )A e
a e v*n   a nb v*nb  b  (PP*  PN* )A n
J e  FeP   a E P  E 
Pe 

a e  De  AMAX  Pe, 1  , 0
2 

Fe 

a e  AMAX  Fe, De  , 0
2 

Fw 

a w  AMAX Fw, Dw 
, 0
2


ae
De
Pe
Fe u e
Pe 

De  x
0
3. Pressure correction equation
a P PP'  a E PE'  a W Pw'  a N PN'  a S PS'  D*

 2 P '  D*
A
a PE  d e A e ; d e  e & D*   u *e A e  u *w A w  v*n A n  v*sA n
ae

u 
True

u*
Pr edicted

u'
Corrector
v  v *  v'
P  P *  P'
uA uA
vAvA  uAuAvAvA
'
e
e
'
w
w
'
n
n
'
n
n
*
e
*
w
e
Pr edictor
w
*
n
n
D mass div. (Corrector)
Predictor Eq.  a e u *e   a nb u *nb  b  (PP*  PE* )A e
Corrector Eq.  a e u 'e   a nb u 'nb 


(PP'  PE' )A e
neglected
1
*
s
n

If you sum both equations you get the original momentum equation. Substituting the
velocity corrector equation into the mass conservation equation, one gets the pressure
corrector equation:
d P  P A  d P  P A  d P
 u A  u A  v A  v A 
e
'
P
*
e
'
E
e
e
w
*
w
'
P
'
W
*
n
w
w
n
*
s
n
'
P

 

 PN' A n  d s PP'  PS' A n
n
4. Update the pressure and velocities values to satisfie mass balance at each
cell:
u *e

P*  P*  P'
 u *e  d e PP'  PE'




Actualized Pr edicted
Correction
*
*
'
v n  v n  d n PP  PN'


5. Solve any scalar field (temperature, kinectic energy, concentrations etc)
6. Return to step 1 using the updated pressure field as a new guess.
ae, aw, an, as, ap
Solve Predictor u*
P=P*+P’
U=U*+U’
D*
Solve Corrector P’
2
Pressure Boundary Conditions
INLET
UIN
Ue
W
P


'
d e PP'  PE' A e  d w PP'  PW
A w   d n PP'  PN' A n  d s PP'  PS' A n










No Correction





 



 *
  u e A e  u IN A w   v *n A n  v *s A n


 

No Prediction 



 





Since the UIN is given, the flow rate across w face should not be expressed as a
predicted field, u*, but in terms of the true values of u, i.e., u’ will be zero – no
correction applies. As a consequence P’W will not appear or aW will be zero in the P’
equation.
a P PP'  a E PE'  a N PN'  a S PS'  D*


D*   u *e A e  u IN A w  v*n A n  v*sA n

Phoenics Implementation
Boundary conditions appears on the rhs of the  equations and have the form:
T  C  V  P 
T  ( tiny )  u IN tiny    P 
Fixing a mass flux at the inlet one have
 a i i  Sf   TCV
P 
 a i   TC
 a i i  Sf   Ttiny Source tiny   a i i  Sf  Source
P 

 a i   Ttiny 
ai
3
OUTLET
Creating a ficticious node E and fixing the external pressure at PE.
Uw
Ue
W
E
P
Noticing that at the outlet boundary the PE is given, then PE’ is zero. Therefore the
momentum predictor and corrector equations takes the form:
Predictor Eq.  a e u *e   a nb u *nb  b  (PP*  PE )A e
Corrector Eq.  a e u 'e 
(PP'  0)A e
Substituting into the mass conservation equation:




A  d P '  P ' A   d P '  P ' A  d P '  P ' A
d e  PP' 
0
w P
W
w
n P
N
n
s P
S
n

 e


PEisknown 



 
 

  u *e A e  u *w A w  v *n A n  v *s A n


 

One must observe that the u velocity equation is not solved at the last V.C. in order to
obtain Ue. In fact the Ue velocity is determined by the pressure difference between the
node Pp and the first external node. This can be set through a pressure coefficient Cp
such as:
 Ue  CpVp  Pp
where Vp (which in this case is coincident with PE as represented in the example) is the
external pressure and PP is the last pressure node. Therefore the source term UeAe in
the pressure correction equation, is replaced by the expression above. This form to
express the outlet has two major advantages:
1) It creates a pressure referential based on the external pressure. The difference
between the internal node pressure and the external pressure will depend on the CP
coefficient. The pressure referential is necessary to establish the pressure
differences at the momentum equations.
2) It can be easily expressed in the form T  C  V  P  , in this case T is the area, C is
the pressure coefficient and V the external pressure.
4
Representing the Ue term by means of the pressure coefficient CP and a pressure
difference has other implications as far as inflows and outflows are concerned. If P P >
VP the resultant Ue is positive and correspond to an outflow. On the other hand, if P P <
VP the resultant Ue is negative and entails to an inflow which in same cases may be
plausible if the physics of the problem demands but in other may cause numerical
divergence. How close or how far PP will be from VP will depend on the CP value.
Choosing large CP values correspond to small pressure differences and is very likely to
occur an inflow where an outflow is desired. The other way around, small C P values
creates large pressure differences are most likely to render outflows. How large or small
the CP values are depends on the outflow velocities, Ue. Requiring the pressure
difference across the outles greatly exceeds the dynamic-head variations, ie
Vp  Pp  U 2
but since  Ue  CpVp  Pp this lead to the required value of CP:
1
C P 
U
5
PHOENICS UPDATING ORDER ALGORITHM
Slabwise Pressure Correction
DO ISTEP = 1, LSTEP
DO ISWEEP = 1, LSWEEP
DO IZ=1,NZ
DO ITHYD = 1, LITHYD
DO IC = 1,LITC
Solve scalars in order
KE, EP, H1, C1,C2, …C35
ENDDO
Solve velocities in order V1, U1, W1
Construct and solve Pressure correction eqn
Adjust Pressure and Velocities
ENDDO
ENDDO
ENDDO
ENDDO
Whole Field Pressure Correction
DO ISTEP = 1, LSTEP
DO ISWEEP = 1, LSWEEP
DO IZ=1,NZ
Apply previous sweep’s pressure & velocity corrections
DO IC = 1,LITC
Solve scalars in order
KE, EP, H1, C1,C2, …C35
ENDDO
Solve velocities in order V1, U1, W1
Construct and store Pressure correction sources & coeff.
ENDDO
Solve and store pressure correction whole field
ENDDO
ENDDO
6
group 15
LITHYD ---- Integer; default=1;
LITHYD....maximum number of hydrodynamic iterations at a slab. This iteration loop covers all solved
variables, and includes the solution of the slab pressure-correction equation ( when the N appears as the fourth
argument of SOLUTN for P1 ).
For parabolic calculations ( PARAB=T ), LITHYD should always be given a value greater than 1 ( say 10 ). The
slab-iteration-loop will then be terminated either after LITHYD iterations, or when the RESREF conditions are met.
LITHYD does for a slab in a parabolic flow what LSWEEP does for the whole domain in elliptic flow; and
the whole-slab iterations may be terminated, as are the whole-domain ones allowed by LSWEEP, by the falling of
the residuals below the user-set values of RESREF. What has been written in Section 5.5(a) therefore applies here
also, except that the decision to terminate solution at a slab is subject to the sum of the absolute residuals falling
below RESREF*NZ.
However, two further points should be mentioned. First, slabwise iterations can be employed for elliptic
problems (ie LITHYD may be set to exceed 1); and convergence may indeed be accelerated by this practice if the
flow direction is entirely from low z to high z, especially when the domain is long and thin, and the w component of
velocity is always positive.
Secondly, if NZ equals unity, so that only one slab is in question, it is almost immaterial whether LSWEEP or
LITHYD is used to control the amount of computational work which is done; but it is probably simpler to set
LITHYD to unity and rely only on LSWEEP.
LSWEEP ---- Integer; default=1;
LSWEEP....index number of last sweep.
In a steady or transient calculation, a sequence of iterative sweeps through the integration domain is
terminated after solution-sweep number LSWEEP has been completed. In a steady calculation, the run is then
complete; in a transient calculation, the computation then progresses to the next time step. LSWEEP is inactive for
parabolic calculations ( ie. PARAB=T ), for which, by the nature of the calculation , only one solution sweep is
required.
Thus, for a steady non-parabolic calculation in which FSWEEP retains its default setting of unity,
LSWEEP is the number of solution sweeps to be performed in the run. If FSWEEP has been set to a finite value, for
a restarted ( see RESTRT ) run, the number of sweeps to be performed will be LSWEEP-FSWEEP+1 .
For a transient run, FSWEEP will always be unity, LSWEEP is then the number of sweeps to be performed at each
time step. Further, if any of the variables are solved whole field (ie. Y entered in the fourth argument of SOLUTN),
LSWEEP should never be less than 2, because the effects of the whole-field solver are only felt at the beginning of
the second sweep.
For both steady and transient cases, the succession of iterative sweeps will be terminated before LSWEEP
is reached, if the total sum of the absolute residuals for all cells in the integration domain becomes less than
RESREF(phi) for all phis solved.
LITC ------ Integer; default=1;
LITC....is the number of iterations at a slab during a sweep of the solution cycle encompassing the
variables with indices from 12 upwards. This loop is within the loop of which LITHYD is the counter limit, but
unlike the LITHYD loop it does not extend to the solution of the velocities and the slab-wise pressure corrections.
Values in excess of 1 may be useful if several such variables interact strongly, as in the case of chemical reaction.
Unless the user has good reason for doing otherwise he is advised to leave LITC at its default value.
RESFAC, the residuals factor
RESFAC is a PIL variable, defaulted to 0.0, used by EARTH, when SELREF = T, to compute the RESREF for each
variable from RESREF = RESFAC * typical flow of the variable
See also entry for SELREF.
RESREF ---- Real array; default= 1.E-8;
RESREF(phi)....reference value of residual used as determinant of whether sweeps (or iterations at a zstation for PARAB) may be terminated. When the sum of the absolute values of the residuals for a variable falls
below the associated RESREF, the solution for that variable is terminated. When this condition is satisfied for all
variables, the solution as a whole is terminated. In this case, one more sweep of the domain is performed to give
print-out, but no solving is done on this print sweep.
GROUND is informed about the termination of iterations and sweeps by the two logical variables ENUFIT and
ENUFSW. When the slab-wise iterations ( governed by LITHYD ) terminate, ENUFIT is set to T; when the sweeps
are terminated, ENUFSW is set T.
7
The possibility of some variables ceasing to be solved whilst others are still solved has its problems. For
example, even if the u velocity is not solved because its RESREF criterion is satisfied, it will still be adjusted at the
continuity-adjustment stage: it can then progressively move away from satisfaction of its momentum equation, until
its solution is reactivated. In fact, the decision to cease solving for a particular variable is done on a slab-wise basis:
so if the residual sum at the slab falls below RESREF divided by NZ the solution at the slab for the variable is
switched off.
For these reasons it is recommended that the RESREFs are always set to a small fraction of the incoming
flow times the value of the variable brought in, or any other suitable normalizing quantity.
The print-out of the whole-domain residual sum for each variable is normalized by its RESREF; therefore printed
values below 1.0 signify that the convergence criterion has been satisfied.
group 16
ENDIT ----- Real array; default= 1.E-8;
ENDIT(phi) … is the iteration-termination criterion employed in EARTH to terminate the iterations of the
linear-equation solver when the cell-average absolute change in the correction from one iteration to the next falls
below the appropriate ENDIT. If this criterion is not satisfied, the solver stops after LITER iterations. ENDIT for
velocity is measured in meters/ second, that for pressure in Newtons per square meter, and so on. If a value is set
which is below the round-off capability of the machine, it is most probable that the iteration limit, LITER, will be
reached. The user can ensure that LITER iterations are all performed by setting ENDIT to zero. This is sometimes
needed to avoid the premature termination of iterations that round-off errors can cause.
When greater than zero, ENDIT influences the termination of iterations in the Stone-type linear equation
solver by requiring the average change of value to be less than ENDIT times the average change at the first iteration
before termination can occur (unless LITER iterations have been performed)
When less than zero (but not = GRND1), ENDIT represents the negative of the over-relaxtion factor to be
used for the variable in question, in the built-in Stone-type linear-equation solver. See PHENC entry: overrelaxation. When ENDIT = GRND1, the conjugate-gradient solver is called instead for the PHI in question, whereas
the setting CSG3=CNGR causes that solver to be called for all variables, which may not be desirable.
LITER ----- Integer array;
LITER(phi)....maximum number of iterations which are to be performed by the linear-equation solver for
the variable phi, when such a solver is being employed for it. The linear-equation solver is used unless the user
decrees by means of SOLUTN that the linearized equations are to be solved Jacobi point-by-point.
For one-dimensional operations (eg at "slabs" for which NX=1 or NY=1), the linear equations are solved
directly, so that whatever the original setting, LITER is taken as 1.
In order to elicit information about the progress of the iterations within the linear-equation solver set LITER(phi) to
minus the maximum number of iterations wanted. The information is written to the VDU. This print-out comes at an
iteration frequency of TSTSWP. When examining this output, it is important to recognise that it is the correction
equations that are solved: the solution to the direct equations is obtained when the corrections are zero.
Information about the progress of the linear-equation solvers can also be directed to the main output ( ie. to
the file RESULT ), by means of the third argument of OUTPUT.
Termination of sweeps and iterations; advice on LSWEEP, RESREF, LITHYD
(a) Sweeps (Group 15)
Prior to the introduction of the UWATCH and USTEER commands, of the graphical monitor (switched on by a
negative TSTSWP setting), and of SELREF and RESFAC (q.v.) the following advice (which appeared in the
Beginner's Guide) was appropriate. Even now it has some value.
"If you are watching over the progress of your calculation, and can have immediate and unimpeded access to your
computer, it is useful to set LSWEEP to a small value (eg 20) and to proceed by way of a succession of restarts.
8
Even if this is not done, it is wise to ensure that LSWEEP is set to some not-excessive value, especially if the
computation is to be performed without your being on call to abort a run which is evidently not converging.
Probably 100 is as large as should ordinarily be allowed, unless experience has shown that, for the problem in
question, satisfactory convergence requires more sweeps.
Preferably however, the sweeps should not be terminated by LSWEEP at all, but instead by the falling of all sums of
absolute residuals to below the values pre-set in the array RESREF.
In this connexion it should be noted that RESREF is a quantity having the dimension of the dependent variable in
question, multiplied by mass and divided by time (except in the case of variable P1, as explained below).
You need to consider, by reference to the flow rates involved in the phenomenon being simulated, what value of
RESREF is appropriate to each of the variables for which you are solving.
In time-dependent problems, for example, the transient terms in the balance equations become larger the smaller is
the time step, because the time interval appears as a divisor. It is therefore appropriate also to make RESREF larger
as the time step is diminished. This is easily done by setting RESREF by way of an arithmetic expression involving
FLOAT(LSTEP) in the numerator and TLAST in the denominator.
Extreme values of RESREF should be avoided. If RESREF is set too high, the solution sequences will
terminate too early, at least for the relevant variable; and the solution will be correspondingly inaccurate.
Uneven values of RESREF should also be avoided. If the solution of one of the momentum equations terminates
prior to the termination of the pressure-correction equation and the other momentum equations, it will continue to be
adjusted by the pressure corrections without its momentum equation being solved. This can lead to a gradual drift
away from convergence until its residual sum exceeds its RESREF, whereupon its momentum equation will be
solved again. In extreme cases this behaviour can lead to divergence.
If, on the other hand, RESREF is set too low, calculations will continue long after the solution has been
reached as nearly as the machine's round-off error will permit. It is of course hard to know with certainty, before the
calculation begins, what values of LSWEEP, RESREF etc will be appropriate. It is therefore convenient that the
restart facility of PHOENICS permits you to make a few sweeps, to pause in order to inspect the results, and then to
continue the calculation, with different settings of relaxation parameters if this seems desirable.
It is important to understand the differing roles of RESREF(P1), RESREF(R1) and RESREF(R2), all of which are
concerned with continuity balances.
RESREF(P1) is the reference value of the volumetric-flow imbalance; and, when two-phase flows are in
question, it is compared with the sums of the volumetric imbalances for the two phases for each cell. RESREF(R1)
and RESREF(R2), by contrast, represent mass imbalances, and they relate to the individual phases. When they are
all set to values other than zero, all contribute to the determination of whether sweeps should terminate prior to the
performance of LSWEEP of them.
Since version 1.6, a self-selection mechanism has been provided. It is activated by setting SELREF=T in
the Q1 file. Then the user has only to select a single value, namely RESFAC, which causes EARTH to set RESREF
for each variable to RESFAC times a representative flow rate for that variable in that flow.
See PHENC entries: SELREF, RESFAC, TSTSWP, RESREF, UWATCH, USTEER
(b) Slabwise iterations (Group 16)
For parabolic problems, only one sweep is made through the integration domain, because storage is
provided only for variables belonging to two slabs at a time, namely:
(1) the slab for which variables are being calculated, and
(2) its 'low' neighbour.
LSWEEP is therefore set equal to 1 by EARTH, whatever value happens to have been set by the SATELLITE.
The interconnectedness of the equations makes it necessary that, in parabolic problems, the whole cycle of variable
adjustments should be repeated many times. This is achieved by setting the variable LITHYD to a sufficiently large
number.
See the Encyclopaedia entry 'LITHYD'.
(c) Iterations in the linear-equation solver (Group 16)
The linear-equation solver of PHOENICS acts in an iterative manner, except when all but one of NX, NY
and NZ are unity, or when NX or NY is unity and whole-field solution has been switched off. In other
circumstances, the question arises: how many iterations should be performed?
In terms of data settings, the questions become: what values should be ascribed to LITER, to RESREF and to
ENDIT for each of the solved-for variables?
These questions are of importance; for they often affect the speed with which the overall solution is arrived at; and,
when the variable in question is P1, which is strongly connected with the satisfaction of mass continuity, they may
affect whether it is attained at all. Especially because simulations with fine grids are often too expensive for comfort,
means of reducing cost without loss of accuracy are worthy of consideration.
The expense itself will of course be smallest if LITER is small, or if both RESREF and ENDIT are large;
for either will cause the iteration process to be swiftly terminated. Whether or not this is tolerable depends upon
whether the variable in question is one of those of which the convergence limits the speed of approach to the overall
solution.
In forced-convection heat-transfer problems, in which the fluid-flow pattern is of great importance, the
pressure-correction sequence controls the satisfaction of mass continuity; it is therefore usually desirable to employ
9
large values of LITER(P1) and small values of RESREF(P1) and ENDIT(P1). This entails that a large amount of
computer time will be spent in solving for P1; but it is probably well-spent. Corresponding expenditure on the
enthalpy equation is less likely to be worthwhile, because there is no point in having a highly accurate solution to
the linear equations if their coefficients have not yet settled down.
Indeed, if the enthalpy (and other scalar fields) are only weakly coupled (or not coupled at all) to the velocity field,
great economy can be achieved by settling the hydrodynamics first, without solving for enthalpy. In subsequent
restarts, the enthalpy can be solved on a frozen velocity field by deactivating the solution of the hydrodynamic
variables (ie the velocities and pressure).
In this connexion, it is always worth considering the use of the index ISWC1, which appears in Group 15,
and is defaulted to 1. This controls the first sweep at which the dependent variables from number 12 (KE) onwards
enter the solution cycle. If ISWC1 is set to 50, say, the velocity fields will have had 50 sweeps in which to attain
their converged values before solution for variable C1 starts at all.
Free-convection heat-transfer problems, by contrast, would not be suitably treated in this way; for the velocity fields
cannot be determined independently of the temperature field. In such cases equal importance should be ascribed to
both the pressure- and the temperature-equation solvers.
Flow-simulation problems are so various that it is difficult to give any further generally applicable advice.
However, it is possible to find out what time that is spent in the linear-equation solvers in any particular flow
simulation, and about the work that they are doing, by setting LITER to the negative of the value required. This has
the effect of transmitting to the VDU information about the course of the iterative process for each sweep for which
ISWEEP is a multiple of TSTSWP. If inspection of this information shows that many iterations are performed in
which there is almost no change to the values, ENDIT should be enlarged.
The convergence rate of the whole-field linear solver can be accelerated by means of the OVRRLX
parameter. Also of use to those users who wish to observe or control the convergence behaviour are the PIL
variables UWATCH and USTEER. Setting these to T in the Q1 file permits intervention in the calculation as it
proceeds.Further, setting TSTSWP (q.v.) to a negative number activates the graphical convergence monitor."
DIVERGENCE AND HOW TO COMBAT IT
(a) What is divergence
Because the solution procedures built into PHOENICS are essentially iterative, it is usual that many adjustment
cycles must be carried out before the residuals have been reduced sufficiently for the computation to be terminated.
Sometimes however, the residuals in one or more equations start and continue to increase rather than decrease as the
sweeps proceed. This phenomenon is known as "divergence"; and it is often accompanied by the appearance of
unphysically large values in some of the dependent variables. This process can be watched at the VDU screen. (See
PHENC entries UWATCH and TSTSWP).
In hydrodynamic problems, it is often the values of the pressure which depart farthest from physically-realistic
values; because of this, PHOENICS has a built-in trap which causes the run to be terminated when excessive values
of pressure are encountered. A message explaining this reason for the abandonment is then printed.
Sometimes the problem is not that residuals grow but that they fail to diminish sufficiently as far as has been
expected. Often this behaviour is associated with finite-amplitude fluctuations in the values of some of the
dependent variables, which continue indefinitely. Such behaviour may be quite localised, as when a pressure
fluctuation close to an aperture connected with the outside causes inflows and outflows there, which alternate from
sweep to sweep.
However, it must also be recognised that, since all computations are subject to round-off error, there is often a limit
beyond which no reduction of the residuals is possible. Such computations can fairly be regarded as fully converged.
It is therefore always wise to set SELREF = T and RESFAC = a number which is not unreasonably small (eg 0.01).
(See SELREF and RESFAC)
(b) Identifying the cause
When divergence occurs, it is necessary to establish the cause; this if it is not faulty posing of the problem, is usually
to be found in the strength of the linkages between two or more sets of equations, which are being solved in turn
rather than simultaneously.
For example, if a problem of free-convection heat transfer is being solved, the two-way interaction between the
temperature field and the velocity field, whereby each influences the other, is a common source of divergence.
Whether it is the source in a particular case is easily established by 'freezing' the temperature field before the
divergence has progressed too far, and then seeing if the divergence persists. If it does not, the velocity-temperature
link can be regarded as the source of the divergence; otherwise, the cause must be sought in some other linkage.
How is the 'freezing' to be effected? The simplest means is to under-relax heavily. If this is done through the
SATELLITE, an appropriate setting is:
RELAX(H1,FALSDT,1.E-10) , or alternatively RELAX(H1,LINRLX,1.E-10) .
10
In this way, one can investigate the contributions to divergence of linkages between: individual velocity
components; the volume fractions and the velocity field in a two-phase process; the chemical-species concentrations
in a reacting flow; the pressure and the density in a compressible flow; the turbulence energy and its dissipation rate
in a turbulent flow; and many other variables.
If the non-convergence is thought to originate in the linkage between the flow field and a boundary condition, as is
often true of the fluctuations mentioned above, it may be beneficial to impose a LOCAL 'freezing'. This can be
effected by defining a 'source' patch for the region of interest, and then setting the third argument of the associated
COVAL as a large number such as 1.E10, and the fourth argument as SAME.
(c) Under-relaxation as a cure for divergence
If freezing by very severe under-relaxation restores convergent behaviour, it is obviously possible that modest
under-relaxation will have the same qualitative tendency, while still allowing the solution to proceed so that all
residuals do finally diminish (the residuals of 'frozen' variables, incidentally, do not diminish).
The use of under-relaxation is by far the most common means of securing convergence in practice. If employed
indiscriminately, it can lead to waste of computer time; however, when it is applied to just those equations that have
been identified as potential causes of divergence, and in just the amount that is necessary to procure convergence, it
is probably the best first-recourse remedy to apply.
PHOENICS is equipped with a device called EXPERT for adjusting under relaxation factors automatically. It cannot
be expected to make the correct choices in extremely complex circumstances; but it is always worth trying. (See
PHENC entry EXPERT).
(d) The use of limits
The VARMAX and VARMIN quantities can also be useful in preventing divergence, particularly when this is
associated with a poor starting field for the iterative process, which allows some variables at first to stray outside the
physically meaningful range.
VARMAX and VARMIN can be employed in two distinct ways: they may set upper and lower bounds to the values
of the dependent variables themselves; or they may set limits to the changes in these values in a single adjustment
cycle. (See PHENC entry VARMIN)
The values of VARMAX and VARMIN can of course be chosen differently for each dependent and auxiliary
variable; but there is no built-in way of applying them over restricted regions at present. However, it is easy for a
user who is willing to introduce coding in GROUND to do this for himself; for the functions FN22 and FN23 are
available for applying limits to any variable over regions defined locally by IXF, IXL, IYF, etc.
(e) Linearisation of sources
Source terms can be introduced in GROUND either directly or in a linearised manner. The first involves ascribing a
single quantity for each cell, viz the source itself; the second involves ascription of two quantities, the "coefficient"
and "value". (See PHENC entries: COVAL and BOUNDARY CONDITIONS).
Suppose that the source of variable j, S, does depend upon j, so that it is possible to express it in a linearised manner
as:
S = S# + (j-j#)*(dS/dj)#
wherein the # appended to a symbol signifies "current best estimate" of its value.
This expresion can be reformulated in terms of CO and VAL (See COVAL) ie as:
S = C*(V-j)
if
C = - (dS/dj)#
and
V = j# + S#/C
If C is positive (ie S decreases as j increases), convergence is promoted by using the linearised-source form for S.
If however C is negative (ie S increases as j increases), use of this form may cause divergence. It is then better to use
the first-mentioned mode, ie to employ simply:
S = S#
for otherwise the denominator of the expressions for j may fall through zero, causing unrealistically large values of j
to be computed.
(f) The time-dependent approach
Many computer codes for fluid-flow simulation operate wholly in the transient mode, even when it is the ultimatelyapproached steady state that is of practical interest; and one reason is that, if the transient development of a flow
process is followed realistically, the non-physical values which characterise divergence can hardly occur.
The fully-implicit formulations built into PHOENICS permit the steady state to be simulated more directly, albeit in
an iterative way which does have some of the properties of 'time-marching'. Nevertheless, if convergence proves
hard to procure, there is no reason why the user should not, after setting STEADY to F, watch the flow phenomenon
develop in time.
Doing so, as well as yielding indirectly the desired steady-state solution, may well reveal the cause of the difficulty
encountered by the direct approach. Thus, one feature of the flow may prove to require very small time steps for its
adequate resolution; in the direct approach, small 'false' time steps would correspondingly have been needed.
Of course, if convergence still proves impossible to achieve by way of the time-dependent approach, no matter how
small are the time steps which are employed, the making of some fundamental in the problem set-up should be
11
suspected. After all, if the flow that it i desired to simulate is physically possible, there must be some way o
simulating it numerically.
(g) Changing the problem formulation
A recalcitrant divergence problem is sometimes best solved by changing its formulation. For example, high-Machnumber steady-state compressible flows are difficult to simulate when the density is obtained from the pressure and
the temperature, the latter being deduced from the stagnation enthalpy and the kinetic energy.
The reason is that the speeds of approach of the enthalpy and the velocities to their true-solution values may be very
different, with the result that densities may be temporarily computed which are very far from the true-solution
values; moreover, the "staggering" of the velocity fields with respect to the scalar storage locations introduces
uncertainties as to how the kinetic energy to be linked with the stagnation enthalpy is to be deduced by interpolation.
When however an equation is solved for the specific enthalpy, and the density is deduced from this quantity and the
pressure, this problem may disappear entirely.
Convergence, and how to accelerate it
A simulation is said to be converging when the residuals (or errors) in the equations decrease as the
iterative solution proceeds. During the run, the residuals are usually written or plotted on the screen by EARTH.
The following discussion is organized under the headings:
(a) The choice of initial guesses
(b) Easily-removed causes of slow convergence
(c) Solution of one volume fraction equation
(a) The choice of initial guesses
If one knew the solutions to the equations at the start, and could insert the corresponding variable-field values as
initial guesses, convergence would be immediate. Of course, the solutions never are known; however, if initial
guesses can be made which are close to these solutions, convergence is likely to be rapid.
It is therefore usually worthwhile to set values of the initial fields, by way of FIINIT, which are as close as possible
to the expected average values of the solutions. It is possible to do even better, if the PATCH and INIT commands
are used; for these permit linearly-varying values (and indeed more complicated piece-wise linear distributions) to
be inserted rather easily.
How far to go in this direction should be determined by reference to the man-time cost of determining and
introducing suitable initial values and of the computer-time cost that is thereby saved.
A means of saving computer time that requires very little man-time, once the system has been set up, is to employ
the PHI file of a previous run of similar character, and then to work in the restart mode. This is of course most easily
accomplished when a series of related runs is to be performed in the course of a "parametric study" of some kind; for
then the solution of a just-completed run can serve as the initial guess for the immediately-following one.
However, the method is more-generally applicable; and PHOENICS users who perform expensive fine-grid runs
may well find it useful to store the resulting PHI files on tape, just in case they may be useful, in the future, as
starting solutions for some further related computations.
Also valuable is the creation of a set of initial-guess fields by interpolation in or extrapolation from the results of an
earlier solution performed with a different grid. This can be achieved by use of the PINTO program.
(b) Easily-removed causes of slow convergence
It often occurs that convergence proceeds smoothly, but not fast enough. In order to establish whether acceleration
may be possible, the cause of slow convergence should first be sought among the following:* Possibly too much under-relaxation is being applied. This is often the case when the user has had a
struggle to procure convergence at all, has achieved it in a rather unsystematic manner by applying underrelaxation to every variable he could think of, and, being thankful that his calculation now is converging, is
fearful of changing any of the settings.
* Possibly too much time is being spent in obtaining intermediate solutions of excessively high accuracy
for variables which have little influence on the number of sweeps which are needed for attainment of the
final solution.
For example, there is no point in solving for a scalar variable at all, if it does not directly or indirectly influence the
velocity field, until after the velocity field has converged; and one should certainly not set low values of ENDIT and
high values of LITER for such variables while velocity-field adjustments are in progress.
* Even for variables which do participate significantly in the velocity-field solution, such as the pressure, or
one of the velocity components, excessive demands may be being made at the linear-equation-solution
level.
* Similarly, LSWEEP may have been set to a very large number, and at least some of the RESREF's to
excessively low values, so that the computer is either producing solutions of a higher accuracy than are
needed, or is continuing to perform adjustment cycles without (because of round-off error) increasing the
12
accuracy of the solution at all. It is best indeed not to set RESREFs at all, but to allow EARTH to calculate
then by settting SELREF=T.
* If the flow being simulated is a time-dependent one, the time step chosen may be too small. This will
often be the case if the time step was selected so as to ensure convergence, rather than because the
phenomenon is a rapidly-varying one.
How can one determine whether one of the above is contributing to excessive computer charges? By changing the
relevant settings and observing what happens. Every reduction in the amount of under- relaxation, even an
enlargement in time step, is to be welcomed, provided that it does not on the one hand lead to divergence or on the
other entail a significant falling off in numerical accuracy.
(c) Solution of one volume fraction equation
It is recommended that only the second-phase volume-fraction equation is solved when the two phases coexist
everywhere in finite proportions, eg the volume fraction of one of the phases never falls below 0.001. The following
PIL instruction:
SOLUTN(R1,Y,N,...); SOLUTN(R2,Y,Y,...),
causes EARTH to solve for R2 and to calculate R1 as 1-R2. In addition to being more economical than solving for
R1 and R2, this practice has proved to give faster convergence in several
2-phase simulations.
When the phase volume fractions do not coexist everywhere in finite proportions, it is necessary to solve R1 and R2,
by way of the settings:
SOLUTN(R1,Y,Y,...); SOLUTN(R2,Y,Y,...).
Were R2 alone solved in this situation, loss of accuracy would occur in the calculation of R1 from 1-R2 in those
location in which R2 is close to unity.
(d) Other measures to be considered
There are other measures which can be taken at the SATELLITE level in order to reduce computer time. One
important one is to change the choice of solution procedure in the light of the considerations discussed in Section
5.4. The point-by-point procedure should be used for the velocity components and volume fractions when the
diffusion terms are of little importance; but it should definitely not be used otherwise.
Different velocity components may need different solution procedures. For example, a boundary-layer flow in which
z is the predominant flow direction is best handled with point-by-point solution for u and v, but slab-wise solution
for w. The reason is that w is strongly influenced by viscosity in these circumstances, where as u and v are not.
In some fluid-flow simulations, it is best to use the TERMS command in order to switch off the viscous terms
entirely. More surprisingly, perhaps, it is sometimes permissible to switch off the convection terms as well. For
example, when the flow takes place in a porous medium such as EARTH or sand, the only important terms are the
pressure gradient and the resistance exerted by the medium; so there is no point in computing terms which are
negligible. (See DARCY in TR 200 for an automatic means of establishing the porous-media-flow equations).
A number of other devices eg ADDDIF, GALA, ZDIFAC, NEWRH1 etc. are available for solution control and
economy. These are in Group 8; they are described in TR200.
Finally, attention is drawn once more to the possibility of varying the starting-time and the frequency of updating of
the various dependent variables, and for that matter of the auxiliary variables as well. PHOENICS possesses many
devices for effecting such variations, which you are advised to explore. The guiding principle should of course be
this: quantities which both influence and are influenced by the velocity (or other dominant-variable) field should be
updated frequently throughout the computation; those which influence but are not influenced should be set at the
beginning and never updated; and those which are influenced but do not influence should be updated only at the end.
A note on RESREF settings
As stated before, RESREF is an important resource to control the accuracy of
the numerical solution. It is used in conjunction with RESFAC in such a way that when
the sum of the residuals divided by RESREF is below RESFAC the solver for such
variable is stopped:
 residuals   RESFAC
RESREF 
An appropriate choice of RESREF allow to control the convergence rate of each
variable in order that all the solved variables reach the RESFAC limit simultaneously
thus avoiding non converged solutions of some variables. There is two ways to set
RESREF, one is in a built in PHOENICS facility which is activated by the logical variable
SELREF. When SELREF = T, EATH will evaluate the RESREF independently of the
13
values set by the user. On the other hand, when SELREF = F, the user has to adjust
himself the RESREF.
The residual of reference, RESREF has the dimension of a mass flux times the
dimension of the variable phi in question:
 
RESREF  m
It derives when one try to estimate the a reference flux through the face of a control
volume:
Re f .Flux  uA w  

u
P
FLUX
Aw
If one is dealing with the pressure correction equation,  =1, for the x momentum
equation,  =u; for the turbulent kinetic energy  =k and so on. So estimates on the
reference flux can be made on the typical scales of the mass flow rate (kg/s) for one
specific cell times and . With this reference flux one can constitute the RESREF :
RESREF  REFFLUX * NX * NY * NZ * 
where  is a reduction factor, properly chosen by the user, to set the desired RESREF.
Typically  is of 0.1 to 0.01. The convenient choice of  allows the user to obtain fast
intermidiate solutions (not fully converged) and, with the use of restart runs and further
adjustments either  or RESFAC one can get the numerical field to the desired
accuracy.
14
15
Download