A Brief Overview of In-Form

Summary

In-Form is a feature which enables users of PHOENICS greatly to extend its capabilities, without the introduction of new coding.

Users are enabled to express their requirements by way of formulae. These are read by the Input Module (Satellite), which transmits them to the Solver Module (EARTH); this then interprets them and performs the implied computations.

Unlike PLANT, its predecessor in functionality, In-Form does not require use of a re-compilable version of PHOENICS.

This document provides a brief overview of In-Form. The complete documentation can be found here.


Contents

  1. Syntax
  2. KEYWORD
  3. VARIABLE
  4. LOCATION
  5. FORMULA
  6. CONDITION
  7. Examples
  8. The In-Form Editor

Syntax

The syntax of In-Form is relatively simple. A typical In-Form command will have some if not all of these elements:

 

(KEYWORD of VARIABLE at LOCATION is FORMULA with CONDITION)

 

It should be noted that:


KEYWORD

The most commonly-used keywords include:

 

There are other less-commonly used keywords, which are listed in the full In-Form documentation


VARIABLE

This keyword defines the variable the In-Form statement is to operate on. It can be any of the SOLVEd variables, or any of the auxiliary variables declared by STORE, or by the In-Form STORED command.


LOCATION

This keyword defines the location where the In-Form command will be applied. If it is absent, the command will apply to the whole domain.

LOCATION can be one of:

More details are given here.

If different formulae are required at different locations, a separate In-Form statement will be needed for each location.


FORMULA

This is the formula, long or short, simple or complex, which describes what the In-Form is trying to implement. A full description is given here.

The formulae employed by In-Form, whether for setting properties, initial values, sources or anything else, are arrangements of operators, functions and operands which conform to rules which are similar to those of algebra and/or Fortran.

No significance attaches to whether upper- or lower-case characters are used.

Operators

The operators which may be used are:

Functions

The functions, listed in alphabetical order here, include:


CONDITION

There are numerous post-formula options; but many of them apply only to particular keywords, as is shown here. If more than one 'with' condition is required, they must be separated by ! rather than 'with'.

There are two which apply to many keywords, these being:

Limitation to a particular material by use of 'with IMAT' etc

Other variables than PRPS can be used in a similar way. Thus, it is possible to:

IF

Another generally-applicable post-formula option is the "IF( condition)" construct, wherein condition can be a Fortran-like expression, as exemplified in many library cases.

Note that blank spaces must not be used inside the IF() condition.

    'with IF(MARK.EQ.1)' is correct

    'with IF(MARK .EQ. 1)' will produce errors.


Examples

Here are some simple examples of using In-Form:

  Save7begin

(stored of PTOT is P1+PRESS0 with imat<100)

  Save7end 
  Save9begin

(property RHO1 is 1.0+0.1*TEM1+1.E-6*TEM1^2)

  Save9end 
  Save9begin

(property RHO1 at B10 is 1.0+0.1*TEM1+1.E-6*TEM1^2) 

  Save9end 
  Save9begin

(property RHO1 is 1.0+0.1*TEM1+1.E-6*TEM1^2 with imat=123) 

  Save9end 

Q = min(10000*t, 3.0E6) for t < 720

Q = max(3.0e6-13000*(t-720), 5000) for t> 720

The heat source will thus increase linearly with time for the first 720 seconds, to a peak of 3MW which is reached after 300 seconds and maintained until 720 seconds. After 720 seconds, the heat source reduces linearly with time until it reaches a minimum value of 5kW at 950 seconds.

  Save13begin

(source of tem1 at fire1 is min(1e4*tim,3.e6) with if(tim.le.720)!WHOL)

(source of tem1 at fire1 is max(3.e6-1.3e4*(tim-720),5e3) with if(tim.gt.720)!WHOL)

  Save13end

The condition !WHOL sets the source as a total source for the whole object. Without it, the source would be per unit volume.

Note that in the above examples the In-Form commands are enclosed in Save begin/end lines. These are crucial for the VR-Editor to locate the lines, present them for editing and write them back into the Q1 file.

There are many other examples to be found in the library. They can be found from the PHOENICS Commander by following 'Study special features', 'In-Form'.


The In-Form Editor

Because In-Form statements often require more than one line, a special In-Form-Editor module has been attached to the Virtual-Reality Editor in order to facilitate their creation, recognition and modification. There are 'In-Form' buttons on the relevant pages of the Main Menu. Clicking on them starts the In-Form Editor:

InForm Editor

This can be used in insert new commands and modify or delete existing ones. It will automatically insert the begin / end lines.


Contents