Convection in a box with prescribed, variable velocity boundary conditions#

A similarly simple setup to the ones considered in the previous subsections is to equip the model we had with a different set of boundary conditions. There, we used slip boundary conditions, i.e., the fluid can flow tangentially along the four sides of our box but this tangential velocity is unspecified. On the other hand, in many situations, one would like to actually prescribe the tangential flow velocity as well. A typical application would be to use boundary conditions at the top that describe experimentally determined velocities of plates. This cookbook shows a simple version of something like this. To make it slightly more interesting, we choose a \(2\times 1\) domain in 2d.

Like for many other things, has a set of plugins for prescribed velocity boundary values (see Sections Boundary velocity model and Prescribed velocity boundary conditions). These plugins allow one to write sophisticated models for the boundary velocity on parts or all of the boundary, but there is also one simple implementation that just takes a formula for the components of the velocity.

To illustrate this, let us consider the cookbooks/platelike-boundary.prm input file. It essentially extends the input file considered in the previous example. The part of this file that we are particularly interested in in the current context is the selection of the kind of velocity boundary conditions on the four sides of the box geometry, which we do using a section like this:

subsection Boundary velocity model
  set Tangential velocity boundary indicators = left, right, bottom
  set Prescribed velocity boundary indicators = top: function

  subsection Function
    set Variable names      = x,z,t
    set Function constants  = pi=3.1415926
    set Function expression = if(x>1+sin(0.5*pi*t), 1, -1); 0
  end
end

We use tangential flow at boundaries named left, right and bottom. Additionally, we specify a comma separated list (here with only a single element) of pairs consisting of the name of a boundary and the name of a prescribed velocity boundary model. Here, we use the function model on the top boundary, which allows us to provide a function-like notation for the components of the velocity vector at the boundary.

The second part we need is that we actually describe the function that sets the velocity. We do this in the subsection Function. The first of these parameters gives names to the components of the position vector (here, we are in 2d and we use \(x\) and \(z\) as spatial variable names) and the time. We could have left this entry at its default, x,y,t, but since we often think in terms of “depth” as the vertical direction, let us use z for the second coordinate. In the second parameter we define symbolic constants that can be used in the formula for the velocity that is specified in the last parameter. This formula needs to have as many components as there are space dimensions, separated by semicolons. As stated, this means that we prescribe the (horizontal) \(x\)-velocity and set the vertical velocity to zero. The horizontal component is here either \(1\) or \(-1\), depending on whether we are to the right or the left of the point \(1+\sin(\pi t/2)\) that is moving back and forth with time once every four time units. The if statement understood by the parser we use for these formulas has the syntax if(condition, value-if-true, value-if-false).

The remainder of the setup is described in the following, complete input file:

############### Global parameters

set Dimension                              = 2
set Start time                             = 0
set End time                               = 20
set Use years in output instead of seconds = false
set Output directory                       = output-platelike-boundary


############### Parameters describing the model
# Let us here choose again a box domain of size 2x1
# where we fix the temperature at the bottom and top,
# allow free slip along the bottom, left and right,
# and prescribe the velocity along the top using the
# `function' description.

subsection Geometry model
  set Model name = box

  subsection Box
    set X extent = 2
    set Y extent = 1
  end
end


# We then set the temperature to one at the bottom and zero
# at the top:
subsection Boundary temperature model
  set Fixed temperature boundary indicators = bottom, top
  set List of model names = box

  subsection Box
    set Bottom temperature = 1
    set Top temperature    = 0
  end
end


# The velocity along the top boundary models a spreading
# center that is moving left and right:
subsection Boundary velocity model
  set Tangential velocity boundary indicators = left, right, bottom
  set Prescribed velocity boundary indicators = top: function

  subsection Function
    set Variable names      = x,z,t
    set Function constants  = pi=3.1415926
    set Function expression = if(x>1+sin(0.5*pi*t), 1, -1); 0
  end
end


# We then choose a vertical gravity model and describe the
# initial temperature with a vertical gradient. The default
# strength for gravity is one. The material model is the
# same as before.
subsection Gravity model
  set Model name = vertical
end


subsection Initial temperature model
  set Model name = function

  subsection Function
    set Variable names      = x,z
    set Function expression = (1-z)
  end
end


subsection Material model
  set Model name = simple

  subsection Simple model
    set Thermal conductivity          = 1e-6
    set Thermal expansion coefficient = 1e-4
    set Viscosity                     = 1
  end
end


# The final part of this input file describes how many times the
# mesh is refined and what to do with the solution once computed
subsection Mesh refinement
  set Initial adaptive refinement        = 0
  set Initial global refinement          = 5
  set Time steps between mesh refinement = 0
end


subsection Postprocess
  set List of postprocessors = visualization, temperature statistics, heat flux statistics

  subsection Visualization
    set Time between graphical output = 0.1
  end
end

This model description yields a setup with a Rayleigh number of 200 (taking into account that the domain has size 2). It would, thus, be dominated by heat conduction rather than convection if the prescribed velocity boundary conditions did not provide a stirring action. Visualizing the results of this simulation1 yields images like the ones shown in Fig. 27.

../../../../../_images/platelike.png

Fig. 27 Variable velocity boundary conditions: Temperature and velocity fields at the initial time (top left) and at various other points in time during the simulation.#


1

In fact, the pictures are generated using a twice more refined mesh to provide adequate resolution. We keep the default setting of five global refinements in the parameter file as documented above to keep compute time reasonable when using the default settings.