How to get a second derivative in udf?
How to get a second derivative ( diff(T,z,2), where T is temperature, z is one dimensionality, 2 refers to the second derivative) in udf?
Thanks. 
Re: How to get a second derivative in udf?
you must copy for each cell the first derivative of T in a UDMlocation (at the end or after each iteration when needed). In postprocessing you can ask for the first derivative of this UDM, which is actually the desired second derivative.
As far as I know there is no other way. good luck, Laika, still orbiting 
Re: How to get a second derivative in udf?
Thanks.
How can I get the first derivative of the defined UDM? by C_UDSI_G(c,t,i)? Can I define an UDS to refer to first derivative of temperature [C_UDSI(c,t,0)=C_T_G(c,t)[2]] and use C_UDSI_G(c,t,0) to give the second derivative? Thanks a lot. the second derivative appears in the source term, so I must update its value by each iteration. 
Re: How to get a second derivative in udf?
almost UDS >c_UDSI(... UDM >C_UDMI(...
the difference is that Fluent solves a transport equation for a UDS and not for a UDM. A UDM is just a memory location, but you can ask for the first derivatives. Hence the procedure:ask to calculate the first derivative of your quantity. Store it through the use of a UDF in a UDM, and ask for the first derivative of your UDM. good luck, Laika, still orbiting 
Well, it seems C_UDMI_G(cell, thread, n) isn't accessible, but we can get C_UDSI_G(cell, thread, n). The problem I met is that those values of C_UDSI_G at cells attached with boundaries are wrong. Any idea to properly get it fixed or any other approach we can employ?
Quote:

Hi every body
I wanted to return derivative of UDS as wall boundary value, but I faced with "fatal signal" while initializing (both Hybrid and standard) that I found this because of boundary condition UDS.:( this is part of my udf for B.C of UDS( volume fraction of nanoparticle in my case) DEFINE_PROFILE(alpha_bc1,thread,position) { Thread *t; cell_t c; . . . begin_f_loop(f,thread) { C_UDSI_G(c,t,0)[0]=(D_T/D_B)*C_T_G(c,t)[0]; F_PROFILE(f,thread,position)=C_UDSI_G(c,t,0)[0]; } end_f_loop(f,t) } I would appreciate if anyone can help me about my mistakes. 
Furthermore, I used Define_Adjust to calculate laplacian, maybe this is my fault?
can I use UDS as scalar variable and then I used it in source function? I will turn off all Uds except one that I wanted to solve. is it true? thread_loop_c(t,d) { begin_c_loop(c,t) { C_UDSI(c,t,1)=D_T*C_T_G(c,t)[0]; C_UDSI(c,t,2)=D_T*C_T_G(c,t)[1]; C_UDSI(c,t,3)=D_T*C_T_G(c,t)[2]; Laplacian=Laplacian+C_UDSI_G(c,t,1)[0]+C_UDSI_G(c,t,2)[1]+C_UDSI_G(c,t,3)[2]; C_UDSI(c,t,5)=dD_T*C_T_G(c,t)[0]; C_UDSI(c,t,6)=dD_T*C_T_G(c,t)[1]; C_UDSI(c,t,7)=dD_T*C_T_G(c,t)[2]; d_Laplacian=d_Laplacian+C_UDSI_G(c,t,4)[0]+C_UDSI_G(c,t,5)[1]+C_UDSI_G(c,t,6)[2]; C_UDSI(c,t,9)=D_D*C_T_G(c,t)[0]; C_UDSI(c,t,10)=D_D*C_T_G(c,t)[1]; C_UDSI(c,t,11)=D_D*C_T_G(c,t)[2]; LL=LL+C_UDSI_G(c,t,9)[0]+C_UDSI_G(c,t,10)[1]+C_UDSI_G(c,t,11)[2]; C_UDSI(c,t,13)=dD_D*C_T_G(c,t)[0]; C_UDSI(c,t,14)=dD_D*C_T_G(c,t)[1]; C_UDSI(c,t,15)=dD_D*C_T_G(c,t)[2]; dLL=dLL+C_UDSI_G(c,t,13)[0]+C_UDSI_G(c,t,14)[1]+C_UDSI_G(c,t,15)[2]; } end_c_loop(c,t) } C_UDSI(c,t,4)=Laplacian; C_UDSI(c,t,8)=d_Laplacian; C_UDSI(c,t,12)=LL; C_UDSI(c,t,16)=dLL; } 
Quote:
A workaround is to attach this boundary condition after initialization, not before. 
Hi
thankyou for advice. I attached the B.C after initializing but no change is obtained. ): 
All times are GMT 4. The time now is 23:41. 