|
[Sponsors] |
Retrieve value of Scheme variable in TUI command |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 8, 2019, 12:49 |
Retrieve value of Scheme variable in TUI command
|
#1 |
New Member
Mark Lytell
Join Date: Apr 2019
Location: Chicago area
Posts: 4
Rep Power: 7 |
Hi,
I couldn't seem to find an answer to this particular type of problem. So here goes... In a Fluent Journal, I would like to define a string constant that contains the root name of the case file so that I can use the same string in other TUI commands, e.g., setting the root name for auto-save, etc.. This is what I did: ; define the case/data file name root (define casedatfileroot "./mdl-name-shell-cond-transient") ; define the case file path (define casefilepath (string-append casedatfileroot ".cas.gz")) These variables are defined, but when I try to read in the case file, using this command, /file/read-case (rpgetvar 'casefilepath) I get the errors: Error: File "(rpgetvar" not found! Error Object: #f invalid command ['casefilepath)] This is using Fluent 2019R3. Can someone please help me? The ANSYS documentation is essentially non-existent for this. |
|
November 8, 2019, 14:59 |
|
#2 | |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66 |
Filenames are not evaluated in the text prompt system, they are the only exception.
Quote:
Here is a link to the non-existent documentation. |
||
November 8, 2019, 16:29 |
|
#3 |
New Member
Mark Lytell
Join Date: Apr 2019
Location: Chicago area
Posts: 4
Rep Power: 7 |
Thanks, so this is not possible? That's a bummer.
|
|
September 18, 2020, 05:19 |
|
#4 |
New Member
Join Date: Sep 2020
Posts: 8
Rep Power: 6 |
For the record
First option using scheme variable (only valid during the current session of Fluent): Code:
(define casedatfileroot "./mdl-name-shell-cond-transient") (define casefilepath (string-append casedatfileroot ".cas.gz")) ; Quoted (ti-menu-load-string (format #f "/file/read-case ~s") casefilepath) ; Un-quoted ; (ti-menu-load-string (format #f "/file/read-case ~a") casefilepath) Code:
(rp-var-define 'casedatfileroot "./mdl-name-shell-cond-transient" 'string #f) (rp-var-define 'casefilepath (format #f "~s" (string-append (rpgetvar casedatfileroot) ".cas.gz")) 'string #f) ; Quoted (ti-menu-load-string (format #f "/file/read-case ~s") (rpgetvar 'casefilepath)) ; Un-quoted ; (ti-menu-load-string (format #f "/file/read-case ~a") (rpgetvar 'casefilepath)) Code:
(format #f "format string ~s" variable) (ti-menu-load-string (format #f "format string ~s" variable)) Code:
(define (fmt . args) (apply format (append (list #f) args))) (define (tui . args) (ti-menu-load-string (apply fmt args))) Code:
(define casedatfileroot "./mdl-name-shell-cond-transient") (define casefilepath (string-append casedatfileroot ".cas.gz")) ; Quoted (tui "/file/read-case ~s" casefilepath) ; Un-quoted ; (tui "/file/read-case ~a" casefilepath) while the second example could be simplified to Code:
(rp-var-define 'casedatfileroot "./mdl-name-shell-cond-transient" 'string #f) (rp-var-define 'casefilepath (fmt "~s" (string-append (rpgetvar casedatfileroot) ".cas.gz")) 'string #f) ; Quoted (tui "/file/read-case ~s" (rpgetvar 'casefilepath)) ; Un-quoted ; (tui "/file/read-case ~a" (rpgetvar 'casefilepath)) |
|
April 10, 2021, 15:15 |
typo?
|
#5 | |
New Member
|
Hi, thanks for your contribution. My first time quoting, I hope to do it correctly.
For me, the format command (rpgetvar option) worked only if I include the (rpgetvar 'variable) inside the parentheses of the format command. I am referring to the lines: Quote:
As an example, here are my own commands, where I put the rpgetvar inside the format parenthesis: Code:
(ti-menu-load-string (format #f "report/dpm-extended-summary yes casename_~a yes no" (rpgetvar 'flow-time))) However, the following DID NOT WORK: Code:
(ti-menu-load-string (format #f "report/dpm-extended-summary yes casename_~a yes no") (rpgetvar 'flow-time)) With the error: Error: CAR: invalid argument [1]: wrong type [not a pair] Error Object: () |
||
April 11, 2021, 23:47 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
that was typo
__________________
best regards ****************************** press LIKE if this message was helpful |
|
Tags |
fluent, scheme language, tui command |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to save /adjoint/observable/evaluate result to scheme variable? | ProBioticum | Fluent UDF and Scheme Programming | 5 | October 8, 2019 09:55 |
[PyFoam] PyFoam 0.6.9 wrong path to gnuplot | klausb | OpenFOAM Community Contributions | 5 | March 15, 2018 15:28 |
I need help for TUI command | ringtail | FLUENT | 3 | September 8, 2010 11:31 |
error in COMSOL:'ERROR:6164 Duplicate Variable' | bhushas | COMSOL | 1 | May 30, 2008 05:35 |
Replace periodic by inlet-outlet pair | lego | CFX | 3 | November 5, 2002 21:09 |