Text User Interface (TUI)
Text User Interface (TUI)
In addition to the graphical user interface described in Chapter 2: Graphical User Inter-
face (GUI), the user interface to FLUENT consists of textual command line interface.
The text interface (TUI) uses, and is written in, a dialect of Lisp called Scheme. Users
familiar with Scheme will be able to use the interpretive capabilities of the interface to
create customized commands.
>
To generate a listing of the submenus and commands in the current menu, simply press
<RETURN>.
c Fluent Inc. January 11, 2005 3-1
Text User Interface (TUI)
> <RETURN>
adapt/ file/ report/
define/ grid/ solve/
display/ parallel/ surface/
exit plot/ view/
By convention, submenu names end with a / to differentiate them from menu commands.
To execute a command, just type its name (or an abbreviation). Similarly, to move down
into a submenu, enter its name or an abbreviation. When you move into the submenu,
the prompt will change to reflect the current menu name.
> display
/display> set
/display/set>
To move back to the previously occupied menu, type q or quit at the prompt.
/display/set> q
/display>
/display> /file
/display//file>
In the above example, control was passed from /display to /file without stopping in
the root menu. Therefore, when you quit from the /file menu, control will be passed
directly back to /display.
/display//file> q
/display>
Furthermore, if you execute a command without stopping in any of the menus along the
way, control will again be returned to the menu from which you invoked the command.
3-2
c Fluent Inc. January 11, 2005
3.1 Text Menu System
/display>
The text menu system provides on-line help for menu commands. The text menu on-line
help system is described in Section 3.6: Using the Text Interface Help System.
> (define a 1)
a
> (+ a 2 3 4)
10
c Fluent Inc. January 11, 2005 3-3
Text User Interface (TUI)
3.1.3 Aliases
Command aliases can be defined within the menu system. As with the UNIX csh shell,
aliases take precedence over command execution. The following aliases are predefined in
Cortex: error, pwd, chdir, ls, ., and alias.
error displays the Scheme object that was the “irritant” in the most recent Scheme error
interrupt.
pwd prints the working directory in which all file operations will take place.
3-4
c Fluent Inc. January 11, 2005
3.2 Text Prompt System
3.2.1 Numbers
The most common prompt type is a number. Numbers can be either integers or reals.
Valid numbers are, for example, 16, -2.4, .9E5, and +1E-5. Integers can also be specified
in binary, octal, and hexadecimal form. The decimal integer 31 can be entered as 31,
#b11111, #o37, or #x1f. In Scheme, integers are a subset of reals, so you do not need a
decimal point to indicate that a number is real; 2 is just as much a real as 2.0. If you
enter a real at an integer prompt, any fractional part will simply be truncated; 1.9 will
become 1.
3.2.2 Booleans
Some prompts require a yes-or-no response. A yes/no prompt will accept either yes or
y for a positive response, and no or n for a negative response. yes/no prompts are used
for confirming potentially dangerous actions such as overwriting an existing file, exiting
without saving case, data, mesh, etc.
Some prompts require actual Scheme boolean values (true or false). These are entered
with the Scheme symbols for true and false, #t and #f.
3.2.3 Strings
Character strings are entered in double quotes, e.g., "red". Plot titles and plot legend
titles are examples of character strings. Character strings can include any characters,
including blank spaces and punctuation.
3.2.4 Symbols
Symbols are entered without quotes. Zone names, surface names, and material names are
examples of symbols. Symbols must start with an alphabetical character (i.e., a letter),
and cannot include any blank spaces or commas.
3.2.5 Filenames
Filenames are actually just character strings. For convenience, filename prompts do not
require the string to be surrounded with double quotes. If, for some exceptional reason,
a filename contains an embedded space character, then the name must be surrounded
with double quotes.
One consequence of this convenience is that filename prompts do not evaluate the re-
sponse. For example, the sequence
c Fluent Inc. January 11, 2005 3-5
Text User Interface (TUI)
> hc fn
will end up writing a hardcopy file with the name fn, not valve.ps. Since the filename
prompt did not evaluate the response, fn did not get a chance to evaluate "valve.ps"
as it would for most other prompts.
3.2.6 Lists
Some functions in FLUENT require a “list” of objects such as numbers, strings, booleans,
etc. A list is a Scheme object that is simply a sequence of objects terminated by the
empty list, ’(). Lists are prompted for an element at a time, and the end of the list is
signaled by entering an empty list. This terminating list forms the tail of the prompted
list, and can either be empty or can contain values. For convenience, the empty list
can be entered as () as well as the standard form ’(). Normally, list prompts save the
previous argument list as the default. To modify the list, overwrite the desired elements
and terminate the process with an empty list. For example,
element(1) [()] 1
element(2) [()] 10
element(3) [()] 100
element(4) [()] <RETURN>
3-6
c Fluent Inc. January 11, 2005
3.3 Interrupts
creates a five element list: 1, 10, 11, 12, and 13. Finally, a single empty list removes all
elements
element(1) [1] ()
3.2.7 Evaluation
All responses to prompts (except filenames, see above) are evaluated by the Scheme
interpreter before they are used. You can therefore enter any valid Scheme expression as
the response to a prompt. For example, to enter a unit vector with one component equal
to 1/3 (without using your calculator),
/foo> set-xy
x-component [1.0] (/ 1 3)
y-component [0.0] (sqrt (/ 8 9))
or, you could first define a utility function to compute the second component of a unit
vector,
shrink-factor [0.8] (/ _ 3)
3.3 Interrupts
The execution of the code can be halted using <Control-C>, at which time the present
operation stops at the next recoverable location.
c Fluent Inc. January 11, 2005 3-7
Text User Interface (TUI)
!pwd and !ls will execute the UNIX commands in the directory in which Cortex was
started. The screen output will appear in the window in which you started FLUENT,
unless you started it remotely, in which case the output will appear in the window in
which you started Cortex. (Note that !cd executes in a subshell, so it will not change the
working directory either for FLUENT or for Cortex, and is therefore not useful.) Typing
cd with no arguments will move you to your home directory in the console window.
FLUENT includes three system command aliases (pwd, ls, and chdir) that will be exe-
cuted in your working directory with output displayed in the FLUENT console window.
Note that these aliases will invoke the corresponding UNIX commands with respect to
the parent directory of the case file. For example, pwd prints the parent directory of the
case file in the FLUENT console window, while !pwd prints the directory from which you
started FLUENT in the UNIX shell window where you started FLUENT.
Several examples of system commands entered in the console are shown below. The
screen output that will appear in the window in which FLUENT was started (or, if you
started the program remotely, in the window in which Cortex was started) follows the
examples.
Example input (in the FLUENT console):
> !pwd
3-8
c Fluent Inc. January 11, 2005
3.5 Text Menu Input from Character Strings
Example output (in the window in which FLUENT—or Cortex, if you started the program
remotely—was started):
/home/cfd/run/valve
valve1.cas valve1.msh valve2.cas valve2.msh
!cd and !dir will execute the DOS commands and the screen output will appear in the
FLUENT console window. The !cd command with no argument will display the current
working directory in the FLUENT console.
Several examples of system commands entered in the console are shown below.
Example input (in boxes) and output (in the FLUENT console):
> !cd
p:/cfd/run/valve
> !dir valve*.*/w
Volume in drive P is users
Volume Serial Number is 1234-5678
Directory of p:/cfd/run/valve
valve1.cas valve1.msh valve2.cas valve2.msh
4 File(s) 621,183 bytes
0 Dir(s) 1,830,088,704 bytes free
c Fluent Inc. January 11, 2005 3-9
Text User Interface (TUI)
A Scheme loop that will open windows 0 and 1 and display the front view of the grid in
window 0 and the back view in window 1 is given by
(for-each
(lambda (window view)
(ti-menu-load-string (format #f "di ow ~a gr view rv ~a"
window view)))
’(0 1)
’(front back))
This loop makes use of the format function to construct the string used by
menu-load-string. This simple loop could also be written without using menu com-
mands at all, but you need to know the Scheme functions that get executed by the menu
commands to do it:
(for-each
(lambda (window view)
(cx-open-window window)
(display-grid)
(cx-restore-view view))
’(0 1) ’(front back))
String input can also provide an easy way to create aliases within FLUENT. For example,
to create an alias that will display the grid, you could type the following:
Then any time you enter dg from anywhere in the menu hierarchy, the grid will be drawn
in the active window.
ti-menu-load-string evaluates the string argument in the top level menu. It ignores
any menu you may be in when you invoke ti-menu-loadstring. Therefore, the com-
mand
will not work even if you type it from within the display/ menu—the string itself must
cause control to enter the display/ menu, as in
3-10
c Fluent Inc. January 11, 2005
3.6 Using the Text Interface Help System
> ?dis
display/: Enter the display menu.
You can also enter a lone ? to enter “help mode.” In this mode, you need only enter the
command or menu name to display the help message. To exit help mode type q or quit
as for a normal menu.
Example:
> ?
[help-mode]> di
display/: Enter the display menu.
[help-mode]> pwd
pwd: #[alias]
(LAMBDA ()
(BEGIN
(SET! pwd-cmd ((LAMBDA n
n) ’system (IF (cx-send ’(unix?))
"pwd"
"cd")))
(cx-send pwd-cmd)))
[help-mode]> q
Help can also be obtained when you are prompted for information by typing a ? at the
prompt.
Example:
> display/annotate
Annotation text [""] ?
Enter the text to annotate the plot with.
Annotation text [""]
c Fluent Inc. January 11, 2005 3-11
Text User Interface (TUI)
3-12
c Fluent Inc. January 11, 2005