CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Oddly diffuse results from UDF in multiphase (picture and udf) (https://www.cfd-online.com/Forums/fluent-udf/166508-oddly-diffuse-results-udf-multiphase-picture-udf.html)

Jehosh February 10, 2016 21:03

Oddly diffuse results from UDF in multiphase (picture and udf)
 
1 Attachment(s)
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:

Attachment 45099

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);
}

hwet February 10, 2016 22:48

I am not good at all with UDF's but since you asked for it, here it goes: :p

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.

`e` February 11, 2016 04:53

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.


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