CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for condensation (https://www.cfd-online.com/Forums/fluent-udf/223785-udf-condensation.html)

rupak504 January 26, 2020 13:24

UDF for condensation
 
hello,

I was trying to add UDF for condensation problem.
............
UDF
.............


#include <udf.h>
#define T_sat 373.15
#define hfg 2256400
#define r 0.1

DEFINE_SOURCE (vapour_source, cell, cell_thread, ds, eqn)
{
Thread **pt;
pt = THREAD_SUB_THREADS(cell_thread);
real source_v;
if (C_T(cell, cell_thread) <= T_sat)
{


source_v = -C_R(cell, cell_thread)*r*C_VOF(cell, pt[1]) *(fabs(C_T(cell, cell_thread) - T_sat) / T_sat);

ds[eqn]= 0;
}
else
{
source_v = 0;

ds[eqn]=0;

}

return source_v;
}

DEFINE_SOURCE (liquid_source, cell, cell_thread, ds, eqn)
{

Thread **pt;
pt = THREAD_SUB_THREADS(cell_thread);
real source_l;

if (C_T(cell, cell_thread) <= T_sat)
{
source_l = C_R(cell, cell_thread)*r*C_VOF(cell, pt[0])*(fabs(C_T(cell,cell_thread)-T_sat)/T_sat);

ds[eqn]=0;

}
else
{

source_l = 0;

ds[eqn]=0;

}

return source_l;
}


DEFINE_SOURCE (energy_source, cell, cell_thread, ds, eqn)

{
Thread **pt;
pt = THREAD_SUB_THREADS(cell_thread);
real source;

if (C_T(cell, cell_thread) <= T_sat)

{
source= C_R(cell, cell_thread)*r*C_VOF(cell, pt[0]) *(fabs(C_T(cell, cell_thread) - T_sat) / T_sat);

ds[eqn]=0;

}

else

{

source=0;

ds[eqn]=0;

}

return hfg*source;

}


............
Errors
............


udf_names.c(7): error C2059: syntax error: '}'
udf_names.c(8): warning C4034: sizeof returns 0


---------------------------------

Any help would be appreciated
regards

AlexanderZ January 27, 2020 06:08

start with
Code:

#include "udf.h"
compile your code, show latest version of code and problems you have


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