Tutorial 1 - gnomeCreative/HYBIRD GitHub Wiki

logo

Laminar Channel Flow (Poiseuille Flow)

This first example consists of developing a very basic flow using LBM. We consider a laminar flow between two parallel walls, driven by a constant pressure gradient, as shown in the figure below.

Newtonian Geometry for the Newtonian Poiseuille flow.

The flow has periodic boundary conditions in $x$ and $y$ directions, while in $z$ direction a no-slip condition is applied. This type of flow is called Poiseuille flow. For this case, an analytical solution of the Navier-Stokes equations exists. The theory can be found in classical fluid mechanics books. From the analytical solution, it is known that the velocity profile in the vertical direction assumes a parabolic shape. This profile refers to a flow at $\textrm{Re} = 12.5$, where $\textrm{Re} = U \rho_\textrm{f} H /\nu$ is the Reynolds number, based on the mean velocity $U$, half channel height $H$ and the dynamic viscosity $\nu$. The maximum velocity at the centre of the channel should be:

$u_\textrm{N,max}=\frac{f_x \rho_\textrm{f} H^2} {2\nu}$

with $f_x$ the imposed pressure gradient.

We impose density $\rho_\textrm{f}=1~\textrm{kg}/\textrm{m}^3$, dynamic viscosity $\nu=0.2~\textrm{kg}/\textrm{m}\textrm{s}$, external acceleration $f_x=1~\textrm{m}/\textrm{s}^2$, and channel half width $H=2~\textrm{m}$. With these settings, the maximum velocity should be $u_\textrm{N,max}=2.5~\textrm{m}/\textrm{s}$. We discretize using a cuboid with dimensions $1\times10\times200$ in the three directions.

Setting the Environment

All configuration files should be set inside the tutorials/laminar_flow folder. Here, the DEM part is deactivated by choosing empty particles (particleFile=./null.dat) and object files (objectFile=./null.dat). The null.dat files must be provided (these are files containing a single 0), otherwise, the code will stop execution. The configuration file is already ready for use (laminar_flow.cfg), but the most important features are described here. As an exercise, the user can try to reconstruct it from scratch.

We are using only the LBM solver, and we do not need the free-surface algorithm for this, so we set:

  • demSolver=0 No DEM.
  • lbSolver=1 LBM is on.
  • freeSurfaceSolver=0
  • forceFieldSolver=1 We need an external forcing for our flow to develop.

In this case, a minimal setup is necessary for the output files:

  • maxTime=20.0 The code will run for $0~\textrm{s}$ simulation time.
  • restartFluid=false Computation is from scratch, no restart file is required.
  • fluidRecycleExpTime=false No restart files will be generated.
  • screenExpTime=0.1 The code will show a state line on screen every $0.1~\textrm{s}$ simulation time.
  • fluidExpTime=1.0 The code will generate a fluid Paraview file every $1.0~\textrm{s}$ simulation time.
  • fluidLagrangianExpTime=0 The code will not generate Lagrangian fluid Paraview files.

The boundary conditions are periodicity in xx and yy, and no-slip walls on zz. This can be set by specifying:

boundary0=periodic boundary1=periodic boundary2=periodic boundary3=periodic boundary4=stat_wall boundary5=stat_wall

Domain setup:

  • latticeSpacing=0.01
  • domainSizeX=0.1 The lattice spacing in $x$ is equal to 10 lattice spacings, so that we can visualise the flow field.
  • domainSizeY=0.01 The lattice spacing in $y$ is equal to the lattice spacing, so that we work with a single sheet of fluid cells.
  • domainSizeZ=2.0, so that our half-channel height $L$ is unitary.
  • fluidMinX=-100.0 and fluidMaxX=100.0 Since we set the minimum and maximum borders of the fluid to be beyond the domain borders, the fluid will fill the whole space (same for directions $y$ and $z$).

The physical parameters are the following:

  • rheologyModel=NEWTONIAN We use a simple Newtonian model.
  • fluidDensity=1.0 The fluid mass density $\rho_\textrm{f}$.
  • initVisc=0.2 The dynamic viscosity $\nu$.
  • forceX=1.0 The imposed pressure gradient $f_x$.
  • turbulenceSolver=0 No need for a turbulence model.

The code is configured by setting the following options:

fluidTimeStep=0 The code will choose the time step automatically, so that the relaxation time $\tau$ will be unitary. In this case, this corresponds to $\Delta t= 8.3 \cdot 10^{-5}$.

Running the Code

To run the code, we need to create a folder somewhere that can be reached with a terminal (e.g., the Cygwin folder). We need to put in this folder:

  • The configuration file laminar_flow.cfg.
  • A file with just 0 in it, to indicate that no particles are used.
  • A folder to store outputs (which can be simply called "results").
  • The executable hybird.exe.

At the end, the folder should look something like this:

laminar_flow_folder Structure of the folder to run the laminar flow tutorial.

The following command should be issued in the terminal, once this has positioned inside the examples/laminarFlow folder. To run it, execute the command line:

./hybird.exe -c incline_flow.cfg -d results -n time

The code will run, and it will print on screen the value of the maximum velocity. You can see it increasing slowly towards convergence.

Visualising the results

The code will also create a subfolder with a timestamp inside the results folder. To visualise the results, open Paraview and load the fluid files (see The fluid files).

laminarflow1 Field visualization of the laminar Poiseuille flow.

Loading the Paraview files will result in a cuboid dataset. To visualise the flow, the easiest way is by using a section, provided by the filter Slice, shown in the figure with a green square. The slice position is set by the Plane Parameters, highlighted in the figure above. This can be automatically done by pressing the Y Normal option. The slice can be coloured using the field v (Magnitude).

laminarflow2 Graphical visualization of the laminar Poiseuille flow.

Another way to visualise the data is by obtaining a graph. This can be done by selecting the filter Plot Over Line, see the green highlights in the figure above. Once again, the settings in Line Parameter should be defined, but this is done automatically by pressing Z Axis. The profile should be a parabola, with maximum u=2.5 for z=1.0.