‘How do I know when
to stop my calculation?’ and ‘How do I know my mesh is good enough?’ are questions
often asked when running SOLIDWORKS Flow Simulation studies.
The answer is to
ensure the solution reached is both fully converged AND mesh independent. In
practice this can take a bit of trial and error as well as some experience in
the process. However, SOLIDWORKS Flow can help us do both of these at once! Here’s
how…
Let’s start by
explaining the more straightforward to achieve of the two - convergence.
As a
steady state flow simulation progresses through its iterations we can see if
parameters of interest (goals) reach constant values (converge). Flow
automatically sets criteria (which can be overridden) to make sure these goals
have reached that constant state. Once they have then the solver will stop,
this is controlled on the finishing tab of calculation control options. If our
goals are truly converged, then running through more iterations isn’t going to
give us a different solution.It is tempting to say that we have reached a good
solution at this point however this isn’t the full story.
We can get a
converged solution from a coarse mesh and a completely different converged
solution for the same study using a fine mesh. Convergence alone doesn’t tell us
we’ve reached a good solution - we need to do a bit more work here.
With any simulation
study we’re looking to find that Goldilocks value where refining the mesh
further doesn’t give a more accurate result. We can then run further studies
using this mesh to get accurate solutions from minimal time and computational
effort. This is a really useful place to be when running multiple scenarios of
the same study. Getting to this point normally requires a mesh independence
test where we vary the number of elements and see how this effects a parameter
of interest.
Below shows the plot you could expect to see.
Now what if I told
you that you can ensure convergence and mesh independence in SOLIDWORKS Flow
Simulation in just one study AND refine the mesh where the refinement’s needed
most? Pretty neat right?
To do this we need to
dive into the often overlooked ‘refinement’ tab on calculation control options.
Here we can set options for performing mesh refinement mid calculation at
locations the solver thinks are best. I’m using the simple Coletor from lesson
1 of the Flow Simulation course as an example. This is a fairly typical
internal flow problem, with a single inlet splitting to multiple outlets. A
good solution here would show converged and mesh independent values for outlet
volumetric flow rates – so those we’ll monitor these using goals.
The refinement
strategy tells the software when to perform a mesh refinement; setting this to
goal convergence means the mesh will be refined once our goals have converged.
Goals can be selected from those created; in this example I’ve selected all of
them. It’s useful to add a delay after convergence to ensure goals have
absolutely converged before the next mesh refinement starts. On a similar note
a relaxation interval of iterations after the final mesh refinement can be set
to ensure the solution has run for long enough to fully converge. Here I’ve set
a delay of 20 iterations and a relaxation interval of 50 (though these will
vary study to study). Importantly on the finishing tab we can set the number of
refinements to complete before the solution ends. We’ll want to make sure we’ve
set the maximum refinement number and refinement level to at least this value.
Here I’ve selected 5 for all three values. If there were any local mesh
refinements these could also be controlled here.
So, what results can
we get from this?
Starting the study
with a coarse mesh we see our goal values converging, once these converge the
mesh refines itself. This refined mesh has a different converged solution to
the coarser mesh so we see goal values changing and converging on new values.
Once fully converged the mesh is refined again until the number of refinements
specified has been reached. Here we see how the values for a parameter of
interest (in this case one of the outlet volume flows) varies as the solution
progresses. I’ve highlighted when the mesh is refined, pretty cool to see
what’s going on!
Not only does
SOLIDWORKS Flow refine the mesh, it also does so only at specific areas. How
does it do this? Helpfully, the software looks for high pressure and velocity
gradients where averaged values across the cells of a coarse mesh would give a
poor result. Refining here ensures these high gradients are accurately
captured. Here we can see the stages as the mesh is refined at the inlet
(coloured by velocity), notice that there’s a coarser mesh where there’s no
significant velocity gradient – smart right?
Note: Velocity colour not to scale.
When running a mesh
independence study manually we would then go through and extract the number of
elements in each mesh and corresponding converged goal values to plot. Doing this
process within one study Flow can produce a ‘refinement table’. With a little
bit of post processing we can plot converged goal values for each mesh against
the number of elements to get a mesh convergence plot. This makes it nice and
easy to see the best mesh to use going forward. Alternatively, if we haven’t
reached a mesh independent solution, we can increase the maximum global level
of refinement and continue the study. In this case it can be seen that we reach
within 2 % of our final solution value at mesh number 4, roughly 500000
elements (note the log scale on this chart). If we were running future studies
this is the one we would use going forwards.
Next time you’re running a Flow Simulation try using the auto-refinement options. You’ll be surprised how easy it can be to find that sweet spot of a quick yet accurate solution!