CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   How to plot a function over a time period? (http://www.cfd-online.com/Forums/cfx/66445-how-plot-function-over-time-period.html)

Cirion0000 July 15, 2009 12:33

How to plot a function over a time period?
 
I want to plot this function: "1000*0.3142E-07*areaAve(Velocity)@OUTLET" [mass flow rate] over a certain time period. How can I do this? Seemingly simple problem, especially after all the hurdles I went through to get the FSI simulation and everything, but yet I can't figure this out, so any help is appreciated.

I would think there would be a way to achieve this in the table directly, sort of how in excel you assign the time values in one column also.

ghorrocks July 15, 2009 18:34

Hi,

Assign the CEL expression to a monitor point. Then you can get the full time history as the solution progresses in the solver manager.

Glenn Horrocks

Cirion0000 July 16, 2009 09:15

That's cool and all, but is there any way I can get the mass flow solution per time step (with the idea of plotting them over time as well as getting the overall mass flow over time) without having to re-do both FSI simulations entirely? I've already done them, and they took 30-50 hours... a pop. (Our computers here are bad, lol)

[edit] I think I've got it, now I just have to find a way to take all the data and find an overall mass flow (but this is a start at least.)

What I did was just make a time chart, and use method: expression, and put in my expression there.

[edit2] Got it. Just exported the CSV file, done. Surprised I didn't figure this out before...

PS - I'm not sure if you were already telling me to do what I just did, but it sounded like from monitor point you meant in the cfx-pre solver menu.

ghorrocks July 16, 2009 19:34

Hi,

Yes, I think you got it. There are two main approaches:

1) put in a monitor point and it will calculate as the simulation proceeds. You cannot post-process this.

2) Load the res files into CFD-Post and extract it there using the function calculator or a table. If you feel adventurous you can script it in CFD-Post to do it automatically. This can be done post-processing but obviously only on the time steps saved as the run proceeded.

Glenn Horrocks

rogbrito July 18, 2009 12:48

Hi,
IŽd like to know in how to do that in a transient simulation (please see the text below)?
Rogerio.



Example: Pressure Calculation on Multiple Files using Batch Mode

This example calculates the value of pressure at a point in each of three results files.
These features can be useful in situations where a large number of results files need to be processed at once.
In order to carry out this procedure, you will make use of session files, power syntax and the Command Editor
dialog box.

First, create a session file based on the first results file.
  1. Copy the results files to your current working directory.
  2. Start CFD-Post and select File > Load Results. Select the static mixer results file StaticMixer_001.res. (Your results file may have a slightly different name).
  3. Select Session > New Session from the main menu.
    For details, see New Session Command.
  4. Enter batchtest.cse as the session file name and click Save.
  5. Select Session > Start Recording from the main menu to begin recording the session file commands.
  6. Select Insert > Location > Point and accept the default name Point 1.
    You will now use Power Syntax to find the value of pressure at Point 1, and print it to the command line. In addition to printing the value of pressure, it would be useful to know the name of the results file. You will make use of the DATA READER object to find the name of the current results file.
  7. Select Tools > Command Editor.
  8. Enter the following into the command window:
    ! $filePath = getValue("DATA READER","Current Results File");
    ! $pressureVal =
    probe("Pressure","Point 1");
    ! print "\nFor results file $filePath, Pressure at Point 1 is \
    $pressureVal\n";
  9. Click Process to process the commands.
  10. Now enter the following:
    ! $pressureVal = probe("Pressure","Point 1");
    ! print "\nFor results file $filePath, Pressure at Point 1 is \
    $pressureVal\n";
  11. Check your terminal window to make sure the command worked as desired.
This completes the first part of the example. Select Session > Stop Recording from the main menu to stop recording the session file. You may want to close down CFD-Post at this time.
You can now run the session file on any number of results files using the command:

<CFXROOT>/bin/cfdpost -batch testbatch.cse <resfile>

where <resfile> is the name of your results file. You can re-run the command by typing in another results file name.

As an example, this C shell script would pass arguments as results file names to the CFD-Post command line:

#!/bin/csh
foreach file ($argv)
<CFXROOT>/cfdpost -batch testbatch.cse $file
end


All times are GMT -4. The time now is 22:11.