Encyclopaedia Index

### 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:

• sxth, syth and szth are the theoretical stresses in the x, y and z directions;
• exth, eyth and ezth are the theoretical strains in the x, y and z directions: and
• pth is the theoretical dilatation.

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:

• the innermost loop visits all the cells in a "slab" of constant IZ;
• the intermediate loop "sweeps" through the whole domain, thereby visiting every slab; and
• the outermost loop, if the phenomenon simulated is time-dependent, updates variables at each time step.

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:

• The following lines extracted from the core-library case 701:
```  * Temperature
(STORED of T1 is H1/CP)
* Heat capacity
(STORED of CP is 4186.8*POL3(T1,.616,-.0040428,1.8333e-5,-2.38E-08))
```
enable the stored-only temperature, T1, to be computed from the solved-for enthalpy.

Here it should be noted that the calculation of T1 makes use of CP, and that of CP makes use of T1. Divergence is a possibility in such cases; but it does not arise in this case because the dependence of CP on T1 is small. Inspection of the Q1 file shows that the so-calculated T1 is used extensively for further property calculations.

• In case 706 the lines :
```(STORED VAR FLIQ IS MAX(1.e-5,MIN(1.,(TEMP-:RG(1):)/(:RG(2):\$
-:RG(1):))))
PATCH (iMUSHY,VOLUME,1,NX,1,NY,1,NZ,1,1)
(SOURCE OF U1 AT iMUSHY IS (0-U1)*:RG(3):*(1-FLIQ)/FLIQ)
(SOURCE OF V1 AT iMUSHY IS (0-V1)*:RG(3):*(1-FLIQ)/FLIQ)```
enable the liquid fraction to be deduced from the temperature during the casting of a metal alloy, and thereafter the momentum sinks to be computed.

• In case 752:
`(STORED of DM is 1.-AM-BM-CM-EM)`
deduces the concentration of a fifth not-solved-for concentration, DM, to be computed from the solved-for values of the four other components of a mixture.

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:

• single real variables,
• user-dimensioned real-variable arrays, and
• real variables having values for each cell in a patch.

#### 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:

• (MAKE dimension OF varname IS formula)
• where:
• 'dimension' is an integer or integer expression;
• 'varname' is the new variable name, having no more than eight characters, and being neither a standard PIL-variable name nor one that the user has declared;
• formula is the mathematical expression of the initial value of the variable, the default of which is 1.e-10 .

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:

• (MAKE 1 OF varname)
• (MAKE OF varname)
• (MAKE VAR varname)
• (MAKE varname)
• (MAKE 1 varname)
• (MAKE varname IS 1.E-10)
• (MAKE 1 varname IS 1.E-10)

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:

• In library case 781, which supersedes the earlier PLANT case z616.
• (MAKE RES)
• (STORE1 of RES is SUM(VOL*(GENG-2.*:RHO1:*EPKE*G)/(NY*NZ)))
• (STORE1 of RESREF(G) is RES)
• In library case 778, which supersedes the earlier PLANT case z619.
• (MAKE of SIZMIN is GREAT)
• (STORE1 of SIZMIN at PATCH2 is MIN(DZW,MIN(DYG,MIN(DXG,SIZMIN))) with IF(ISWEEP.EQ.LSWEEP))
and also in library case 778
• (MAKE of VELMAX is TINY)
• (STORE1 of VELMAX at PATCH2 is MAX(W1,MAX(V1,MAX(U1,VELMAX))) with IF(ISWEEP.EQ.LSWEEP))
• (TGRID of DT at PATCH3 is SIZMIN/VELMAX)

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:

• (MAKE :NX:*:NY: of SWTH is 0)
• (STORE1 SWTH is OLD(TEM1[:IXP:,:IYP:,])-:TLIM: with ZSLSTR)
• (SOURCE var V1 at WWALF is -:FORM:*V1 with IF(SWTH.LE.0))

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