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 build "Second Derivative " in UDF (https://www.cfd-online.com/Forums/fluent-udf/37146-how-build-second-derivative-udf.html)

Bowling July 5, 2005 05:38

How to build "Second Derivative " in UDF
 
In my UDF, it has second derivative such as (d2u/dx2). I see in fluent and it has only du/dx. How can I write secon derivative in UDF? Thank you in advance.

Joey July 6, 2005 00:58

Re: How to build "Second Derivative " in UDF
 
uds1 = du/dx in define adjust

store the gradient of uds

the udsi_g[0] is what you want

Bowling July 6, 2005 01:18

Re: How to build "Second Derivative " in UDF
 
Thank you very much Joey. I wonder something. If my derivative is not by dx, what can I do. For example, I would like to write d(scalar)/du which u is velocity.

dirk July 6, 2005 08:43

Re: How to build "Second Derivative " in UDF
 
I recently asked Fluent support how to calculate second derivative, as I also needed it for UDS source term. There is no macro to compute it and they also proposed me to define another uds as the derivative of the first uds. You then have to assign these uds after or before every iteration and set very low relaxation factors (1e-10 or so) for them, so that they do not change. It worked in my case, but the problem is you need to solve three additional transport equations in 3D, one for each derivative dUDS/dx_i which costs time and memory.

Another method should be to use divergence theorem, as described in the manual for second order upwind discretization: grad(Phi)=sum_faces(Phi_face*face_area_vector)/volume. If you set Phi here as dUDS/dx_i you should get your required derivative dČUDS/dx_iČ. For that you need to know the gradients at the faces. I tried to manage this with interpreted UDF but failed in compiling. Maybe you or someone else can do this and tell me.

Dirk

vsmkrm298 October 17, 2012 05:52

Hi Dirk,
Actually i am also facing same kind of problem in which, i need the second derivative of scalar, i dont understand the answer given by you. Can u please elaborate it?


All times are GMT -4. The time now is 13:27.