|
[Sponsors] |
Getting the mass flow for each time automatically |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 3, 2016, 10:05 |
Getting the mass flow for each time automatically
|
#1 |
Member
Thomas B
Join Date: Apr 2016
Location: Germany
Posts: 30
Rep Power: 10 |
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 |
|
June 3, 2016, 10:16 |
|
#2 |
Senior Member
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 413
Rep Power: 13 |
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. |
|
June 3, 2016, 11:18 |
|
#3 |
Member
Thomas B
Join Date: Apr 2016
Location: Germany
Posts: 30
Rep Power: 10 |
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? |
|
June 6, 2016, 04:48 |
|
#4 |
Senior Member
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 413
Rep Power: 13 |
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 |
|
June 7, 2016, 02:48 |
|
#5 |
Senior Member
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 413
Rep Power: 13 |
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. Last edited by -Maxim-; June 9, 2016 at 06:25. Reason: typo |
|
June 7, 2016, 06:13 |
|
#6 |
Member
Thomas B
Join Date: Apr 2016
Location: Germany
Posts: 30
Rep Power: 10 |
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. |
|
June 7, 2016, 06:53 |
|
#7 | ||
Senior Member
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 413
Rep Power: 13 |
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......." To get the syntax of your USER POINTS, you can use the following command: Code:
%ansyspath% -res %name%.res -showvars > showvars.txt Quote:
Quote:
|
|||
June 9, 2016, 05:26 |
|
#8 |
Member
Thomas B
Join Date: Apr 2016
Location: Germany
Posts: 30
Rep Power: 10 |
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. |
|
June 9, 2016, 06:23 |
|
#9 |
Senior Member
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 413
Rep Power: 13 |
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. |
|
|
|
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 |