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

Editing a UDF for a velocity boundary in a multiphase

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 7, 2009, 16:48
Default Editing a UDF for a velocity boundary in a multiphase
  #1
New Member
 
Join Date: May 2009
Posts: 3
Rep Power: 17
rubenk is on a distinguished road
Hello,

Does someone have an example of how to specify velocity as function of time for a multiphase mixture at a velocity inflow boundary condition? I am using a VOF scheme.

I know I'll get a RTFM but I did read the manual and other posts in this forum related to my question. I am confused as to if I should use both domain and subdomain pointers. I started by trying to augment the following code that works for a single phase situation but maybe that is not the way to go:

/************************************************** ********************
unsteady.c
UDF for specifying a transient velocity profile boundary condition
************************/
#include"udf.h"
#include"unsteady.h"
float *vel_data, vel; //velocity will be redefined as mass flow for the purposes of this problem
DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
int t = N_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) = vel_data[t];
}
end_f_loop(f, thread)
}

DEFINE_ON_DEMAND(read_velocity)
{
int i = 0;
int *time_data, filelength, time;
FILE* fp;
#if !RP_NODE
Message(
"Beginning Read File Routine \n");
#endif
fp = fopen("velocity.dat","r");
if ( fp!=NULL )
{
#if !RP_NODE
Message(
" \n");
Message(
"Reading file velocity.dat \n");
Message(
" \n");
#endif
}
else
{
#if !RP_NODE
Message(
" \n");
Message(
"Error opening file \n");
Message(
" \n");
#endif
}
fscanf(fp,
"%i \n",&filelength);
#if !RP_NODE
Message(
"The file length is: %i \n",filelength);
#endif
//time_data = (int *) malloc(filelength*sizeof(int));
vel_data = (float *) malloc(filelength*sizeof(float));
if ( (vel_data==NULL) )
{
#if !RP_NODE
Message(
"Memory allocation error \n");
#endif
}
for(i=0; i<filelength; i++)
{
fscanf(fp,
"%f \n",&vel);
//time_data[i] = time;
vel_data[i] = vel;
//#if DISPLAY_TABLES
#if !RP_NODE
Message(
"%.3f \n", vel_data[i]);
#endif
}
//#else
#if !RP_NODE
Message(
" \n");
#endif
//#endif
fclose(fp);
}
rubenk is offline   Reply With Quote

Reply

Tags
multiphase, udf, velocity


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
UDF velocity and temperature Raj FLUENT 3 February 1, 2009 19:29
maintaining a logarithmic velocity distribution Morten Andersen CFX 1 January 8, 2007 12:37
why boudary slip velocity is so larte using udf cxzhao FLUENT 0 July 4, 2005 01:06
velocity inlet boundary x.tang FLUENT 1 May 4, 2001 10:11
slip velocity on boundary (V.P.M) Lee, Juhee Main CFD Forum 3 October 22, 1998 16:30


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