execute command, how to refer to report definitions
Hi everybody,
I'm writing an execute command which has to do a specific task each time-step. It has to interrupt the calculation after a parameter reach a determined value. So i tried something of this type: Code:
thank you in advance. |
Report Definition
Report Definitions are used only for defining a report and not for computing it. Though in GUI there is an option by doing a right-click on Report-Definitions and selecting Compute, in TUI, you need to define an output-parameter which is equal to report-definition. Then you can access the value using
def para out p-t-c "name of output parameter" |
Thank you Vinerm,
Code:
(if(=170 (def para out p-t-c "energia-totale-op" Error: eval: unbound variable Error Object: =170 What does it mean? Thank you in advance |
Space
A space is required between operand and operator. Write it as = 170.
And you have to use pick to pick-up numerical value. The output of direct command is just like report. |
Thank you again,
The problem of "unbound variable" isn't occurring anymore, in fact a space was missing as you said. But how do i use "pick" in my code? Really sorry for the question, it should be easy but i have no background in scheme programming. Thank you in advance |
Pick
Just the way you did it before with report. (pick-a-real "TUI command" indices), where TUI command is full define param command all the way up to the selection of the output parameter and indices are used to identify the value you want to pick-up. You can try with just one index, say, 3 or 4 and see which one returns the value you are expecting.
|
In TUI you mean this way: ( pick-a-real "/define/parameters/output-parameters, stop-op" )
or not? But then i do not understand the meaning of the "indices". I tried to write in it 1,2,3,4,.. but no values are returned. Code:
def para out p-t-c "stop-op" (if(< 0 ( pick-a-real "/define/parameters/output-parameters, stop-op" INDICES )) (set! mstop? #t)) |
Command
pick-a-real command is actually a combination of two commands, pick and string->number. It picks up a string from the output of the journal command and then converts it into number because returned value is always string. So, if you type
define parameters output-parameters print-to-console report-def-0-op it will return number but other strings as well. You need to pick up only the value of the number. That's what pick-a-real does. Since the whole output is a list of strings (that's what Scheme language is, a subset of List Processing Language), user needs to specify which member of the list he or she requires. Index starts from bottom. So, usually, for dimensional return values, 3 is the index to be used and for non-dimensional ones, 2 is to be used. The command to compare it and then execute a stop has to be outside pick command. So, the command (if (> threshold_value (pick-a-real "define parameters output-parameters print-to-console report-def-0-op" 3)) (cx-interrupt)) will stop Fluent if value of output parameter report-def-0-op is smaller than threshold_value. |
Stop transient simulation when a parameter reaches threshold value
Hello everyone,
I am trying to stop a transient simulation when the volume averaged temperature of a cell zone reaches a particular value using the following scheme script: Code:
(if (< 295 (pick-a-real "/rep/vol/volume-avg 32 , temperature n")) (set! mstop? #t)) The problem is as soon as the simulation starts with the above scheme command, the simulation stops while the volume average temperature of the cell zone is still around 320 K. If anybody could explain what is the problem with the above scheme command or the execution part, your help would be appreciated. Thanks |
Code:
(set! mstop? #t) Actually, you code seems to be correct. you can execute it through execute commands window, don't see any problem here, frankly speaking you may try to print the value of avg temperature at the moment, when simulation stops, just to check |
All times are GMT -4. The time now is 13:46. |