
[Sponsors] 
August 2, 2005, 06:09 
How to get a second derivative in udf?

#1 
Guest
Posts: n/a

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. 

August 3, 2005, 16:13 
Re: How to get a second derivative in udf?

#2 
Guest
Posts: n/a

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 

August 3, 2005, 22:44 
Re: How to get a second derivative in udf?

#3 
Guest
Posts: n/a

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. 

August 9, 2005, 18:01 
Re: How to get a second derivative in udf?

#4 
Guest
Posts: n/a

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 

February 26, 2013, 12:41 

#5  
Member
Join Date: Feb 2012
Posts: 57
Rep Power: 6 
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:


September 20, 2015, 13:27 

#6 
Member
Join Date: Nov 2014
Posts: 42
Rep Power: 4 
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. 

September 20, 2015, 13:34 

#7 
Member
Join Date: Nov 2014
Posts: 42
Rep Power: 4 
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; } 

September 22, 2015, 04:43 

#8  
Senior Member
Join Date: Nov 2013
Posts: 943
Rep Power: 13 
Quote:
A workaround is to attach this boundary condition after initialization, not before. 

September 28, 2015, 03:38 

#9 
Member
Join Date: Nov 2014
Posts: 42
Rep Power: 4 
Hi
thankyou for advice. I attached the B.C after initializing but no change is obtained. ): 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
How to build "Second Derivative " in UDF  Bowling  Fluent UDF and Scheme Programming  4  October 17, 2012 04:52 
UDF parallel error: chipexec: function not found?????  shankara.2  Fluent UDF and Scheme Programming  1  January 16, 2012 23:14 
can i get pressure derivative in UDF?  ruirui389  Fluent UDF and Scheme Programming  4  April 8, 2011 04:12 
second derivative in udf  dirk  FLUENT  0  June 8, 2005 12:56 
UDF for Second Derivative of Velocity  Satish  FLUENT  1  March 8, 2004 05:15 