CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

CFD-Post Expression help

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 3 Post By ghorrocks
  • 1 Post By ghorrocks

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 15, 2016, 14:22
Default CFD-Post Expression help
  #1
New Member
 
Justin
Join Date: Jan 2015
Posts: 28
Rep Power: 11
DA6righthand is on a distinguished road
Hey all,

I need help writing an expression in CFD-Post. I have a cylinder through which a fluid flows and encounters arrays of static bars that are intended to mix the fluid. What I want to do is create an expression that outputs the standard deviation of the velocity magnitude for a clip plane of its cross-section. I'm fairly new to the CFX Expression Language and haven't had much luck searching online for help. I know the equations for velocity magnitude and standard deviation:

\left \| \vec{V} \right \|_i=\sqrt{u^2_i+v^2_i+w^2_i}

\sigma=\sqrt{\frac{1}{n} \left [\left(  \left \| \vec{V} \right \|_1-\left \| \vec{V} \right \|_{avg}\right )^2 +\left(  \left \| \vec{V} \right \|_2-\left \| \vec{V} \right \|_{avg}\right )^2 +\cdots + \left(  \left \| \vec{V} \right \|_n-\left \| \vec{V} \right \|_{avg}\right )^2\right]}

where i=1,2,...,n nodes. So how can I translate that second equation into a CEL output expression? My variables in CFD-Post are Velocity, Velocity u, Velocity v, and Velocity w. The location I want the standard deviation of velocity magnitude computed is Plane 2. If someone could help me out, that would be awesome!
DA6righthand is offline   Reply With Quote

Old   July 16, 2016, 06:25
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,703
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
There already is a variable, I think it is called "Velocity" which is the magnitude of the velocity. This means you don't need your first equation.

Your function could be something like:

Vavg = volumeAve(Velocity)@domain
STDDEV = sqrt(volumeAve((Velocity-Vavg)^2)@domain)

Note that I used a volume average function, not the nodal average you defined. If you do the nodal average it can get distorted in meshes with changes in element size. Note you will probably have to add a units correction for the sqrt function (ie, make it unitless).
ghorrocks is offline   Reply With Quote

Old   July 18, 2016, 12:07
Default
  #3
New Member
 
Justin
Join Date: Jan 2015
Posts: 28
Rep Power: 11
DA6righthand is on a distinguished road
Thanks for your help! Although, I had to use areaAve rather than volumeAve because my domain was a plane (a.k.a. clip plane) of the fluid body. Also, I attempted to make it unitless by giving the expression units of [m^-1 s] but it wouldn't allow me to do so. I'll figure that out though. I really appreciate your help!
DA6righthand is offline   Reply With Quote

Old   July 18, 2016, 20:33
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,703
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
If the expression evaluates to units [m^-1 s] then multiply by 1 [m s^-1] and it will be unitless. But this sort of thing is usually a bad idea, you should check your function to get the units right in the first place.
ghorrocks is offline   Reply With Quote

Old   July 20, 2016, 16:54
Default
  #5
New Member
 
Justin
Join Date: Jan 2015
Posts: 28
Rep Power: 11
DA6righthand is on a distinguished road
I appreciate your help! Everything is working just fine.

On another note, I'm now wanting to determine the percentage of fluid in two velocity ranges: range A is 0-5% maximum velocity in the fluid domain; and range B 0-0.003 m/s. My method was to create a volume, select it as an Isovolume with the variable velocity. I chose the mode as below value and checked inclusive. Of course, I created two volumes: one for each range. In the value box for the Isovolume of range A, I put the expression 0.05*maxVal(Velocity)@fluid.

Then in the Expressions tab, I created two new expressions:

PercentRangeA = ((volume()@Volume A)/(volume()@fluid))*100
PercentRangeB = ((volume()@Volume B)/(volume()@fluid))*100

The percentages were both much higher than I had anticipated. When I had used EnSight, the percentages were around 12% and 5% for range A and range B, respectively. My questions are: first, did I create the desired Isovolumes correctly; and second, did I use the correct expressions? Again, I really appreciate your help! Thanks.
DA6righthand is offline   Reply With Quote

Old   July 20, 2016, 21:07
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,703
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
You will have to work your way through the way you calculated it. Is the isovolume correct? Is the volume calculated correctly?
ghorrocks is offline   Reply With Quote

Old   July 21, 2016, 16:24
Default
  #7
New Member
 
Justin
Join Date: Jan 2015
Posts: 28
Rep Power: 11
DA6righthand is on a distinguished road
Going back to the original question, why do I use volumeAve or areaAve rather than just plain old ave (average)? I understand the two former are volume weighted or area weighted averages...but it definitely makes a difference as to which one I use. I experimented around with areaAve and ave and the standard deviation changes.

Why I'm asking is because there's a difference between the standard deviations I calculated using EnSight and CFD-Post. If both softwares are using nodal values for velocity magnitude, I'd expect to get nearly the same result for standard deviation. Am I wrong? The CFD-Post results differed from those in EnSight even though they were formed from the same mesh and same Fluent simulation.
DA6righthand is offline   Reply With Quote

Old   July 21, 2016, 18:17
Default
  #8
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,703
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Ave simply sums up the nodal values and divides by the number of nodes. It takes no account of the size of the control volumes the nodes represent.

CFD-Post uses the integration points to calculate some values whereas exported data to Ensight would probably be just the nodal values. Thus the CFD-Post values should be on higher resolution data and be more accurate.
arashjkh likes this.
ghorrocks is offline   Reply With Quote

Old   October 27, 2021, 17:04
Default
  #9
New Member
 
kailash
Join Date: Jun 2018
Posts: 19
Rep Power: 7
kailash007 is on a distinguished road
Thank you very much for this expression. I am able to implement it for a problem similar to the one you faced last time.
kailash007 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
CFD Design...The CFD Future John C. Chien Main CFD Forum 20 November 19, 2015 23:40
Error reading profile data in expression in cfx post banu CFX 4 March 27, 2015 09:03
CFD Online Celebrates 20 Years Online jola Site News & Announcements 22 January 31, 2015 00:30
CFD Post - How to check for case in an expression pilakin ANSYS 0 September 26, 2014 04:44
How to install CGNS under windows xp? lzgwhy Main CFD Forum 1 January 11, 2011 18:44


All times are GMT -4. The time now is 00:35.