CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Sutile and Tricky : Drive Fluent UDF parameters directly from workbench (https://www.cfd-online.com/Forums/fluent-udf/228837-sutile-tricky-drive-fluent-udf-parameters-directly-workbench.html)

amscosta July 16, 2020 12:00

Sutile and Tricky : Drive Fluent UDF parameters directly from workbench
 
1 Attachment(s)
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

AlexanderZ July 17, 2020 00:45

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")

amscosta July 17, 2020 09:31

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.

AlexanderZ July 20, 2020 01:46

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)))

amscosta July 21, 2020 16:50

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


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