# CFDm 2.5.Boundary Conditions

(Difference between revisions)
 Revision as of 16:18, 2 September 2013 (view source)Antonia (Talk | contribs)← Older edit Latest revision as of 17:48, 3 October 2013 (view source)Pablo (Talk | contribs) (→Pressure Boundary Conditions) (98 intermediate revisions by 2 users not shown) Line 1: Line 1: [[Category: CFDm 2.Structure]] [[Category: CFDm 2.Structure]] + + Since there are two different variables in the fluid simulation problem, we can group them as follows: + * Velocity Boundary Conditions + * Pressure Boundary Conditions + + ==Velocity Boundary Conditions== + To clarify the possible boundary conditions in a fluid problem, a typical example is analized. A rigid body inside a fluid domain is simulated with an input current on the left wall as in the folllowing picture. + + [[image:Domain_streamlines.png]] + + ===Slip Boundary Conditions=== + + An critical point, both in real experiments (wind tunnels) and in CFD is measuring effectively the desired variable (such as aerodynamic drag) without the influence of surrounding bodies. Therefore it is important the the upper and lower walls distort the flow as little as possible. If the velocity was imposed to zero in these walls, the flow would be modified severily and therefore the forces obtained would not represent the body in a free current. Therefore a different condition must be selected. The most common BC for these cases is imposing the impeneatrability condition, that is, the fluid cannot pass through a wall. Mathematically speaking, that is: + + [[image:Domain_slip.png]]  $v . \hat n = 0$ + + where $\hat n$ is the normal to the surface + + This allows for the flow to be undisrupted when it is flowing parallel to the wall but also mantains the solution stable by not creating artificial fluid inlets or outlets. + + ====Applying Slip BC in GiD==== + + In the menu Fluid -> Boundary Conditions -> Is Slip select the correct group. Notice that they must be lines in 2D or surfaces in 3D + + [[image:Is_slip_menu.png]] + + ===Dirichlet Conditions=== + + If the value of the velocity is imposed on the selected boundaries to have a fixed value, the condition is known as  [[Finite_Element_Method_Formulation_for_the_Poisson%27s_Equation#Dirichlet_boundary_condition|Dirichlet Boundary Condition ]]. Based on this definition, they can be applied in the following scenarios: + * Inlet Velocity : By setting a fixed velocity in a boundary, it is possible to create conditions inside the domain as if it was a wind tunnel with an exact inlet velocity. Supposing the figure below is a body surrounded in a fluid domain $\Omega$ , the inlet velocity would be set in $\Gamma_D$ + [[image:Domain_inlet2.png]]  $v = V(x,t) \forall x \in \Gamma_D$ + + * Fixed Wall velocities : The velocity of a viscous fluid in a point that is infinitesimally close to a wall, must be the same the one in the wall. This phenomena is known as the [http://en.wikipedia.org/wiki/No-slip_condition no slip condition] and could be, at a first glance, the most realistic condition to apply on solids walls since it follows experimental observations. Notice that despite the imposed velocity is zero, it is simply a particular case of the previous condition. So actually all Dirichlet Velocity condition can be merged into the same group and just changing the function $v = V(x,t)$ + + [[image:Domain_noslip.png]] $v = 0 \forall x \in \Gamma_{D0}$ + + ====Applying No Slip BC in GiD==== + + In the menu Fluid -> Boundary Conditions -> select the option '''Inlet velocity''' or '''No Slip''' . Then write the 3 components of the velocity. Notice that they must be lines in 2D or surfaces in 3D + + [[image:Fixed_velocity_menu.png]] + + ==== Limitations of the no slip BC ==== + + Despite this condition matches the behaviour of fluids in the real world, its direct application in the discretized domain would lead to inaccurate results when an exact computation of the forces of a body inside a fluid is required; In most practical applications it is not possible to simulate the geometry with enough detail to capture the strong velocity gradients in the  [http://en.wikipedia.org/wiki/Boundary_layer boundary layer] and therefore an important amount of information is lost. The following example is the result obtained when a coarse mesh is used (two linear elements are visible). Notice that the shear stress depends on the gradient of the velocity respect to $y$. + + [[image:Boundary_layer2.png]] $\tau = \mu \left.\frac{\partial u}{\partial y}\right|_{y = 0}~~.$ + + In the picture above it is clear that both the gradient of the velocity (difference between the blue and red lines) and the mass flow (difference in light blue) are not correctly represented due to the coarse discretization. This means that the forces on the body and the fluid behaviour would be strongly mesh dependant, leading to estimations that cannot be trusted. Since it is normally not possible to run examples with a mesh sufficiently fine enough to capture all the complex phenomena happening inside the boundary layer, an alternative approach has to be taken to obtain better results. + + === Wall Law === + To overcome the shortcomings of the no slip BC in the simulation of bodies whose boundary layer cannot be captured by the mesh, the [http://en.wikipedia.org/wiki/Law_of_the_wall| Law of the wall] provides an alternative that leads to more accurate results. By supposing an velocity profile in the scale that is below the size of the elements, a shear stress is calculated and added to the momentum equation and the system is solved this way. The obtained velocity at the boundary nodes is not zero but the result of the energy loss due to the viscosity. + + [[image:Wall_law.png]] + + ==== Applying the Wall Law BC in Gid ==== + + Go to the menu Fluid -> Boundary Conditions -> Wall Law. Select the desired boundary of the domain and the wall law value. + + [[image:Wall_law_menu.png]] + + [[image:Pressure_domain.png]] + + ==Pressure Boundary Conditions== + + Due to the structure of the coupled velocity-pressure system of the Navier-Stokes equations, in principle pressure boundary conditions are not needed, since they  are weakly imposed as [[Finite_Element_Method_Formulation_for_the_Poisson%27s_Equation#Neumann_boundary_condition|Neumann BC ]] at the boundaries. + + However, there is a different scenario when a segregated pressure-velocity scheme is used such as the [http://ac.els-cdn.com/S0021999101967257/1-s2.0-S0021999101967257-main.pdf?_tid=3c2c202e-2c4c-11e3-b699-00000aacb35e&acdnat=1380819349_bd1cfea9e1c1324918cdaee42c9116d9| Fractional Step]. This method consists on solving separately (staggered) the velocity unknonwns and the pressure, leading to system of equations that are better conditioned for the solvers. An intereseting feature of the pressure system is that its shape is similar to the one of [[Poisson%27s_Equation| heat diffusion]] (a laplacian): + + ::$\nabla \cdot (K \nabla p )= \nabla . \hat V \qquad \text{where} \qquad \hat V \qquad \text{is known}$ + + Just as it happens in the diffusion problem, the new pressure equation obtained in the fractional step formulation requires the pressure to be fixed at least in one point of the domain. Therefore a wise choice is to choose the outlet of the flow as a Dirichlet Boundary Condition for the pressure, fixing it in all the nodes that are part of the outflow surface. (On the other hand, imposing the pressure even when a monolitic solver is used, does not affect the convergence of the solution) + + ====Applying the Pressure BC in Gid==== + + Go to the menu Fluid -> Boundary Conditions -> Outlet pressure. + + [[image:Pressure_menu.png]]

## Latest revision as of 17:48, 3 October 2013

Since there are two different variables in the fluid simulation problem, we can group them as follows:

• Velocity Boundary Conditions
• Pressure Boundary Conditions

## Velocity Boundary Conditions

To clarify the possible boundary conditions in a fluid problem, a typical example is analized. A rigid body inside a fluid domain is simulated with an input current on the left wall as in the folllowing picture.

### Slip Boundary Conditions

An critical point, both in real experiments (wind tunnels) and in CFD is measuring effectively the desired variable (such as aerodynamic drag) without the influence of surrounding bodies. Therefore it is important the the upper and lower walls distort the flow as little as possible. If the velocity was imposed to zero in these walls, the flow would be modified severily and therefore the forces obtained would not represent the body in a free current. Therefore a different condition must be selected. The most common BC for these cases is imposing the impeneatrability condition, that is, the fluid cannot pass through a wall. Mathematically speaking, that is:  $v . \hat n = 0$

where $\hat n$ is the normal to the surface

This allows for the flow to be undisrupted when it is flowing parallel to the wall but also mantains the solution stable by not creating artificial fluid inlets or outlets.

#### Applying Slip BC in GiD

In the menu Fluid -> Boundary Conditions -> Is Slip select the correct group. Notice that they must be lines in 2D or surfaces in 3D

### Dirichlet Conditions

If the value of the velocity is imposed on the selected boundaries to have a fixed value, the condition is known as Dirichlet Boundary Condition . Based on this definition, they can be applied in the following scenarios:

• Inlet Velocity : By setting a fixed velocity in a boundary, it is possible to create conditions inside the domain as if it was a wind tunnel with an exact inlet velocity. Supposing the figure below is a body surrounded in a fluid domain Ω , the inlet velocity would be set in ΓD  $v = V(x,t) \forall x \in \Gamma_D$

• Fixed Wall velocities : The velocity of a viscous fluid in a point that is infinitesimally close to a wall, must be the same the one in the wall. This phenomena is known as the no slip condition and could be, at a first glance, the most realistic condition to apply on solids walls since it follows experimental observations. Notice that despite the imposed velocity is zero, it is simply a particular case of the previous condition. So actually all Dirichlet Velocity condition can be merged into the same group and just changing the function v = V(x,t)  $v = 0 \forall x \in \Gamma_{D0}$

#### Applying No Slip BC in GiD

In the menu Fluid -> Boundary Conditions -> select the option Inlet velocity or No Slip . Then write the 3 components of the velocity. Notice that they must be lines in 2D or surfaces in 3D

#### Limitations of the no slip BC

Despite this condition matches the behaviour of fluids in the real world, its direct application in the discretized domain would lead to inaccurate results when an exact computation of the forces of a body inside a fluid is required; In most practical applications it is not possible to simulate the geometry with enough detail to capture the strong velocity gradients in the boundary layer and therefore an important amount of information is lost. The following example is the result obtained when a coarse mesh is used (two linear elements are visible). Notice that the shear stress depends on the gradient of the velocity respect to y.  $\tau = \mu \left.\frac{\partial u}{\partial y}\right|_{y = 0}~~.$

In the picture above it is clear that both the gradient of the velocity (difference between the blue and red lines) and the mass flow (difference in light blue) are not correctly represented due to the coarse discretization. This means that the forces on the body and the fluid behaviour would be strongly mesh dependant, leading to estimations that cannot be trusted. Since it is normally not possible to run examples with a mesh sufficiently fine enough to capture all the complex phenomena happening inside the boundary layer, an alternative approach has to be taken to obtain better results.

### Wall Law

To overcome the shortcomings of the no slip BC in the simulation of bodies whose boundary layer cannot be captured by the mesh, the Law of the wall provides an alternative that leads to more accurate results. By supposing an velocity profile in the scale that is below the size of the elements, a shear stress is calculated and added to the momentum equation and the system is solved this way. The obtained velocity at the boundary nodes is not zero but the result of the energy loss due to the viscosity.

#### Applying the Wall Law BC in Gid

Go to the menu Fluid -> Boundary Conditions -> Wall Law. Select the desired boundary of the domain and the wall law value.

## Pressure Boundary Conditions

Due to the structure of the coupled velocity-pressure system of the Navier-Stokes equations, in principle pressure boundary conditions are not needed, since they are weakly imposed as Neumann BC at the boundaries.

However, there is a different scenario when a segregated pressure-velocity scheme is used such as the Fractional Step. This method consists on solving separately (staggered) the velocity unknonwns and the pressure, leading to system of equations that are better conditioned for the solvers. An intereseting feature of the pressure system is that its shape is similar to the one of heat diffusion (a laplacian): $\nabla \cdot (K \nabla p )= \nabla . \hat V \qquad \text{where} \qquad \hat V \qquad \text{is known}$

Just as it happens in the diffusion problem, the new pressure equation obtained in the fractional step formulation requires the pressure to be fixed at least in one point of the domain. Therefore a wise choice is to choose the outlet of the flow as a Dirichlet Boundary Condition for the pressure, fixing it in all the nodes that are part of the outflow surface. (On the other hand, imposing the pressure even when a monolitic solver is used, does not affect the convergence of the solution)

#### Applying the Pressure BC in Gid

Go to the menu Fluid -> Boundary Conditions -> Outlet pressure.