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

Sutile and Tricky : Drive Fluent UDF parameters directly from workbench

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 16, 2020, 13:00
Default Sutile and Tricky : Drive Fluent UDF parameters directly from workbench
  #1
Member
 
Alexandre M S Costa
Join Date: Apr 2009
Posts: 30
Rep Power: 15
amscosta is on a distinguished road
Hi All,
This issue is very tricky and I am spending too many hours trying to find a workaround.
Hopefully it will drag the attention of a scheme-udf master for a solution.
Lets start:
The Australian Leap site provides the steps for a conventional property derived from workbench:
  1. In an open Fluent Window; first initialise the scheme variables in Fluent. In the TUI, type the following line:
    (rp-var-define ‘leap 0.0 ‘real #f)
  2. Repeat the above line of code for every variable needed by replacing “leap” with a representative variable name. This name will be used to call the variable in the UDF.
  3. In the Fluent window, go to "Define">"Parameters". In the displayed window, go to "More" > "Use In Scheme Procedure". Click the "Select" button next to the Input Parameter box at the top and click “New Parameter” to create a new parameter. Name the parameter with a representative name. This will be the name of the parameter referenced in Workbench.
  4. Click OK on the two windows until you get back to the “Use Input Parameter in Scheme Procedure” window. In the Scheme Procedure box, type the following Scheme code:
    (lambda (param) (rpsetvar ‘leap param))
  5. Click the “Define” button to link the WB parameter to the UDF accessable scheme parameter.
  6. Do the same for any subsequent parameters, choosing unique and representative names for each.
The parameters are now setup. To access the value in the UDF, use the following function in the source code:
RP_Get_Real("leap")


In short as long as you can define the property with DEFINE_PROPERTY udf, the problem is solved.


My problem is that I am using the density set by using the boussinesq model, and I want to parametrize in workbench that density after setting the boussinesq model.


Any thoughts, even not using worbench at all but parametrizing using fluent are very
welcome.
Best for All
Attached Images
File Type: png Captura de tela de 2020-07-16 13-02-16.png (49.7 KB, 23 views)

Last edited by amscosta; July 16, 2020 at 13:07. Reason: some text no showing
amscosta is offline   Reply With Quote

Old   July 17, 2020, 01:45
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,256
Rep Power: 32
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you can use journal file to make all settings for your case, and define density as well

combination of scheme and TUI commands will give you control on the whole Fluent

by the way, why did you print command above with white color?
Code:
 RP_Get_Real("leap") 
__________________
best regards


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

Old   July 17, 2020, 10:31
Default
  #3
Member
 
Alexandre M S Costa
Join Date: Apr 2009
Posts: 30
Rep Power: 15
amscosta is on a distinguished road
Hi Alexander,
Thanks for the reply.
My question is tricky because I can drive properties from the workbench as long
as I can define it using the DEFINE_PROPERTY udf. I need just to follow the
guidelines from the leap site (please see the attached image).

My problem is that I want to define the reference density (numerical value in the
box just below when I select boussinesq for Density). So the model for the density
is boussinesq and I can not use the DEFINE_PROPERTY udf for define density.


My current aproach(that is not working) : I just followed the guidelines in the section 7.1.8.2.3 in the Fluent Users Guide issuing Fluent TUI commands as below : (after adding nitrogen fluid in materials):
/define/parameters/input-parameters/advance> use-in

Select type:> scheme-proc
Name of parameter ["parameter-3"] rho-p
rho-p value [0] 0.06
Enter the name/body of apply-function [] (lambda (value) (ti-menu-load-string (format #f "/define/materials/change-create nitrogen nitrogen yes boussinesq ~g no no no no no no" value)))


It is not working because, although I can see the rho-p parameter in the workbench design table, it is not being updated when I request to update all the design points with different values of rho-p (reference density for the boussinesq density model).


Any output towards a solution is highly appreciated.
amscosta is offline   Reply With Quote

Old   July 20, 2020, 02:46
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,256
Rep Power: 32
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
try
Code:
(ti-menu-load-string (format #f "/define/materials/change-create nitrogen nitrogen yes boussinesq ~a no no no no no no" (rpgetvar 'rho-p)))
was
Code:
Enter the name/body of apply-function [] (lambda (value) (ti-menu-load-string (format #f "/define/materials/change-create nitrogen nitrogen yes boussinesq ~g no no no no no no" value)))
__________________
best regards


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

Old   July 21, 2020, 17:50
Default
  #5
Member
 
Alexandre M S Costa
Join Date: Apr 2009
Posts: 30
Rep Power: 15
amscosta is on a distinguished road
Hi Alexander,
Thanks for the reply.
As long as I define rho-p :
(rp-var-define 'rho-p 0.06 'real #f)
The (ti-menu-load-string ....) you suggested works.
But I am still missing how to make the rho-p parameter appear in the workbench.
Should I do that in the execute commands ?
Any clue is very welcome.

Best
Alex
amscosta is offline   Reply With Quote

Reply

Tags
property parameterizing

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



All times are GMT -4. The time now is 05:40.