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/)
-   -   Calculating derivatives in Fluent (https://www.cfd-online.com/Forums/fluent-udf/247265-calculating-derivatives-fluent.html)

abc777 January 24, 2023 03:00

Calculating derivatives in Fluent
 
Good afternoon, please, can someone help me in calculating derivatives in Fluent?
Please tell me:
1) How can I calculate derivatives in Fluent for all values, or in particular, for temperature or impurity?
2) Why does UDS_Derivatives.c for calculating the derivative not work in the latest versions of ANSYS Fluent?

Example of UDS_Derivatives.c:

#include "udf.h"
#include "sg.h"

DEFINE_ADJUST(adjust,d)
{
int n;
for(n=0; n<n_uds; ++n) uds_derivatives(d, n);

/* The UDS gradients are now available */


}

void uds_derivatives(Domain *d, int n)
{
/* Code to compute derivative of a variable. Variable storage allocation first.... */
MD_Alloc_Storage_Vars(d, SV_UDSI_RG(n), SV_UDSI_G(n), SV_NULL);
Scalar_Reconstruction(d, SV_UDS_I(n), -1, SV_UDSI_RG(n), NULL);
Scalar_Derivatives(d, SV_UDS_I(n), -1, SV_UDSI_G(n), SV_UDSI_RG(n), NULL);
return;
}


All times are GMT -4. The time now is 08:33.