Encyclopaedia Index
Back to main contents

5. Auxiliary variables

Contents of Section 5

  1. Whole-field, for viewing and post-processing
  2. Whole-field, for participation in the calculation
  3. Other (MAKE, STORE1)

5.1 Whole-field, for viewing or post-processing

The (stored .... ) keyword of In-Form enables whole-field variables to be created in accordance formulae specified by the user.

This facility may be used for variables which the user wishes to inspect, but which play no part in the calculation. RHM1, in an example in section 4.2, was of this character.

A solid-stress example

During development work, it is often desirable to perform numerical calculations for cases of which the analytical solution is known, in order that the accuracy of the numerical solution can be checked. The computation and printing of the exact values as auxiliary variables facilitates this.

Library case s603 can serve as an example. It concerns the heating of a solid block under various conditions of constraint.

The exact solutions are provided by In-Form statements here, wherein:

Whether the computed solutions are adequate can the be deduced by inspecting the RESULT file, of which a part is shown here.

Another exact-solution check

Case 718 provides an example of an artificially-contrived three-dimensional diffusion problem which possess an an exact solution.

This case is, incidentally, the In-Form equivalent of a much-earlier PLANT-using example, Case z118, where the PLANT-style formula for the exact solution can be seen, for comparison with the In-Form-style one.

There is an obvious similarity; but the advantage of the In-Form approach is, of course, that no new Fortran coding is required.

Stagnation pressure

It may be interesting, for flows for which there should be large regions of uniform stagnation pressure, to check whether this expectation is confirmed by the numerical calculations. This can be done for library case 805, where the velocity squared is stored by means of STORE(VLSQ), and then STGP, i.e. P1 + 0.5*RHO1*VLSQ by means of an In-Form STORED statement.

The contour plot shown here reveals that there is indeed a substantial region of uniform stagnation pressure, despite the coarseness of the grid.

Use of LOG10 for display enhancement

Library case 402 concerns the parabolic-mode simulation of the turbulent plume of oil-contaminated water which may rise above a leaking tanker on the ocean floor. Because of the large distances and volumes ofwater involved, the oil concentration varies over many orders of magnitude, which makes graphical display by way of contour plots rather difficult.

This is easily contrived by means of an In-Form stored statement.

The following images show:

If however the logarithm of the concentration has been computed, its variation, being less extreme, is easier to display.

Control of when and where the quantities are computed

The STORED-command formula can be optionally followed by 'with condition', where condition is one of:

ZSLSTR
for 'start of z-slab',
ZSLFIN
for 'finish of z-slab',
SWPSTR
for 'start of sweep',
SWPFIN
for 'finish of sweep',
TSTSTR
for 'start of time step',
TSTFIN
for 'finish of time step',

These may be understood by recalling that PHOENICS calculations are organised in nested iterative loops, whereby:

These 'with' conditions act as economy devices, enabling values to be updated only when needed. If no condition is supplied, In-Form takes ZSLFIN as its default.

Inspection of the Q1 for case 805 will show that 'with SWPFIN' was used.


5.2 Whole-field, for participation in the calculation

Auxiliary variables may be stored whole-field, and computed within the main equation-solving loop, for many purposes, including those of acting as intermediaries in the calculation of sources or fluid properties.

Examples of use

Thus:

This, it should be remarked, as a display-only action; for DM appears not to be used during the computation.

5.3 Other

Other auxiliary variables which In-Form can create are:

Syntax for other auxiliary variables: the MAKE command

The MAKE keyword is used for the allocation of memory for storage of real variables required by the user.

The complete format of the In-Form MAKE statement is:

If 'dimension' is more than 1 it should be equal to the number of cells in one slab NX*NY. Its default value is unity.

If an expression is used, it must involve only quantities such as NX, LSTEP, NTPRIN. which are known at the start of the calculation; for that is the moment at which the storage has to be allocated.

When a single real variable is to be declared, it suffices to specify only its name. Thus, the following In-Form statements are all equivalent:

Single variables declared in this way can subsequently be used in any In-Form statement.

The (MAKE statement is usually followed by one which uses the STORE1 keyword, the purpose of which is to show how the value of the variable is to be altered during the course of the computation. Its syntax can be deduced from the following examples.

Examples of the use of a single variable are:

and also in library case 778

An example of the use of MAKE for a real array is to be found In library case 786, which supersedes the earlier PLANT case z350:

Other relevant cases in the Input-File Library include:
779 and 783.