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

streamwise pressure gradient

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 21, 2018, 08:45
Default streamwise pressure gradient
  #1
New Member
 
G Ionut
Join Date: Sep 2016
Posts: 29
Rep Power: 9
Ionut G is on a distinguished road
Hello,
I need some help to calculate the streamwise pressure gradient for my UDF in Ansys Fluent.

I have considered two 2D cases: Case A, a horizontal pipe and Case B, a tilted pipe (as in the figures below).
The two cases have the same geometry, mesh and coordinate system, the difference is that the second pipe is tilted.

For Case A the streamwise pressure gradient is found using the C_P_G(c,t)[0] function from fluent, the pressure gradient along the x-axis.

For Case B the above function is not valid. How can the streamwise pressure gradient can be calculated for the considered case?
Attached Images
File Type: jpg 2D pipe cases.jpg (16.4 KB, 19 views)
Ionut G is offline   Reply With Quote

Old   February 21, 2018, 11:19
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Just use the definition of streamwise pressure gradient.

The streamwise pressure gradient is the inner product between the pressure gradient and the unit vector in the direction of the flow.
How do you calculate the unit vector in the direction of the flow? Divide the velocity vector by its magnitude.

Code:
real UVDF[ND_ND]; /*UVDF = unit vector in direction of Flow */
real flowmag;

 ...
 
flowmag=sqrt(C_U(c,t)*C_U(c,t)+C_V(c,t)*C_V(c,t)+C_W(c,t)*C_W(c,t));
UVDF[0]=C_U(c,t)/flowmag;
UVDF[1]=C_V(c,t)/flowmag;
UVDF[2]=C_W(c,t)/flowmag;
And then take the inner product with the pressure gradient:

Code:
real SPG; /* SPG = streamwise pressure gradient */
 ...
 
SPG = UVDF[0]*C_P_G(c,t)[0]+UVDF[1]*C_P_G(c,t)[1]+UVDF[2]*C_P_G(c,t)[2];
This can all be combined into one line of code, but I'll leave that to you (and it might be easier to understand if you don't do that).
pakk is offline   Reply With Quote

Old   February 21, 2018, 11:43
Default
  #3
New Member
 
G Ionut
Join Date: Sep 2016
Posts: 29
Rep Power: 9
Ionut G is on a distinguished road
Quote:
Originally Posted by pakk View Post
Just use the definition of streamwise pressure gradient.

The streamwise pressure gradient is the inner product between the pressure gradient and the unit vector in the direction of the flow.
How do you calculate the unit vector in the direction of the flow? Divide the velocity vector by its magnitude.

Code:
real UVDF[ND_ND]; /*UVDF = unit vector in direction of Flow */
real flowmag;

 ...
 
flowmag=sqrt(C_U(c,t)*C_U(c,t)+C_V(c,t)*C_V(c,t)+C_W(c,t)*C_W(c,t));
UVDF[0]=C_U(c,t)/flowmag;
UVDF[1]=C_V(c,t)/flowmag;
UVDF[2]=C_W(c,t)/flowmag;
And then take the inner product with the pressure gradient:

Code:
real SPG; /* SPG = streamwise pressure gradient */
 ...
 
SPG = UVDF[0]*C_P_G(c,t)[0]+UVDF[1]*C_P_G(c,t)[1]+UVDF[2]*C_P_G(c,t)[2];
This can all be combined into one line of code, but I'll leave that to you (and it might be easier to understand if you don't do that).
thank you very much pakk, your idea works flawlessly.
Ionut G is offline   Reply With Quote

Reply

Tags
fluent, pressure gradient, udf


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
Polyhedral mesh cyclic boundary problem C-L OpenFOAM 13 December 21, 2016 07:53
Straight Pipe with imported velocity profile. Pressure gradient? Ahuja.Darsh FLUENT 7 September 13, 2016 08:11
Pressure Outlet Guage pressure Mohsin FLUENT 36 April 29, 2016 17:16
question on simulating rotating channel with a pressure gradient huangxianbei CFX 10 January 14, 2014 23:00
Report Streamwise Pressure Gradient? Will FLUENT 0 July 12, 2008 22:01


All times are GMT -4. The time now is 01:48.