CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Source Term Question (

Blackhawks84 July 31, 2012 13:38

Source Term Question
2 Attachment(s)
Hello All,

I have been stuck on this problem for a few weeks now so any help would be awesome. Here is a background of what I am doing and what I need to do. I have a 10mm x 10mm structured grid (nothing special) with grid spacing 0.01mm. In Fluent, the whole mesh is liquid water and I mark a small circle of vapor to start my bubble growth on the wall. I would like to apply my source term to the interface and on a cell adjacent to the wall. I have ran a case where I was able to apply the source term to the interface and the row of cells adjacent to the wall. During the simulation, the vapor bubble basically flattened and slid along the row of cells adjacent to the wall. I would like to fix the source term to basically one cell that will feed the bubble from the source term and keep the source term in one cell along the wall. I tried to fix the source term by using centroids but it did not work.

I have attached a word document two UDFs for volume of fraction and its gradient. I have also attached a picture of the start of the simulation to help. Below is the main code I use for the source term. Thank you for helping.

# include"udf.h"
# include"mem.h"
# include"metric.h"
# include"math.h"
/*calculating and storing the source term*/
#if !RP_HOST
Domain *d;
face_t f;
cell_t c0;
Thread *t,*t0=t->t0;
double vof;
double vof_grad;
double st;
int Zone_ID = 6; /*zone id boundary conditions, 6 = base wall*/
double m_flux = 34.234; /*define mass flux, units: kg/(s*m^2)*/
d=Get_Domain(2); /*liquid domain*/
/*loops over all faces on the base wall in the liquid domain*/
t = Lookup_Thread(d,Zone_ID);
/*c0 and t0 identify the adjacent cell*/
t0 = THREAD_T0(t);
c0 = F_C0(f,t);
/*loops over all cells adjacent to wall*/
vof = C_UDSI(c0,t0,0);
vof_grad = C_UDMI(c0,t0,0);
if ((vof_grad < 0.001)||(vof < 0.001)||(vof > 0.999))
C_UDMI(c0,t0,1) = 0.0;
st = -1*(2*vof*vof_grad*m_flux);
C_UDMI(c0,t0,1) = st;

Blackhawks84 July 31, 2012 15:44

is there a way to find the y-cell centroid on the row adjacent to the wall where the interface is? then maybe i could store that value in a UDS or UDM and restrict the y-direction that way? i am all out of ideas on this one :confused:

All times are GMT -4. The time now is 08:35.