19 User profile
The real power of TUI is the ability to introduce user-defined commands from a configuration file. This example setup showcases what kind of functionalities can be achieved. The following chapters may need elements exported here.
To get going, save this file to a case root or to your user home directory as .fluent; the next time you launch fluent, check the transcript for something as Loading "/home/<user>/.fluent". You can define new functions here that best suit your typical CFD workflow.
; ----------------------------------------------------------------------------
; Utilities
; ----------------------------------------------------------------------------
; Configure number of blank lines for screen clear
(define m-nblanks 50)
; Clear screen (by printing a bunch of new lines)
(define (cls)
(do ((i 0 (+ i 1)))
((= i m-nblanks))
(newline))
(display "...\n"))
; Alias of Linux list command
(define (ls)
(system "ls -alt"))
; ----------------------------------------------------------------------------
; Manipulate zone info
; ----------------------------------------------------------------------------
; Get all zone info (list of zone-info)
(define (m-all-zones)
(get-zones-info))
; Select zone name from zone info (1)
(define (m-get-zone-name zone-info)
(symbol->string (car zone-info)))
; Select zone id from zone info (2)
(define (m-get-zone-id zone-info)
(cadr zone-info))
; Select zone type from zone info (3)
(define (m-get-zone-type zone-info)
(symbol->string (caddr zone-info)))
; Select cell flag from zone info (4)
(define (m-is-cell-zone? zone-info)
(cadddr zone-info))
; ----------------------------------------------------------------------------
; DPM zone selection
; ----------------------------------------------------------------------------
; Zone types to ignore in DPM reports
(define M-DPM-IGNORE-ZONE-TYPES
(list "fluid" "symmetry" "periodic" "interior"))
; Select zones for DPM reporting (not in ignore list and not cell zones)
(define (m-filter-dpm-zones zone-list)
(filter
(lambda (zone-info)
(and (not (member (m-get-zone-type zone-info) M-DPM-IGNORE-ZONE-TYPES))
(not (m-is-cell-zone? zone-info))))
zone-list))
; Get names of DPM zones for reporting
(define (m-dpm-zones-names)
(map m-get-zone-name (m-filter-dpm-zones (m-all-zones))))
; ----------------------------------------------------------------------------
; Solution
; ----------------------------------------------------------------------------
; Alias for programatically iterating flow
(define (m-solve-iterate n-iterations)
(ti-menu-load-string (format #f "/solve/iterate ~a" n-iterations)))
; Alias for programatically updating DPM
(define (m-solve-dpm-update)
(ti-menu-load-string "/solve/dpm-update"))
; ----------------------------------------------------------------------------
; EOF
; ----------------------------------------------------------------------------