-
-
October 17, 2018 at 8:13 am
monaqu.1205
SubscriberHow do I modify the boiling.c code to account for level set method along with VOF model for horizontal film boiling tutorial given by fluent??
-
October 17, 2018 at 9:02 am
Rob
Ansys EmployeeIn what way do you want to modify the code? It'd probably help if you posted the UDF too.
-
October 17, 2018 at 9:41 am
monaqu.1205
SubscriberI would like to include Level-set method for calculating surface tension at the interface for film boiling. I am attaching the standard code provided by ansys for film boiling using VOF model is attached below:
#include "udf.h"
#include "sg.h"
#include "sg_mphase.h"
#include "flow.h"
#include "mem.h"
/**************************************************************/
/* UDF for specifying an interfacail area density */
/**************************************************************/
DEFINE_ADJUST(area_density, domain)
{
Thread *t;
Thread **pt;
cell_t c;
Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,P_PHASE);
real voidx, voidy, voidz=0;
{
Alloc_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);
Scalar_Reconstruction(pDomain, SV_VOF,-1,SV_VOF_RG,NULL);
Scalar_Derivatives(pDomain,SV_VOF,-1,SV_VOF_G,SV_VOF_RG,
Vof_Deriv_Accumulate);
}
{
Alloc_Storage_Vars(domain, SV_T_RG, SV_T_G, SV_NULL);
T_derivatives(domain);
Free_Storage_Vars(domain, SV_T_RG, SV_NULL);
}
mp_thread_loop_c (t,domain,pt)
if (FLUID_THREAD_P(t))
{
Thread *tp = pt[P_PHASE];
begin_c_loop (c,t)
{
#if RP_3D
C_UDMI(c,t,0) = (C_VOF_G(c,tp)[0]*C_T_G(c,t)[0]+
C_VOF_G(c,tp)[1]*C_T_G(c,t)[1]+C_VOF_G(c,tp)[2]*C_T_G(c,t)[2]);
#endif
#if RP_2D
C_UDMI(c,t,0) = (C_VOF_G(c,tp)[0]*C_T_G(c,t)[0]+
C_VOF_G(c,tp)[1]*C_T_G(c,t)[1]);
#endif
}
end_c_loop (c,t)
}
Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);
Free_Storage_Vars(domain, SV_T_G, SV_NULL);
}
DEFINE_SOURCE(gas, cell, thread, dS, eqn)
{
real x[ND_ND];
real source;
Thread *tm = THREAD_SUPER_THREAD(thread);
Thread **pt = THREAD_SUB_THREADS(tm);
real Kl = C_K_L(cell, pt[1])*C_VOF(cell, pt[1]),
Kg = C_K_L(cell, pt[0])*C_VOF(cell, pt[0]);
real L = 1e5;
source = (Kl+Kg)*C_UDMI(cell,tm,0) / L;
C_UDMI(cell, tm, 1) = source;
C_UDMI(cell, tm, 2) = -source*L;
dS[eqn] =0;
return source;
}
DEFINE_SOURCE(liquid, cell, thread, dS, eqn)
{
real x[ND_ND];
real source;
Thread *tm = THREAD_SUPER_THREAD(thread);
Thread **pt = THREAD_SUB_THREADS(tm);
source = -C_UDMI(cell, tm, 1);
dS[eqn] = 0;
return source;
}
DEFINE_SOURCE(energy, cell, thread, dS, eqn)
{
real x[ND_ND];
real source;
Thread *tm = thread;
source = C_UDMI(cell, tm, 2);
dS[eqn] = 0;
return source;
}
/***********************************************************************/
/* UDF for initializing flow field variables */
/***********************************************************************/
DEFINE_INIT(my_init_function, domain)
{
Thread *t;
Thread **pt;
Thread **st;
cell_t c;
Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,P_PHASE);
Domain *sDomain = DOMAIN_SUB_DOMAIN(domain,S_PHASE);
real xc[ND_ND], y, x;
mp_thread_loop_c (t,domain,pt)
if (FLUID_THREAD_P(t))
{
Thread *tp = pt[P_PHASE];
begin_c_loop (c,t)
{
C_CENTROID(xc,c,t);
x=xc[0];
y=xc[1];
if ( y < 0.00292 + 0.0006*cos(6.283*x/0.0778) )
C_VOF(c,tp) = 1;
else
C_VOF(c,tp) = 0;
}
end_c_loop (c,t)
}
mp_thread_loop_c (t,domain,st)
if (FLUID_THREAD_P(t))
{
Thread *sp = st[S_PHASE];
begin_c_loop (c,t)
{
C_CENTROID(xc,c,t);
x=xc[0];
y=xc[1];
if ( y < 0.00292 + 0.0006*cos(6.283*x/0.0778) )
C_VOF(c,sp) = 0;
else
C_VOF(c,sp) = 1;
}
end_c_loop (c,t)
}
}
-
October 17, 2018 at 10:20 am
DrAmine
Ansys EmployeeThe CLSVOF implementation in Fluent does not support mass transfer. Adding that would require a lot of efforts.
-
October 17, 2018 at 11:47 am
Karthik R
AdministratorHello,
just a curious question - is there a reason why you would like to add level set to this UDF?
thanks.
Best Regards,
Karthik
-
October 18, 2018 at 4:41 am
monaqu.1205
SubscriberIn CLSVOF method, I would be using VOF model to calculate mass transfer whereas level set method will be used to calculate surface tension force.
So can you help me in modifying the code for CLSVOF?
-
October 18, 2018 at 4:45 am
monaqu.1205
SubscriberHello,
I want to include Level set method to calculate Surface tension force.
-
October 18, 2018 at 4:57 am
DrAmine
Ansys EmployeeYou can calculate Surface tension force without using the Level Set Method. The step to include mass transfer effects for CLSVOF is not easy and requires a lot of efforts and some deep knowledge of C programming, parallelization and UDF. As ANSYS Stuff we cannot help here. Perhaps a community member might help you here out.
-
October 18, 2018 at 9:21 am
monaqu.1205
SubscriberC programming and parallelization is not an issue. I'm positive, I can handle it.
However, I need to know what modifications are required in UDF.
-
October 18, 2018 at 10:31 am
Rob
Ansys EmployeeSimply (and that's as far as we're going as staff) you need to ID the cell with the free surface and add/remove material from the phases based on local temperature etc.
-
December 13, 2018 at 10:46 am
amaligaadi2018
SubscriberHi monaqu.1205, I have same difficulty in the implementation of CLSVOF, please have you solved the problem and how did you do it?
-
July 28, 2019 at 10:17 am
shadman
Subscribercan anyone provide me with the test-2d.msh.gz boiling.c files for the tutorial of nucleate boiling?
-
July 29, 2019 at 2:35 pm
Rob
Ansys EmployeeThey'll be on the ANSYS Learning Hub, so you'll need to get access to that: we can't supply them.
-
- You must be logged in to reply to this topic.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
-
2656
-
2120
-
1347
-
1118
-
461
© 2023 Copyright ANSYS, Inc. All rights reserved.