CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

Source Term Question

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 31, 2012, 13:38
Default Source Term Question
  #1
New Member
 
Bradley J
Join Date: Jul 2012
Location: Cincinnati, OH
Posts: 12
Rep Power: 5
Blackhawks84 is on a distinguished road
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*/
DEFINE_EXECUTE_AT_END(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);
begin_f_loop(f,t)
{
/*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;
}
else
{
st = -1*(2*vof*vof_grad*m_flux);
C_UDMI(c0,t0,1) = st;
}
}
end_f_loop(f,t)
#endif
}
Attached Images
File Type: jpg Mass Flux Trial.jpg (77.8 KB, 21 views)
Attached Files
File Type: docx udf.docx (13.8 KB, 19 views)
Blackhawks84 is offline   Reply With Quote

Old   July 31, 2012, 15:44
Default
  #2
New Member
 
Bradley J
Join Date: Jul 2012
Location: Cincinnati, OH
Posts: 12
Rep Power: 5
Blackhawks84 is on a distinguished road
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
Blackhawks84 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Source term linearization lost.identity Main CFD Forum 7 May 8, 2010 11:07
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08
UDF - Source Term Question Jacques FLUENT 0 December 8, 2008 14:40
UDF Scalar Code: HT 1 Greg Perkins FLUENT 8 October 20, 2000 12:40
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 13, 2000 23:03


All times are GMT -4. The time now is 21:24.