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

UDF for Pulsed flow

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By blackmask

Reply
 
LinkBack Thread Tools Display Modes
Old   July 10, 2013, 03:08
Default UDF for Pulsed flow
  #1
New Member
 
Vahideh zare
Join Date: Jul 2013
Posts: 5
Rep Power: 4
Vahidehzare1367 is on a distinguished road
Hi all ,Iím new in fluent and particularly UDF, I want to model a system that a gas is inlet and it flows for 3s and doesnít flow for 3s alternatively and continuously. I wrote a udf for this problem But it don't do correctly.
Please, guide me.
Thank you very much

#include"udf.h"
DEFINE_PROFILE(inlet_x_velocity, t, position)
{
face_t f;
real flow_time = RP_Get_Real(
"flow-time");
int i;
begin_f_loop(f, t)
{
for(i=0; i<=flow_time; i++)
{
if(flow_time >= i*6 && flow_time <= i*6 +3)
F_PROFILE(f,t ,position)=0;
else
F_PROFILE(f,t,position)=0.58425;
}
}
end_f_loop(f, t)
}
Vahidehzare1367 is offline   Reply With Quote

Old   July 10, 2013, 04:33
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 12
blackmask will become famous soon enough
Try this one.

Code:
#include"udf.h"
DEFINE_PROFILE(inlet_x_velocity, t, position)
{
face_t f;
real flow_time = RP_Get_Real("flow-time");
int i = (int)(flow_time/3.0)%2;
begin_f_loop(f, t)
{

if( i)
F_PROFILE(f,t ,position)=0;
else
F_PROFILE(f,t,position)=0.58425;
}
end_f_loop(f, t)
}
blackmask is offline   Reply With Quote

Old   July 10, 2013, 05:09
Default
  #3
New Member
 
Vahideh zare
Join Date: Jul 2013
Posts: 5
Rep Power: 4
Vahidehzare1367 is on a distinguished road
Thank you very much in advance.

regards
Vahidehzare1367 is offline   Reply With Quote

Old   July 16, 2013, 02:19
Default
  #4
New Member
 
Vahideh zare
Join Date: Jul 2013
Posts: 5
Rep Power: 4
Vahidehzare1367 is on a distinguished road
Hi Blackmask, if I want to model a system that a gas is inlet and it flows for 0.05s and doesnít flow for 0.05s alternatively and continuously, What do I do?
Vahidehzare1367 is offline   Reply With Quote

Old   July 16, 2013, 02:59
Default
  #5
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 12
blackmask will become famous soon enough
Change

int i = (int)(flow_time/3.0)%2;

to

int i = (int)(flow_time/0.05)%2;
tsram90 likes this.
blackmask is offline   Reply With Quote

Old   July 16, 2013, 03:17
Default
  #6
New Member
 
Vahideh zare
Join Date: Jul 2013
Posts: 5
Rep Power: 4
Vahidehzare1367 is on a distinguished road
I change this but the udf can't do correctly
Vahidehzare1367 is offline   Reply With Quote

Old   July 16, 2013, 03:31
Default
  #7
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 12
blackmask will become famous soon enough
Please explain in more details. What is the time step you choose in your calculation? Make sure that the time step is at least one order smaller that the period of the pulsating flow.
blackmask is offline   Reply With Quote

Old   July 16, 2013, 03:35
Default
  #8
New Member
 
Yaser
Join Date: May 2013
Posts: 20
Rep Power: 4
Barzanoni is on a distinguished road
Hi Dear Vahideh
please see Chapter 8 of the ANSYS FLUENT UDF Manual.

/************************************************** *********************
vprofile.c
UDF for specifying steady-state velocity profile boundary condition
************************************************** **********************/
#include "udf.h"
DEFINE_PROFILE(inlet_x_velocity, thread, position)
{
real x[ND_ND]; /* this will hold the position vector */
real y, h;
face_t f;
h = 0.016; /* inlet height in m */
begin_f_loop(f,thread)
{
F_CENTROID(x, f, thread);
y = 2.*(x[1]-0.5*h)/h; /* non-dimensional y coordinate */
F_PROFILE(f, thread, position) = 0.1*(1.0-y*y);
}
end_f_loop(f, thread)
}

/************************************************** ********************
unsteady.c
UDF for specifying a transient pressure profile boundary condition
************************************************** *********************/
#include "udf.h"
DEFINE_PROFILE(unsteady_pressure, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) = 101325.0 + 5.0*sin(10.*t);
}
end_f_loop(f, thread)
}
Barzanoni is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF to measure Mass Flow Rate a.lynchy Fluent UDF and Scheme Programming 21 February 15, 2014 03:18
UDF for time-dependent flow borhan_sd@yahoo.com Fluent UDF and Scheme Programming 2 May 30, 2013 02:59
UDF for transient pressure inlet, mass flow check at nozzle exit and volumetric heat kokoory FLUENT 0 August 17, 2011 02:07
How to define mass flow rate using UDF? SAMUEL FLUENT 0 December 16, 2004 03:55
UDF for multiphase flow ROOZBEH FLUENT 3 April 7, 2004 17:54


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