
[Sponsors] 
July 14, 2009, 02:19 
UDF VOF model on Fluent

#1 
New Member
baechtelguillaume
Join Date: Apr 2009
Posts: 13
Rep Power: 17 
Hi everybody,
I have just wrote a new UDF to have 2 different contact angles as I am working on blood droplet impact onto inclines. But I can't see if my udf is working, that's why, before continuing my work, I want to have your point of view. Does my UDF look OK ? Thanks you very much for answer. I would appreciate to talk to someone who has already work on drop impact models with Fluent. Guillaume /* UDF To add advancing receding angles*/ #include <udf.h> DEFINE_PROFILE(contact_angle,thread, position) { real r[ND_ND]; /* this will hold the position vector */ real x; face_t f ; begin_f_loop(f,thread) { F_CENTROID(r,f,thread); x = r[0]; if (y <= 17.03862) /* center of my droplet */ { F_PROFILE(f, thread, position) = 44; /* advancing angle */ } F_PROFILE(f, thread, position) = 34; /* receding angle */ } end_f_loop(f,t) } 

July 14, 2009, 19:05 

#2 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144 
Hi,
Your UDF seems to have several bugs. 1) You use "y <= 17.03862" but the variable y is not defined anywhere. This should give a compilation error about undeclared variables. 2) Your line "F_PROFILE(f, thread, position) = 34;" is done regardless of whether it is in the drop or not  so all faces will have this applied and nothing will get the 44 value set previously. Glenn Horrocks 

July 14, 2009, 19:41 

#3 
New Member
baechtelguillaume
Join Date: Apr 2009
Posts: 13
Rep Power: 17 
Hi,
Thank you for answer, I had forgotten to change some parameters. Do you think it is alright now ? Thaks a lot for answer, /* UDF To add advancing and receding angles*/ #include <udf.h> DEFINE_PROFILE(contact_angle,thread, position) { real r[ND_ND]; /* this will hold the position vector */ real y; face_t f ; begin_f_loop(f,thread) { F_CENTROID(r,f,thread); y = r[0]; if (y <= 17.03862) /* center of my droplet */ { F_PROFILE(f, thread, position) = 44; /* advancing angle */ } else F_PROFILE(f, thread, position) = 34; /* receding angle */ } end_f_loop(f,t) } 

July 14, 2009, 20:27 

#4 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144 
You have fixed the obvious errors. The only thing now is to try it and test it works!
I recommend you test it using a wide range in contact angles (maybe 30 and 150) so it will be obvious that the contact angles you nominate are being correctly set. 

July 14, 2009, 21:02 

#5 
New Member
baechtelguillaume
Join Date: Apr 2009
Posts: 13
Rep Power: 17 
Ok, thank you for help Glenn. I'll do it as soon as possible.
Guillaume 

March 29, 2011, 17:59 
udf working

#6 
Member
rose
Join Date: Dec 2010
Posts: 30
Rep Power: 15 
where we can see udf working ????????
thank you 

February 19, 2013, 00:56 

#7 
New Member
Josy
Join Date: Mar 2009
Location: India
Posts: 29
Rep Power: 17 
Guillaume,
What is the radius of the droplet you have used? 

January 20, 2016, 18:13 

#8 
New Member
SMD
Join Date: Jan 2016
Posts: 1
Rep Power: 0 
Hello everyone
I'm trying to simulate a multi phase (evaporation & condensation) in a Thermosyphone/heatpipe using VOF model. I wrote UDF for mass and energy source. the question is i can see evaperation, but condensation doesn't happen (even in some regeion we have temperature below the Phase change temperature) until we consider an exaggerated boundary condition in condenser section of thermosyphone, e.g. set a tempreature for condenser wall, 500K lower than Phase change temperature. and in this case instead of seeing a film condensation we see pool condensation! if someone could help regarding this i really appreciate it. here is the UDF : #include "udf.h" #include "sg_mphase.h" #define T_SAT 633 #define LAT_HT 234700 /* vapour phase */ DEFINE_SOURCE(vap, cell, pri_th, dS, eqn) { Thread *mix_th; Thread *sec_th; real m_dot_v; mix_th = THREAD_SUPER_THREAD(pri_th); sec_th = THREAD_SUB_THREAD(mix_th, 1); if (C_T(cell, mix_th) <= T_SAT) { m_dot_v = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(C_T(cell, mix_th)  T_SAT)/T_SAT; dS[eqn] = 0.1*C_R(cell, pri_th)*fabs(C_T(cell, mix_th)  T_SAT)/T_SAT; } else { m_dot_v = 0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th) * fabs(T_SATC_T(cell,mix_th))/T_SAT; dS[eqn] = 0.; } return m_dot_v; } /* liquid phase */ DEFINE_SOURCE(liq, cell, sec_th, dS, eqn) { Thread *mix_th; Thread *pri_th; real m_dot_l; mix_th = THREAD_SUPER_THREAD(sec_th); pri_th = THREAD_SUB_THREAD(mix_th, 0); if (C_T(cell, mix_th)<=T_SAT) { m_dot_l = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(C_T(cell, mix_th)  T_SAT)/T_SAT; dS[eqn] = 0.; } else { m_dot_l = 0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(T_SATC_T(cell,mix_th))/T_SAT; dS[eqn] = 0.1*C_R(cell, sec_th)* fabs(C_T(cell, mix_th)  T_SAT)/T_SAT; } return m_dot_l; } /* energy */ DEFINE_SOURCE(enrg, cell, mix_th, dS, eqn) { Thread *pri_th; Thread *sec_th; real e_dot; pri_th = THREAD_SUB_THREAD(mix_th, 0); sec_th = THREAD_SUB_THREAD(mix_th, 1); if (C_T(cell, mix_th)<=T_SAT) { e_dot = LAT_HT*0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(C_T(cell, mix_th)  T_SAT)/T_SAT; dS[eqn] = LAT_HT*0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)/T_SAT; } else { e_dot = 0.1*LAT_HT*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(T_SATC_T(cell,mix_th))/T_SAT; dS[eqn] = 0.1*LAT_HT*C_VOF(cell, sec_th)*C_R(cell, sec_th)/T_SAT; } return e_dot; } 

Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Two questions on Fluent UDF  Steven  Fluent UDF and Scheme Programming  7  March 23, 2018 03:22 
Superlinear speedup in OpenFOAM 13  msrinath80  OpenFOAM Running, Solving & CFD  18  March 3, 2015 05:36 
HELP! UDF sinusoidal wave, VOF model, porous face!  A8anato_psofimi  FLUENT  2  November 10, 2009 14:42 
Film formation in VOF model using fluent  Ajay  FLUENT  0  September 6, 2007 05:57 
about VOF model  rey  FLUENT  5  August 13, 2002 06:02 