Hey there,
It’s Robin from CFD Engine & we’re making plots like this todayπ
Streamlines, restricted to the surface, based on an interpolated vector field, that look a bit like experimental oilflow plots.
Super-useful for revealing separation lines, showing flow paths in attached regions and relatively easy to make (once you know how).
So, grab your crayons & a recent solution, it’s time to get creative π¨
The basics
The heart of these plots are the streamlines, which you can generate in ParaView, or export from OpenFOAM.
I prefer the OpenFOAM option, as (in my experience) they tend to have smoother paths, they’re quicker to generate & they can be added to any simulation via a single dictionary.
You arguably have more control over your seed points in ParaView, but the streamlines can be really slow when you’re tracing a good number of them.
Whether you choose OpenFOAM or ParaView, you’ll follow the same basic steps:
- Export a velocity vector (or shear stress) field at the wall (I’m assuming you’re using
noSlip
walls) β this is best done in OpenFOAM; - Select some seed points on the surfaces you’re interested in;
- Trace surface-restricted streamlines from those seed points, using your new vector field;
- That’s it πΉ
How to do it in OpenFOAM
Yet again, the tutorials are your friend π
This exact process is included in my favourite, the motorBike tutorial via the wallBoundedStreamlines
file.
This file includes two function calls β the first to interpolate the velocity field onto the surfaces of the motorBike
. And the second to use that new velocity field to trace 20,000 wall-bounded streamlines, from random points across the bike.
You could grab that file, save it to your system
directory, include it in the function
section of your controlDict
(like this) & you’d be away.
But, here are a few hints on what’s what & a guide to the bits you might want to change/tweak to fit your case…
Running it
By default, it’s setup to write the near-wall field & export streamlines every time your simulation saves. But what if you want to run it on a completed case?
Just as before, reference the wallBoundedStreamlines
dictionary in the functions
section of your controlDict
(like this) and then run your chosen solver in postProcess
mode, something like this:
simpleFoam -postProcess -latestTime
The nearWallFields
function object doesn’t work using the stand-alone postProcess
tool, hence why we need to do it like this.
Which surfaces to interpolate onto
If you’re only interested in a subset of your surfaces (like in my plot, with just the rider) then you can specify which ones to interpolate the velocity field onto by editing this line.
Streamline settings
These links show which lines to edit to tweak the following streamline settings:
- The number of streamlines traced;
- Which surfaces to trace streamlines on β they should be the surfaces that you generated your near-wall velocity field for;
- Which fields you want to be able to colour your exported streamlines by β this needs to include at least your near-wall velocity field;
- The direction you want to trace the streamlines β
forward
,backward
orbidirectional
(my preference); - The length of the streamlines β leave it at
100
initially & then increase it or decrease it, if you don’t like the output;
Your streamlines will be exported into the postProcessing/sets/wallBoundedStreamLines/
directory (under the relevant time step) as a single .vtp
file, which can go straight into ParaView for plotting.
ParaView method
Speaking of ParaView…drop me a note if you’d like to see the method for doing this in ParaView β I’m collecting a list of “ParaView stuff that could be better explained in a screencast” and I’ll add this to the list (if anyone’s interested) π€·ββοΈ
Useful?
I don’t use standard streamlines much, but I use these guys A LOT β I find them clearer (& easier to explain) than LIC (we can have an email on that, if you’re interested) & an essential part of my standard post-pro output.
If you haven’t used them yet, definitely give them a go, either on the motorBike
tutorial or tweak the setup to fit one of your own simulations.
Let me know how you get on, I think you might like them.
Until next week,