|
[Sponsors] |
October 6, 2014, 10:13 |
How to plot residuals using Code Saturn
|
#101 |
New Member
Peter Rosén
Join Date: Sep 2014
Posts: 12
Rep Power: 12 |
Hello
I use Code-Saturn. My log file, generated by Code-Saturn named "listing" does not seem to work with the script above. Does anyone know the reason for that? what differs? Regards |
|
October 6, 2014, 13:40 |
|
#102 |
New Member
Join Date: Oct 2013
Posts: 15
Rep Power: 13 |
hey,
of course it doesn't work with you file. the script searches for special parts in your log file. could you show some parts of your log file? |
|
October 7, 2014, 01:08 |
|
#103 | ||
New Member
Alexa
Join Date: Sep 2014
Posts: 5
Rep Power: 12 |
Hi all!!
I'm running a simulation with nonNewtonianIcoFoam. My PISO loop is defined like this: Quote:
Can you help me on how to adapt the code, in a way I can plot my pressure residuals? Quote:
Thank you very much for your attention! |
|||
October 7, 2014, 04:16 |
|
#104 |
New Member
Join Date: Oct 2013
Posts: 15
Rep Power: 13 |
hey,
have you read the whole thread? whats your error message? i think you cut out the wrong parts. as the script cuts out the 9. word position in each line and your residuals are standing at 8. position. |
|
October 7, 2014, 12:19 |
|
#105 | |
New Member
Alexa
Join Date: Sep 2014
Posts: 5
Rep Power: 12 |
Hi pingat, thank you for your answer!!
Yes, I read the thread... I can get my Ux and Uy residuals, but not the pressure... My error message is: Quote:
|
||
November 18, 2014, 15:48 |
|
#106 |
Senior Member
SinaJ
Join Date: Nov 2009
Posts: 136
Rep Power: 17 |
I'm using "nNonOrthogonalCorrectors = 2", so I get more than 1 pressure log each time step. How can I plot only the last pressure solution residual? Because the pressure iterations go faster. (please see the attached)
|
|
November 18, 2014, 17:11 |
|
#107 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
__________________
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 19, 2014, 09:43 |
Hi! I cant sort this out.. =( can someone give me an example of how to setup the text
|
#108 |
New Member
Peter Rosén
Join Date: Sep 2014
Posts: 12
Rep Power: 12 |
Hi! I cant sort this out.. =( can someone give me an example of how to setup the textfile to work with my log file?
set logscale y set title "Residuals" set ylabel 'Residual' set xlabel 'Iteration' plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,\ "< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,\ "< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,\ "< cat log | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines,\ "< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,\ "< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines pause 1 reread /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.x | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.3.x-42314c41c511 Exec : simpleFoam -parallel Date : Nov 19 2014 Time : 13:16:02 Host : "peter-Sigma" PID : 31421 Case : /home/peter/OpenFOAM/peter-2.3.x/run/Skyware nProcs : 6 Slaves : 5 ( "peter-Sigma.31422" "peter-Sigma.31423" "peter-Sigma.31424" "peter-Sigma.31425" "peter-Sigma.31426" ) Pstream initialized with: floatTransfer : 0 nProcsSimpleSum : 0 commsType : nonBlocking polling iterations : 0 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0.54 Reading field p Reading field U Reading/calculating face flux field phi Selecting incompressible transport model Newtonian Selecting RAS turbulence model kOmegaSST kOmegaSSTCoeffs { alphaK1 0.85; alphaK2 1; alphaOmega1 0.5; alphaOmega2 0.856; gamma1 0.555556; gamma2 0.44; beta1 0.075; beta2 0.0828; betaStar 0.09; a1 0.31; b1 1; c1 10; F3 false; } No finite volume options present SIMPLE: convergence criteria field p tolerance 1e-07 field U tolerance 1e-08 field "(k|epsilon|omega)" tolerance 0.0001 Starting time loop forceCoeffs forceCoeffs1: Not including porosity effects Time = 0.541 smoothSolver: Solving for Ux, Initial residual = 0.000804916, Final residual = 5.49369e-07, No Iterations 11 smoothSolver: Solving for Uy, Initial residual = 2.29261e-05, Final residual = 8.56105e-07, No Iterations 5 smoothSolver: Solving for Uz, Initial residual = 0.000867147, Final residual = 5.90003e-07, No Iterations 11 GAMG: Solving for p, Initial residual = 0.00203898, Final residual = 6.64107e-07, No Iterations 9 GAMG: Solving for p, Initial residual = 0.000470797, Final residual = 8.8148e-07, No Iterations 4 GAMG: Solving for p, Initial residual = 5.863e-05, Final residual = 9.59074e-07, No Iterations 2 time step continuity errors : sum local = 3.54146e-10, global = -9.50863e-12, cumulative = -9.50863e-12 smoothSolver: Solving for omega, Initial residual = 5.37503e-05, Final residual = 9.52376e-07, No Iterations 6 smoothSolver: Solving for k, Initial residual = 0.000221609, Final residual = 5.34179e-07, No Iterations 9 ExecutionTime = 14.92 s ClockTime = 15 s forceCoeffs forceCoeffs1 output: Cm = -0.267356 Cd = 0.37438 Cl = 0.00166993 Cl(f) = -0.266521 Cl(r) = 0.268191 Time = 0.542 smoothSolver: Solving for Ux, Initial residual = 0.000801499, Final residual = 5.4714e-07, No Iterations 11 smoothSolver: Solving for Uy, Initial residual = 2.27642e-05, Final residual = 8.50023e-07, No Iterations 5 smoothSolver: Solving for Uz, Initial residual = 0.000862468, Final residual = 5.87098e-07, No Iterations 11 |
|
November 19, 2014, 12:52 |
|
#109 |
New Member
fabi
Join Date: Jan 2014
Posts: 5
Rep Power: 12 |
Hello Zappstar
the command you use reads: 'cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,\...' cat log - gives your complete log-file grep 'Solving for Ux' - is searching for lines that include 'Solving for Ux' cut -d' ' -f9 - cuts out the 9th field in each line using the delimiter ' ' that should be the string 'Final' in your example: 1 ___________2 _____3 _4 __5 ___6 _____7 8 ___________9 __10 ____11 12 ________13 14 ______15 smoothSolver: Solving for Ux, Initial residual = 0.000801499, Final residual = 5.4714e-07, No Iterations 11 try -f8 or -f12 instead of the option -f9 btw: tr -d ',' - deletes the comma ('0.000804916,' --> '0.000804916') you can try this step by step by typing the commands into a terminal like: cat log - (see what happens...) cat log | grep 'Solving for Uz' - (see what happens...) and so on... good luck Last edited by odin; November 19, 2014 at 14:19. |
|
November 19, 2014, 13:00 |
|
#110 |
New Member
fabi
Join Date: Jan 2014
Posts: 5
Rep Power: 12 |
Hello sina_mech
You can use the command 'sed'. Depending on how many NonOrthogonalCorrectors you use sed -n '0~2p' and for 'the other one': sed -n '1~2p' "< cat log.pisoFoam | grep 'Solving for p' | cut -d' ' -f9 | tr -d ',' | sed -n '0~4p'" title '0-p' look for: 'delete pattern space. start next cycle.' in the manual Last edited by odin; November 19, 2014 at 14:13. |
|
February 9, 2015, 08:44 |
Multiplot - modification, deltaT and Courant number
|
#111 |
New Member
jiri kozak
Join Date: Jan 2013
Posts: 21
Rep Power: 13 |
Hi!
I would like to say Thank you... this script, tutorial and whole thread are very useful. I've modified the script for my purpose. The residuals are ploted in three separated windows, which is a bit more clear (I thing). The Courant number and deltaT are ploted in the fourth window. Code:
set multiplot layout 2, 2 rowsfirst set logscale y set ylabel "Residuals" set xlabel "Iteration" plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,\ "< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,\ "< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines plot "< cat log | grep 'Solving for epsilon' | cut -d' ' -f9 | tr -d ','" title 'epsilon' with lines,\ "< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines plot"< cat log | grep 'Solving for p' | cut -d' ' -f9 | sed -n 'p;N;N;N' | tr -d ','" title 'p' with lines,\ "< cat log | grep 'Solving for alphawater' | cut -d' ' -f9 | tr -d ','" title 'alphawater' with lines plot"< cat log | grep 'deltaT' | cut -d' ' -f3 " title 'delta T' with lines,\ "< cat log | grep 'Courant Number' | cut -d' ' -f6 " title 'maxCo' with lines unset multiplot pause 1 reread |
|
June 3, 2015, 08:50 |
Nice Script, does anyone have one for solids or FSI :)
|
#112 |
New Member
Join Date: Jun 2015
Posts: 1
Rep Power: 0 |
Hello and thanks for the script.
Does anyone have another for solids and/or FSI? I have seen some forums directing towards pyFoam as a "plug in" for the processing of results. Is this the better solution? Thanks Jerry |
|
July 30, 2015, 05:09 |
|
#113 | |
Senior Member
Fatema Zandi Goharrizi
Join Date: Mar 2009
Posts: 158
Rep Power: 17 |
Quote:
Dear andersking Code:
turbFoam > log & pyFoamPlotWatcher.py log could you help me please? the ERROR is Code:
>>> turbFoam > log & File "<stdin>", line 1 turbFoam > log & ^ SyntaxError: invalid syntax >>> pyFoamPlotWatcher.py log File "<stdin>", line 1 pyFoamPlotWatcher.py log ^ SyntaxError: invalid syntax |
||
August 2, 2015, 09:46 |
|
#114 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi zandi,
The 3 "larger than" characters (>>>) mean that you're working inside the Python shell. Those commands you have tried to use are meant to be used from the bash/sh shell, not Python. Therefore, you will need to run these commands: Code:
quit() turbFoam > log & pyFoamPlotWatcher.py log Code:
>>> quit() ofuser@machine:~$ turbFoam > log & ofuser@machine:~$ pyFoamPlotWatcher.py log Bruno |
|
August 8, 2015, 21:39 |
|
#115 |
Member
Mike
Join Date: Apr 2011
Location: Canada
Posts: 83
Rep Power: 15 |
Hi All,
I am very new to OpenFoam and have some very simple questions for you. I usually use public domain computers to do my simulations (I submit the job and it stays in queue). In that case, the log file is not shown until the simulation is complete. Now I have the following questions for you: 1-How to record the residuals and CFL number in different columns separately in a file. In the log file, there are a lot of texts as well and practically I can not extract the CFL for example at each time step to plot them. 2-Is that possible that we can take a look at the log file before the simulation is over? 3-Also, since the simulations are 3D and needs very large space to store many snapshots, if I want to have 2D planes within the domain (for example I want to store the data at each 200 time steps just inside the plane z=0) or even a portion of that plane, can I do that? Thanks in advance for your guidance |
|
August 9, 2015, 02:17 |
|
#116 | |
Senior Member
Fatema Zandi Goharrizi
Join Date: Mar 2009
Posts: 158
Rep Power: 17 |
Quote:
the file for commands is like this Code:
# script for paralle execution #!/bin/bash #PBS -S /bin/bash #PBS -N OpenFoam #PBS -l nodes=1:ppn=8 #PBS -q batch #PBS -o $HOME/OF230/OF_Sample/$PBS_JOBID.OF.out #PBS -e $HOME/OF230/OF_Sample/$PBS_JOBID.OF.err #PBS -l walltime=12:00:00 NP=8 ######## Running ####### export TOPDIR=$HOME/OF230/OF_Sample export OFPATH=reactingFoam {solver} cd $TOPDIR time mpirun -np $NP $OFPATH -parallel > $TOPDIR/$PBS_JOBID.out.log {log file} |
||
August 9, 2015, 02:28 |
|
#117 | |
Senior Member
Fatema Zandi Goharrizi
Join Date: Mar 2009
Posts: 158
Rep Power: 17 |
Quote:
I still have the same problem maybe I didn't do your advice right and di not understand it. could please tell me more about it or guide me to a useful tutorial please |
||
August 9, 2015, 13:55 |
|
#118 |
Member
Mike
Join Date: Apr 2011
Location: Canada
Posts: 83
Rep Power: 15 |
Thanks for your reply.
Any comments regarding my third question? Thanks |
|
August 9, 2015, 15:43 |
|
#119 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Quick answers:
Quote:
Please ask that 3rd in a separate thread, because this thread says right on the title "Tutorial of how to plot residuals !", in other words, it's for asking questions about plotting residuals. |
||
August 9, 2015, 18:13 |
|
#120 |
Senior Member
Join Date: Aug 2014
Location: Germany
Posts: 292
Rep Power: 14 |
Hello,
i have difficulties plotting my simpleFoam residuals. My log files looks like Code:
Starting time loop Time = 1 DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 0.0657653, No Iterations 1 DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 0.0290663, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 1, Final residual = 0.0416476, No Iterations 1 DICPCG: Solving for p, Initial residual = 1, Final residual = 0.00888325, No Iterations 313 time step continuity errors : sum local = 0.000143341, global = -5.07606e-008, cumulative = -5.07606e-008 ExecutionTime = 6.233 s ClockTime = 6 s Time = 2 DILUPBiCG: Solving for Ux, Initial residual = 0.362055, Final residual = 0.0114528, No Iterations 2 DILUPBiCG: Solving for Uy, Initial residual = 0.529153, Final residual = 0.0453389, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 0.33249, Final residual = 0.0105906, No Iterations 2 DICPCG: Solving for p, Initial residual = 0.939307, Final residual = 0.0085134, No Iterations 398 time step continuity errors : sum local = 0.000600287, global = -4.63279e-008, cumulative = -9.70885e-008 ExecutionTime = 10.351 s ClockTime = 10 s Code:
set logscale y set title "Residuals" set ylabel 'Residual' set xlabel 'Iteration' plot "< cat Log | grep 'Solving for Ux' | cut -d' ' -f12 | tr -d ','" title 'Ux' with lines,\ "< cat Log | grep 'Solving for Uy' | cut -d' ' -f12 | tr -d ','" title 'Uy' with lines,\ "< cat Log | grep 'Solving for Uz' | cut -d' ' -f12 | tr -d ','" title 'Uz' with lines,\ "< cat Log | grep 'Solving for p' | cut -d' ' -f12 | sed -n 'p;N;N' | tr -d ','" title 'p' with lines pause 1 reread Code:
the command "cat" is written wrong or could not be found. Code:
line 8: x range is invalid I'm running OpenFoam and gnuplot under Windows with cygwin64. The command to execute gnuplot is: gnuplot> load E:/Residuals.txt Can somebody please help me. Thanks a lot! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
plot residuals in multiregion solver | val46 | OpenFOAM | 4 | December 12, 2016 07:06 |
To Plot Residuals on the fly. | neeraj | OpenFOAM Running, Solving & CFD | 5 | October 2, 2013 07:23 |
[PyFoam] why pyFoamPlotRunner doesn't plot continuity residuals? | immortality | OpenFOAM Community Contributions | 10 | May 5, 2013 07:13 |
plot of residuals | hawkeye321 | OpenFOAM | 5 | December 7, 2012 10:05 |
[Virtualization] OpenFOAM oriented tutorial on using VMware Player - support thread | wyldckat | OpenFOAM Installation | 2 | July 11, 2012 17:01 |