|
[Sponsors] |
[PyFoam] Using regular expressions on multi-line output |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 5, 2014, 04:39 |
Using regular expressions on multi-line output
|
#1 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
I want to plot the output values of the force function object. However, in my current installation (OF-2.3.x) the force function object produces multiline output.
In my example I apply the force function object on two patches. How can I write a regular expression for pyFoamPlotWatcher or -Runner that extracts the correct values? Code:
forces forceRotor output: sum of forces: pressure : (4.96081e-09 -5.11743e-11 -0.000116436) viscous : (4.97137e-13 -1.13776e-12 6.15157e-08) porous : (0 0 0) sum of moments: pressure : (7.7971e-11 3.93148e-10 -0.0360825) viscous : (6.43907e-14 1.0728e-14 -4.57924e-05) porous : (0 0 0) forces forceStator output: sum of forces: pressure : (-6.20745e-08 7.22842e-08 7.44833e-05) viscous : (4.96527e-14 -2.59452e-14 2.79123e-09) porous : (0 0 0) sum of moments: pressure : (-6.05447e-09 -6.97223e-09 -3.86287e-07) viscous : (2.41672e-15 5.02503e-15 1.78738e-10) porous : (0 0 0) |
|
November 5, 2014, 05:46 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Code:
switchForce { type phase; idNr 1; expr "forces (.+) output:"; } Code:
forces { type dynamic; multiLine 9; expr " <long ugly RegExp> "; }
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
November 5, 2014, 08:54 |
|
#3 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
I "solved" the problem by not using pyFoam and I am aware that this is kind of a terrible thing to say.
I figured out, that the functionObject writes the results (forces & moments) in *.dat files in the postProcessing folder. I use then this files to plot the moments with gnuplot. However, the problem still persists, e.g. for stuff that the solver computes directly and prints to Terminal via Code:
Info << "some stuff = " << someStuff << endl; There, I do not have the luxury of some *.dat files that are created for me. |
|
November 5, 2014, 11:38 |
|
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
I usually don't do feature-requests from non-customers but you're just using up the credit you created with publishing your "book"
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
Tags |
pyfoamplotwatcher.py, regular expressions |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM] Take derivative of mean velocity in paraFoam | hiuluom | ParaView | 13 | April 26, 2016 07:44 |
[OpenFOAM] could not open file .vtk in paraview | ali_atrian | ParaView | 8 | August 27, 2014 11:31 |
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 | keepfit | ParaView | 60 | September 18, 2013 04:23 |
is internalField(U) equivalent to zeroGradient? | immortality | OpenFOAM Running, Solving & CFD | 7 | March 29, 2013 02:27 |
Problems of Duns Codes! | Martin J | Main CFD Forum | 8 | August 15, 2003 00:19 |