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

Turbulent Dispersion Model (Burns et al)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2021, 11:54
Question Turbulent Dispersion Model (Burns et al)
  #1
New Member
 
Join Date: Jun 2021
Posts: 5
Rep Power: 4
Prantik Das is on a distinguished road
Is my UDF for Burns et al model right or wrong ?

# include "udf.h"
DEFINE_VECTOR_EXCHANGE_PROPERTY(burnetal,cell,mixt ure,liquid,solid,Ftdvector)
{
Thread *thread_l, *thread_s;
real rho_l,rho_s,Sigmapq,alpha_l,alpha_s,term,Ftd,Ctd,K pq;
real px,py,pz,sx,sy,sz;
thread_l=THREAD_SUB_THREAD(mixture,liquid);
thread_s=THREAD_SUB_THREAD(mixture,solid);
/* Calculation of Gradients */
alpha_l=C_VOF(cell, thread_l); /* liquid phase volume fraction */
alpha_s=C_VOF(cell, thread_s); /* Solid Phase Volume fraction */
rho_l=C_R(cell,thread_l);
rho_s=C_R(cell,thread_s);
Kpq=alpha_l*rho_l*C_K(cell, thread_l)+alpha_s*rho_s*C_K(cell, thread_s);
Ctd=1;
Sigmapq=.9;
term=Ctd*Kpq*C_MU_T(cell,thread_l)/(rho_l*Sigmapq);
px=C_VOF_G(cell,thread_l)[0]/alpha_l;
py=C_VOF_G(cell,thread_l)[1]/alpha_l;
pz=C_VOF_G(cell,thread_l)[2]/alpha_l;
sx=C_VOF_G(cell,thread_s)[0]/alpha_s;
sy=C_VOF_G(cell,thread_s)[1]/alpha_s;
sz=C_VOF_G(cell,thread_s)[2]/alpha_s;
/* Calculation of the Final Expression */
Ftdvector[0]=term*(px-sx);
Ftdvector[1]=term*(py-sy);
Ftdvector[2]=term*(pz-sz);
printf("\n%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t %f\t%f\t%f\t%f\t%f\t%f\t%f\t",Ftdvector[0],Ftdvector[1],Ftdvector[2],Ctd,term,px,py,pz,sx,sy,sz,alpha_l,alpha_s,Kpq,C_ MU_T(cell,thread_l),C_K(cell, thread_l),C_K(cell, thread_s));
}

Last edited by Prantik Das; June 7, 2021 at 00:24.
Prantik Das is offline   Reply With Quote

Old   June 7, 2021, 03:16
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
# include "udf.h"
DEFINE_VECTOR_EXCHANGE_PROPERTY(burnetal,cell,mixture,liquid,solid,Ftdvector)
{
Thread *thread_l, *thread_s;
real rho_l,rho_s,Sigmapq,alpha_l,alpha_s,term,Ftd,Ctd,K,pq;
real px,py,pz,sx,sy,sz,Kpq;
thread_l=THREAD_SUB_THREAD(mixture,liquid);
thread_s=THREAD_SUB_THREAD(mixture,solid);
/* Calculation of Gradients */
alpha_l=C_VOF(cell, thread_l); /* liquid phase volume fraction */
alpha_s=C_VOF(cell, thread_s); /* Solid Phase Volume fraction */
rho_l=C_R(cell,thread_l);
rho_s=C_R(cell,thread_s);
Kpq=alpha_l*rho_l*C_K(cell, thread_l)+alpha_s*rho_s*C_K(cell, thread_s);
Ctd=1;
Sigmapq=.9;
term=Ctd*Kpq*C_MU_T(cell,thread_l)/(rho_l*Sigmapq);
px=C_VOF_G(cell,thread_l)[0]/alpha_l;
py=C_VOF_G(cell,thread_l)[1]/alpha_l;
pz=C_VOF_G(cell,thread_l)[2]/alpha_l;
sx=C_VOF_G(cell,thread_s)[0]/alpha_s;
sy=C_VOF_G(cell,thread_s)[1]/alpha_s;
sz=C_VOF_G(cell,thread_s)[2]/alpha_s;
/* Calculation of the Final Expression */
Ftdvector[0]=term*(px-sx);
Ftdvector[1]=term*(py-sy);
Ftdvector[2]=term*(pz-sz);
Message0("\n%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t %f\t%f\t%f\t%f\t%f\t%f\t%f\t",Ftdvector[0],Ftdvector[1],Ftdvector[2],Ctd,term,px,py,pz,sx,sy,sz,alpha_l,alpha_s,Kpq,C_MU_T(cell,thread_l),C_K(cell, thread_l),C_K(cell, thread_s));
}
compile
Prantik Das likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   June 7, 2021, 09:30
Question Floating Point Exception
  #3
New Member
 
Join Date: Jun 2021
Posts: 5
Rep Power: 4
Prantik Das is on a distinguished road
Getting Error at Node 0: floating point exception error.

Divergence detected in AMG solver: pressure correction Stabilizing k to enhance linear solver robustness.
Stabilizing epsilon to enhance linear solver robustness.
Stabilizing vof-1 to enhance linear solver robustness.

Divergence detected in AMG solver: vof-1
Error at host: floating point exception

Error at Node 0: floating point exception

Error: floating point exception
Error Object: #f

while using this UDF
Prantik Das is offline   Reply With Quote

Old   June 7, 2021, 19:49
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you are printing most variables into console, check their values.
if the values are wrong, fix it
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   June 8, 2021, 01:17
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
In general: a UDF is correct if I it does what you want. So if you want to know if it is correct: try it. If it works, be happy, if it does not, fix it.

I don't understand the tendency to put code on a forum and ask other people if it is correct... Just try it!

And if, like in your case, you get errors: mention that!
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk 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
Use of k-epsilon and k-omega Models Jade M Main CFD Forum 40 January 27, 2023 07:18
Implementation of turbulent algebraic heat flux model Fabio1893 OpenFOAM Programming & Development 24 December 30, 2021 02:08
Equation in Burns.C of Turbulent dispersion model of Burns et al. Chaoran OpenFOAM 1 November 24, 2020 03:43
Question about the Low Reynolds K-Omega turbulent model. dinhanh Main CFD Forum 0 July 14, 2017 05:53
Access precalculated k-field in lagrangian dispersion model oswald OpenFOAM Programming & Development 0 September 3, 2013 11:25


All times are GMT -4. The time now is 18:38.