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

UDF for energy source in VOF model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 26, 2018, 01:27
Question UDF for energy source in VOF model
  #1
New Member
 
Harnoor Singh
Join Date: Jan 2016
Posts: 14
Rep Power: 10
Harnoor is on a distinguished road
I am working on my phD thesis that involves simulation of an ink droplet impacting a rigid surface. I am using a 2d planar multiphase VOF solver with surface tension modeling. So the primary phase is air and the secondary phase is the ink droplet. Now I wish to apply a constant volumetric heating source to the region where volume fraction of the droplet > 0.9 (cut off value). For this, I wrote a UDF. Even though I don't get any errors during interpretation, the UDF does not produce any volumetric heating. The UDF is pasted below:


#include "udf.h"
#include "mem.h" /* cell indexing header */

DEFINE_SOURCE(hgen_source,c,t,dS,eqn)
{
real source;
int phase_domain_index;
cell_t cell;
Thread *cell_thread;
Domain *subdomain;
Domain *mixture_domain;
mixture_domain = Get_Domain(1);

/* loop over all subdomains (phases) in the superdomain (mixture) */
sub_domain_loop(subdomain, mixture_domain, phase_domain_index)
{
/* loop if secondary phase */
if (DOMAIN_ID(subdomain) == 3) //DOMAIN_ID of: mixture =1, primary = 2, secondary = 3, by convention.
{
/* loop over all cell threads in the secondary phase domain */
thread_loop_c (cell_thread,subdomain)
{
/* loop over all cells in secondary phase cell threads */
begin_c_loop_all (cell,cell_thread)
{
if (C_VOF(cell,cell_thread)>0.9)
{
source = 8*pow(10,11);
dS[eqn] = 0;
}
else
{
source = 0;
dS[eqn] = 0;
}
}
end_c_loop_all (cell,cell_thread)
}
}
}

return source;
}


However when I remove the if condition inside c_loop_all and just set source equal to a constant value, I do get volumetric heating in the entire domain. I just can't find a way to apply the source term only to the region with droplet volume fraction > 0.9. Is there something wrong with the UDF? I am really new to UDF's so any help will be greatly appreciated.
Harnoor is offline   Reply With Quote

Old   July 28, 2018, 01:54
Default
  #2
New Member
 
Harnoor Singh
Join Date: Jan 2016
Posts: 14
Rep Power: 10
Harnoor is on a distinguished road
Hey guys, I would really appreciate any insights into the problem. I am stuck and need some help to proceed.
Harnoor is offline   Reply With Quote

Old   July 29, 2018, 22:51
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
did you hook your functions in Fluent GUI?
try to compile instead of interpret

best regards
AlexanderZ is offline   Reply With Quote

Old   August 1, 2018, 20:34
Default
  #4
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 12
obscureed is on a distinguished road
Hi Harnoor,

Quoting from the ANSYS Fluent Customization Manual:
Your UDF will need to compute the real source term only for a single cell and return the value to the solver

So you don't need a cell loop at all. On each call to the UDF, you only need to consider the cell defined by the values of c,t that are passed into the function.

By the way, when a publication writes 8×10^11, you should use 8.e11 in a program, not 8*pow(10,11). They arrive at the same answer, but 8.e11 goes straight there. It's a bit like not knowing how decimal points work, so writing 93.3 as (93+3./10.).

I am uneasy about the physical basis for defining a volume-based energy source. Are you relying on a uniform cell height for the wall-adjacent cells?

Good luck!
Ed
obscureed is offline   Reply With Quote

Reply

Tags
source energy term, udf c_vof, vof multiphase


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 18:18
Trouble compiling utilities using source-built OpenFOAM Artur OpenFOAM Programming & Development 14 October 29, 2013 11:59
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 02:41
Source terms due to mass transfer in VOF model ssamton FLUENT 0 March 5, 2012 01:03
UDF for Heat Exchanger model francois louw FLUENT 2 July 16, 2010 03:21


All times are GMT -4. The time now is 14:16.