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/)
-   -   How to calculate integral and derivative in udf (https://www.cfd-online.com/Forums/fluent-udf/234956-how-calculate-integral-derivative-udf.html)

Amirreza_pro March 25, 2021 11:48

How to calculate integral and derivative in udf
 
2 Attachment(s)
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:
Attachment 83521

and also if I want to compute this derivative (the derivative of specific volume with respect to pressure for constant temperature):
Attachment 83520
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

pakk March 25, 2021 11:57

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.

Amirreza_pro March 25, 2021 12:09

1 Attachment(s)
Quote:

Originally Posted by pakk (Post 799867)
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:
Attachment 83522

And also the same for the derivative.

pakk March 25, 2021 14:23

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


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