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

How to save /adjoint/observable/evaluate result to scheme variable?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 19, 2018, 13:40
Default How to save /adjoint/observable/evaluate result to scheme variable?
  #1
New Member
 
Join Date: Dec 2018
Posts: 3
Rep Power: 4
ProBioticum is on a distinguished road
I have an observable ld(lift drag ratio) which I'm calculating through scheme script by which is calling command /adjoint/observable/evaluate.

The result is printed to TUI console.
Code:
Observable name: ld
Observable Value (undefined): 2.6054044
But I need to get that same calculation result into some variable in scheme script so the next statement could read that variable and operate with it.

For example the scheme script should look like this:

Code:
1. apply command  /adjoint/observable/evaluate
2. save that ld value to scheme variable
3. do something next with that variable
How can I save that calculation result into scheme variable?
ProBioticum is offline   Reply With Quote

Old   December 19, 2018, 23:44
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,788
Rep Power: 28
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
try to use following command
Code:
(rpgetvar 'monitor/lift)
what output do you have?

best regards
AlexanderZ is offline   Reply With Quote

Old   January 6, 2019, 05:57
Default
  #3
New Member
 
Join Date: Dec 2018
Posts: 3
Rep Power: 4
ProBioticum is on a distinguished road
Code:
(rpgetvar 'monitor/lift)
Gives result

Code:
()
ProBioticum is offline   Reply With Quote

Old   January 7, 2019, 01:44
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,788
Rep Power: 28
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you may get lift/drag coef value using following command
Code:
(car (cdr (car (rpgetvar 'adjoint/multiobjective-data ))))
create your own rpvar variable
Code:
	(define (make-new-rpvar name default type)
	(if (not (rp-var-object name))
	(rp-var-define name default type #f)))
(make-new-rpvar 'my_lift/drag 0.0 'real)
set your variable equal to computated ld ratio

Code:
(rpsetvar 'my_lift/drag (car (cdr (car (rpgetvar 'adjoint/multiobjective-data )))))
check
Code:
(rpgetvar 'my_lift/drag)
now you can use it in scheme as well as in UDF

best regards
riccardo.frezza likes this.
AlexanderZ is offline   Reply With Quote

Old   May 10, 2019, 17:07
Default
  #5
New Member
 
Join Date: Dec 2018
Posts: 3
Rep Power: 4
ProBioticum is on a distinguished road
Thank you for your contribution. The solution you proposed worked for the observable `ld`. How would I get values of other observables (lift, drag, le_moment)?
ProBioticum is offline   Reply With Quote

Old   October 8, 2019, 08:55
Default
  #6
New Member
 
Riccardo Frezza
Join Date: Dec 2018
Posts: 12
Rep Power: 4
riccardo.frezza is on a distinguished road
Hi, I'm new in using the scheme language and I need to get the "pressure-drop" observable into a variable in scheme script. Did you find a different solution? With (rpgetvar 'adjoint/multiobjective-data) it shows me the pressure-drop observable value. Adjoint/multiobjective-data isn't a TUI command. Where can I find those commands?
riccardo.frezza is offline   Reply With Quote

Reply

Tags
fluent, observable, result, scheme

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
can you tell me best gradient, pressure & momentum order selection in fluent sanjiiv FLUENT 6 February 14, 2020 06:07
Scheme programing, variable definition Leonlow Fluent UDF and Scheme Programming 1 September 3, 2014 19:21
scheme variable Gimli FLUENT 7 December 21, 2012 03:03
Scheme variable problem syavash Fluent UDF and Scheme Programming 0 August 12, 2012 23:11
Cavity air flow with radiation – result variable Yingchun CFX 1 November 25, 2005 11:13


All times are GMT -4. The time now is 13:19.