How Small is Too Small? Optimal CFD Domain
Kevin Baur 09.08.2024
Tech Article 24/12  Influence of domain size in CDF
Have you ever noticed that the results of your simulation depend on the position of the boundary conditions? A few questions quickly arise: How large does the fluid domain need to be? What if it is too small? Does the shape matter? This article explains why we should ask ourselves these questions when performing an external flow simulation.
Definition of the fluid domain
First, we consider the fundamental aspects of the fluid domain to be created for an external CFD simulation. Using the external flow of a 2D NACA 2412 airfoil, we will analyze the effect of the fluid domain size on the drag of the airfoil. Why the effort? Why not simply place a box around the body and start calculating? In reality, every external flow affects its surroundings—particularly the wake region. In the simulation, however, we need to specify values at the boundaries of the computational domain, keeping in mind that the closer we get to the body, the more these values deviate from what would be measured in reality.
The rotor stray inductivity X_{2} and the rotor resistance R_{2}, here split into two parts, are multiplied by this factor. An extension already included is a resistor to take into account the iron losses R_{Fe} in the ECM.
How large should the fluid domain be? When creating a simple fluid domain in Ansys Discovery, it is by default 25% larger in all directions than the bounding box of all selected bodies. The flow direction is not taken into account. However, when using the External Flow tool in the simulation environment to create a fluid domain, it is necessary to specify the inlet position and the ground plane, which affect the shape of the fluid domain. The outlet is automatically positioned further away than the inlet, as the flow downstream is more disrupted by the body than upstream.
Let's consider the simple case of a cuboid with an external flow. As shown in the image, the distance between the cuboid and the outlet is greater than between the cuboid and the inlet. The distance to the inlet is 0.8 times the length of the cuboid in the flow direction (ly). Due to the wake region, the outlet is automatically positioned twice as far away. For the lateral distance, Ansys Discovery uses the width of the body (lx) as a reference. This width is also used for the distance above the body. By selecting the ground plane, the distance to the underside is 0 m.
Automatic enclosure in Ansys Discovery  © CADFEM
The Role of Shape and Size
Some might now be tempted to apply the standard domain. After all, it was surely defined with careful consideration. Or how do you define your fluid domain? Have you ever thought about this in one of your projects? Especially with a new, unfamiliar project, the question of the size and shape of the fluid domain cannot be immediately answered. I often define the distance between the body and the positions of the boundary conditions based on my experience from previous projects. But how does one approach this systematically?
First, let's consider a suitable shape for the fluid domain, as a simple box is not always practical. Depending on the angle of attack, a circular inlet may be more suitable (as in the following example). For a rotationally symmetric body, a cylindrical shape is more suitable—spherical domains are also conceivable. The advantage here is the flexibility regarding the direction of the flow, although there are typically more cells normal to the direction of flow than are required.
Next, we consider the size of the fluid domain. For this, we define the reference length 𝑙 as the length of the object in the flow direction. The distance to the positions of the boundary conditions is then specified as a multiple of this reference length. For example, the inlet is positioned 15 ⋅ 𝑙 upstream. Due to the wake region, the distance between the outlet and the body is typically greater than the distance between the inlet and the body. These proportions depend on the wake region itself. Laterally, as well as above and below, the same factor as for the inlet is often defined.
Fluid domain definition  © CADFEM
Influence fluid domain on Cdvalue
Using our wing profile, we will now analyze the effect of the fluid domain size on the result. To do this, we will examine the change in the drag coefficient C_{d} as a function of the domain size. The chord length of the wing is defined as our characteristic length l. Since we want to analyze the effect at various angles of attack, a circular inlet is defined. The distance between the wing profile and the boundary conditions is given as a multiple of the chord length. Thus, the inlet is located x⋅l from the leading edge of the wing. In our example, the distance between the trailing edge of the wing and the outlet is typically twice as far as the inlet (i.e., 2⋅x⋅l).
Using the previously described scheme, we now create four fluid domains with x=2, 5, 15, and 40. For each fluid domain size, a simulation is performed at 0°, 5°, and 10° angles of attack, and C_{d} is determined in each case. In a diagram, x is plotted on the abscissa and C_{d} on the ordinate for each angle of attack. The diagram shows how the drag coefficient C_{d} behaves as a function of the fluid domain size.
Similar to a mesh study to determine the necessary cell size, the value of C_{d} that would result in an infinitely large domain is now extrapolated (1/x→0). As we can see, Cd is linearly proportional to x for small angles of attack (here: 0°). At angles of attack of 5° and 10°, nonlinearity can be observed, so we use a quadratic function for extrapolation in these cases.
Diagram of the Influence of Enclosure on the Drag Coefficient  © CADFEM
Influence of size in figures
For an angle of attack of 0°, the expected error due to the finite size of the fluid domain is 4.5% for x=2. This may be sufficient for a quick initial simulation or to identify trends: different designs can be compared with minimal effort. However, if absolute values are of interest, the small fluid domain (x=2) is no longer adequate. It should be noted that the error discussed here is solely due to the size of the fluid domain. Other errors, such as iteration, discretization, and model errors, must also be considered and determined separately.
Furthermore, it can be seen that as the angle of attack increases, the requirements for the fluid domain size also increase. For x=40, the expected error is 0.9% at 5° angle of attack and 1.7% at 10° angle of attack. This is likely due to the increasing wake region with a higher angle of attack. Therefore, it would be beneficial to analyze the ratio between the inlet and outlet distances to the wing, instead of globally increasing the factor x. By adjusting the shape of the fluid domain to the flow, some cells can be saved.
In conclusion, there is no single answer to the correct choice of domain shape and size. The appropriate fluid domain size depends on the flow itself and varies greatly from case to case. Those seeking certainty can estimate the error caused by the fluid domain size using the approach presented in this article. Additionally, it should be noted that not all result variables are as sensitive to the fluid domain size as the drag coefficient. In our example, the influence on the lift coefficient is significantly smaller. If only the lift coefficient is of interest, a smaller fluid domain can be selected. In our seminar Fluid Dynamic Drag of Immersed Bodies, we dive deeper into this topic and present further best practice from our experience.
Expected error depending on the domain size  © CADFEM
Training on the topic

Fluid Dynamic Drag of Immersed Bodies with Ansys Fluent
In this training, you will learn about aerodynamic and hydrodynamic modeling approaches and receive best practice tips for their solution.
Editor
Dr.Ing. Marold Moosrainer
Head of Professional Development
+49 (0)8092 700545
mmoosrainer@cadfem.de
Cover images: © CADFEM GmbH  Adobe Stock