CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF VOF model on Fluent (http://www.cfd-online.com/Forums/fluent-udf/66388-udf-vof-model-fluent.html)

baechtel July 14, 2009 02:19

UDF VOF model on Fluent
 
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)
}

ghorrocks July 14, 2009 19:05

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

baechtel July 14, 2009 19:41

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)
}

ghorrocks July 14, 2009 20:27

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.

baechtel July 14, 2009 21:02

Ok, thank you for help Glenn. I'll do it as soon as possible.

Guillaume

rubis March 29, 2011 17:59

udf working
 
where we can see udf working ????????

thank you

Josyula February 19, 2013 01:56

Guillaume,
What is the radius of the droplet you have used?

SMD January 20, 2016 19:13

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_SAT-C_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_SAT-C_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_SAT-C_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;
}


All times are GMT -4. The time now is 09:56.