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 calculate integral and derivative in udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 25, 2021, 12:48
Default How to calculate integral and derivative in udf
  #1
Member
 
Amirreza Niazmehr
Join Date: Nov 2018
Posts: 40
Rep Power: 8
Amirreza_pro is on a distinguished road
Hey guys,
I'm stuck in calculating Derivative and integral in UDF.
We have our own discrete Data for our gas properties (like Cp,rho ,...) and by measn of a interpolation (interpolation function) we will have a continuous function for these properties like Cp
That means we have our own formulation for these properties.
Now my question is:
If I have my own function for Cp (for example) then How I can caculate the Enthalpy by means of this integral:
Int.PNG

and also if I want to compute this derivative (the derivative of specific volume with respect to pressure for constant temperature):
Der.PNG
In our Udf code by means of our data for CP, rho and s on, then what should I do?

Does anybody have any clue how to write the code in udf to calculate derivative and integral?

Thanks in advance
All the bests
Amirreza_pro is offline   Reply With Quote

Old   March 25, 2021, 12:57
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
You don't calculate derivatives and integrals in UDFs. You open your thermodynamics book, and try to write these integrals and derivatives in a way that you can use in a UDF, in a way that does not involve integrals or derivatives.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   March 25, 2021, 13:09
Default
  #3
Member
 
Amirreza Niazmehr
Join Date: Nov 2018
Posts: 40
Rep Power: 8
Amirreza_pro is on a distinguished road
Quote:
Originally Posted by pakk View Post
You don't calculate derivatives and integrals in UDFs. You open your thermodynamics book, and try to write these integrals and derivatives in a way that you can use in a UDF, in a way that does not involve integrals or derivatives.
Thanks alot dear pakk
You are right my question was alittle vague.
Actually we have our discrete Data for our gas properties (like Cp,rho ,...) and by measn of a interpolation we will have a continuous function for these properties like Cp
That means we have our own formulation for these properties.
Now my question is:
If I have my own function for Cp (for example) then How I can caculate the Enthalpy by means of this integral:
Int.PNG

And also the same for the derivative.
Amirreza_pro is offline   Reply With Quote

Old   March 25, 2021, 15:23
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Using any software you want (excel works), and write the result in a UDF. You don't need to do the integration in a UDF...
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Reply


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
Integral condition on a face Cedric FLUENT 0 February 18, 2004 06:18


All times are GMT -4. The time now is 18:57.