Difference between revisions of "Fluid Mechanics"

From Medusa: Coordinate Free Mehless Method implementation
Jump to: navigation, search
(CBS Algorithm)
(Numerical solutions)
Line 143: Line 143:
  
 
== Numerical solutions ==
 
== Numerical solutions ==
[[Basic tests]]
+
* [[Basic tests]]

Revision as of 15:12, 5 October 2017

introduction

Computational fluid dynamics (CFD) is a field of a great interest among researchers in many fields of science, e.g. studying mathematical fundaments of numerical methods, developing novel physical models, improving computer implementations, and many others. Pushing the limits of all the involved fields of science helps community to deepen the understanding of several natural and technological phenomena. Weather forecast, ocean dynamics, water transport, casting, various energetic studies, etc., are just few examples where fluid dynamics plays a crucial role. The core problem of the CFD is solving the Navier-Stokes Equation or its variants, e.g. Darcy or Brinkman equation for flow in porous media. Here, we discuss basic algorithms for solving CFD problems. Check reference list on the Main Page for more details about related work.

We want to solve \begin{equation} \frac{\partial \mathbf{v}}{\partial t}+(\mathbf{v}\nabla )\cdot \mathbf{v}=-\frac{1}{\rho }\nabla P+\mu {{\nabla }^{2}}\mathbf{v}+\mathbf{f} \label{NavierStokes} \end{equation} also known as a Navier-Stokes equation. In many cases we are interested in the incompressible fluids (Ma<0.3), reducing the continuity equation to \begin{equation} \nabla \cdot \mathbf{v}=0 \label{contuinity} \end{equation} and implies simplification

\[\frac{\partial \left( \rho \mathbf{v} \right)}{\partial t}+\nabla \cdot \left( \rho \mathbf{vv} \right)=\frac{\partial \left( \rho \mathbf{v} \right)}{\partial t}+(\rho \mathbf{v}\nabla )\cdot \mathbf{v}\].

Note that in general the $\nabla \cdot \left( \rho \mathbf{vv} \right)$ stands for tensor product \[\nabla \cdot \left( \rho {{\mathbf{v}}^{T}}\mathbf{v} \right)=\left[ \begin{matrix} {{v}_{1}}{{v}_{1}} & ... & {{v}_{1}}{{v}_{n}} \\ ... & ... & ... \\ {{v}_{n}}{{v}_{1}} & ... & {{v}_{n}}{{v}_{n}} \\ \end{matrix} \right]\] An example of incompressible variant in 2D would be \[\left( \mathbf{v}\nabla \right)\mathbf{v}=\left( \left( \begin{matrix} u \\ v \\ \end{matrix} \right)\left( \begin{matrix} \frac{\partial }{\partial x} \\ \frac{\partial }{\partial y} \\ \end{matrix} \right) \right)\left( \begin{matrix} u \\ v \\ \end{matrix} \right)=\left( \begin{matrix} u\frac{\partial u}{\partial x}+v\frac{\partial u}{\partial y} \\ u\frac{\partial v}{\partial x}+v\frac{\partial v}{\partial y} \\ \end{matrix} \right)\]

The goal of CFD is to solve system \ref{NavierStokes} and \ref{contuinity}. It is obvious that a special treatment will be needed to couple both equations. In following discussion we cover some basic approaches, how this can be accomplished.

Solutions algorithms

Artificial compressibility method

The simplest, completely explicit approach, is an artificial compressibility method (ACM), where a compressibility term is included in the mass continuity \[\frac{\partial \mathbf{v}}{\partial t}+(\mathbf{v}\nabla )\cdot \mathbf{v}=-\frac{1}{\rho }\nabla P+\mu {{\nabla }^{2}}\mathbf{v}+\mathbf{f}\] \[\frac{\partial \rho }{\partial t}+\nabla \cdot \mathbf{v}=0\] \[\frac{\partial \rho }{\partial p}\frac{\partial p}{\partial t}+\nabla \cdot \mathbf{v}=0\] Now, the above system can be solved directly.

The addition of the time derivative of the pressure term physically means that waves of finite speed (the propagation of which depends on the magnitude of the ACM) are introduced into the flow field as a mean to distribute the pressure within the domain. In a true incompressible flow, the pressure field is affected instantaneously throughout the whole domain. In ACM there is a time delay between the flow disturbance and its effect on the pressure field. Upon rearranging Equation yields \[\frac{\partial p}{\partial t}+\rho {{C}^{2}}\nabla \cdot \mathbf{v}=0\] where the continuity equation is perturbed by the quantity dp/dt denominated herein as the AC parameter/artificial sound speed recognized by $C[m/s]$ - speed of sound \[\frac{1}{{{C}^{2}}}=\frac{\partial \rho }{\partial p}\] Or in another words \[{{C}^{2}}={{\left( \frac{\partial p}{\partial \rho } \right)}_{S}}\] where $\rho$ is the density of the material. It follows, by replacing partial derivatives, that the isentropic compressibility can be expressed as: \[\beta =\frac{1}{\rho {{C}^{2}}}\] The evaluation of the local ACM parameter in incompressible flows is inspired by the speed of sound computations in compressible flows (for instance, from the perfect gas low). However, in the incompressible flow situation, employing such a relation is difficult, but an artificial relation can be developed from the convective and diffusive velocities. Reverting to the justification of continuity modification, it can be immediately seen that the artificial sound speed must be sufficiently large to have a significant regularizing effect and at the same time must be as small as possible to minimizing perturbations on the incompressibility equation. Therefore, C influences the convergence rate and stability of the solution method. In other words, assists in reducing large disparity in the eigenvalues, leading to a well-conditioned system. Values of in the range of 1–10 are recommended for better convergence to the steady state at which the mass conservation is enforced. In addition, Equation ensures that C does not reach zero at stagnation points that cause instabilities in pseudo-time, effecting convergence

Explicit/Implicit pressure calculation

Applying divergence on \ref{NavierStokes} yields \[\nabla \cdot \frac{\partial \mathbf{v}}{\partial t}+\nabla \cdot (\mathbf{v}\nabla )\cdot \mathbf{v}=-\frac{1}{\rho }{{\nabla }^{2}}P+\nabla \cdot \mu {{\nabla }^{2}}\mathbf{v}+\nabla \cdot \mathbf{f}\]

And since $\nabla \cdot \mathbf{v}=0$ and we can change order in $\nabla \cdot \nabla^2$ and $ \nabla^2 \cdot \nabla$ quation simplifies to \[\frac{1}{\rho }{{\nabla }^{2}}P=\nabla \cdot \mathbf{f}-\nabla \cdot (\mathbf{v}\nabla )\cdot \mathbf{v}\] Now, we need boundary conditions that can be obtained by multiplying the equation with a boundary normal vector \[\mathbf{\hat{n}}\cdot \left( \frac{\partial \mathbf{v}}{\partial t}+(\mathbf{v}\nabla )\cdot \mathbf{v} \right)=\mathbf{\hat{n}}\cdot \left( -\frac{1}{\rho }\nabla P+\mu {{\nabla }^{2}}\mathbf{v}+\mathbf{f} \right)\cdot \mathbf{\hat{n}}\] \[\frac{\partial P}{\partial \hat{n}}=\left( \mu {{\nabla }^{2}}\mathbf{v}+\mathbf{f}-\frac{\partial \mathbf{v}}{\partial t}-(\mathbf{v}\nabla )\cdot \mathbf{v} \right)\cdot \mathbf{\hat{n}}\]

Note that using tangential boundary vector gives equivalent BCs \[\frac{\partial P}{\partial \hat{t}}=\left( \mu {{\nabla }^{2}}\mathbf{v}+\mathbf{f}-\frac{\partial \mathbf{v}}{\partial t}-(\mathbf{v}\nabla )\cdot \mathbf{v} \right)\cdot \mathbf{\hat{t}}\] For No-slip boundaries BCs simplifies to

\[\frac{\partial P}{\partial \hat{n}}=\left( \mu {{\nabla }^{2}}\mathbf{v}+\mathbf{f} \right)\cdot \mathbf{\hat{n}}\] Otherwise an appropriate expression regarding the velocity can be written, i.e. write full and taken in account velocity BCs. For example, Neumann velocity $\frac{\partial u}{\partial x}=0$ in 2D \[\frac{\partial P}{\partial x}=\left( \mu {{\nabla }^{2}}u+{{f}_{x}}-\frac{\partial u}{\partial t}++v\frac{\partial u}{\partial y} \right)\] Note that you allready know everything about the velocity and thus you can compute all the terms explicitely.


So the procedure is: • Compute Navier Stokes either explicitly either implicitly • Solve pressure equations with computed velocities • March in time

Basic boundary conditions Wall: $\mathbf{v}=0$, \[\frac{\partial P}{\partial \hat{n}}=\left( \nabla \cdot \left( \mu \nabla \mathbf{v} \right)+\mathbf{f} \right)\cdot \hat{n}\] Inlet: $\mathbf{v}=\mathbf{a}$, \[\frac{\partial P}{\partial \hat{n}}=\left( \nabla \cdot \left( \mu \nabla \mathbf{v} \right)+\mathbf{f}-\nabla \cdot (\rho \mathbf{v}\cdot \mathbf{v})-\rho \frac{\partial \mathbf{v}}{\partial t} \right)\cdot \hat{n}\]

Above system can be linearized (advection term) and solver either explicitly or implicitly.

Further reading: 5. W. D. Henshaw, A fourth-order accurate method for the incompressible Navier–Stokes equations on overlapping grids, J. Comput. Phys. 113, 13 (1994) 11. J. C. Strikwerda, Finite difference methods for the Stokes and Navier–Stokes equations, SIAM J. Sci. Stat. Comput. 5(1), 56 (1984)

Explicit Pressure correction calculation

Another possibility is to solve pressure correction equation. Again Consider the momentum equation and mass continuity and discretize it explicitly \[\frac{{{\mathbf{v}}_{2}}-{{\mathbf{v}}_{1}}}{\Delta t}=-\frac{1}{\rho }\nabla {{P}_{1}}-({{\mathbf{v}}_{1}}\nabla )\cdot {{\mathbf{v}}_{1}}+\mu {{\nabla }^{2}}{{\mathbf{v}}_{1}}+\mathbf{f}\] Computed velocity obviously do not satisfy the mass contunity and therefore let’s call it itermediate velocity. Intermediate velocity is calculated from guessed pressure and old velocity values \[{{\mathbf{v}}^{iter}}=-\Delta t\left( \frac{1}{\rho }\nabla {{P}_{1}}-({{\mathbf{v}}_{1}}\nabla )\cdot {{\mathbf{v}}_{1}}+\mu {{\nabla }^{2}}{{\mathbf{v}}_{1}}+\mathbf{f} \right)+{{\mathbf{v}}_{1}}\] the correction term is added that drives velocity to divergence free field

\[\nabla \cdot ({{\mathbf{v}}^{iter}}+{{\mathbf{v}}^{corr}})=0\,\,\,\,\,\,\,\to \,\,\,\,\,\,\nabla \cdot {{\mathbf{v}}^{iter}}=-\nabla \cdot {{\mathbf{v}}^{corr}}\]

Velocity correction is affected only by effect of pressure correction. This fact is obvious due to all terms except gradient of pressure on the right side of equation are constant. \[{{\mathbf{v}}^{corr}}=-\frac{\Delta t}{\rho }\nabla {{P}^{corr}}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\] Applying divergence and we get pressure correction poisson equation. \[\,{{\nabla }^{2}}{{P}^{corr}}\,=\frac{\rho }{\Delta t}\nabla \cdot {{\mathbf{v}}^{iter}}\,\]

Boundary condition can be obtained by mulitplying the equation with a normal vector \[\frac{\Delta t}{\rho }\frac{\partial {{P}^{corr}}}{\partial n}\,=\mathbf{\hat{n}}{{\mathbf{v}}^{corr}}\,\,\,\] For dirichlet velocity boundaries it is obvious that velocity correction should be zero, since there is no velocity correction for dirichlet boundary, therefore \[\frac{\partial {{P}^{corr}}}{\partial n}\,=0\]

CBS Algorithm

With the explicit temporal discretization problems is formulated as \[\mathbf{\hat{v}}={{\mathbf{v}}_{0}}+\Delta t\left( -\nabla {{P}_{0}}+\frac{1}{\operatorname{Re}}{{\nabla }^{2}}{{\mathbf{v}}_{0}}-\nabla \cdot ({{\mathbf{v}}_{0}}{{\mathbf{v}}_{0}}) \right)\] \[P={{P}_{0}}-\xi \Delta {{t}_{F}}\nabla \mathbf{\hat{v}}+\xi \Delta {{t}_{F}}\Delta t{{\nabla }^{2}}{{\overset{\scriptscriptstyle\frown}{P}}_{0}},\] where $\mathbf{\hat{v}}\text{,}\Delta t,\text{ and }\xi \text{, }\Delta {{t}_{F}}$stand for intermediate velocity, time step, relaxation parameter, and artificial time step, respectively, and index 0 stands for previous time /iteration step. First, the intermediate velocity is computed from previous time step. Second, the velocity is driven towards solenoidal field by correcting the pressure . Note that no special boundary conditions for pressure are used, i.e., the pressure on boundaries is computed with the same approach as in the interior of the domain. In general, the internal iteration with an artificial time step is required until the divergence of the velocity field is not below required criteria. However, if one is interested only in a steady-state solution, the internal iteration can be skipped and \[\Delta t\] equals \[\Delta {{t}_{F}}\]. Without internal stepping the transient of the solution is distorted by artificial compressibility effect. This approach is also known as ACM with Characteristics-based discretization of continuity equation, where the relaxation parameter relates to the artificial speed of sound [35].

The relaxation parameter should be set between 1-10, lower number more stable solution.

And also dimensional form

\[P={{P}_{0}}-{{C}^{2}}\Delta {{t}_{F}}\rho \nabla \mathbf{\hat{v}}+{{C}^{2}}\Delta {{t}_{F}}\Delta t{{\nabla }^{2}}{{P}_{0}}\],

Where C is speed of sound [m/s]

Numerical solutions