View
5
Download
0
Category
Preview:
Citation preview
It's the little things that matter:Improving Speed and Stability in OpenFOAM
4th UK & Eire OpenFOAM User Meeting19th April 2016, Exeter, UK
Dr. Aleksander J. Dubas,Research Engineer,TSL Technology Ltd.
(& Visiting Academic @ University of Southampton)
About Me
● First started using OpenFOAM to simulate flow through valves and other hydraulic flows in 2010
● Also (coincindentally) started to dabble with Linux at around the same time
About Me
● PhD in Complex Systems Simulation, awarded 2014:
– “Robust Automated Computational Fluid Dynamics Analysis and Design Optimisation of Rim Driven Thrusters”
– Simulations all done in OpenFOAM (automation and optimisation using Python)
About Me
● Innovate UK - Knowledge Transfer Partnership– Used OpenFOAM to design, prototype, test and put into production a
new thruster with world class performance
About Me
About This Presentation
Better
Cheaper Faster
Pre-Solution with potentialFoam
● Initialises a velocity field● Pressure field can also be initialised with -writep flag
– This may be an unstable initialisation
– Method (and results) changed at version 2.4.0:http://www.openfoam.org/version2.4.0/
● Add -noFunctionObjects to stop Function Objects calculations (e.g. forces)
Turbulence Model Selection
k-epsilon k-omega SST
Field Cacheing
● In system/fvSolution add:
cache { grad(U); }
● Instant solving speed boost (slight increase in memory usage)
A Double Glazing Problem
Hot (inside) Cold (outside)
A Double Glazing Problem
Hot (inside) Cold (outside)
- 1100 K
NOT PHYSICALLY POSSIBLE!
Using buoyantBoussinesqPimpleFoam (transient solver)
A Double Glazing Solution
● In system/fvSchemes change:
div(phi,T) Gauss upwind;
to
div(phi,T) bounded Gauss upwind;
● Moral of the story: boundedness is not just for steadyState
A Compilation of Improvements
● Compiling your own copy gives faster solutionsthan pre-packaged binaries
● However it does take a while to compile them (trade-off)● It is not as easy
– But the instructions at http://www.openfoam.org/download/source.php are very helpful
● Can add a little more edge with a few compiler flags
A Compilation of Improvements
A Compilation of Improvements
● -march=native
● N.B. only if you are compiling on the same machine you are running on
● Up to 20% faster!
A Compilation of Improvements
● Where? (your specific location may vary)– $HOME/OpenFOAM/OpenFOAM-3.0.x/wmake/rules/linuxGcc64
● Which files?– In c and c++
● What do I change?– cc = gcc -m64 -march=native
– CC = g++ -m64 -march=native
A Compilation of Improvements
● -mfpmath=sse
● -mfpmath=both and -mfpmath=sse,387 reduce performance
● Available SSE instructions are activated by -march=native
● An extra 3% faster
A Compilation of Improvements
● Where? (your specific location may vary)– $HOME/OpenFOAM/OpenFOAM-3.0.x/wmake/rules/linuxGcc64
● Which files?– In c and c++
● What do I change?– cc = gcc -m64 -march=native -mfpmath=sse
– CC = g++ -m64 -march=native -mfpmath=sse
A Compilation of Improvements
● -funroll-loops
● Noticeably increases compilation time
● An extra 1% faster (maybe)
● Worth it? Not sure.
A Compilation of Improvements
● Where? (your specific location may vary)– $HOME/OpenFOAM/OpenFOAM-3.0.x/wmake/rules/linuxGcc64
● Which files?– In cOpt and c++Opt
● What do I change?– cOPT = -O3 -funroll-loops
– c++OPT = -O3 -funroll-loops
Summary
● Five ways to speed up and/or stabilise your solutions:– Pre-solve with potentialFoam (with or without -writep)
– Choose an appropriate turbulence model
– cache{ grad(U); }
– div(phi,T) bounded Gauss upwind;
– Compile with a few extra flags
Thank You for Listening
● Any questions?
● Contact Details:– Email: ajd205@soton.ac.uk
– Skype: ajdubas
– Twitter: @ajdubas
Recommended