CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

How to get a second derivative in udf?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 2, 2005, 06:09
Default How to get a second derivative in udf?
  #1
demigod
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.
  Reply With Quote

Old   August 3, 2005, 16:13
Default Re: How to get a second derivative in udf?
  #2
Laika
Guest
 
Posts: n/a
you must copy for each cell the first derivative of T in a UDM-location (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
  Reply With Quote

Old   August 3, 2005, 22:44
Default Re: How to get a second derivative in udf?
  #3
demigod
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.
  Reply With Quote

Old   August 9, 2005, 18:01
Default Re: How to get a second derivative in udf?
  #4
Laika
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
  Reply With Quote

Old   February 26, 2013, 11:41
Default
  #5
Member
 
Join Date: Feb 2012
Posts: 59
Rep Power: 14
Raymond.Leoi is on a distinguished road
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:
Originally Posted by Laika
;123159
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
Raymond.Leoi is offline   Reply With Quote

Old   September 20, 2015, 13:27
Default
  #6
Member
 
Join Date: Nov 2014
Posts: 42
Rep Power: 11
Maryam-A is on a distinguished road
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.
Maryam-A is offline   Reply With Quote

Old   September 20, 2015, 13:34
Default
  #7
Member
 
Join Date: Nov 2014
Posts: 42
Rep Power: 11
Maryam-A is on a distinguished road
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;
}
Maryam-A is offline   Reply With Quote

Old   September 22, 2015, 04:43
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by Maryam-A View Post
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.
You ask Fluent what the value of "C_T_G(c,t)" is, but when you initialize, this value does not exist yet, so Fluent does not know what to do.

A workaround is to attach this boundary condition after initialization, not before.
pakk is offline   Reply With Quote

Old   September 28, 2015, 03:38
Default
  #9
Member
 
Join Date: Nov 2014
Posts: 42
Rep Power: 11
Maryam-A is on a distinguished road
Hi
thankyou for advice.
I attached the B.C after initializing but no change is obtained. ):
Maryam-A is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22: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 04:15


All times are GMT -4. The time now is 11:22.