The Most Common Mistakes Made in SOLIDWORKS Flow Simulation
Computational fluid dynamics (CFD) is a tool no longer reserved for dedicated analysts. Advances in computer hardware and the automated setup provided by modern CFD software make it accessible for design engineers to evaluate and optimize their products during the design phase.
However, the extra accessibility afforded by modern CFD software allows users to neglect common analysis fundamentals. This can lead to poor accuracy or misleading results. It won’t be possible to address every possible source of error in this article, but I’ll do my best to address the major setup mistakes I’ve seen often working with engineers using CFD.
The article will focus primarily on SOLIDWORKS Flow Simulation but the principles should apply to most CFD packages.
Mistake: Not Creating an Analysis Plan
Before jumping into any kind of simulation, it’s a great idea to come up with an analysis plan. This should include defining the main parameters of interest (the “outputs” or independent variables) and the main inputs to be used in the simulation.
While you’re at it, it’s a good idea to document the relevant assumptions you’ll be making and the level of simplifications you plan on making to the models.
A little bit of planning upfront can keep you on track and save a lot of time in the long run so you don’t lose sight of your end goals and assumptions. Perhaps more important is that having your plan documented allows you to easily reach out for help to colleagues or your software technical support team and clearly explain what you’re trying to achieve.
Figure 1. Simplified analysis plan for a Tesla valve.
If you’re having trouble coming up with a plan, I usually recommend thinking of the simulation setup like a virtual experiment. If you were conducting a real-life experiment, how would you set it up? Where would you place measurement sensors and what parameters would you want to measure? Would you run the test only for a short duration or an extended period? How large would the test chamber/environment need to be?
Answering these questions provides a great starting point for an analysis plan. This will directly translate into decisions on where to place virtual sensors to monitor the solution, choosing a steady-state vs transient analysis, sizing the computational domain, etc.
Mistake: Not Monitoring Goals and Solution Convergence
Whatever the parameters of interest for the simulation are, appropriate goals should be defined to track them throughout the course of the solution. Depending on the type of analysis this could include monitoring values such as pressure loss from inlet to outlet, flow rates, lift and drag forces on surfaces, temperatures of key components in a thermal analysis, or the concentrations of various species of fluids in a mixing problem.
Since computational fluid dynamics is an iterative process, failure to monitor these values can cause one of two problems: the peak values may not be captured due to the solution not developing long enough (causing major inaccuracy) or the solve time may be drastically increased by solving for much longer than required.
To avoid this, a good rule of thumb is to think of these result monitoring locations as virtual sensors, so wherever you would place a sensor in a physical experiment, place a goal or output request to track the parameter of interest in that location.
You can then plot values at these locations over the course of the solution (practically every CFD package will allow viewing results at these monitored locations in real-time) to manually assess convergence once the values have stabilized within a certain threshold, but a better idea is to take advantage of stopping criteria.
Figure 2. Goals defined in SOLIDWORKS Flow Simulation (left) and solver monitor goals plot.
When goals are defined in SOLIDWORKS Flow Simulation, automatic stopping criteria are placed to stop the solver once the goals are converged to within a tolerance. The user can manually specify the tolerance if they want more control. As soon as all the parameters of interest are stabilized to within this threshold, the solver will automatically terminate and save the results, often cutting minutes or hours off the solve time.
It is still important to double-check the solution convergence after the fact.
Adjusting Stopping Criteria
If you find that the monitored locations are still increasing in value when the solution stopped, it’s likely that some secondary stopping criteria, such as a limit on number of iterations or “travel” is kicking in. For problems where your monitored locations are taking a particularly long time to converge, it may be necessary to raise the limit for the number of iterations/travels or eliminate these secondary stopping criteria entirely.
Figure 3. Finishing criteria for SOLIDWORKS Flow Simulation with manual goal tolerance.
Aside from helping ensure accuracy of the solution, defining the goal or other result monitors in advance saves time when it comes to post-processing or interpreting the results later, as these values can easily be graphed and exported to reports.
If you find you need to extend the solution after completing an analysis, most CFD programs allow you to continue or resume the calculation from where you left off. You don’t have to solve the whole problem all over.
SOLIDWORKS Flow Simulation doesn’t require the monitoring of residuals for typical problems including steady-state and transient problems with the default settings.
In other CFD packages like SIMULIA Fluid Dynamics Engineer, the residuals will automatically have associated output requests so that they can be plotted over the course of the solution. Residuals are typically provided for mass flow, energy and turbulence parameters. The residual value can be thought of as the imbalance that remains between iterations of the solver and, due to the iterative nature of the solution process, they are expected to decrease over the course of the analysis before plateauing at some infinitesimal value.
If you observe residuals increasing over the course of the solution or their absolute value is much larger than expected, it is likely there is a problem with the CFD setup and the program is producing an instability or “divergent” solution. The results in this case should not be trusted until whatever is causing the residuals to diverge is corrected.
Note that monitoring residuals on their own isn’t a replacement for directly monitoring the convergence of your parameters of interest. In SIMULIA Fluid Dynamics Engineer, this can be done by placing additional output request for whatever your key parameters are, similar to the goals in SOLIDWORKS Flow Simulation.
If you happen to be running a SOLIDWORKS Flow Simulation time-dependent study with “nested iterations,” you will have access to residuals for normalized mass, momentum and energy as additional goal plots. If you are trying to speed up the solution process by forcing a large manual timestep with nested iterations, checking these residuals will let you know if the solution is stable or if you’ve pushed the timestep size too far.
Mistake: Resuming or Continuing an Analysis
When running the CFD any time after the initial solve, there should be an option to resume the previous simulation.
Figure 4. Dialog showing options for either new or continued calculation in SOLIDWORKS Flow Simulation.
As previously discussed, this option to resume can be helpful if the goals were not converged and you wanted to solve for more iterations. However, take note that if you made any changes to the simulation setup, you will most likely want to do a “New calculation.”
This comes up often: you are making changes to the simulation setup and wondering why they are not being reflected in your results. It’s very possible you’ve accidentally picked the “Continue calculation” option rather than starting a new one.
Performing model adjustments or geometry changes will flag the mesh as out-of-date and start the process from scratch but you must pay close attention to these options when you’re only modifying simulation parameters.
Mistake: Lack of Mesh Refinement
Automatic meshing done by many CFD packages makes it easy to do simulation but it is important to examine the mesh to ensure it fulfills a few general guidelines. If time allows, a mesh convergence study should be performed to examine the effects of increasing mesh refinement and determine a point of diminishing returns. These studies are commonly called “mesh dependence” or “grid dependence” studies and are carried out with the goal of proving the solution is mesh or grid independent.
SOLIDWORKS Flow Simulation uses a fairly unique meshing technology that combines a Cartesian grid or octree mesh with the immersed boundary method, a technique that allows capturing features that are smaller than the mesh cell size.
These cells (referred to as solid/fluid or partial cells in SOLIDWORKS Flow Simulation) provide a great deal of flexibility in controlling the amount of detail in a simulation.
In the image below you can see a draft mesh for a server rackmount unit featuring hundreds of components.
Figure 5. SOLIDWORKS Flow Simulation mesh for electronics cooling displaying partial solid/fluid cells.
Note that the mesh cells in the zoomed-in view are larger than and not aligned with the memory chips. Thanks to the support for partial or solid/fluid cells, SOLIDWORKS Flow Simulation can resolve this detail which greatly reduces the mesh cell count (and time) required to solve such a problem.
Avoiding Severe Mesh Issues
While the automatic mesh creation is impressive, it’s not a magic bullet for all situations.
By far the most common issue I see regarding meshing for SOLIDWORKS Flow Simulation is a mesh with cell sizes many orders of magnitude larger than the solid features they are trying to resolve. There is only so much the partial cells can do and when there is too much variation in the size of the cells will result in very inaccurate results or generated cryptic solver error messages.
Simply checking the mesh that the software generates by inserting a Mesh Plot command. This will ensure the cell sizes are roughly of the same order of magnitude as the feature sizes you expect to resolve and will prevent these worst errors.
To increase accuracy further, it’s recommended that you provide a few cells across any narrow channels. If you’re expecting to see detailed thermal gradients through a solid, then you’d be well advised to include a couple cells through the solid thickness as well. For the best quality results, you will want to place 10-15 cells across a narrow channel.
Proving Mesh Independence
None of the guidelines discussed are replacements for performing a mesh independence or mesh convergence study. Performing a series of studies with increasing mesh refinement to observe the sensitivity of your key results to the mesh is crucial if you are striving to eliminate all errors.
One area where additional effort for mesh refinement is important is aero and hydrodynamic effects on curved surfaces – for example, lift or drag calculations for a vehicle or the performance of a rotating impeller.
Figure 6. Mesh convergence study for a propeller thrust calculation.
The figure above shows a simple mesh convergence study conducted on a rotating propeller, with the thrust as the key output. Zooming in to the propeller cross section and hiding the propeller body shows that at coarse refinement levels the profile of the propeller cross section is not well defined – this is known as discretization or local truncation error. If you consider that that pressure is resolved into forces across each cell, it is clear why this can yield large differences in the predicted thrust.
However, with minor refinements the solution converges to a thrust value while still maintaining a reasonable number of cells. As one might expect, this is the level (Refinement 5 in figure above) at which the outline of the profile of the cells on the zoomed in view matches the geometry of the original propeller blade. Refinement 6, which more than triples the cell counts, does not change the thrust, so the results may be considered converged.
Note that ensuring the solution is mesh independent does not necessarily mean it is accurate – only that you have addressed one possible source of error.
If you don’t want to fool around with a mesh convergence study, you can also check whether your CFD software offers a solution-adaptive mesh approach.
Figure 7. Solution-adaptive mesh solve progression for wind loading.
SOLIDWORKS Flow Simulation’s solution-adaptive mesh allows setting targets for the maximum number of cells and a time period to wait between refinements. The software will then periodically refine areas of the model with high pressure gradients. If you are tracking your goals, this will give you a record of the goals converged values at each level of mesh refinement – essentially built-in proof that your solution is grid-independent.
The structured Cartesian mesh used by SOLIDWORKS Flow Simulation excels at applications like electronics cooling but can require significant amounts of refinement on smooth curved geometries. For classical aerodynamic and hydrodynamic problems, many CFD experts swear by “unstructured” or body-fitted mesh like that available in SIMULIA Fluid Dynamics Engineer and other standalone CFD packages.
Figure 8. Coarse and semi-refined body-fitted mesh in SIMULIA fluid dynamics engineer.
This mesh structure relies on special boundary-layer elements (commonly referred to as an “inflation layer”) near the walls to precisely resolve the mesh.
This meshing method tends to require additional geometry preparation and simplification as it is much less forgiving about any faults or imperfections in the CAD model quality compared to the immersed boundary method used by SOLIDWORKS Flow Simulation, which is capable of healing over small faults and geometry errors.
The payoff (especially when combined with advanced turbulence models like k-ω SST) can be higher accuracy for predictions of lift and drag, potentially at overall lower element counts.
Meshing guidelines for conformal mesh are mostly related to the thickness of the boundary layer elements, which can be determined in SIMULIA Fluid Dynamics engineer by placing an output request to track YPLUS (y+) the normalized wall-normal distance.
Each turbulence model will have recommended values for y+ to aim for depending on whether you plan to rely on wall functions which approximate the local effects of the near-wall boundary layer (possible with even a crude mesh) or directly resolving the viscous-sublayer.
That’s all…for now. There’s a few more mistakes to be avoided. Stay tuned.