BCs System

This system is used to specify generic, non-LBM boundary conditions for the real-space finite-difference solve path (as opposed to the LBM-specific lattice boundary conditions under the Boundary system).

Overview

Each object fills the ghost cells of one buffer on one face (left, right, bottom, top, back, front) of a non-periodic axis, before any compute that reads the ghost cells runs. All of them impose the cell-centred Robin condition

on the face, with the outward normal, approximated by the average of the boundary-adjacent cell and its ghost, and by their difference over the grid spacing. TensorDirichletBC (, ) and TensorNeumannBC (, ) are presets of TensorRobinBC. Every non-periodic face of a buffer that is read with ghost cells needs a boundary condition.

The coefficients and are constants. The value (value and flux in the presets) is a constant, or varies along the face, given by at most one of

  • a function (c_function, value_function, flux_function), evaluated at the face position and the cell centres along the face, at the time of the solve: the current time for explicit solvers, the new time for ImplicitFDSolver, or

  • a buffer (c_buffer, value_buffer, flux_buffer), whose first owned cell layer next to the face holds . The compute that writes it must evaluate at the face position, not at the cell centres. Its values are those the compute last wrote: for ImplicitFDSolver, whose explicit computes run at the start of the substep, they lag the new time by one time step. A buffer that no compute or initial condition writes is an error. The compute runs before any compute that reads the variable with ghost cells.

A stencil reaching cells across the face (e.g. two for the 5-point Laplacian) needs ghost layers. Ghost layer is filled from the same condition applied to it and its mirror, owned cell from the face, which are apart: the even mirror for a zero-flux face and the odd mirror about for a Dirichlet face. Every rank next to the face must own at least cells normal to it, and must be nonzero for each layer; both are checked at setup.

Example Input File Syntax

A Dirichlet condition on the left face and a Neumann condition on the right face of a domain that is periodic in :

[Domain<<<{"href": "../../Domain/index.html"}>>>]
  dim<<<{"description": "Problem dimension"}>>> = 2
  nx<<<{"description": "Number of elements in the X direction"}>>> = 20
  ny<<<{"description": "Number of elements in the Y direction"}>>> = 8
  parallel_mode<<<{"description": "Parallelization mode."}>>> = REAL_SPACE
  periodic_directions<<<{"description": "Periodic directions of the simulation cell (controls halo exchange wrap-around)."}>>> = 'Y'
  xmin<<<{"description": "Lower X Coordinate of the generated mesh"}>>> = 0
  xmax<<<{"description": "Upper X Coordinate of the generated mesh"}>>> = 1
  ymin<<<{"description": "Lower Y Coordinate of the generated mesh"}>>> = -1
  ymax<<<{"description": "Upper Y Coordinate of the generated mesh"}>>> = 1
[]

[TensorComputes<<<{"href": "../index.html"}>>>]
  [BCs<<<{"href": "index.html"}>>>]
    [left]
      type = TensorDirichletBC<<<{"description": "Dirichlet boundary condition (u = value) on a non-periodic domain face.", "href": "../../../source/tensor_computes/TensorDirichletBC.html"}>>>
      variable<<<{"description": "The field this boundary condition applies to."}>>> = u
      boundary<<<{"description": "Which face of the domain this boundary condition applies to."}>>> = left
      value<<<{"description": "Prescribed value of the field on this face (u = value)."}>>> = 1
    []
    [right]
      type = TensorNeumannBC<<<{"description": "Neumann boundary condition (du/dn = flux) on a non-periodic domain face.", "href": "../../../source/tensor_computes/TensorNeumannBC.html"}>>>
      variable<<<{"description": "The field this boundary condition applies to."}>>> = u
      boundary<<<{"description": "Which face of the domain this boundary condition applies to."}>>> = right
      flux<<<{"description": "Prescribed outward normal flux on this face (du/dn = flux)."}>>> = 2
    []
  []
[]
(test/tests/real_space/neumann_linear.i)

Values that vary along the face, from functions and from buffers:

[TensorComputes<<<{"href": "../index.html"}>>>]
  [BCs<<<{"href": "index.html"}>>>]
    [left]
      # evaluated at the face position x = 0, where it is y
      type = TensorDirichletBC<<<{"description": "Dirichlet boundary condition (u = value) on a non-periodic domain face.", "href": "../../../source/tensor_computes/TensorDirichletBC.html"}>>>
      variable<<<{"description": "The field this boundary condition applies to."}>>> = u
      boundary<<<{"description": "Which face of the domain this boundary condition applies to."}>>> = left
      value_function<<<{"description": "Function giving the field value along the face, evaluated at the face position at the solve time."}>>> = u_func
    []
    [right]
      type = TensorDirichletBC<<<{"description": "Dirichlet boundary condition (u = value) on a non-periodic domain face.", "href": "../../../source/tensor_computes/TensorDirichletBC.html"}>>>
      variable<<<{"description": "The field this boundary condition applies to."}>>> = u
      boundary<<<{"description": "Which face of the domain this boundary condition applies to."}>>> = right
      value_buffer<<<{"description": "Buffer whose first owned cell layer next to the face holds the field value along the face. The compute that writes it must evaluate it at the face position, not at the cell centres."}>>> = right_value
    []
    [bottom]
      type = TensorNeumannBC<<<{"description": "Neumann boundary condition (du/dn = flux) on a non-periodic domain face.", "href": "../../../source/tensor_computes/TensorNeumannBC.html"}>>>
      variable<<<{"description": "The field this boundary condition applies to."}>>> = u
      boundary<<<{"description": "Which face of the domain this boundary condition applies to."}>>> = bottom
      flux_buffer<<<{"description": "Buffer whose first owned cell layer next to the face holds the outward normal flux along the face. The compute that writes it must evaluate it at the face position, not at the cell centres."}>>> = bottom_flux
    []
    [top]
      type = TensorNeumannBC<<<{"description": "Neumann boundary condition (du/dn = flux) on a non-periodic domain face.", "href": "../../../source/tensor_computes/TensorNeumannBC.html"}>>>
      variable<<<{"description": "The field this boundary condition applies to."}>>> = u
      boundary<<<{"description": "Which face of the domain this boundary condition applies to."}>>> = top
      flux_function<<<{"description": "Function giving the outward normal flux along the face, evaluated at the face position at the solve time."}>>> = top_flux
    []
  []
[]
(test/tests/real_space/bc_varying_laplacian.i)

Available Objects

Available Actions

  • Marlin App
  • AddTensorBCActionAdd a TensorBoundaryCondition object to the simulation.