Hello everyone 

The objective of my project is to study the dissolution of CO2 bubble in an oil in ANSYS Fluent using VOF model. For this, I am trying to implement a UDF for my mass transfer model (Bothe and Fleckenstein) but unable to do it because of some code errors. My problem statement has been attached in a file .

#include "udf.h"

DEFINE_MASS TRANSFER( CO2_dissolution, cell, thread, from_index, from_species_index, to_index, to_species_index)

{

float D, Cint,C,dist;

int n;

real X ,m_gl;

real cell_pos1 [3],cell_pos2 [3];

Thread *tf;

face_t f ;

X=7.6e-03;

D=8.02e-09;

Cint=8.183;

Thread *gas = THREAD_SUB_THREAD(thread, from_index);

Thread *liq = THREAD_SUB_THREAD(thread, to_index);

m_gl=0.;

begin_c_loop(cell, thread)

{

C_ CENTROID(pos1, cell, thread);

c_face_loop(cell, thread,n);

{

f = C_FACE(cell, thread, n);

tf = C_FACE_THREAD(cell ,thread, n);

F_CENTROID(pos2, f, tf);

}

dist=pow((pow((pos1[1]-pos2[1]),2)+pow((pos1[2]-pos2[2]),2)+pow((pos1[3]-pos2[3]),2)), 0.5);

m_gl= D* ((Cint - (C_VOF(cell,gas)*C_R(cell,liq)))/dist);

}

end_c_loop(cell, thread)

return(m_gl);

}

Desperately in search of an advice .

Similar questions and discussions