inabower |
January 7, 2019 22:17 |
Analyzing log with PyFoam without GNUPlot windows
Hi FOAMers.
I'm trying to manipulate OpenFOAM in iPython (jupyter notebook).
I want to get like a plot data generated by pyFoamPlotWatcher.py in line as following.
[In]
Code:
import os
import shutil
from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile
from PyFoam.Execution.BasicRunner import BasicRunner
from PyFoam.Execution.GnuplotRunner import GnuplotRunner
from PyFoam.IPythonHelpers.Case import Case
orgCase = os.path.join(os.environ['FOAM_TUTORIALS'],'incompressible','simpleFoam','pitzDaily')
newCase = os.path.join('./result/pitzDaily_')
shutil.copytree(orgCase, newCase)
blockMesh = BasicRunner(['blockMesh','-case',newCase], silent=True).start()
simpleFoam = GnuplotRunner(['simpleFoam','-case',newCase], progress=True).start()
case = Case(newCase)
plots = case.pickledPlots(case.sol.pickledPlots[0])
plots['linear'].head()
[out]
Code:
Ux Ux_final Ux_iterations Uy Uy_final Uy_iterations \
1.0 1.000000 0.053810 1.0 1.000000 0.030925 2.0
2.0 0.437824 0.030824 5.0 0.283531 0.025853 4.0
3.0 0.123694 0.011162 4.0 0.201901 0.015971 4.0
4.0 0.068341 0.004392 5.0 0.101704 0.008352 4.0
5.0 0.057485 0.003968 5.0 0.087349 0.008410 4.0
epsilon epsilon_final epsilon_iterations k k_final \
1.0 0.199984 0.010028 3.0 1.000000 0.043920
2.0 0.153314 0.010948 3.0 0.419186 0.031304
3.0 0.101901 0.008398 2.0 0.179557 0.014245
4.0 0.078654 0.005480 2.0 0.116407 0.010367
5.0 0.051670 0.004668 2.0 0.086742 0.005037
k_iterations p p_final p_iterations
1.0 3.0 1.000000 0.068427 17.0
2.0 3.0 0.052242 0.004242 15.0
3.0 3.0 0.148196 0.011370 6.0
4.0 3.0 0.123471 0.010857 6.0
5.0 4.0 0.117570 0.011387 3.0
then, I could get dataFrames like pandas' .
BUT a gnuplot window always did popup and I don't need it because I want to do case study and to compare the plots of the each cases.
Do you have any ideas to avoid the pop-up window of gnu plot or to analyze logs silent ?
Best regards.
inabower
|