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

How to change flow direction during a transient analysis?

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 1 Post By kaufparkangucker
  • 1 Post By kaufparkangucker
  • 1 Post By venturi
  • 1 Post By kaufparkangucker
  • 1 Post By venturi
  • 1 Post By kaufparkangucker
  • 1 Post By kaufparkangucker

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 17, 2017, 05:04
Default How to change flow direction during a transient analysis?
  #1
New Member
 
Join Date: May 2017
Posts: 9
Rep Power: 9
kaufparkangucker is on a distinguished road
Hello forum community,

I want to reverse the direction of flow of water in a pipe after a certain time. At the beginning water flows from the inlet through the tube to the outlet for 20 seconds. Afterwards the flow direction turns and it flows water 40 seconds from the outlet to the inlet. That is what I want.

I have tried whether I can enter negative values ​​for the speed at the velocity-inlet. That's no problem. As a result, the water flows from the outlet towards inlet.

I also tried to interrupt the calculation and during this break I changed the boundary conditions of the velocity_inlet into a pressure_outlet and the pressure_outlet into a velocity_inlet. Then I have the calculation run further. When I look at the result in the CFD postprocessor the velocity vectors change according to the direction - so this works also. Although I do not have streamlines in the animation to look at. For some reason the calculation of the streamlines takes eternally.

After these tests and the realization that it seems possible to change the flow direction, I have tried to use a customized UDF for it:

Code:
#include "udf.h"
DEFINE_PROFILE (inlet_velocity, thread, position)
{
Real t, v;
Face_t f;

begin_f_loop (f, thread)
{
T = RP_Get_Real ("flow-time");
{
If (t> 0 && t <= 20)
{
V = 1.5;
}
Else if (t> 20 && t <= 60)
{
V = -1.5;
}
}
F_PROFILE (f, thread, position) = v;
}
end_f_loop (f, thread)
}
Unfortunately this does not work. The direction of flow does not change after 20 seconds.

I would be very happy if you can help me to adjust the UDF.



Thanks and regards


Kauf
kaufparkangucker is offline   Reply With Quote

Old   May 17, 2017, 19:17
Default
  #2
Senior Member
 
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 416
Rep Power: 15
Svetlana is on a distinguished road
Try to use lowercase 'v' and 't' everywhere?
Svetlana is offline   Reply With Quote

Old   May 18, 2017, 05:51
Default
  #3
New Member
 
Join Date: May 2017
Posts: 9
Rep Power: 9
kaufparkangucker is on a distinguished road
Sorry, this is a spelling error. In the source text I have noticed the case sensitivity.

The code I use is:

Code:
#include "udf.h"
DEFINE_PROFILE(inlet_velocity, thread, position)
{ 
real t, v;
face_t f;

begin_f_loop(f,thread)
{
t = RP_Get_Real("flow-time");
{
if(t > 0 && t <= 20)
{
v = 1.5;
}
else if(t > 20 && t <= 60)
{
v = - 1.5;
} 
}
F_PROFILE(f,thread,position) = v;
}
end_f_loop(f,thread)
}
Is it maybe not possible to change flow direction after some Seconds from x to -x?


Any ideas?
Svetlana likes this.

Last edited by kaufparkangucker; May 21, 2017 at 10:09.
kaufparkangucker is offline   Reply With Quote

Old   May 28, 2017, 04:12
Question
  #4
New Member
 
Join Date: May 2017
Posts: 9
Rep Power: 9
kaufparkangucker is on a distinguished road
As a beginner, I have no idea if it is possible to reverse the flow direction during a transient analysis in Fluent. Maybe there is also a solution other than UDF?

Is it possible, for example, to first solve a transient solution for the flow direction in +x direction through a pipe and then use this solution as the starting condition of a new transient solution, where I change the position of the inlet and outlet so the new flow direction is now in -x direction?

I would like to see how the liquid behaves in a tube when the flow direction turns suddenly by 180°.

I am grateful for all tips and hints.
Svetlana likes this.
kaufparkangucker is offline   Reply With Quote

Old   May 29, 2017, 09:04
Default
  #5
New Member
 
D. N. Venturi
Join Date: Jan 2013
Location: Brazil
Posts: 25
Rep Power: 13
venturi is on a distinguished road
Are you trying to look the streamlines at CFD-Post?

If so, a possible problem could occur if you select the inlet as starting point for the streamlines and tried to integrate "forward" while the flow is reversed.

Try making the streamlines in a center plane, or uniformly distributed in all the domain if this is the problem.
Svetlana likes this.
venturi is offline   Reply With Quote

Old   May 30, 2017, 12:41
Question
  #6
New Member
 
Join Date: May 2017
Posts: 9
Rep Power: 9
kaufparkangucker is on a distinguished road
Thanks Venturi - but that's not what I'm trying.

I would like to see the turbulence image that is produced when the direction of flow in the pipe change the direktion.

For that, I'm trying to make a flow simulation through a simple pipe.
The entrance is say "left" and the exit is "right".
The input e.g. a Velocity input and the output is a pressure output. At the beginning the flow velocity should be + 2m / s for 10 seconds. Subsequently, the flow velocity should be -2 m/s for 10 seconds.

The velocity in the pipe should be:
10 secounds +2 m/s
and than
10 secounds - 2 m/s

Has some of you an idea how to do that?
Svetlana likes this.
kaufparkangucker is offline   Reply With Quote

Old   May 30, 2017, 12:58
Default
  #7
New Member
 
D. N. Venturi
Join Date: Jan 2013
Location: Brazil
Posts: 25
Rep Power: 13
venturi is on a distinguished road
Oh I'm sorry then. That is what I understood from your first post.

Quote:
Originally Posted by kaufparkangucker View Post
When I look at the result in the CFD postprocessor the velocity vectors change according to the direction - so this works also. Although I do not have streamlines in the animation to look at. For some reason the calculation of the streamlines takes eternally.
Svetlana likes this.
venturi is offline   Reply With Quote

Old   May 31, 2017, 07:48
Question
  #8
New Member
 
Join Date: May 2017
Posts: 9
Rep Power: 9
kaufparkangucker is on a distinguished road
Yes, I have certainly expressed something ambiguous. I hope you understand my problem now and have an idea how I can solve it.
Svetlana likes this.
kaufparkangucker is offline   Reply With Quote

Old   June 22, 2017, 12:24
Default
  #9
New Member
 
Join Date: May 2017
Posts: 9
Rep Power: 9
kaufparkangucker is on a distinguished road
Nobody any idea how to change flow direction during a simulation in ansys fluent?
Svetlana likes this.
kaufparkangucker is offline   Reply With Quote

Old   June 22, 2017, 21:29
Default Add x, F_CENTROID
  #10
Senior Member
 
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 416
Rep Power: 15
Svetlana is on a distinguished road
This version works for me with added x variable and F_CENTROID function call,

Code:
#include "udf.h"
DEFINE_PROFILE(inlet_velocity, thread, position)
{ 
real x[ND_ND];    // added
real t, v;
face_t f;

begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread); // added
t = RP_Get_Real("flow-time");
{
if(t > 0 && t <= 20)
{
v = 1.5;
}
else if(t > 20 && t <= 60)
{
v = - 1.5;
} 
}
F_PROFILE(f,thread,position) = v;
}
end_f_loop(f,thread)
}
Svetlana 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
Can I change flow direction using UDF? newcfdone Fluent UDF and Scheme Programming 4 April 6, 2016 23:49
Low Mixing time Problem Mavier CFX 5 April 29, 2013 01:00
Transient flow in fluent linyx FLUENT 15 April 24, 2013 10:54
beginner: how to change flow behaviour? yvar CFX 6 July 28, 2011 15:54
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 10:11


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