Tag Archives: Navier-Stokes

Time-Varying Cylinder Motion in Cross-flow: timeVaryingFixedUniformValue

This post is a simple demonstration of the timeVaryingFixedUniformValue boundary condition. This boundary condition allows a Dirichlet-type boundary condition to be varied in time. To demonstrate, we will modify the oscillating cylinder case.


Instead of using the oscillating boundary condition for point displacement. We will have the cylinder do two things:

  • Move in a circular motion
  • Move in a sinusoidal decay motion

The basics of this boundary condition are extremely simple. Keep in mind that although (here) we are modifying the pointDisplacement boundary condition for the cylinder, the basics of this BC would be the same if you were doing a time varying boundary condition for say pressure or velocity.

In the pointDisplacement file:

 type timeVaryingUniformFixedValue;
 fileName "prescribedMotion";
 outOfBounds clamp;

fileName points to the file where the time varying boundary condition is defined. Here we used a file called prescribedMotion however you can name it whatever you want. The outOfBounds variable dictates what the simulation should do if the simulation time progresses outside of the time domain defined in the file.

The additional file containing the desired motion prescribedMotion is formatted in the following way:

( 0 (0 0 0))
( 0.005 (-0.0000308418795848531 0.00392682932795517 0))
( 0.01 (-0.0001233599085671 0.00785268976953207 0))
( 0.015 (-0.000277531259507496 0.0117766126774107 0))
( 0.02 (-0.00049331789293211 0.0156976298823283 0))
( 9.99 (-0.0001233599085671 -0.00785268976953189 0))
( 9.995 (-0.0000308418795848531 -0.00392682932795479 0))
( 10 (0 -3.06161699786838E-016 0))

The first column is the time in seconds, and the vector defines the point displacement. In the present tutorial, these points were calculated in libreOffice and then exported into the text file.  I arbitrarily made up the motions purely for the sake of making this blog post.

The circular motion was defined as:

x=0.25\cos\left(\pi t\right)-0.25 and y=0.25\sin\left(\pi t\right)

Decaying sinusoidal motion was:

y=\sin(\pi t) \exp\left(-t/2\right)

The rest of the set-up is identical to the set-up in the oscillating cylinder example. The solver pimpleDyMFoam is then run.


Circular Motion


Sinusoidal Decay



This post demonstrated how a more complicated motion can be prescribed by using a little math and the timeVaryingUniformFixedValue boundary condition. Always like to hear questions and comments! Has anybody else done something like this?


Hagen-Poiseuille flow

Here, I am going to go over the solution to fully developed laminar pipe flow. This is a canonical problem and provides an exact solution to the Navier-Stokes equations. It is often referred to as the Hagen-Poiseuille flow problem.

The problem is depicted in the figure below:

Fig: Hagen-Poiseuille Flow Problem Definition

In this problem, we are examining laminar flow through a pipe. The problem states that the flow in the pipe is being driven by a constant pressure gradient in the axial direction (dP/dz=constant). We assume that the flow is purely axial (v_r = v_\theta =0), steady state (\partial / \partial t  =0), incompressible (ρ=constant), axisymmetric (\partial / \partial \theta  =0). We also neglect gravity.

First we start with the axial Navier-Stokes momentum equation in cylindrical coordinates:

\rho v_z \frac{\partial v_z}{\partial z} = -\frac{dp}{dz}+\frac{\mu}{r} \frac{d}{dr}\left(r \frac{dv_z}{dr}\right)

By using our assumptions we can reduce this equation to give us:

\frac{dp}{dz}=\frac{\mu}{r} \frac{d}{dr}\left(r \frac{dv_z}{dr}\right)

Because we know that dP/dz is a constant, this function is easily integrated twice. The first integration:


And the second integration:

v_z=\frac{r^2}{4\mu}\frac{dP}{dz}+A \ln(r)+B

Now we apply our boundary conditions!

No slip condition at r=R : v_z=0=\frac{dP}{dz}\frac{R^2}{4\mu}+A\ln(r)+B

Finite axial velocity at r=0: v_z=0+A \ln(0)+B

Since ln(0) is a discontinuity, we know that in order for these equations to be satisfied, A must be equal to zero (ie A=0). Then combining these two equations, we get that:


Thus our final solution is:


And there we have our answer!

Couette Flow (Moving Wall)

In this post I am going to go through the solution to the moving wall Couette flow problem.

An illustration of the problem is given below:

Fig 1: Illustration of Couette Flow

In this problem, the fluid between two parallel plates is being driven by the motion of the top plate. Here, we assume that the flow is axial (v=w=0), incompressible (ρ=constant), fully developed (u only a function of y). We also assume that gravity can be neglected and that no pressure gradient is present (dp/dx=0).

First we start with the Navier-Stokes momentum equation in the x-direction:

\rho\left(u\frac{\partial u}{\partial x}+ v \frac{\partial u}{\partial y}\right) = \frac{\partial p}{\partial x} + \mu\left( \frac{\partial^2 u}{\partial y^2}+\frac{\partial^2 u}{\partial y^2}\right)

By applying our assumptions listed above, you should be able to see that the equation simply becomes:

\frac{d^2 u}{dy^2}=0

To solve the problem we must integrate this equation and solve using the boundary conditions defined by the problem. The integration results in:


Our boundary conditions come from the problem and our super smart knowledge of the no-slip condition ;). Ie.

@ y=h, u=V

@ y=0, u=0

After subbing in we get two equations, with two unknowns (the integration constants)



Therefore we can see that B=0 and A=V/h. This leads to the final solution of this plane Couette flow problem:


Now we have shown that the velocity profile in this case is the linear profile above. We can also calculate the shear stress:

\tau=\mu \frac{du}{dy} = \mu \frac{V}{h}

Any thoughts or questions please respond in the comments!