CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

execute command, how to refer to report definitions

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By vinerm
  • 1 Post By vinerm
  • 1 Post By vinerm
  • 1 Post By vinerm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 7, 2020, 12:18
Default execute command, how to refer to report definitions
  #1
Member
 
Francesco
Join Date: Apr 2020
Posts: 56
Rep Power: 6
franc1 is on a distinguished road
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:
 
(if (<VALUE (pick-a-real "/rep/vol...PROBLEM..."))(set! mstop? #t))
The problem is: how can i call my parameter (which is a report definition i defined) on the command? (instead of "PROBLEM" obv)

thank you in advance.
franc1 is offline   Reply With Quote

Old   May 7, 2020, 13:26
Default Report Definition
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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"
franc1 likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 8, 2020, 04:39
Default
  #3
Member
 
Francesco
Join Date: Apr 2020
Posts: 56
Rep Power: 6
franc1 is on a distinguished road
Thank you Vinerm,

Code:
(if(=170 (def para out p-t-c "energia-totale-op" 
))(set! mstop? #t))
this gives me the error:
Error: eval: unbound variable
Error Object: =170

What does it mean?

Thank you in advance
franc1 is offline   Reply With Quote

Old   May 8, 2020, 04:51
Default Space
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
franc1 likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 8, 2020, 05:16
Default
  #5
Member
 
Francesco
Join Date: Apr 2020
Posts: 56
Rep Power: 6
franc1 is on a distinguished road
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
franc1 is offline   Reply With Quote

Old   May 8, 2020, 06:06
Default Pick
  #6
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
franc1 likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 8, 2020, 07:18
Default
  #7
Member
 
Francesco
Join Date: Apr 2020
Posts: 56
Rep Power: 6
franc1 is on a distinguished road
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))
franc1 is offline   Reply With Quote

Old   May 8, 2020, 07:39
Default Command
  #8
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
franc1 likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   January 16, 2021, 08:56
Default Stop transient simulation when a parameter reaches threshold value
  #9
New Member
 
Sagar
Join Date: Apr 2016
Posts: 23
Rep Power: 10
ksgr is on a distinguished road
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))
where, 295 K is the volume-averaged threshold temperature below which if the simulation should stop, 32 is the cell zone id.

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
ksgr is offline   Reply With Quote

Old   January 18, 2021, 01:32
Default
  #10
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
(set! mstop? #t)
where did you find this command? did you make it by your own?

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
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing report files and creating report definitions. cfd_worker99 FLUENT 3 June 12, 2020 13:55
Report Forces vs Report Definitions iakov1703 ANSYS 0 April 4, 2020 20:55
Problem with Report Definitions in Solver rupak504 FLUENT 2 February 11, 2020 10:27
Post-Processing Report Definitions After Re-Opening CAS file m_ridzon FLUENT 3 November 12, 2018 19:59
Report > Discrete Phase > Report > How to commands Francesco Micchetti FLUENT 1 January 23, 2008 07:10


All times are GMT -4. The time now is 21:20.