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.

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

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 (1e10 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 
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 03:31. 