CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Patching Volume Fraction in a sloped channel (https://www.cfd-online.com/Forums/fluent/86469-patching-volume-fraction-sloped-channel.html)

KateyMT March 23, 2011 10:53

Patching Volume Fraction in a sloped channel
 
Hello. I'm running an open channel VOF model of a sloped channel and would like to be able to patch a volume fraction of 1 for the area under the water surface. I understand how to do this in a flat channel using region adaption in Fluent. I can't however figure out how to do this for a sloped channel in which the water surface is also sloped at approximately the same angle as the channel bottom.

any suggestions?

Amir March 23, 2011 14:56

Hi Katey,
you can do that with a simple UDF with DEFINE_INIT macro. loop over all cells and set a condition over y-coordinate ....

KateyMT March 23, 2011 15:05

Thanks. I will look into that. I'm pretty new at this but I'm finding if I can't intialize the volume fraction for the water portion of the problem it takes a long time to get water through the channel.

KateyMT March 24, 2011 10:44

Use of VOF Multiphase Macro
 
So in order to use the DEFINE_INIT macro I need to find the correct cell macro to initialize the volume fraction in the cell. I believe this is the C_VOF(c,t) macro but I'm a little confused about how to apply it...or I should say how to indicate which phase i'm changing, 1 or 2.

Any help is much appreciated.

Amir March 24, 2011 12:12

Quote:

Originally Posted by KateyMT (Post 300909)
So in order to use the DEFINE_INIT macro I need to find the correct cell macro to initialize the volume fraction in the cell. I believe this is the C_VOF(c,t) macro but I'm a little confused about how to apply it...or I should say how to indicate which phase i'm changing, 1 or 2.

Any help is much appreciated.

Hi,
the similar code is available in UDF manual that you can use it but your procedure is simpler:
Code:

/*****************************************************************
UDF for initializing phase volume fraction
******************************************************************/
#include "udf.h"
/* domain pointer that is passed by INIT function is mixture domain */
DEFINE_INIT(my_init_function, mixture_domain)
{
int phase_domain_index;
cell_t cell;
Thread *cell_thread;
Domain *subdomain;
real xc[ND_ND];
/* 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)
/* 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)
{
C_CENTROID(xc,cell,cell_thread);
if (sqrt(ND_SUM(pow(xc[0] - 0.5,2.),
pow(xc[1] - 0.5,2.),
pow(xc[2] - 0.5,2.))) < 0.25)
/* set volume fraction to 1 for centroid */
C_VOF(cell,cell_thread) = 1.;
else
/* otherwise initialize to zero */
C_VOF(cell,cell_thread) = 0.;
}
end_c_loop_all (cell,cell_thread)
}
}
}


KateyMT March 24, 2011 12:13

Thanks. I just found that and I'm running it now. Crossing fingers.


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