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

udf for slip velocity in mixture model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 27, 2018, 11:30
Default udf for slip velocity in mixture model
  #1
New Member
 
Kaazem
Join Date: Jul 2018
Posts: 13
Rep Power: 7
Kaazem_RA is on a distinguished road
Dear all
I am trying to simulate natural convection in a square cavity filled with nanofluid using ansys fluent 16. I use mixture model and have written a udf for slip velocity which is defined by a very simple equation. Also i should say that when using mixture model in fluent viscosity and thermal conductivity of mixture (nanofluid in my case) are given by a linear function of volume fraction which is not the case in this simulation. So i wrote two other udfs for theraml conductivity and viscosity of nano particles. my udfs are as follows.

#include "udf.h"

#define pi 4.*atan(1.)

#define kB 1.38066e-23


DEFINE_VECTOR_EXCHANGE_PROPERTY(Buongiorno_slip,c, mixture_thread,second_column_phase_index,first_col umn_phase_index,vector_result)

{

real dp = 150.e-09 ;

real ST = 0.006 ;

real DB, phi, rho_p, rho_f, rho_nf, mu_f, T_nf ;

real grad_T[2], grad_phi[2] ;

Thread *thread_p, *thread_f ;

thread_f = THREAD_SUB_THREAD(mixture_thread, first_column_phase_index) ;

thread_p = THREAD_SUB_THREAD(mixture_thread, second_column_phase_index) ;

T_nf = C_T(c,mixture_thread) ;

mu_f = C_MU_L(c,thread_f) ;

DB = (kB*T_nf)/(3.*pi*mu_f*dp) ;

phi = C_VOF(c,thread_p) ;

if ( NULL != THREAD_STORAGE(mixture_thread,SV_T_G) )

{

grad_T[0] = C_T_G(c,mixture_thread)[0] ;

grad_T[1] = C_T_G(c,mixture_thread)[1] ;

}

else

{

grad_T[0] = 0. ;

grad_T[1] = 0. ;

}

if ( NULL != THREAD_STORAGE(mixture_thread,SV_VOF_G) )

{

grad_phi[0] = C_VOF_G(c,thread_p)[0] ;

grad_phi[1] = C_VOF_G(c,thread_p)[1] ;

}

else

{

grad_phi[0] = 0. ;

grad_phi[1] = 0. ;

}


rho_f = C_R(c,thread_f) ;

rho_p = C_R(c,thread_p) ;

rho_nf = C_R(c,mixture_thread) ;

vector_result[0] = (-DB*grad_phi[0]/phi - ST*mu_f*grad_T[0]/(rho_f*T_nf))/(1. - phi*rho_p/rho_nf) ;

vector_result[1] = (-DB*grad_phi[1]/phi - ST*mu_f*grad_T[1]/(rho_f*T_nf))/(1. - phi*rho_p/rho_nf) ;

}



DEFINE_PROPERTY(mu_particle,c,t)

{

real mu_p, phi ;

real mu_f = 855.e-06 ;

phi = C_VOF(c,t) ;

mu_p = (1./(1. - pow(phi,2.5)) - (1. - phi))*mu_f/phi ;

return mu_p ;

}



DEFINE_PROPERTY(k_particle,c,t)

{

real kf = 0.6 ;

real kp = 40. ;

real k_p, phi ;

phi = C_VOF(c,t) ;

k_p = ((kp + 2.*(kf + phi*(kp - kf)))/(kp + 2.*(kf - phi*(kp - kf))) - (1. - phi)*kf)/phi ;

return k_p ;

}

I compile my udf successfully but the results are not physical. There is no volume fraction gradient and slip velocity. They are equal to zero. please help me fix this problem
Thank you
Kaazem_RA is offline   Reply With Quote

Old   April 15, 2020, 13:47
Default How to get Phase velocity from mixture velocity data
  #2
New Member
 
Abhi
Join Date: Jan 2018
Posts: 27
Rep Power: 8
abhilasht is on a distinguished road
Quote:
Originally Posted by Kaazem_RA View Post
Dear all
I am trying to simulate natural convection in a square cavity filled with nanofluid using ansys fluent 16. I use mixture model and have written a udf for slip velocity which is defined by a very simple equation. Also i should say that when using mixture model in fluent viscosity and thermal conductivity of mixture (nanofluid in my case) are given by a linear function of volume fraction which is not the case in this simulation. So i wrote two other udfs for theraml conductivity and viscosity of nano particles. my udfs are as follows.

#include "udf.h"

#define pi 4.*atan(1.)

#define kB 1.38066e-23


DEFINE_VECTOR_EXCHANGE_PROPERTY(Buongiorno_slip,c, mixture_thread,second_column_phase_index,first_col umn_phase_index,vector_result)

{

real dp = 150.e-09 ;

real ST = 0.006 ;

real DB, phi, rho_p, rho_f, rho_nf, mu_f, T_nf ;

real grad_T[2], grad_phi[2] ;

Thread *thread_p, *thread_f ;

thread_f = THREAD_SUB_THREAD(mixture_thread, first_column_phase_index) ;

thread_p = THREAD_SUB_THREAD(mixture_thread, second_column_phase_index) ;

T_nf = C_T(c,mixture_thread) ;

mu_f = C_MU_L(c,thread_f) ;

DB = (kB*T_nf)/(3.*pi*mu_f*dp) ;

phi = C_VOF(c,thread_p) ;

if ( NULL != THREAD_STORAGE(mixture_thread,SV_T_G) )

{

grad_T[0] = C_T_G(c,mixture_thread)[0] ;

grad_T[1] = C_T_G(c,mixture_thread)[1] ;

}

else

{

grad_T[0] = 0. ;

grad_T[1] = 0. ;

}

if ( NULL != THREAD_STORAGE(mixture_thread,SV_VOF_G) )

{

grad_phi[0] = C_VOF_G(c,thread_p)[0] ;

grad_phi[1] = C_VOF_G(c,thread_p)[1] ;

}

else

{

grad_phi[0] = 0. ;

grad_phi[1] = 0. ;

}


rho_f = C_R(c,thread_f) ;

rho_p = C_R(c,thread_p) ;

rho_nf = C_R(c,mixture_thread) ;

vector_result[0] = (-DB*grad_phi[0]/phi - ST*mu_f*grad_T[0]/(rho_f*T_nf))/(1. - phi*rho_p/rho_nf) ;

vector_result[1] = (-DB*grad_phi[1]/phi - ST*mu_f*grad_T[1]/(rho_f*T_nf))/(1. - phi*rho_p/rho_nf) ;

}



DEFINE_PROPERTY(mu_particle,c,t)

{

real mu_p, phi ;

real mu_f = 855.e-06 ;

phi = C_VOF(c,t) ;

mu_p = (1./(1. - pow(phi,2.5)) - (1. - phi))*mu_f/phi ;

return mu_p ;

}



DEFINE_PROPERTY(k_particle,c,t)

{

real kf = 0.6 ;

real kp = 40. ;

real k_p, phi ;

phi = C_VOF(c,t) ;

k_p = ((kp + 2.*(kf + phi*(kp - kf)))/(kp + 2.*(kf - phi*(kp - kf))) - (1. - phi)*kf)/phi ;

return k_p ;

}

I compile my udf successfully but the results are not physical. There is no volume fraction gradient and slip velocity. They are equal to zero. please help me fix this problem
Thank you



Did you solve your problem? Kindly help me in getting phase velocities from mixture velocity data. If you have a UDF, please share it.
abhilasht is offline   Reply With Quote

Old   April 15, 2020, 15:05
Default Gradients
  #3
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Fluent does not store gradients being accessed in the UDF to save memory. So, the space needs to be assigned for the gradients before accessing those. Since the code checks for the existence of the gradients, it does not give an error. It simply does not find the value and the variables retain their original values. You can keep the gradients either by assigning memory to those using commands within UDF or by issuing following command in Fluent

sol set exp

And then by answering yes to the question regarding keeping the memory from being freed. This ensure that the memory used to store gradients is not freed up and, hence, the gradients are available within UDF.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm 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
UDF velocity inlet. Different values (compile - Fluent) asking FLUENT 0 July 13, 2018 17:02
2D UDF for inlet y velocity Keyu Fluent UDF and Scheme Programming 1 April 26, 2016 05:01
Having trouble adapting serial UDF to work in parallel muyuntao Fluent UDF and Scheme Programming 1 November 10, 2015 13:42
Velocity boundary condtion UDF help victoryv Fluent UDF and Scheme Programming 2 October 9, 2012 15:27
UDF component in Cyliderical Velocity? Hongchan Kim FLUENT 3 April 24, 2001 12:20


All times are GMT -4. The time now is 15:44.