Another name for a simulation. When a case is defined by use of the PHOENICS Commander, the case name forms a unique filename for the Q1 file.
-------------- Advanced PIL command --- -
Examples are:
a) Numeric CASE
CASE NX OF
WHEN 1
+ MESG(NX=1
WHEN 3
+ MESG(NX=3
ENDCASE
b) Character CASE, with the WHEN's extra number of characters argument
CASE :CH1: OF
WHEN XXXX,3
+ MESG(CH1 = XXX
WHEN YYYY,3
+ MESG(CH1 = YYY
ORELSE
+ MESG(CH1 = something else
ENDCASE
The CASE statement is provided mainly for use when implementing menus. The syntax is:
CASE <numeric expression> OF WHEN <value 1> <statements 1> WHEN <value 2> <statements 2> WHEN <value n> <statements n> ORELSE <statements o> ENDCASE
for example:
CASE NX OF
WHEN 1
MESG(NX=1
WHEN 3
MESG(NX=3
ENDCASE
The effect of this construct is to execute <statements 1> when the <numeric expression> equals <value 1>, <statements 2> when it equals <value 2> and so on. If the numeric expression does not match any of the WHEN values, the statements following the ORELSE (if present) are executed.
Character-case statements are similar in syntax to numeric constructs except for the presence of an optional extra parameter in the WHEN statement specifying the number of characters to be compared, eg:
CASE CH1 OF
WHEN XXXX,3
+ MESG(CH1 = XXX)
WHEN YYYY,3
+ MESG(CH1 = YYY)
ENDCASE
This will execute the command MESG(CH1 = XXX) if CH1 has the values XXX or XXXX, but not if it has the values XX, XXC, XXXC or XXXXX. If the number of characters to match is not specified, then all characters must match.
It should be noted that the character variable does not need to be enclosed in colons (:) in the CASE statement in order for its value to be evaluated, but it is allowed for compatibility.
The number of WHEN statements permitted within a CASE. ENDCASE construct is unlimited.
CASE constructs can be nested to a maximum depth of 20 and interleaved freely with DO loops and other "flow- control" constructs.
The following sequence sets up a 2-D duct in the X-Y plane, but asks whether to put the main flow direction along X or Y. There are also options to have a blockage at the inlet, and to include or dispense with relaxation.
TALK=F;RUN( 1, 1);VDU=WINDOWED
CHAR(ANS);INTEGER(I1);BOOLEAN(BLOCK)
CHAR(TYP,TYPOUT,TYPTOP,TYPBOT,VEL1,VEL2)
REAL(UIN)
DO II=1,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