# CFD computational domain definition

A Computational Fluid Dynamics (CFD) domain is the portion of space where the solution of the CFD simulation is calculated. The computational domain needs to be discretised into a computational grid (or mesh) to solve the discretised equations of fluid flows. In external aerodynamics, a CFD simulations of the flow around a geometrical object (“geometry”) is required, therefore the computational domain is a volume of adequate dimensions around the geometry of interest. Meanwhile, in internal flows, the computational domain is defined by the confines of the geometry itself and the space inside the geometry is discretised into a computational grid.

## CFD computational domain dimensions

The dimensions of a computational domain depend on the type of problem: whether it is an external aerodynamic problem or an internal flow problem.
In external aerodynamics, the computational domain, often referred to as outer domain, describes the region around the geometry of interest where the flow solution is required. Its shape and size of the depend mainly on the aerodynamic characteristics of the geometry.
A body immersed in a flow field affects the flow around it as the flow needs to get around and past the body. In a low speed simulation (low Mach number/subsonic flow), the pressure increases in areas where the flow velocity reduces and decreases where the flow accelerates. Moreover, the presence of the body is felt upstream and the flow starts to divert before actually making contact with the body. In most cases, the geometry of the body is such that it leaves a wake of low energy flow behind, as the flow separates from it.
As an example, the picture below shows the flow around an aerofoil in a wind tunnel. The streamlines deviates as they approach the aerofoil and, due to the high angle of attack, the flow over the top surface is separated with large recirculations zones. Photograph of an airfoil in a wind tunnel, showing separated flow over the top surface 

Therefore, the sides of the computational domain that do not represent physical geometries like walls, grounds and ceilings are generally placed as far away as possible from the geometry that needs to be modelled. Such distance should be large enough to make sure that the boundary conditions assigned to the outer domain do not alter the flow next to it an affect the quality of results.
An external aerodynamics problem can involves the presents of physical boundaries, like the walls of a wind tunnel, or the ground in an open road simulation or aircraft landing condition. In these cases, the computational domain is defined by the geometry of the physical walls and generally only the position of the inlet and outlet boundaries need to be defined. If detailed data for setting up the inlet and outlet boundary conditions is known, these can be placed to match the experimental measurements. On the contrary, when no data is available and simple constant inlet velocity and constant pressure outlet boundary condition are used, the same principle of an external aerodynamic case should be used.
In internal aerodynamic problems instead, the geometry itself defines the computational domain and the boundary conditions are directly applied to the surfaces of the geometry.

In our free CFD software SimWorks, a computational domain (outer domain) is automatically created around the imported geometry so that it can be used for external aerodynamics calculations. The user can modify the domain extents and its position relative to the main geometry in order to obtain the most suitable size for the simulation. In case of internal flow simulations, the computational domain can be deactivated.

## CFD domain dimensions best practises

When deciding on the size of the computational domain for external aerodynamics problems, it would be beneficial to know in advance the effect of the body on the surrounding flow field. This can evaluated considering previous CFD simulations of similar geometries or by carrying out a simulation with an oversized domain. When previous results are not available or when carrying out a simulation with a very large domain is not feasible due to the computational cost, it is possible to use experience and best practises to estimate the domain dimensions. Once the simulation has run, the results should be checked to see if the boundary of the domain are influencing the flow around the body and, if so, the size of the domain should be adjusted for any subsequent simulation.
In general, it is necessary to allow enough space around the geometry of interest to so that the perturbations introduced by the presence of the geometry do not interfere with the boundaries themselves. If the distance is too small, the numerical boundary conditions can affect the flow field around the body in a non-physical manner because in the solution algorithm the flow is always forced to comply with the conditions defined at the boundary.
Upstream of the body, a good starting point would be to have a minimum of roughly 2 times the length of the body itself. This dimension should be enough to allow the flow to adjust due to the presence of the geometry. Downstream, generally the body will shed a wake of lower energy flow, which is also convected by the flow. Therefore, it is recommended to have length of minimum 5 times the dimension of the body along the direction of the flow to allow enough space to the boundary condition imposed at the domain outlet. In a similar manner, it is usually recommended to leave a space of about 2 times the body width on each side to allow for local flow deviation. In most applications, the flow can be assumed symmetric and therefore it is possible to simulate the flow only in one half of the domain, using a symmetry boundary condition along the symmetry plane of the object of interest. This helps reducing the overall computational domain size and the computational cost of the simulation.

Below are two examples of computational domains for the simulation of the flow around a truck (heavy-goods vehicle). The first has a full domain while the second exploit the symmetry of the model along the XZ plane.

These recommendations are valid for a generic body, but the domain dimensions may need to be further adjusted for each specific geometry. For example, a bluff body like in the truck above will have a much bigger wake than an aerodynamic streamlined car and will develop unsteady structures within its wake which will require a larger box behind the body. In this case a good starting point is to extend the outer domain by 10 times the bluff body main length.

In the pictures below there is a comparison of the total pressure coefficient (Cp0) for two CFD simulations of the flow around a truck. The one on the top is obtained using a computational domain where the inlet plane is too close to the geometry itself, leading to a non-physical result where the total pressure coefficient is significantly above 1.

By increasing the distance between the inlet boundary (left side) to the truck, the total pressure coefficient values are more reasonable.

Also, when the geometry imposes a strong deviation to the flow, for instance an aeroplane in a high lift configuration, it is a good idea to increase the outer domain dimension in the direction of the diverted flow. This is very important when wall boundary conditions are used, as the presence of walls near the body will affect the flow and change the forces on the body itself. This effect is known as ground effect. While this phenomenon is easily calculated with a CFD models where the ground is included in the simulation, it is important not to introduce it as a spurious effect in a free stream simulation.

## CFD domain shape

In external aerodynamics simulations, most of the times the CFD computation domain is a simple box. This layout allows for a simple definition of the boundary conditions on the box faces and it is relatively easy to assign its overall dimensions and placement with respect to the geometry. Moreover, using a box shape, it is relatively straight forward to include in the CFD analysis the presence of walls or ground by simply changing the boundary condition on the corresponding faces. This is useful to simulate the flow of an aeroplane in ground effect or the interaction of a car with the moving road.
Another possibility is to define a cylindrical shaped domain around the body, where top and bottom base of the cylinder represents the inlet and outlet of the domain. This layout is well suited for a free stream analysis of an axis symmetric body or a streamlined geometry as it guarantees a constant distance of the sides from the body itself and allows to directly define a single boundary condition on the cylinder side. A cylindrical outer domain is also used in urban flow and wind analysis around building. This time the cylindrical side is used a velocity inlet, while the top and bottom of the domain represent the sky and ground, respectively. In this way, it’s possible to change the wind direction in the CFD simulation by simply changing the angle of the inlet velocity. Furthermore, the same computational mesh can be reused for the computation of all wind directions.
As mentioned earlier, sometimes certain features of the geometry are directly included in the computational domain. For instance in the simulation of the periodic hill flow – a classical verification and validation case for CFD solvers – the bottom surface represents the shape of the hill itself, with an inlet to the left, an outlet to the right and the top surface representing the free stream flow as shown in the picture below. Velocity contour and streamlines of an LES simulation of the peridioc hill case 

## Rotating the domain

One of the most common CFD analysis is the sensitivity study to varying the incidence of the flow on the geometry and study the effect on the resulting flow field. Typical examples are the calculation of the performance envelope of an aircraft with varying angles of attack, or studying the effect of different wind directions for an urban flow or a wind farm assessment. A common approach is to change the angle of the body inside a fixed computational domain. This is a valid solution but might lead to difficulties in a side by side comparison for different flow conditions, where the results would be difficult to interpret due to the rotation of the geometry itself. An alternative approach is to change the angle of the computational domain according to the main direction of the incoming flow, this way the object will always be in the same position making a comparison of how the flow field varies in the surrounding of the body easier. In this case the boundary condition on the CFD domain inlet face is defined as the value of the flow velocity normal to the face itself rather than a velocity in the absolute coordinate system.

## Meshing strategy

As already discussed, in external aerodynamics, the correct size of the computational domain is very important for the quality of the results of a CFD simulation, and generally a large domain is recommended. On the other hand, oversizing the domain can lead to a high number of mesh cells. So it is always recommended to assess whether a domain is oversized once the first simulation has run and, if possible, reduce its size for subsequent analyses. Moreover, the flow far from the body is not expected to be significantly affected by the presence of body itself and therefore will show very little velocity and pressure variations. For this reason, it is possible to use a relatively coarse mesh away from the body and progressively refining it in the regions next to the body, thus increasing the cell mesh count only where needed. This is possible using mesh refinement volumes, which are geometrical volumes where the mesh resolution can be explicitly specified. The shape and size of the refinement volume depend on the shape of the geometry and of the flow structures that we want to capture. In internal flows, like those in pipes, ducts, etc., the entire computational domain is defined by the geometry itself, but same principle of using mesh refinement volumes where there are strong flow variations applies.

A cost-saving strategy that can be used is to exploit a geometrical symmetry of the problem. In most applications, we expect the flow to be symmetric for symmetrical objects, therefore it is possible to solve the flow on half of the computational domain using a symmetry boundary condition on the symmetry plane. Similarly, for axisymmetric geometries, it is possible to use a wedged shaped computational domain and use a cyclic boundary condition on the wedge sides. These type of domains are typical of internal combustion engine simulations, or portions of a turbine or compressor.
In both internal and external flows, particular attention should be placed in the region very close to the wall surfaces, where the strongest gradients occur. Generally, the resolution on the surface of the geometry itself can be controlled by the geometrical features, like edges and corners, as well as the curvature. The local surface refinement, due to sharp edges and curvature, will propagate to the volume near the wall. Furthermore, as in viscous flow a boundary layer is formed on all wall surfaces, the strongest gradients are typically normal to the walls, therefore it is common practise to use layers of prismatic cells around the body.

In summary, the computational domain should be always defined by finding the best compromise between size and cell mesh count. The mesh can be coarsened where these gradients are small but the resolution should be increased in the regions where flow variations are expected. Indeed, a coarse mesh will artificially increase the global diffusivity of the CFD solution and there is a risk of not being able to correctly capture the flow structures and obtaining an incorrect result.

## Resources

1. An Album of Fluid Motion – Milton Van Dyke – 1982
2. Frohlich, J., Mellen, C. P., Rodi, W., Temmerman, L., and Leschziner, M. A., 2005. Highly resolved large-eddy simulation of separated flow in a channel with streamwise periodic constrictions. J. Fluid Mech. 526, pp. 19-66.

Try our free CFD software SimWorks, no registration required or contact us to find out more