Register Blogs Members List Search Today's Posts Mark Forums Read February 21, 2018, 08:45 streamwise pressure gradient
#1
New Member

G Ionut
Join Date: Sep 2016
Posts: 29
Rep Power: 8 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) 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 2D pipe cases.jpg (16.4 KB, 15 views)   February 21, 2018, 11:19 #2 Senior Member   Join Date: Nov 2013 Posts: 1,965 Rep Power: 25 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=C_U(c,t)/flowmag; UVDF=C_V(c,t)/flowmag; UVDF=C_W(c,t)/flowmag;``` And then take the inner product with the pressure gradient: Code: ```real SPG; /* SPG = streamwise pressure gradient */ ... SPG = UVDF*C_P_G(c,t)+UVDF*C_P_G(c,t)+UVDF*C_P_G(c,t);``` 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).   February 21, 2018, 11:43 #3
New Member

G Ionut
Join Date: Sep 2016
Posts: 29
Rep Power: 8 Quote:
 Originally Posted by pakk 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=C_U(c,t)/flowmag; UVDF=C_V(c,t)/flowmag; UVDF=C_W(c,t)/flowmag;``` And then take the inner product with the pressure gradient: Code: ```real SPG; /* SPG = streamwise pressure gradient */ ... SPG = UVDF*C_P_G(c,t)+UVDF*C_P_G(c,t)+UVDF*C_P_G(c,t);``` 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.  Tags fluent, pressure gradient, udf Thread Tools Search this Thread Show Printable Version Email this Page Search this Thread: Advanced Search Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 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 OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules Similar Threads Thread Thread Starter Forum Replies Last Post C-L OpenFOAM 13 December 21, 2016 07:53 Ahuja.Darsh FLUENT 7 September 13, 2016 08:11 Mohsin FLUENT 36 April 29, 2016 17:16 huangxianbei CFX 10 January 14, 2014 23:00 Will FLUENT 0 July 12, 2008 22:01

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