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

Getting the mass flow for each time automatically

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By -Maxim-

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 3, 2016, 10:05
Default Getting the mass flow for each time automatically
  #1
Member
 
Thomas B
Join Date: Apr 2016
Location: Germany
Posts: 30
Rep Power: 10
Thomasbr is on a distinguished road
Hello,

I have run a transient simulation and have 65 transient files. I would like to get the mass flow through a pipe that is in my geometry.

For this purpose, I inserted a plane normal to the pipe and then with the function calculator I can get the mass flow trough this plane (actually through the pipe) for each time.

I would like to plot the mass flow for each time (corresponding to a transient file) with Excel. But it does take a lot of time to get the mass flow calculated for each time (since I must change the time manually).

Is there a way to get it automatically done? I read that it could be achieved with some Perl instructions, but I don't know this language at all.


Cheers,
Thomas
Thomasbr is offline   Reply With Quote

Old   June 3, 2016, 10:16
Default
  #2
Senior Member
 
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 413
Rep Power: 13
-Maxim- is on a distinguished road
you could create a chart in Post over all time steps ("XY - transient or sequence") on the x-axis with an expression of the massFlow through your plane on the y-axis.
Be careful, when you click 'apply' while creating that chart, Post will loop through all results which might take a couple of hours depending on your project size and hardware.

For the next time, you could set up a monitor, add that monitor in solver manager where you can save the data points directly to a csv file.
Alternatively, you can export those monitor points via "cfx5mondata" in command line.
-Maxim- is offline   Reply With Quote

Old   June 3, 2016, 11:18
Default
  #3
Member
 
Thomas B
Join Date: Apr 2016
Location: Germany
Posts: 30
Rep Power: 10
Thomasbr is on a distinguished road
Thanks for your reply Maxim. I will then set up a monitor for the simulations to come, it appears to be the simplest way.

I already plotted the mass flow with excel and would like now to test your first suggestion. Which I will be able to compare with the plot from excel.

I had a variable timestep for my simulation and used for the output of transient files a constant time of 3.3e-5 s. In X-Axis I can choose among other things between t and Time: is one of those convenient for my purpose?

For the Y-Axis I created the variable 'massenstrom' using the Expression massFlow@Plane 2.

It seems that I should provide datas in the "Data Series" tab before clicking on Apply. Because I tried with several Expressions for the X-Axis, then clicked on Apply but this yields nothing.

I then tried to provide an Expression in the Data Series tab:
Time -> computes immediately but yields nothing
massFlow@Plane 2 -> computes for 10 minutes but yields also nothing

But why would I need to provide anything in the Data Series tab, as everything required is already indicated in the X- and Y-Axis?
Thomasbr is offline   Reply With Quote

Old   June 6, 2016, 04:48
Default
  #4
Senior Member
 
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 413
Rep Power: 13
-Maxim- is on a distinguished road
Setting up a monitor will be a bit tricky I guess since we cannot add a simple plane in PRE as we can in POST. CFX let us only create monitors on planes that are already there such as interfaces. Don't ask my why.
As workaround you can add "source points" and use those as locators for your monitors. I posted in this forum a detailed description - you will find that via search.

I agree that the chart function is very confusing. I just set up such a chart in my case and hit 'apply'.
I did use an expression "massFlow@plane" in 'data series'. And I chose the variable made of the expression on the y axis. I chose 'Time' on the x axis. Now let's see. I will report back as soon as it is done... Might be some hours
-Maxim- is offline   Reply With Quote

Old   June 7, 2016, 02:48
Default
  #5
Senior Member
 
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 413
Rep Power: 13
-Maxim- is on a distinguished road
okay - it took a night but it worked for me:

General: XY - Transient or Sequence
Data Series: "MassFlowOutlet" with Expression (massFlow@plane)
X Axis: Time
Y Axis: Variable: MassFlowVar (Variable made from Expression)

After clicking 'Apply' it looped through my 175 .trn-files and shows me the chart now. I can also export all data points (button next to 'Apply') to a csv-file.

Maybe you can try again with those settings

Since it takes super long, I would definitely recommend monitor points or writing a script that loops through the trn-files in a command line - that's faster than loading the trn-files in Post. That applies also to keyframe animations etc in case you would like to do that later.
Thomasbr likes this.

Last edited by -Maxim-; June 9, 2016 at 06:25. Reason: typo
-Maxim- is offline   Reply With Quote

Old   June 7, 2016, 06:13
Default
  #6
Member
 
Thomas B
Join Date: Apr 2016
Location: Germany
Posts: 30
Rep Power: 10
Thomasbr is on a distinguished road
Hello Maxim,

thanks for your messages it is greatly appreciated. I will try your settings for the chart (I am currently on an another version of Ansys Workbench so I cannot open my last file...).

For now I do not have any clue how to write a script (I don't know the language), I will be taking care of that later.

So I'm trying the alternative with the monitor point: I think I found your post you are relating to:

I created three source points (all of them have the same y-coordinate, the equation of the plane would then be y = 27.5 mm).
And now I have to create the expression massFlow@Plane.
Where Plane is defined through the 3 source points Source Point 1,2,3. But I do not know how I can do that (thing is I need a source surface rather than a source point). I understand you can easily create an expression such as pressure@Source Point but massFlow@Source Point does not make sense.


edit: I have just started a simulation with the monitor point probe(Pressure)@Source Point 1 as the behaviour of the pressure is also important in my case. Furthermore this will allow me to become familiar with the Monitor Point feature and to try my first command cfx5dfile <file> -read-monitor to retrieve the file.
Thomasbr is offline   Reply With Quote

Old   June 7, 2016, 06:53
Default
  #7
Senior Member
 
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 413
Rep Power: 13
-Maxim- is on a distinguished road
yes, source points are useless for your problem (massFlow through a plane). Maybe the way to go would be a 'user surface'. It's a new (maybe still beta) feature in CFX 17/17.1. You have to create such a plane in a CAD program for example and save as *.stl file (basically a lot of coordinates for many points that 'form' a plane). You can import that stl-file as 'user surface' and you should be able to create a monitor with that.
I tried that before but my transient calculation crashed. I reported it to the support and they said they look into it. Oh well.

I use the source point method for my pressure probes - the way I described works fine including Arithmetic Averaging, Maximum and Minimum directly in the monitors -- in case you need pressure fluctuations as well. To extract the data I use the command 'cfx5mondata'. It looks like this in the command line:
Code:
SET ansyspath="C:\Program Files\ANSYS Inc\v171\CFX\bin\cfx5mondata.exe"
SET name= <name of your res file>
%ansyspath% -res %name%.res -out pressure_TOP_Left_AVE.csv -lastvaluesonly -varlist "USER POINT......."
The syntax is quite easy to understand and documented in Ansys Help.
To get the syntax of your USER POINTS, you can use the following command:
Code:
%ansyspath% -res %name%.res -showvars > showvars.txt
Regarding your initial massFlow problem: This might also be an interesting read for you.
Quote:
Originally Posted by opaque View Post
Dear Md Hamidur,

You are not being specific on which Mass Flow Rate you want? Do you want the mass flow rate on the inlet, outlet, a 2d region within the domain?

If you know which 2d region you want, you can monitor it by creating a Output Control/Monitor Points. Select the option Expression and type somethin along the lines of

Expression = massflow()@YourInlet

Expression = massflow()@TheOutlet

Expression = massflow()@REGION: some defined region

Hope it helps,

Opaque
Quote:
Originally Posted by HekLer View Post
This can be done in CFX, just as easy as Fluent.

In addition to opaque's comments, which require you to create a monitor point in CFX Pre, you do not need to do this if you want to monitor the mass flow rate through an existing boundary condition (eg: inlet, outlet, interface boundary, etc..):

- Create a new montior in the solver manager and call it something, say "My Mass Flow Monitor"

- Pick "FLOW" in the tree

- Pick the domain name you want and then the boundary you want

- Monitor the "P-Mass" flow through that boundary
-Maxim- is offline   Reply With Quote

Old   June 9, 2016, 05:26
Default
  #8
Member
 
Thomas B
Join Date: Apr 2016
Location: Germany
Posts: 30
Rep Power: 10
Thomasbr is on a distinguished road
Hello Maxim,

thanks for the tips, but my plane is not an Inlet or an Outlet unfortunately

I ran a Simulation with a source Point: it worked great I could see the pressure "in real time", it was plotted the same way the residuals are.

I tried your method to get the mass flow rate using the Chart: it worked perfectly and only took 4 minutes to Display the mass flow rate (85 transient files). I guess I have much less elements/nodes (or much less time steps) than you because it was pretty fast to yield the plot.

I will maybe have to refine my Mesh in the future in the area where I need the mass flow rate, so that it might take more time to get it plotted. I will also probably increase the number of time steps by 10 but then the required time to plot the mass flow rate should remain reasonable (under 1 hour) so that I could always use the Chart method.
Thomasbr is offline   Reply With Quote

Old   June 9, 2016, 06:23
Default
  #9
Senior Member
 
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 413
Rep Power: 13
-Maxim- is on a distinguished road
Quote:
Originally Posted by Thomasbr View Post
but my plane is not an Inlet or an Outlet unfortunately
Yeah I know - I have the same problem. If your project doesn't have convenient Interfaces or boundaries where you can set a "P-Mass" Monitor (Plot Line Variable --> FLOW in Solver Manager), you could try to set up an expression to get your mass flow through your domains in case you have several domains.
As long as your imbalances are small, you could use the "P-Mass" monitor basically everywhere because conservation of mass should be true Meaning the mass flow at the inlet, in your pipe and at the outlet should be the same.

Well done with the other parts. Quite convenient that your project is (still) small so that you can loop through your trn files with the chart function quickly.
-Maxim- 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
Multiple floating objects CKH OpenFOAM Running, Solving & CFD 14 February 20, 2019 10:08
Auto saving of mass flow rate or discharge with time step Tanjina FLUENT 2 December 1, 2014 15:15
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 16:33
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 05:03
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


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