Skip to main content
The solver supports two types of velocity boundary conditions: periodic and Dirichlet. The choice is controlled by the periodic_dimension flag in CartesianGeometry and, for non-periodic directions, by registering RobinBcCoefStrategy objects in C++ code.
Only periodic and Dirichlet conditions are currently implemented for the velocity fields. Neumann (pure flux) conditions on velocity are not supported.

Periodic boundary conditions

Periodic BCs are the simplest option and require no extra C++ code. Set periodic_dimension = 1 for each direction you want to be periodic inside the CartesianGeometry block:
A value of 0 in any entry disables periodicity in that direction and requires explicit BCs to be registered for both velocity and (optionally) volume fraction.

Dirichlet boundary conditions via RobinBcCoefStrategy

For non-periodic directions, you must provide one RobinBcCoefStrategy object per velocity component per phase, and register them with the integrator before calling initializePatchHierarchy. The Robin BC formula is:
For a pure Dirichlet condition, set a = 1 and b = 0; then g is the prescribed velocity value.

Registering BCs in C++

The integrator does not take ownership of these objects; you are responsible for deleting them after the simulation ends.

muParserRobinBcCoefs input format

muParserRobinBcCoefs reads its coefficients from a named sub-block in the input file. Each boundary face in 2D has an index 0–3 (left, right, bottom, top), so four entries are needed for each of acoef, bcoef, and gcoef.
The block name must match the name passed to the muParserRobinBcCoefs constructor (un_bcs_0 above). The subscript on the block name corresponds to the velocity component direction (0 = x-component, 1 = y-component). Expression strings follow the same muParser syntax as initial condition blocks: X_0, X_1 for coordinates and t for time.
You can reference top-level scalars defined earlier in the file inside gcoef expressions. For example, if UN_0 = "sin(2*PI*X_0)*cos(2*PI*X_1)" is defined at the top level, you can write gcoef_function_0 = UN_0 to avoid repetition.

Channel flow example

A channel flow with parabolic inflow in the x-direction (X_1 * (1 - X_1)) and no-slip walls at top and bottom:
The same structure is repeated for us_bcs_0 and us_bcs_1 for the solvent-phase velocity.

Volume fraction boundary conditions

When the volume fraction is not advected by an AdvDiffHierarchyIntegrator, you can optionally register Dirichlet BCs for thn via registerVolumeFractionBoundaryConditions:
When thn is advected with an AdvDiffIntegrator, register the BC with the advection–diffusion integrator instead:
If no volume fraction BC object is provided, the solver falls back to linear extrapolation at physical boundaries. The input block has the same acoef/bcoef/gcoef structure as velocity BCs:
Volume fraction BCs are ignored at periodic boundaries regardless of how they are registered. Only non-periodic boundaries use the thn_bc values.

BC face index reference

In 2D, the four boundary faces have the following index assignments: In 3D, indices 4 (front, −z) and 5 (back, +z) are added and all six faces must be specified.

MultigridCartesianGeometry block

For non-periodic simulations, a second MultigridCartesianGeometry block with periodic_dimension = 1, 1 is sometimes used to configure the multigrid preconditioner on a periodic auxiliary problem. This is an advanced option and is only required when the physical domain is non-periodic but you want the preconditioner to use periodic coarse-grid solves: