Computational Fluid Dynamics (CFD) Analysis Procedure

This is the procedure for performing computational fluid dynamics (CFD) analysis using BARAM . While it may vary slightly depending on the problem, I’ve tried to generalize it as much as possible. It’s divided into three steps: problem definition and planning, mesh generation, and simulation execution.

  1. Problem definition and planning
  2. Mesh generation process
  3. Simulation execution process

This is the most crucial step, determining the overall direction. Beginners unfamiliar with CFD often overlook this step, while intermediate users often overlook it due to their own overconfidence. However, if it’s not properly organized, it can lead to a significant waste of time and effort.

1. Understanding the structure and principles of the target product or system

Since CFD simulates physical phenomena, a thorough understanding of the underlying physics is essential. Often, due to a lack of accurate understanding of the actual phenomenon, unnecessarily complex models are used, resulting in poor results and wasted time. Most problems involve a mix of physical and chemical phenomena. It’s crucial to accurately represent the most important phenomena and omit or simplify those with lesser impact.

2. Summarize the purpose of interpretation and the results you want to achieve through interpretation.

Simulation isn’t about replicating real-world phenomena as closely as possible, but rather about achieving the desired results. The more unclear the purpose and desired results of the analysis, the more unnecessary physical models are included, and the more complex the modeling becomes, significantly increasing computational costs. It’s crucial to simplify the analysis model as much as possible to fit the intended purpose.

3. Validation of CFD calculations – Review of governing equations

The Navier-Stokes equations, which govern fluid flow, assume that the fluid is a continuum. Therefore, it is necessary to verify whether this assumption is valid for the target problem. While the continuum assumption is valid for most fluids, it is necessary to verify the validity of the continuum assumption when the vacuum is very low.

4. Clarify the accuracy of the target results.

While the accuracy goals for writing a thesis for a university degree program are relatively clear, in industry, the accuracy required varies greatly depending on the purpose of the analysis (performance evaluation, comparison of design proposals, troubleshooting, etc.).

  • Explore papers or technical materials similar to the target problem to establish a rough baseline.
  • If your simulation aims to achieve quantitatively accurate results, determine the target level of accuracy. To secure the basis for your accuracy assessment, you should seek out research papers or measurement results.
  • If your goal is to identify qualitative characteristics, you need a methodology that allows you to determine whether results from different conditions show consistent trends.

5. Determine the number of interpretation cases

  • Determine the type of case based on the shape and conditions to be interpreted.
  • If you need a lot of interpretation cases, it is recommended to establish an automation strategy.

6. Check the schedule

  • You need to make sure that there are no issues with the overall schedule, taking into account your hardware resources.
  • We develop an overall schedule considering the priorities of each step.

The generation of the mesh for calculation is done through the following process:

  1. Prepare geometry : Define computational domain, simplification level, multi-region or single-region, CAD cleanup
  2. Setup geometry : Import CAD, create far-field, create mesh refine zone, create cell zone
  3. Setup regions : Specify where to create mesh, setting regions for fluid and solid
  4. Background mesh : Create structured type base mesh
  5. Mesh refinement : Set mesh refinement according to feature, surface, volume, curvature, gap size
  6. Geometry fitting : Move cell point to geometry surface
  7. Boundary layer : Set layer number, height, expansion ratio
  8. Export : Export as 2D, axi-symmetry, 3D

1. Prepare the geometry

After determining the calculation domain and the level of geometry simplification, modify the CAD file.

1.1 Determining the computational domain

For internal flow, the computational domain must extend to a region where robust boundary conditions can be applied. For external flow, the far-field boundary can be created using a hexahedron in BaramMesh. Considering the symmetry and periodicity of the geometry, you can decide whether to model half or only a portion of the mesh. This is a crucial decision, as it can reduce the mesh size by more than half.

1.2 Determining the level of shape simplification

Delete parts that do not significantly affect the flow, determine whether complex geometries can be replaced with cell zone models, or whether thin-walled solids can be treated as baffles with no thickness.

Determine how to configure the boundary, cell zone, and interface. When configuring the boundary, consider post-processing items. Determine the area where the cell zone model will be used. Determine the interface, considering the periodicity of the shape and the baffle.

1.3 Determining whether to use multi-region

When conductive heat transfer through a solid is involved, there are two methods: treating the solid as a boundary condition, and modeling the fluid and solid regions separately and calculating them as a multi-region solution. When only one-dimensional heat conduction along the solid thickness direction is required, the solid region can be treated as a boundary condition that includes one-dimensional heat conduction without modeling it separately. However, when heat conduction in other directions as well as the solid thickness direction must be considered, or when the problem is unsteady, a multi-region solution is required.

Determine how to treat the solid domain geometry to suit the problem.

1.4 CAD Clean up

Remove unnecessary areas from CAD files and clean up any torn or disconnected sections. Separate areas that should be separated by boundaries.

2. Running baramMesh and setting the geometry – Geometry

Run baramMesh, load the shape file, and create a background mesh, mesh refinement, and cell zone.

2.1 Importing geometry files

baramMesh uses STL (STereo Lithography) files. When importing a geometry file, you can divide the surface using feature angles to separate the boundaries.

2.2 Creating a far boundary area

For external flow, create the entire area that will be the far-field boundary. Use Hex6, which divides the six faces of a hexahedron. For internal flow, there is no need to create a separate boundary.

The size of the far-field boundary depends on the compressibility of the flow. For incompressible flows, the far-field boundary is typically 3 to 5 times the object’s length in the inlet direction, 10 to 15 times in the outlet direction, and 5 to 10 times in the lateral and vertical directions. For supersonic flows, because information from the wake is not transmitted upstream, the far-field boundary can be set to be 1 to 3 times smaller in the inlet direction and 5 to 10 times smaller in the outlet direction.

2.3 Creating a mesh refinement region

The overall grid structure is determined by considering the basic grid size, grid density distribution, shape curvature, and gaps. Determining the grid size is crucial for simulating flow changes, and it also requires consideration of the ability to accurately represent small shapes. Refinement zones are created to adjust the grid size based on the overall grid structure.

Create shapes using cubes, cylinders, spheres, etc. The surfaces of the area for grid division must be set to None to indicate that they are not boundary surfaces.

2.4 Creating a Cell Zone

Create a region for setting up Porous, MRF, Sliding mesh, source terms, etc. using a cube, cylinder, sphere, etc. You must specify that the faces of the cell zone are not boundaries, and the faces for sliding mesh, multi-region, etc. must be set as interfaces.

3. Region settings

  • For single region problems, specify whether to create the grid outside or inside the shape.
  • For multi-region, specify the area to create the grid for each region.

4. Create a background grid – Base Grid

Create a hexahedral background grid using the blockMesh utility. The size and shape of the cubes are determined by the number of points in the x, y, and z directions.

5. Mesh refinement – castellation

This step splits the background grid and removes unnecessary areas of the grid.

  • Sets the grid level of feature lines, surfaces, and volumes.
  • Sets whether to use the curvature refinement option based on the surface’s curvature.
  • Sets whether to use the gap refinement option in the volume.

6. Geometry Implementation – snap

This is the step of implementing a shape by moving grid points to the surface of an object.

  • Choose between implicit and explicit methods. Explicit uses feature lines automatically generated when reading an STL file, while implicit uses feature angles to directly find the feature line. Implicit is recommended because feature lines are not generated when the intersections of faces forming the shape are not split.
  • Sets various smoothing and relaxation related variables to maintain the quality of the grid.
  • Sets whether to create a buffer layer at the boundary and cell zone boundaries.
Geometry implementation

7. Creating a boundary layer

  • Select the boundaries on which you want to create a boundary layer grid. You don’t need to create a boundary layer grid on every wall; just select those walls with zero velocity where boundary layer flow is important.
  • Determines the thickness, number, and thickness increase ratio of the boundary layer grids.
  • Sets several options to maintain grid quality.

8. Export

Create a grid folder that can be read by baramFlow. You can export it as a 2D grid or an axisymmetric grid using specific faces.

  1. Select solver : Pressure based/density based/multi-phase
  2. Read mesh and check unit and quality
  3. Set Time, gravity, operating pressure
  4. Select physical model : Turbulence, energy, multi-phase, chemical species, passive scalar
  5. Set material properties : Density, viscosity, specific heat, conductivity, molecular weight
  6. Set cell zone conditions : Porous, MRF, sliding mesh, actuator disk, source term
  7. Set boundary conditions
  8. Set numerical methods : Descritization, convergence criteria, relaxation factor, time marching scheme
  9. Set monitoring : Force, point, surface, volume
  10. Initialize and Run : Set initial value, run conditions, batch run, parallel option

1. Solver settings – compressible flow, multiphase flow

  • Run baramFlow
  • Choose between a pressure-based or density-based solver
  • If it is a pressure-based solver, select whether it is a multiphase flow

1.1 Pressure vs. Density-Based Solvers – Compressible Flow

When the flow velocity is close to or greater than the speed of sound, it is effective to use a density-based compressible solver that can capture shock waves well.

1.2 Multiphase flow

When there are more than two phases in the system, decide whether to calculate multiphase flow including each phase or calculate only for one major phase.

Currently, Baram supports the Volume Of Fluid (VOF) and cavitation models, which are models in which the phase boundaries are clearly separated. (The Eulerian model, which calculates separate momentum equations for each phase, and the Discrete Phase Model (DPM), which calculates particle motion in a Lagrangian manner, are not yet supported.)

For multiphase flows, the interFoam, multiphaseInterFoam, and interPhaseChangeFoam solvers are used.

2. Load mesh, check the mesh units and quality

  • Load the mesh from the File – Load Mesh menu.
  • Check the mesh in the Mesh – Info menu.
    • Since baramMesh is unitless, while baramFlow uses meters, check the grid size and ensure the units are correct. If necessary, adjust the units in the Mesh-Scale menu.
    • Check that the minimum volume of the grid is non-negative.
    • Make sure there are no grid issues on the graphic.

3. Time/gravity/operating pressure settings

  • Time selection: Steady/Transient
  • Gravity vector input
  • Enter operating pressure

3.1 Time

If the flow field does not change over time, select the steady-state approach. In some multiphase flow problems, if the values ​​change over time but remain constant beyond a certain time, select the steady-state approach. In this case, use the Local Time Step (LTS) technique.

If the problem involves moving objects or changing conditions over time, or if the flow field continues to change periodically, such as high angle of attack flow or vortex oscillation, it must be calculated as a non-stationary state.

3.2 Gravity

When considering natural convection heat transfer, enter the direction and magnitude of gravity as a vector. Gravity must also be specified for multiphase flow problems involving multiple phases of different densities and multiple chemical species of different densities.

3.3 Operating Pressure

All pressures used in baramFlow are relative to this value. If this value becomes 0, all pressures become absolute.

4. Model Setup – Turbulence/Energy/Chemical Species/User-Defined Scalar

  • Turbulence model selection
  • Choose whether to calculate the energy equation
  • Choose whether to calculate chemical species mixtures
  • Choose whether to compute custom scalars

4.1 Turbulence

You can choose from Inviscid, Laminar, Spalart-Allmaras, k-epsilon, k-omega, DES, and LES. Inviscid is used in some high-speed compressible flows because it ignores the effects of viscosity. Laminar is for laminar flow, and the rest are turbulent models, so choose the appropriate model depending on the problem.

4.2 Energy

Energy is automatically included if a density-based solver is selected and a multi-region mesh is read.

Currently, Baram does not include the energy equation for multi-phase flow.

4.3 Mixing of chemical species

When a fluid is composed of multiple chemical species, but the differences in their physical properties have little effect on the overall flow, they can be treated as a single chemical species. In such cases, passive scalars can be used to visualize the distribution of chemical species. When the differences in physical properties between chemical species significantly affect the overall flow, transport equations for each chemical species must be calculated. (Currently, Baram does not support chemical reactions.)

4.4 User-defined Scalars

It can be calculated by adding arbitrary scalar equations such as the following equation, setting the diffusivity of each scalar.

$\frac{\partial (\rho \phi)}{\partial t} + \nabla \cdot (\rho U \phi)=\nabla \cdot (\Gamma \nabla \phi)+S_{\phi}$

$\Gamma$ : Diffusion coefficient
$S_{\phi}$ : Source term

5. Setting physical properties

  • Working fluid selection
  • Adding materials required for multiphase flow and chemical species mixing problems
  • Select a method for calculating physical properties such as viscosity coefficient, density, specific heat at constant pressure, thermal conductivity, and molecular weight for each substance.

5.1 Viscosity

The relationship between the shear stress generated by a flow and the rate of change in velocity is the viscosity coefficient. A Newtonian fluid is considered linear when this relationship is linear, and the slope is the viscosity coefficient. This viscosity coefficient can be expressed as a constant or as a function of temperature. The viscosity coefficient of a liquid decreases rapidly with increasing temperature, while the viscosity coefficient of a gas increases with increasing temperature. 

A fluid is non-Newtonian when the shear stress and velocity change rate generated by the flow are not linear . Methods for defining the viscosity coefficient include the power law, cross power law, Herschel-Bulkley, and Bird-Carreau models.

Viscoelasticity problems, where elastic deformation and viscous flow occur simultaneously when a force is applied to an object, are not currently supported by Baram.

5.2 Density

There are several ways to define density, including constant, perfect gas, polynomial, and incompressible perfect gas.

5.3 Heat capacity

It can be defined as a polynomial function for a constant or temperature.

5.4 Thermal conductivity

Thermal conductivity can be a constant or a function of temperature. When it is a function of temperature, the polynomial and Chapman-Enskog approximations can be used.

When the viscosity coefficient is calculated using the Sutherland equation, the thermal conductivity is also calculated using the Chapman-Enskog approximation as follows:

$\kappa=\mu C_v\left(1.32+1.77\ \frac{R}{C_v}\right)$

6. Setting cell zone conditions

  • When it is a multi-domain problem, selecting materials for each domain
  • Selection of materials for each phase in multiphase flow
  • Cavitation calculation and model selection
  • Select cell zone type – None, Multiple Reference Frame, Porous Zone, Sliding Mesh, Actuator Disk
  • Source Term Settings
  • Setting Fixed Value Conditions

6.1 Porous media

When there are complex geometries in porous materials or small areas, this method involves modeling pressure loss based on flow velocity without directly implementing the geometry. The Darcy-Forchheimer model and the Power Law model can be used to model pressure loss.

6.2 MRF(Multiple Reference Frame)

This method, when simulating a rotating object, calculates the flow around the rotating body in a rotational relative coordinate system without rotating the object itself. It has the advantage of relatively low computational costs because it allows for steady-state calculations.

6.3 Sliding Mesh

Sliding meshing is a method of configuring cell zones around a moving object and moving the grid. Each boundary between a moving and stationary cell zone must be configured as an interface.  
Moving boundaries within a cell zone must use a moving wall boundary condition . The parameters are rotational speed (RPM), center coordinates of the rotational axis, and rotational direction, which are the same as in MRF.

6.4 Actuator disk

The actuator disk model avoids modeling complex rotating bodies, such as propellers, by modeling them as disks and using average velocity as a generation term. There are two methods: Froude and variable-scaling.

6.5 Source Terms

You can assign generation terms to fields such as energy, mass, and turbulence. There are two ways to assign the size of the generation term: “Value for Entire Cell Zone” and “Value per Unit Volume.”

When it is a non-stationary problem, the generation term can be given as a value that changes over time, and the piecewise linear and polynomial methods are provided.

6.6 Fixed Value 

The average values ​​of the cell zone’s velocity vector, temperature, turbulence, etc. can be fixed. For velocity, a relaxation factor is used to avoid computational instability.

7. Setting boundary conditions

  • Setting entrance conditions
  • Set exit conditions
  • Setting wall conditions
  • Setting interface conditions

8. Setting up numerical analysis techniques

  • Select pressure-velocity coupling: SIMPLE or SIMPLEC. Selecting SIMPLEC and setting a relaxation coefficient of 0.9 or higher may speed up convergence, but may also cause stability issues.
  • Set the discretization technique: Set the discretization technique for time, pressure, momentum, energy, turbulence, vof, chemical species, scalar, etc.
  • Set convergence criteria.
  • Set the relaxation factors.
  • Set calculation conditions when the condition is abnormal – number of iterations per time step (Max Iterations per Time Step), number of pressure corrections (Number of Correctors)
  • Determines whether viscous dissipation, kinetic energy, and pressure work are included in the energy equation.

9. Monitoring Settings

To check convergence in steady-state problems, and to check the change in values ​​over time in non-steady-state problems, monitoring of force, average, integral, maximum, minimum, flow rate, etc. is set.

  • Force: Force acting on the surface and fluid force coefficients (Cd, Cl, Cm)
  • Point: Monitor the value of a floating variable at a specific coordinate.
  • Surface: Monitors the flow rate, mean, integral, maximum, minimum, and rate of variation (CoV) of flow variables on a specific surface.
  • Volume: Monitors the flow rate, average, integral, maximum, minimum, and rate of variation (CoV) of flow variables in a specific area.

10. Initialization and calculation

  • Set initial conditions for all flow variables
  • Set a constant value in a specific area of ​​space
  • Set calculation conditions
    • Number of Iterations, End Time: The number of iterations in normal conditions and the end time in abnormal conditions.
    • Time Step Size: Time advance interval when in an abnormal state
    • Time Stepping Method: A method for advancing time when the system is in an abnormal state. Fixed or Adjust Time Step.
    • Auto Save Interval: Auto save interval
    • Max CFL Number: Maximum CFL number when using the Adjust Time Step method