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

pass reference values to UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2018, 11:59
Default pass reference values to UDF
  #1
New Member
 
DS
Join Date: May 2016
Posts: 28
Rep Power: 10
denis.sanga@hotmail.it is on a distinguished road
Good morning,
I need to pass the reference values from fluent scheme to udf. In particular I setted the reference values using
Code:
report/reference-values/compute/pressure-inlet
but I need of all parameters inside my UDF. Can someone help me to read them values from my udf? maybe is requested to save them in a rpvar list before?
thank you very much
Best Regards
Denis
denis.sanga@hotmail.it is offline   Reply With Quote

Old   June 6, 2018, 23:58
Default
  #2
New Member
 
Ngo Bao Chung
Join Date: Sep 2012
Posts: 14
Rep Power: 14
chienfm is on a distinguished road
Hello Denis,

There are few ways to do that. My normally way is to use input parametric for udf. You can set up them in User define > Parameters > More > UDF > Select. In select parameter table, you can create your variable by choosing New Parameter. In here you can set its value and reference name. Click Ok when you finish an back to the "Use input Parameter for UDF" table, click "Define" to add your new variable, and then press Print to check your value. The Parameter should be called in UDF by RP_Get_Parameter("real-n"), where "real-n" is the ID of the variable you created (can check by Print)

Another way is to follow the steps here: https://www.computationalfluiddynami...sys-workbench/

I hope you find it useful.

Regards,
Chung.
chienfm is offline   Reply With Quote

Old   June 7, 2018, 05:52
Default Reference values
  #3
New Member
 
DS
Join Date: May 2016
Posts: 28
Rep Power: 10
denis.sanga@hotmail.it is on a distinguished road
Thank you really much for your answer and help. I'm sorry for another question. From your method I don't understand how to associate to some parameter the Reference values which fluent compute from some surface.
Or better: I would like to read from my udf the Reference values Area, Density, Length, Velocity, Temperature which are calculated automatically from some surface by Fluent.

Thank you really really much and I'm sorry for disturb
Best Regards
Denis
denis.sanga@hotmail.it is offline   Reply With Quote

Old   June 7, 2018, 06:10
Default
  #4
New Member
 
Ngo Bao Chung
Join Date: Sep 2012
Posts: 14
Rep Power: 14
chienfm is on a distinguished road
Quote:
Originally Posted by denis.sanga@hotmail.it View Post
e.
Or better: I would like to read from my udf the Reference values Area, Density, Length, Velocity, Temperature which are calculated automatically from some surface by Fluent.
Hello Denis,

For that purpose, it really depends on your specific requirements. I assume you want to update reference values after each iteration, so you can use DEFINE_EXCUTE_AT_END function to calculate your parameters then pass back to your profile, source, property or any other function, just like a C program.

Regards,
Chung.
chienfm is offline   Reply With Quote

Old   June 7, 2018, 06:52
Default Reference values
  #5
New Member
 
DS
Join Date: May 2016
Posts: 28
Rep Power: 10
denis.sanga@hotmail.it is on a distinguished road
Thank you really really much again.
My purpose is to use that parameters to find dimensionless force and moment coefficients. For that I would read all the parameter calculated by the command
Code:
report/reference-values/compute/pressure-inlet
by the udf. For this time I'm not interested in change that values but just use them. Maybe have you an example to reach that values by udf functions?

Many many thanks
Best Regars
Denis
denis.sanga@hotmail.it is offline   Reply With Quote

Old   June 8, 2018, 11:25
Default
  #6
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 12
obscureed is on a distinguished road
Hi Denis,

I'm familiar with the Reference Length, Area etc, as set in Reference Values. One way to deal with these is to set Length=1.0m, Area=1.0m2, viscosity=1.0Pa.s, and so on, and then you can almost forget that they exist. (You might want more sensible values in some variables: Temperature and Ratio of Specific Heats.)

I think you will find that those reference values are available as RP variables, so in a UDF you should be able to access them via something like this:
Code:
  real ref_pressure;
  ref_pressure = RP_Get_Real("reference-pressure")
In parallel, I might recommend being a bit careful (but I'm not sure it's needed):
Code:
  real ref_pressure,ref_length,ref_density,ref_area;

#if !RP_NODE
  ref_pressure = RP_Get_Real("reference-pressure")
  ref_length = RP_Get_Real("reference-length")
  ref_density = RP_Get_Real("reference-density")
  ref_area = RP_Get_Real("reference-area")
#endif
  host_to_node_real_4(ref_pressure,ref_length,ref_density,ref_area);
If things get really bad, remember there is always
Code:
if(RP_Variable_Exists_P("varname") ...
You can find the names of these RP-variables by opening up the .cas file from a small test-case in a good text editor.



I'm not at all familiar with the parameters returned by the TUI command that you mentioned. Please can you explain how/where they are used?

By the way, you are correct in not assuming write-access even when a variable is available in a UDF.

Good luck!
Ed
obscureed is offline   Reply With Quote

Reply

Tags
reference values udf


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
wmake problems during custom utility compilation palazi88 OpenFOAM Programming & Development 11 August 13, 2018 21:52
Simulation of a single bubble with a VOF-method Suzzn CFX 21 January 29, 2018 01:58
Ansys CFX problem: unexpected very high temperatures in premix laminar combustion faizan_habib7 CFX 4 February 1, 2016 18:00
WallHeatFlux and chtMultiregion m_f OpenFOAM Post-Processing 13 March 16, 2015 11:16
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08


All times are GMT -4. The time now is 16:39.