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

Oddly diffuse results from UDF in multiphase (picture and udf)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 10, 2016, 22:03
Default Oddly diffuse results from UDF in multiphase (picture and udf)
  #1
New Member
 
Mark Schulte
Join Date: Dec 2015
Posts: 19
Rep Power: 10
Jehosh is on a distinguished road
I have been trying to catch the interface in my vertical falling liquid film simulation. Through kind help from these forums I have figured out how to mark the interface at the beginning using DEFINE_ON_DEMAND and store the results in a UDM just to make sure I am setting everything up right. The results are:

image.png

Which is great as it marks the interface. However, the value at the interface is ~0.25-0.5 and I marked it as 1 in my UDM. Any ideas why that would be?

The udf has some things commented out and likely has some superfluous bits but I wanted to include it all in case something in there is the problem and in case anyone wanted to use it. It's:

#include "udf.h"
#define zone_id 1 /* REPLACE THIS WITH APPROPRIATE BOUNDARY ID */
#define air_phase 0
#define water_phase 1

DEFINE_ON_DEMAND(my_mark_cells)
{
Domain *d = Get_Domain(1); /* POINTER FOR THE DOMAIN */
Thread *t, *t0;
Thread **pt;
cell_t c0, c1;
real vof_cutoff = 0.5;

face_t f;

t = Lookup_Thread(d, zone_id); /* POINTER FOR THE SPECIFIED BOUNDARY */
t0 = THREAD_T0(t); /* POINTER FOR THE FLUID ADJACENT TO SPECIFIED BOUNDARY */
pt = THREAD_SUB_THREADS(t0);

begin_f_loop(f,t) /* LOOP OVER FACES OF THE SPECIFIED BOUNDARY */
{
c0 = F_C0(f,t);
/*c1 = F_C1(f,t0);*/
if ( (C_VOF(c0,pt[water_phase]) > vof_cutoff ) && (C_VOF(c0,pt[water_phase]) < (1 - vof_cutoff)))
{
/*if (C_VOF(c1,pt[water_phase]) > 1 - vof_cutoff )
{*/
C_UDMI(c0,t0, 0) = 1;
/* }*/
}

}
end_f_loop(f,t);
}
Jehosh is offline   Reply With Quote

Old   February 10, 2016, 23:48
Default
  #2
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 13
hwet is on a distinguished road
I am not good at all with UDF's but since you asked for it, here it goes:

From what I understand you specified a value of 1 at the boundary for water phase with your UDF? The interface depends on the cell size and is only a representation of the actual (real) interphase. Your boundary may have a volume fraction of 1 of the liquid phase but since the interface itself is supposed to show you a transition from one phase to another this is what I would have expected your results to show.
hwet is offline   Reply With Quote

Old   February 11, 2016, 05:53
Default
  #3
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
How can this conditional statement ever be true with a vof_cutoff = 0.5? It's only true if the volume fraction is both greater than and less than 0.5 (not possible).

Code:
if ( (C_VOF(c0,pt[water_phase]) > vof_cutoff ) && (C_VOF(c0,pt[water_phase]) < (1 - vof_cutoff)))
One potential issue with your code logic is if the interface shifts and you run this UDF a second time (or you modify the cut off criteria which I suspect you've done before having 0.5). The originally marked cells would remain marked in addition to the new updated interface. A simple fix would be to loop through all faces first and clear the UDM:

Code:
begin_f_loop(f,t)
{
    c0 = F_C0(f,t);
    C_UDMI(c0,t0,0) = 0.;
}
You're probably plotting node values which are interpolations (Fluent is a cell centred solver). Uncheck "Node Values" under contours and select two levels to highlight the binary nature of your plot.

Also, you could double check the interface location by plotting contours of the volume fraction.
`e` is offline   Reply With Quote

Reply

Tags
multiphase, udf, udm


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



All times are GMT -4. The time now is 19:51.