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

UDF for Pulsed flow

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Vahidehzare1367
  • 1 Post By blackmask

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 10, 2013, 04:08
Default UDF for Pulsed flow
  #1
New Member
 
Vahideh zare
Join Date: Jul 2013
Posts: 5
Rep Power: 13
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)
}
schlappeseppel124 likes this.
Vahidehzare1367 is offline   Reply With Quote

Old   July 10, 2013, 05:33
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
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, 06:09
Default
  #3
New Member
 
Vahideh zare
Join Date: Jul 2013
Posts: 5
Rep Power: 13
Vahidehzare1367 is on a distinguished road
Thank you very much in advance.

regards
Vahidehzare1367 is offline   Reply With Quote

Old   July 16, 2013, 03:19
Default
  #4
New Member
 
Vahideh zare
Join Date: Jul 2013
Posts: 5
Rep Power: 13
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, 03:59
Default
  #5
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
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, 04:17
Default
  #6
New Member
 
Vahideh zare
Join Date: Jul 2013
Posts: 5
Rep Power: 13
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, 04:31
Default
  #7
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
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, 04:35
Default
  #8
New Member
 
Yaser
Join Date: May 2013
Location: I. R. Iran, Tehran
Posts: 20
Rep Power: 13
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

Old   June 10, 2016, 05:44
Default udf
  #9
New Member
 
adnan
Join Date: Mar 2016
Posts: 2
Rep Power: 0
adnan1000 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 in steady state. I wrote a udf fo r 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 = (int)(flow_time/1.0)%2;
begin_f_loop(f, t)
{

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

Old   June 10, 2016, 06:37
Default
  #10
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by adnan1000 View Post
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 in steady state. I wrote a udf fo r 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 = (int)(flow_time/1.0)%2;
begin_f_loop(f, t)
{

if( i)
F_PROFILE(f,t ,position)=0;
else
F_PROFILE(f,t,position)=0. 2;
}
end_f_loop(f, t)
}
you want to run a steady state or a transient case? you say one thing, but your problem suggests something different.
Bruno Machado is offline   Reply With Quote

Old   June 11, 2016, 04:38
Default
  #11
New Member
 
adnan
Join Date: Mar 2016
Posts: 2
Rep Power: 0
adnan1000 is on a distinguished road
The Model is a tube being inside water intermittent (pulse), but when I use the code is not there is a change in the results, When change my time
I do not know how or where I put the time flow
adnan1000 is offline   Reply With Quote

Old   March 20, 2018, 13:30
Default
  #12
New Member
 
Join Date: Mar 2018
Posts: 2
Rep Power: 0
andreas_wan1 is on a distinguished road
hello, i'm currently try your code.. but it seems not working. could you please teach me how to write udf...?
andreas_wan1 is offline   Reply With Quote

Old   March 20, 2018, 15:33
Default
  #13
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
"It seems not working" is not very helpful. Please be more detailed.

(Does it give errors? Warnings? Wrong results? Fluent crashes? Your computer destroyed in a fire? Nothing happened?)
pakk is offline   Reply With Quote

Old   March 20, 2018, 23:30
Default
  #14
New Member
 
Join Date: Mar 2018
Posts: 2
Rep Power: 0
andreas_wan1 is on a distinguished road
Thank you for you reply Sir..
so i was trying to simulate gas-solid fludized bed dryer with pulsed flow... 0.2 m/s inlet velocity in +y direction, frequency 1 Hz (
0s -> 0.5s it flow 0.2m/s
0.5s -> 1s the flow stop at 0 m/s
1.0s -> 1.5s the flow again at 0.2m/s , repeat continously

and when i simulate the volume fraction..it doesn't show any pulsed effect..more likely constant velocity..
i'm also trying to change the frequency into 3s flow...3s stop just to see wether the udf code is working properly or not..and it show the same..

here the copy of my udf code for 3S flow..3S stop flow
==================================

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

{
if (i)
F_PROFILE(f,t,position)=0;
else
F_PROFILE(f,t,position)=0.2;
}

end_f_loop(f,t)
}

===============================
note: i still very beginner in fluent, especially in udf... so i don't know wether when we have to add "space" "." or ";" , and anything about coding
andreas_wan1 is offline   Reply With Quote

Reply


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 to measure Mass Flow Rate a.lynchy Fluent UDF and Scheme Programming 31 October 4, 2018 15:10
UDF for time-dependent flow borhan_sd@yahoo.com Fluent UDF and Scheme Programming 2 May 30, 2013 03:59
UDF for transient pressure inlet, mass flow check at nozzle exit and volumetric heat kokoory FLUENT 0 August 17, 2011 03: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 18:54


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