CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Plotting residuals for rhoSimpleFoam tutorial

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2017, 12:13
Default Plotting residuals for rhoSimpleFoam tutorial
  #1
Member
 
power
Join Date: Jun 2014
Posts: 86
Rep Power: 12
enginpower is on a distinguished road
Hello,
I run the tutorial angledDuctExplicitFixedCoeff found among the tutorials of rhoSimpleFoam.

I created this script to plot residuals:
Code:
#!/bin/bash

foamLog log >/dev/null

gnuplot -persist > /dev/null 2>&1 << EOF
        set logscale y
        set title "Residual vs. Iteration"
        set xlabel "Iteration"
        set ylabel "Residual"
        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 U' | cut -d' ' -f9 | tr -d ','" title 'U' with lines,\
         "< cat log | grep 'Solving for e' | cut -d' ' -f9 | tr -d ','" title 'e' with lines,\
             "< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p'   with lines,\
         "< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,\
         "< cat log | grep 'Solving for epsilon' | cut -d' ' -f9 | tr -d ','" title 'epsilon' with lines,\
         "< cat log | grep 'Solving for T' | cut -d' ' -f9 | tr -d ','" title 'T' with lines,\
         "< cat log | grep 'Solving for nut' | cut -d' ' -f9 | tr -d ','" title 'nut' with lines,\
         "< cat log | grep 'Solving for rho' | cut -d' ' -f9 | tr -d ','" title 'rho' with lines,\
         "< cat log | grep 'Solving for alphat' | cut -d' ' -f9 | tr -d ','" title 'alphat' with lines
EOF
After I run the case and all is ok, I run $./Residuals where 'Residuals' is the name of the script file, but I can't see any plot, neither any error from the terminal.

Why?
Do you have the same? Could you check, please?

Thanks

Last edited by enginpower; April 28, 2017 at 06:34.
enginpower is offline   Reply With Quote

Old   April 26, 2017, 18:47
Default
  #2
Senior Member
 
tareqkh's Avatar
 
CFD
Join Date: Nov 2010
Location: United States
Posts: 243
Rep Power: 16
tareqkh is on a distinguished road
This should be easy if you install gnuplot. If you already have gnuplot in your system, just type up

:~$ gnuplot Residuals

It should work with you!
tareqkh is offline   Reply With Quote

Old   April 28, 2017, 06:32
Default
  #3
Member
 
power
Join Date: Jun 2014
Posts: 86
Rep Power: 12
enginpower is on a distinguished road
It returns:
Code:
gnuplot Residuals

foamLog log.rhoSimpleFoam >/dev/null
^
"Residuals", line 3: invalid command
Actually I corrected the script in the file Residuals as:
Code:
#!/bin/bash

foamLog log.rhoSimpleFoam >/dev/null

gnuplot -persist > /dev/null 2>&1 << EOF
        set logscale y
        set title "Residual vs. Iteration"
        set xlabel "Iteration"
        set ylabel "Residual"
        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 U' | cut -d' ' -f9 | tr -d ','" title 'U' with lines,\
         "< cat log | grep 'Solving for e' | cut -d' ' -f9 | tr -d ','" title 'e' with lines,\
             "< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p'   with lines,\
         "< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,\
         "< cat log | grep 'Solving for epsilon' | cut -d' ' -f9 | tr -d ','" title 'epsilon' with lines,\
         "< cat log | grep 'Solving for T' | cut -d' ' -f9 | tr -d ','" title 'T' with lines,\
         "< cat log | grep 'Solving for nut' | cut -d' ' -f9 | tr -d ','" title 'nut' with lines,\
         "< cat log | grep 'Solving for alphat' | cut -d' ' -f9 | tr -d ','" title 'alphat' with lines
EOF
but again it doesn't work!

The log file generated by Allrun script is log.rhoSimpleFoam, but nothing

Thanks
enginpower is offline   Reply With Quote

Old   April 28, 2017, 10:02
Default Try this file!
  #4
Senior Member
 
tareqkh's Avatar
 
CFD
Join Date: Nov 2010
Location: United States
Posts: 243
Rep Power: 16
tareqkh is on a distinguished road
Hi,

Try this file see if it works with you;

Residuals.zip

Best,
tareqkh is offline   Reply With Quote

Old   April 28, 2017, 12:39
Default
  #5
Member
 
power
Join Date: Jun 2014
Posts: 86
Rep Power: 12
enginpower is on a distinguished road
I downloaded your file in my case folder:
~/OpenFoam/angledDuctExplicitFixedCoeff

Then I tried the command:
Code:
$ gnuplot Residuals
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points

plot "< cat log.simpleADFoam | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,     "< cat log.simpleADFoam | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,     "< cat log.simpleADFoam | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,     "< cat log.simpleADFoam | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines,     "< cat log.simpleADFoam | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,     "< cat log.simpleADFoam | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
"Residuals", line 10: x range is invalid
I also tried
Code:
~/OpenFoam/angledDuctExplicitFixedCoeff$ ./Residuals./Residuals: line 5: plot: command not found
./Residuals: line 11: pause: command not found
./Residuals: line 12: reread: command not found
but obviously it doesn't work
enginpower is offline   Reply With Quote

Old   April 28, 2017, 12:56
Default
  #6
Senior Member
 
tareqkh's Avatar
 
CFD
Join Date: Nov 2010
Location: United States
Posts: 243
Rep Power: 16
tareqkh is on a distinguished road
Quote:
Originally Posted by enginpower View Post
I downloaded your file in my case folder:
~/OpenFoam/angledDuctExplicitFixedCoeff

Then I tried the command:
Code:
$ gnuplot Residuals
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points
cat: log.simpleADFoam: No such file or directory
"Residuals", line 10: warning: Skipping data file with no valid points

plot "< cat log.simpleADFoam | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,     "< cat log.simpleADFoam | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,     "< cat log.simpleADFoam | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,     "< cat log.simpleADFoam | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines,     "< cat log.simpleADFoam | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,     "< cat log.simpleADFoam | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
"Residuals", line 10: x range is invalid
I also tried
Code:
~/OpenFoam/angledDuctExplicitFixedCoeff$ ./Residuals./Residuals: line 5: plot: command not found
./Residuals: line 11: pause: command not found
./Residuals: line 12: reread: command not found
but obviously it doesn't work
You need to change what is inside the file from

log.simpleADFoam to your solver i.e. log.rhoSimpleFoam.

Make sure also when you run you simulation, you have to make
log.rhoSimpleFoam. For instance,

rhoSimpleFoam > log.rhoSimpleFoam.

It should work with you now.

Cheers,
tareqkh is offline   Reply With Quote

Old   May 2, 2017, 11:17
Thumbs up
  #7
Member
 
power
Join Date: Jun 2014
Posts: 86
Rep Power: 12
enginpower is on a distinguished road
ok, now it works!

Thanks a lot for your help
enginpower is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorials] Tutorial of how to plot residuals ! wolle1982 OpenFOAM Community Contributions 171 February 20, 2024 02:55
plotting force history in Wigley hull Tutorial jakaranda OpenFOAM Running, Solving & CFD 0 August 1, 2012 11:58
[Virtualization] OpenFOAM oriented tutorial on using VMware Player - support thread wyldckat OpenFOAM Installation 2 July 11, 2012 16:01
Plotting residuals for solid Julie Siemens 1 October 29, 2004 06:24
Rotor/stator tutorial, and how to... gilberto CFX 5 January 21, 2002 09:41


All times are GMT -4. The time now is 19:47.