OpenFOAM Baby Steps - Chapter 2: Cavity Flow, Part 4
This was going to be a quick end to the turbulence topic (for now), but I fell down a gnuplot rabbit hole.
DISCLAIMER:This is not intended as a tutorial. This is my process for working through the available documentation in a manner that makes sense to me. Feel free to follow along, but realize that I am interpreting documentation that already exists.
Paragraph 2.1.7 briefly covers the Reynolds-averaged Simulation (RAS) turbulence model. I didn't plan to get into the details of the various turbulence models, so this should have been a quick read-through. But there is a tiny sentence near the end of the discussion that says, "View the results at consecutive time steps as the solution progresses to see if the solution converges to a steady-state or perhaps reaches some periodically oscillating state."
I thought, 'That sounds interesting....and easy!' If you are a linux person, it probably is. But usually I'm not a linux person, so I spent some time figuring out how to gnuplot from the command line, getting data from a changing log file. In addition to looking up standard linux commands, this was the main article that pointed me in the right direction, https://chrisberkhout.com/blog/log-visualization-with-gnuplot/. Below are the file contents I used to send to gnuplot.
set title "Residuals" set xlabel 'time' set ylabel 'Residual' set format y "%.1e" plot "< cat log_new | grep 'Solving for Ux' | cut -d',' -f3 | tr -d ',' | cut -d' ' -f5" title 'Ux' with lines,\ "<cat log_new | grep 'Solving for Uy' | cut -d',' -f3 | tr -d ',' | cut -d' ' -f5" title 'Uy' with lines pause 1 reread
I think I had issues with updating the log file properly as I was making adjustments to my gnuplot file, but I was really concerned with getting the file plotted rather than the results themselves. That's work for future me.
That's enough of the cavity flow introduction to openFOAM. I will next jump to Mesh Generation, which is chapter 5 in the User Guide, but seems like a reasonable next step.
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.