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

Macro for my equation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 14, 2017, 16:43
Default Macro for my equation
  #1
Member
 
ARAVIND SRIDHARA
Join Date: Jan 2017
Posts: 32
Rep Power: 9
aravind vashista is on a distinguished road
Hii all,
i am simulating 3D supersonic flow for air and hydrogen. I want to know the mixing efficiency for the present case. The mixing efficiency is defined as follows;
∫▒((Y_f ρu)dA)/((yρu)dA)
Where
y_f={ y, y<y_s
y_s* ((1-y))⁄(1-y_s ), y>y_s
y_s is the species mass fraction and
ρ is the density
u is the velocity.
please help in finding the right macroname to define above equations. i have the basic idea of writing the code for udf, my only concern is to find the right macro to define above scalar equation.
Every UDF's are defined using DEFINE_MACRONAME(udf_name, passed-in variables) (say for example: DEFINE_PROFILE, to specify boundry conditions). I am unable to find this right Macroname.

Last edited by aravind vashista; September 15, 2017 at 01:50.
aravind vashista is offline   Reply With Quote

Old   September 15, 2017, 00:57
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
ANSYS Fluent Customization Manual:

3.2.3.6. Flow Variable Macros for Cells
For each cell in domain you can easily got the value of ->
density by C_R(c,t)
velocity by C_U(c,t);C_V(c,t);C_W(c,t)

Could you explain in details, what is the problem with case, you had described.

Best regards
AlexanderZ is offline   Reply With Quote

Old   September 15, 2017, 01:44
Default
  #3
Member
 
ARAVIND SRIDHARA
Join Date: Jan 2017
Posts: 32
Rep Power: 9
aravind vashista is on a distinguished road
Thank you Alexander, and i understood how to access Macros for Cell Flow Variables.
Sir in ANSYS FLUENT UDF's are defined using Functions which are supplied by Ansys Fluent in the name DEFINE_Macros contained within the header udf.h header (example: DEFINE_PROFILE, which helps in giving user defined boundary conditions (say parabolic inlet velocity profile)). In my case i am unable to find right Macroname to right my equation. please help me in finding correct Macroname (DEFINE_MACRONAME(udf_name, passed-in variables)).
Thank you
aravind vashista is offline   Reply With Quote

Old   September 15, 2017, 02:45
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Quote:
Originally Posted by aravind vashista View Post
Thank you Alexander, and i understood how to access Macros for Cell Flow Variables.
Sir in ANSYS FLUENT UDF's are defined using Functions which are supplied by Ansys Fluent in the name DEFINE_Macros contained within the header udf.h header (example: DEFINE_PROFILE, which helps in giving user defined boundary conditions (say parabolic inlet velocity profile)). In my case i am unable to find right Macroname to right my equation. please help me in finding correct Macroname (DEFINE_MACRONAME(udf_name, passed-in variables)).
Thank you
So first of all you should read ANSYS Fluent Customization Manual

In few words, there are several ways, how you can execute UDF functions:
1. DEFINE_ON_DEMAND function is executed once you manually click execute on demand in GUI of Fluent. In tutorials there is an example 2.2.9.DEFINE_ON_DEMAND
2. DEFINE_ADJUST executes at every iteration and is called at the beginning of every iteration before transport equations are solved. So you should put your functions inside this adjust_function body. See 2.2.1.DEFINE_ADJUST
3. DEFINE_EXECUTE_AT_END is executed at the end of an iteration in
a steady-state run, or at the end of a time step in a transient run. See 2.2.3.DEFINE_EXECUTE_AT_END

Depends on your algorithm you may choose one of this macros and put your functions inside.
Read tutorial, there are good enough example

Best regards
AlexanderZ is offline   Reply With Quote

Old   September 15, 2017, 03:12
Smile
  #5
Member
 
ARAVIND SRIDHARA
Join Date: Jan 2017
Posts: 32
Rep Power: 9
aravind vashista is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
So first of all you should read ANSYS Fluent Customization Manual

In few words, there are several ways, how you can execute UDF functions:
1. DEFINE_ON_DEMAND function is executed once you manually click execute on demand in GUI of Fluent. In tutorials there is an example 2.2.9.DEFINE_ON_DEMAND
2. DEFINE_ADJUST executes at every iteration and is called at the beginning of every iteration before transport equations are solved. So you should put your functions inside this adjust_function body. See 2.2.1.DEFINE_ADJUST
3. DEFINE_EXECUTE_AT_END is executed at the end of an iteration in
a steady-state run, or at the end of a time step in a transient run. See 2.2.3.DEFINE_EXECUTE_AT_END

Depends on your algorithm you may choose one of this macros and put your functions inside.
Read tutorial, there are good enough example

Best regards
Thank you Alexander
i will go through the manual and try to implement my code based on ur suggestions.
aravind vashista is offline   Reply With Quote

Old   May 22, 2023, 00:24
Default
  #6
New Member
 
wang kai feng
Join Date: Sep 2021
Posts: 1
Rep Power: 0
wkf111222 is on a distinguished road
Quote:
Originally Posted by aravind vashista View Post
Thank you Alexander
i will go through the manual and try to implement my code based on ur suggestions.
hello sir, have you solved your problem? I have to calculate the mixing efficiency now. And would you kindly share your code with me?
wkf111222 is offline   Reply With Quote

Reply

Tags
define macro, udf's


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
Problem with Velocity Poisson Equation and Vector Potential Poisson Equation mykkujinu2201 Main CFD Forum 1 August 12, 2017 14:15
Non-linearity Pressure Equation -- PISO algorithm gdeneyer OpenFOAM Programming & Development 1 August 23, 2012 06:19
error message cuteapathy CFX 14 March 20, 2012 07:45
continuity equation Rafal Main CFD Forum 4 November 29, 2006 10:27
Two-Phase Buoyant Flow Issue Miguel Baritto CFX 4 August 31, 2006 13:02


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