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 Members List Search Today's Posts Mark Forums Read

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, 04:04
Default How to change flow direction during a transient analysis?
  #1
New Member
 
Join Date: May 2017
Posts: 9
Rep Power: 7
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, 18:17
Default
  #2
Senior Member
 
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 396
Rep Power: 11
Светлана is on a distinguished road
Try to use lowercase 'v' and 't' everywhere?
Светлана is offline   Reply With Quote

Old   May 18, 2017, 04:51
Default
  #3
New Member
 
Join Date: May 2017
Posts: 9
Rep Power: 7
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?
Светлана likes this.

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

Old   May 28, 2017, 03:12
Question
  #4
New Member
 
Join Date: May 2017
Posts: 9
Rep Power: 7
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.
Светлана likes this.
kaufparkangucker is offline   Reply With Quote

Old   May 29, 2017, 08:04
Default
  #5
New Member
 
D. N. Venturi
Join Date: Jan 2013
Location: Brazil
Posts: 25
Rep Power: 11
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.
Светлана likes this.
venturi is offline   Reply With Quote

Old   May 30, 2017, 11:41
Question
  #6
New Member
 
Join Date: May 2017
Posts: 9
Rep Power: 7
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?
Светлана likes this.
kaufparkangucker is offline   Reply With Quote

Old   May 30, 2017, 11:58
Default
  #7
New Member
 
D. N. Venturi
Join Date: Jan 2013
Location: Brazil
Posts: 25
Rep Power: 11
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.
Светлана likes this.
venturi is offline   Reply With Quote

Old   May 31, 2017, 06:48
Question
  #8
New Member
 
Join Date: May 2017
Posts: 9
Rep Power: 7
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.
Светлана likes this.
kaufparkangucker is offline   Reply With Quote

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

Old   June 22, 2017, 20:29
Default Add x, F_CENTROID
  #10
Senior Member
 
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 396
Rep Power: 11
Светлана 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)
}
Светлана is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 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 22:49
Low Mixing time Problem Mavier CFX 5 April 29, 2013 00:00
Transient flow in fluent linyx FLUENT 15 April 24, 2013 09:54
beginner: how to change flow behaviour? yvar CFX 6 July 28, 2011 14:54
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11


All times are GMT -4. The time now is 07:39.