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

UDF, gradient

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 7, 2015, 15:38
Default UDF, gradient
  #1
Member
 
Join Date: Dec 2014
Posts: 38
Rep Power: 12
Harry321 is on a distinguished road
Dear collegues,

I want to calculate for UDS source term formula like this:
\frac{5}{3}\phi\rho\stackrel{\leftarrow}{v}\bullet\nabla\alpha
\phi is the scalar solved for the UDS transport equation. In Fluent units for source in UDS are \frac{\phi kg}{m^{3} s}
\phi in this case is used as a unit for scalar
I assumed this equation could by written like that:
\frac{5}{3}\phi\rho\stackrel{\leftarrow}{v}\bullet\nabla\alpha = \frac{5}{3}\phi\rho(v_{x}\frac{\partial\alpha}{\partial x}+v_{y}\frac{\partial\alpha}{\partial y}+v_{z}\frac{\partial\alpha}{\partial z})
so I wrote a UDF (shown below) and I am not sure if I can use a gradient of UDSI like that. In Fluent in Solution Controls -> Equations I deselected equation for User Scalar 1, User Scalar 0 is selected.
This part is put in DEFINE_ADJUST
thread_loop_c (t,super_domain)
{
begin_c_loop_all (c, t)
{

t01 = THREAD_SUB_THREADS(t); /*this part is used only to show fluent proper phase */
t02 = t01[0];
t03 = t01[1];
C_UDSI(c,t03, 1) = C_VOF(c,t03);
/* C_UDSI(c,t03,0) is a phi for which I want to calculate source term */
C_UDMI(c,t03,1) = 5*C_R(c, t03)*C_UDSI(c,t03,0)*(C_U(c,t03)* C_UDSI_G(c,t03,1)[0]+C_V(c,t03)* C_UDSI_G(c,t03,1)[1]+C_W(c,t03)* C_UDSI_G(c,t03,1)[2])/3;

}
end_c_loop_all (c,t)
}
and then in DEFINE_SOURCE in return I put value of C_UDMI calculated in DEFINE_ADJUST.
Harry321 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
Wall shear stress gradient udf Andrew FLUENT 3 April 4, 2018 02:36
UDF for temperature gradient mariam.sara Fluent UDF and Scheme Programming 8 March 7, 2018 22:01
The gradient of void fraction in UDF summer FLUENT 2 May 20, 2011 04:34
UDF temp gradient tutotial tejasvikrishna FLUENT 0 April 4, 2011 12:10
Gradient in UDF summer FLUENT 0 September 1, 2006 14:50


All times are GMT -4. The time now is 16:42.