Strategies to Achieve Reliable and Accurate CFD Solutions Mark Keating ANSYS UK 2010 ANSYS, Inc. All rights reserved. 1 ANSYS, Inc. Proprietary
Agenda Why develop a CFD strategy? Pre-Processing Strategies Solver Strategies Post Processing Strategies Full Process Strategies Summary 2010 ANSYS, Inc. All rights reserved. 2 ANSYS, Inc. Proprietary
Why Develop a CFD Strategy? Reliable results means a consistently accurate result Using default settings is never optimised for each application for speed/accuracy Process can be prone to user error Hone an optimised strategy for the application to prevent deviation and maintain high quality process Ensures repeatably accurate solution Allow full design space appreciation faster! 2010 ANSYS, Inc. All rights reserved. 3 ANSYS, Inc. Proprietary
Pre-Processing Strategies 2010 ANSYS, Inc. All rights reserved. 4 ANSYS, Inc. Proprietary
Pre Processing Considerations Think ahead about what you want to do and gain from the CFD analysis What are the driving parameters? What zones need to be separate for constraints or post processing? What fluids zones will be replaced? What level of geometric representation is needed? Small changes can have large effects 2010 ANSYS, Inc. All rights reserved. 5 ANSYS, Inc. Proprietary
Mesh Quality Affects Accurate and Reliable Result Geometry problems Small edge Gaps Sharp angle Meshing parameters Sizing Function On / Off Min size too large Inflation parameters Total height Maximum angle Hard sizing Meshing methods Patch conformal or patch independent tetra Sweep or Multizone Cutcell Geometry cleanup in Design Modeler 2010 ANSYS, Inc. All rights reserved. 6 ANSYS, Inc. Proprietary or Virtual topology & pinch in Meshing Mesh setting change Direct meshing can be used to minimize remeshing time Mesh setting change
Mesh Quality Affects Accurate and Reliable Result 2010 ANSYS, Inc. All rights reserved. 7 ANSYS, Inc. Proprietary
Mesh Quality Affects Accurate and Reliable Result (max,avg) CSKEW =(0.912,0.291) (max,avg) CAR =(62.731,7.402) Large cell size change Mesh 2 Mesh 1 (max,avg) CSKEW =(0.801,0.287) (max,avg) CAR =(8.153,1.298) Vz MIN -90ft/min Vz MAX 600ft/min Vz MIN -100ft/min Vz MAX 400ft/min 2010 ANSYS, Inc. All rights reserved. 8 ANSYS, Inc. Proprietary
Parameterization in ANSYS Meshing Meshing controls can be parameterized Global controls and local controls Selection of parameter promotes the parameter to the WB project page Geometry and Meshing parameters can be related using expressions in the parameter manager 2010 ANSYS, Inc. All rights reserved. 9 ANSYS, Inc. Proprietary
Parameterization project example 8+4=12 divisions Number of divisions on the outlet pipe equal to two times its length Number of divisons on the inlet pipe equal to its length + 4 Outlet Inlet 2010 ANSYS, Inc. All rights reserved. 10 ANSYS, Inc. Proprietary
Parameterization project example 2010 ANSYS, Inc. All rights reserved. 11 ANSYS, Inc. Proprietary
Pre-Processing Scripting 2010 ANSYS, Inc. All rights reserved. 12 ANSYS, Inc. Proprietary
Systematic Errors Discrepancies remain, even if numerical and model errors are insignificant Systematic errors : Approximations of: Geometry Component vs. machine Boundary conditions (Turbulence, profiles, ) Unsteady-state flow behavior Fluid and material properties, Try to understand application and physics Document and defend assumptions! 2010 ANSYS, Inc. All rights reserved. 13 ANSYS, Inc. Proprietary
Reducing Errors: Some Best Practice Guidelines Grid quality Grid angles 90 for hex affects truncation error Recommendation Good: 20 < α < 160 Fair: 5 < α < 20 & 160 < α < 175 Poor: α < 5 & α > 175 max Skewness = f(α) max 90 90 min 90, 90 not scalable scalable Poor quality mesh High quality mesh 2010 ANSYS, Inc. All rights reserved. 14 ANSYS, Inc. Proprietary
Mesh Quality Affects Accurate and Reliable Result Use AMP, FLUENT and CFX to check mesh +--------------------------------------------------------------------+ Mesh Statistics +--------------------------------------------------------------------+ Domain Name: Air Duct Minimum Orthogonality Angle [degrees] = 20.4 ok Maximum Aspect Ratio = 13.5 OK Maximum Mesh Expansion Factor = 700.4! Domain Name: Water Pipe Minimum Orthogonality Angle [degrees] = 32.8 ok Maximum Aspect Ratio = 6.4 OK Maximum Mesh Expansion Factor = 73.5! Global Mesh Quality Statistics : Minimum Orthogonality Angle [degrees] = 20.4 ok Maximum Aspect Ratio = 13.5 OK Maximum Mesh Expansion Factor = 700.4! 2010 ANSYS, Inc. All rights reserved. 15 ANSYS, Inc. Proprietary
Solver Strategies 2010 ANSYS, Inc. All rights reserved. 16 ANSYS, Inc. Proprietary
Initialising Many options beyond simply by zone FMG-I (steady state single phase flows) Hybrid initialisation (poorer quality grids) Interpolation Files transfer data from one grid to any another (eg coarse to fine mesh or different geometry) 2010 ANSYS, Inc. All rights reserved. 17 ANSYS, Inc. Proprietary
Pre-Processing in ANSYS CFD Workflow Parameters Input parameters Associate with multiple boundaries Manage in a single panel Output parameters Quantitative values Report all at once ANSYS Workbench 2010 ANSYS, Inc. All rights reserved. 18 ANSYS, Inc. Proprietary
Pre-Processing in ANSYS CFD ANSYS Fluent Automatic Solution Initialization and Case Modification Automatically executed user specified solution strategies Journal setup Spatial interpolation files for better start Gradually ramp up conditions 2010 ANSYS, Inc. All rights reserved. 19 ANSYS, Inc. Proprietary
Pre-Processing in ANSYS CFD ANSYS CFX and CCL 2010 ANSYS, Inc. All rights reserved. 20 ANSYS, Inc. Proprietary
Choosing the solver Segregated solver remains default in FLUENT PBCS typically 5x faster, though can be orders of magnitude. Solves the continuity and momentum correction equations in a coupled implicit manner. Works by dampening out pressure-velocity decoupling errors inherent with segregated solver promoting faster convergence PBCS is much more stable on poor quality mesh (high skewness, high aspect ratio, jumps in cell size) and applicable for all flow regimes. Recommended for all but highly compressible flows. DBNS remains choice when there is a strong interdependence of momentum, energy and density 2010 ANSYS, Inc. All rights reserved. 21 ANSYS, Inc. Proprietary
Turbulent Flow over a Backward Facing Step Problem Description: Re H = 37,400 Inlet height = 8H Outlet/Inlet area ratio = 1.125 Standard k-w model EWT Inlet profiles for u,v,k,w 21,750 quad cells Mesh weighted towards walls and backstep Reference: D. M. Driver and H. l. Seegmiller. Features of reattaching turbulent shear layer in divergent channel flow. AIAA Journal, 23:163-171, 1985. 2010 ANSYS, Inc. All rights reserved. 22 ANSYS, Inc. Proprietary
Turbulent Flow over a Backward Facing Step PBCS Solver Settings: CFL = 200 ERFs = 0.75 PRESTO! for pressure MUSCL all other eqs Contours of Velocity Magnitude from PBCS Skin Friction Coefficient (Cf*1000).vs. Distance behind Step (X/H) Pressure Coefficient (Cp).vs. Distance behind Step (X/H) 2010 ANSYS, Inc. All rights reserved. 23 ANSYS, Inc. Proprietary
Turbulent Flow over a Backward Facing Step Results from the different solvers Solver Memory (MB) Time per Iteration (s) Iterations to Convergence Time to Convergence (s) Segregated 73.2 0.288 2677 771 PBCS 80.7 0.500 494 247 An accurate result can be obtained in a fraction of the time 2010 ANSYS, Inc. All rights reserved. 24 ANSYS, Inc. Proprietary
Solver Options to Improve Accuracy Steady state VOF. Use BGM instead for faster results but comparable accuracy to geo-reconstruct. Transient Multiphase. Consider NITA or variable extrapolation for faster transient results. High accuracy VOF solution maintained using new compressive scheme and applied by zone or phase Conjugate heat transfer. Use W-cycle for energy with BCGSTAB for stability and accuracy. Single Phase flows. Use F-cycle for flow and turbulence. Use NBG for high accuracy. More stable (reliable) than cell based default gradient scheme DBNS has solution steering by regime 2010 ANSYS, Inc. All rights reserved. 25 ANSYS, Inc. Proprietary
RBF Morpher An Example of a Fast, Reliable Process Radial Basis Function Morpher ANSYS Partner Designed by Marco Biancolini @ Rome Uni Embedded in FLUENT Morph in parallel on clusters Zero File I/O between designs Fast convergence from previous design High levels of control on boundaries moving or not moving Easily scripted and connected to optimisation codes, e.g. isight, ModeFrontier, ANSYS Design Explorer, etc... 2010 ANSYS, Inc. All rights reserved. 26 ANSYS, Inc. Proprietary
RBF Morpher 2010 ANSYS, Inc. All rights reserved. 27 ANSYS, Inc. Proprietary
Solver Scripting The Fluent and CFX solvers have their own scripting that can be run interactively (open) or batch (closed) A journal file contains a sequence of TUI (Fluent) or CCL objects/commands (CFX), arranged as they would be typed interactively into the program or entered through the GUI. Fluent s GUI commands are recorded as Scheme code lines in journal files for re-play. FLUENT records everything you type on the command line or enter through the GUI. CFX, CFX-Pre, CFD-Post and TurboGrid commands invoked by Perl script. You can also create these scripts manually with a text editor. Comments can be included. Ensures to prevent any lost time due to incorrect setup Ramp up solver settings gradually 2010 ANSYS, Inc. All rights reserved. 28 ANSYS, Inc. Proprietary
Solver Scripting Anything you normally do can be written as a script. Some typical examples are: Running a batch job or RSF submission Setting up complex material properties (alternative to read boundary conditions) Setting up a simulation Data analysis/post processing Transient data analysis Automating a known convergence strategy Wild card support at R13 (Fluent post operations) report>surface integrals *outlet* Combined with batch solve, whole process can be run hidden and is very repeatable & controlled 2010 ANSYS, Inc. All rights reserved. 29 ANSYS, Inc. Proprietary
Employing CFD Strategy through scripting Gradually ramp up conditions using staged process Rotating solid example process Start single phase with all fluid zones stationary and set first order with conservative CFL Initialise using FMG-i and solve Switch on energy and enable thermal boundary conditions then solve further Switch to second order/presto/muscl and solve Change fluid to solids and solve further Change solid zone to MRF zone at N rpm and solve Switch to aggressive settings (CFL, AMG stabilisation) and solve final section before reporting 2010 ANSYS, Inc. All rights reserved. 30 ANSYS, Inc. Proprietary
Sources of Solver Error Round-off errors Iteration errors Difference between converged solution and solution at iteration n Solution errors Difference between converged solution on current grid and exact solution of model equations Exact solution Solution on infinitely fine grid Model errors Difference between exact solution of model equations and reality (data or analytic solution) 2010 ANSYS, Inc. All rights reserved. 33 ANSYS, Inc. Proprietary
Iteration Error Example Siemens PG Residuals Check for monotonic convergence 2010 ANSYS, Inc. All rights reserved. 34 ANSYS, Inc. Proprietary
Isentropic Efficiency Iteration Error Example Relative error: 0.18% 0.01% Iteration errors: Difference between converged solution and solution at iteration n Convergence criterion Res=10-2 Iteration 35 Res=10-3 Iteration 59 Res=10-4 Iteration 132 Iteration Number 2010 ANSYS, Inc. All rights reserved. 35 ANSYS, Inc. Proprietary
Discretisation Error Example Compressor cascade Residual = 1 10-4 2 nd order discretization scheme Grid 1 Grid 2 Grid 3 2010 ANSYS, Inc. All rights reserved. 36 ANSYS, Inc. Proprietary
Model Errors - Example Inadequacies of (empirical) mathematical models: Base equations (Euler vs. RANS, steady-state vs. unsteady-state, ) Turbulence models Combustion models Multi-phase flow models Discrepancies between data and calculations remain, even after all numerical errors have become insignificant 2010 ANSYS, Inc. All rights reserved. 37 ANSYS, Inc. Proprietary
Model Error - Example Model error: k- 2010 ANSYS, Inc. All rights reserved. 38 ANSYS, Inc. Proprietary
Solver Side Changes ANSYS Fluent You need not always revert back to the geometry or meshing to change the grid Extrude domain (3D) Separate face or cell zones Adapting grids (grid independence) Deactivate/Activate cell zones Delete/Append cell zones Mesh swapping in parallel (R13) Append case/data in parallel (R13) 2010 ANSYS, Inc. All rights reserved. 39 ANSYS, Inc. Proprietary
Post Processing Strategies 2010 ANSYS, Inc. All rights reserved. 40 ANSYS, Inc. Proprietary
Post-Processing in ANSYS CFD Expressions, State & Session Files CFDPost Expressions (user defined outputs eg pressure co-efficients) can be pre-defined and called via CCL, session or state file for quick analysis (like Custom Functions) CFDPost state files can be written and read to allow same objects to be used on different results file ensuring consistency CFDPost can record and replay a session file to repeat repetitive operations and reduce user error Fluent Post Journals 2010 ANSYS, Inc. All rights reserved. 41 ANSYS, Inc. Proprietary
Post-Processing in ANSYS CFD Post object definition 2010 ANSYS, Inc. All rights reserved. 42 ANSYS, Inc. Proprietary
Post-Processing in ANSYS CFD Case Comparison Click to activate Select two of the loaded cases or two timesteps Objects can be locked across models 2010 ANSYS, Inc. All rights reserved. 43 ANSYS, Inc. Proprietary
Workbench Integration of CFDPost No need to worry about files No need to save/load state (auto-saved on close) All project files saved in one shot, including CFD- Post state Automatic refresh of files when they change Integration with ANSYS DX for Optimisation Automatic Report creation 2010 ANSYS, Inc. All rights reserved. 44 ANSYS, Inc. Proprietary
Full Process Strategies 2010 ANSYS, Inc. All rights reserved. 45 ANSYS, Inc. Proprietary
Pre-Processing in ANSYS CFD Workbench Integration All in one simulation huge saving of effort! Project schematic can be stored for re-use Customised schematics can be generated (ensuring process consistency for quality and reducing user deviation/error) 2010 ANSYS, Inc. All rights reserved. 46 ANSYS, Inc. Proprietary
Design Updates in ANSYS Workbench ANSYS Workbench Workflow 1. Change geometry dimensions and/or boundary conditions 2. Generate updated results with the click of a button. This is an enormous time savings for even the most trivial geometry changes!!! Traditional CFD Workflow 1. Change the geometry in the CAD system 2. Export a STEP, Parasolid, or ACIS file from the CAD system 3. Import the STEP or other file into geometry tool 4. Reclean/re-simplify the geometry, often from scratch 5. Recreate the mesh, often from scratch 6. Export the mesh 7. Import the new mesh into CFD solver 8. Re-apply the physics setup 9. Calculate the new CFD solution 10.Redo post-processing 2010 ANSYS, Inc. All rights reserved. 47 ANSYS, Inc. Proprietary
Save Project as Custom System 2010 ANSYS, Inc. All rights reserved. 48 ANSYS, Inc. Proprietary
Pre-Processing in ANSYS CFD Scripting Overview ANSYS 12.1 fully supports Workbench journaling and scripting Project concepts & operations Parameter management Native applications Project Schematic, Design Exploration, Engineering Data File management and data models Python-based scripting language Object-oriented Platform-independent Fully documented & supported Works hand-in-hand with application-level scripting DesignModeler, Meshing, Mechanical, Mechanical APDL, FLUENT, CFX, etc. 2010 ANSYS, Inc. All rights reserved. 49 ANSYS, Inc. Proprietary
Pre-Processing in ANSYS CFD Workbench Journaling Workbench operations are recorded in a journal file Each session creates a new journal file Playing back the journal recreates the session Two types of Workbench journals Automatically recorded session journals Manually recorded journals Tools -> Options -> Journals and Logs 2010 ANSYS, Inc. All rights reserved. 50 ANSYS, Inc. Proprietary
Post-Processing in ANSYS CFD Plane Creation in CFD-Post 2010 ANSYS, Inc. All rights reserved. 51 ANSYS, Inc. Proprietary
Spreadsheet Controller A simple spreadsheet can be used to control or set up workbench workflows thanks to IronPython. (Iron Python is the journaling language of workbench but also allows you to program and link to other applications through the.net framework.). 2010 ANSYS, Inc. All rights reserved. 52 ANSYS, Inc. Proprietary
Data Entry Tab Data entry including analyst and simulation ID describes the simulation Status/progress is is reported here Do the stuff buttons Numerical reports retrieved and displayed on completion 2010 ANSYS, Inc. All rights reserved. 53 ANSYS, Inc. Proprietary
Recorded simulations On completion of the run the background script will record all your settings and the results on the next worksheet Hyperlinks takes you to a detailed automatically generated HTML detailed report with graphics 2010 ANSYS, Inc. All rights reserved. 54 ANSYS, Inc. Proprietary
Summary: CFD Strategy Walk before you can run Think about what you want to gain in advance of setting up the simulation Is process repeatable? Do I need to have a constrained process? What extensibility tools can I use? (UDF s, CCL) Look to combine strategies Look beyond the defaults Construct a reliable and accurate process for your application 2010 ANSYS, Inc. All rights reserved. 55 ANSYS, Inc. Proprietary
Summary: Reducing Errors Representative mesh Define target variables: Pressure loss Efficiency Mass flow rate Select convergence criterion (e.g. residual) Plot target variables as a function of convergence criterion Set convergence criterion such that value of target variable becomes independent of convergence criterion Check for monotonic convergence Check convergence of global balances 2010 ANSYS, Inc. All rights reserved. 56 ANSYS, Inc. Proprietary
Summary Quality assurance is essential for industrial use of CFD Ensure all details captured suitably Accept and understand the sources of error Quantify and reduce numerical errors by deterministic and rational procedures Quantify model and systematic errors by validation work Resources: ERCOFTAC SIG: Quantification of Uncertainty in CFD CFD Best Practice Guidelines for CFD Code Validation for Reactor- Safety Applications ANSYS CFD Best Practice Guidelines Your helpful ANSYS support office 2010 ANSYS, Inc. All rights reserved. 57 ANSYS, Inc. Proprietary