# BCs System

## Boundary Condition

A

`BoundaryCondition`

provides a residual (and optionally a Jacobian) on a boundary (or internal side) of a domain.The structure is very similar to Kernels

`computeQpResidual`

/`Jacobian()`

Parameters

Coupling

The only difference is that some BCs are NOT integrated over the boundary... and instead specify values on Boundaries (Dirichlet).

BCs which are integrated over the boundary inherit from

`IntegratedBC`

.Non-integrated BCs inherit from

`NodalBC`

.

## (Some) Values Available to BCs

Integrated BCs:

`_u, _grad_u`

: Value and gradient of the variable this BC is operating on.`_phi, _grad_phi`

: Value () and gradient () of the trial function.`_test,_grad_test`

: Value () and gradient () of the test function.`_q_point`

: XYZ coordinates`_i, _j`

: test and trial shape function indices.`_qp`

: Current quadrature point index.`_normals`

: Normal vector.`_boundary_id`

: The boundary ID.`_current_elem`

: A pointer to the element.`_current_side`

: The side number of`_current_elem`

Non-integrated BCs:

`_u`

`_qp`

`_boundary_id`

`_current_node`

: A pointer to the current node that is being operated on.

## Coupling and BCs

The coupling of values and gradients into BCs is done the same way as in Kernels and materials :

`coupledValue()`

`coupledValueOld()`

`coupledValueOlder()`

`coupledGradient()`

`coupledGradientOld()`

`coupledGradientOlder()`

`coupledDot()`

## Dirichlet BCs

Set a condition on the

`value`

of a variable on a boundary.Usually... these are NOT integrated over the boundary.

Becomes:

In the following example:

And therefore:

## Integrated BCs

Integrated BCs (including Neumann BCs) are actually integrated over the external face of an element.

Their residuals lokk similar to kernels. Thus

Becomes:

Also note that if , then the boundary integral is zero (sometimes known os the "natural boundary condition").

## Example 4

Look at Example 4

## Periodic BCs

Periodic boundary conditions are useful for modeling quasi-infinite domains and systems with conserved quantities.

MOOSE has full support for periodic BCs

1D, 2D and 3D.

With mesh adaptivity.

Can be restricted to specific variables.

Supports arbitrary translation vectors for defining periodicity.

```
[BCs]
[./Periodic]
[./all]
variable = u
#Works for any regular orthogonal
#mesh with defined boundaries
auto_direction = 'x y'
[../]
[../]
[]
```

```
[BCs]
[./Periodic]
[./x]
primary = 1
secondary = 4
transform_func = 'tr_x tr_y'
inv_transform_func = 'itr_x itr_y'
[../]
[../]
[]
```

Normal usage: with an axis-aligned mesh, use

`auto-direction`

to supply the coordinate direction to wrap.Advanced usage: specify a translation or transformation function.

```
[BCs]
[./Periodic]
[./x]
variable = u
primary = 'left'
secondary = 'right'
translation = '10 0 0'
[../]
[../]
[]
```

## Periodic Example

Look at Example 4 Periodic Example

## Further BCs documentation

- Moose App
- ConvectiveFluxBCDetermines boundary values via the initial and final values, flux, and exposure duration
- DGFunctionDiffusionDirichletBC
- DiffusionFluxBCComputes a boundary residual contribution consistent with the Diffusion Kernel. Does not impose a boundary condition; instead computes the boundary contribution corresponding to the current value of grad(u) and accumulates it in the residual vector.
- DirichletBCImposes the essential boundary condition , where is a constant, controllable value.
- EigenDirichletBCDirichlet BC for eigenvalue solvers
- FunctionDirichletBCImposes the essential boundary condition , where is a (possibly) time and space-dependent MOOSE Function.
- FunctionNeumannBCImposes the integrated boundary condition , where is a (possibly) time and space-dependent MOOSE Function.
- FunctionPenaltyDirichletBC
- FunctionPresetBCThe same as FunctionDirichletBC except the value is applied before the solve begins
- LagrangeVecDirichletBCImposes the essential boundary condition , where are constant, controllable values.
- LagrangeVecFunctionDirichletBCImposes the essential boundary condition , where components are calculated with functions.
- MatchedValueBCImplements a NodalBC which equates two different Variables' values on a specified boundary.
- NeumannBCImposes the integrated boundary condition , where is a constant, controllable value.
- OneDEqualValueConstraintBC
- PenaltyDirichletBCEnforces a Dirichlet boundary condition in a weak sense by penalizing differences between the current solution and the Dirichlet data.
- PostprocessorDirichletBC
- PostprocessorNeumannBC
- PresetBCSimilar to DirichletBC except the value is applied before the solve begins
- SinDirichletBCImposes a time-varying essential boundary condition , where varies from an given initial value at time to a given final value over a specified duration.
- SinNeumannBCImposes a time-varying flux boundary condition , where varies from an given initial value at time to a given final value over a specified duration.
- VacuumBC
- VectorNeumannBCImposes the integrated boundary condition , where is a user-defined, constant vector.
- WeakGradientBCComputes a boundary residual contribution consistent with the Diffusion Kernel. Does not impose a boundary condition; instead computes the boundary contribution corresponding to the current value of grad(u) and accumulates it in the residual vector.
- Rdg App
- AEFVBCA boundary condition kernel for the advection equation using a cell-centered finite volume method.
- Functional Expansion Tools App
- FXFluxBCSets a flux boundary condition, evaluated using a FunctionSeries instance. This does not fix the flux, but rather 'strongly encourages' flux agreement by penalizing the differences through contributions to the residual.
- FXValueBCImposes a fixed value boundary condition, evaluated using a FunctionSeries instance.
- FXValuePenaltyBCSets a value boundary condition, evaluated using a FunctionSeries instance. This does not fix the value, but rather 'strongly encourages' value agreement by penalizing the differences through contributions to the residual.
- XFEMApp
- CrackTipEnrichmentCutOffBCSimilar to DirichletBC except the value is applied before the solve begins
- Heat Conduction App
- ConvectiveFluxFunctionDetermines boundary value by fluid heat transfer coefficient and far-field temperature
- CoupledConvectiveFlux
- CoupledConvectiveHeatFluxBCConvective heat transfer boundary condition with temperature and heat transfer coefficent given by auxiliary variables.
- GapHeatTransferTransfers heat across a gap between two surfaces dependant on the gap geometry specified.
- HeatConductionBC
- Tensor Mechanics App
- CoupledPressureBCApplies a pressure from a variable on a given boundary in a given direction
- DashpotBC
- DisplacementAboutAxisImplements a boundary condition that enforces rotationaldisplacement around an axis on a boundary
- InteractionIntegralBenchmarkBC
- PresetAccelerationPrescribe acceleration on a given boundary in a given direction
- PresetDisplacementPrescribe the displacement on a given boundary in a given direction.
- PresetVelocity
- PressureApplies a pressure on a given boundary in a given direction
- StickyBCImposes the boundary condition if exceeds the bounds provided
- Navier Stokes App
- EnergyFreeBC
- INSMomentumNoBCBCLaplaceFormThis class implements the 'No BC' boundary condition based on the 'Laplace' form of the viscous stress tensor.
- INSMomentumNoBCBCTractionFormThis class implements the 'No BC' boundary condition based on the 'traction' form of the viscous stress tensor.
- INSTemperatureNoBCBCThis class implements the 'No BC' boundary condition discussed by Griffiths, Papanastiou, and others.
- ImplicitNeumannBCThis class implements a form of the Neumann boundary condition in which the boundary term is treated 'implicitly'.
- MassFreeBC
- MomentumFreeBC
- MomentumFreeSlipBC
- NSEnergyInviscidSpecifiedBCThis class corresponds to the inviscid part of the 'natural' boundary condition for the energy equation.
- NSEnergyInviscidSpecifiedDensityAndVelocityBCThis class corresponds to the inviscid part of the 'natural' boundary condition for the energy equation.
- NSEnergyInviscidSpecifiedNormalFlowBCThis class corresponds to the inviscid part of the 'natural' boundary condition for the energy equation.
- NSEnergyInviscidSpecifiedPressureBCThis class corresponds to the inviscid part of the 'natural' boundary condition for the energy equation.
- NSEnergyInviscidUnspecifiedBCThis class corresponds to the inviscid part of the 'natural' boundary condition for the energy equation.
- NSEnergyViscousBCThis class couples together all the variables for the compressible Navier-Stokes equations to allow them to be used in derived IntegratedBC classes.
- NSEnergyWeakStagnationBCThe inviscid energy BC term with specified normal flow.
- NSImposedVelocityBCImpose Velocity BC.
- NSImposedVelocityDirectionBCThis class imposes a velocity direction component as a Dirichlet condition on the appropriate momentum equation.
- NSInflowThermalBCThis class is used on a boundary where the incoming flow values (rho, u, v, T) are all completely specified.
- NSMassSpecifiedNormalFlowBCThis class implements the mass equation boundary term with a specified value of rho*(u.n) imposed weakly.
- NSMassUnspecifiedNormalFlowBCThis class implements the mass equation boundary term with the rho*(u.n) boundary integral computed implicitly.
- NSMassWeakStagnationBCThe inviscid energy BC term with specified normal flow.
- NSMomentumConvectiveWeakStagnationBCThe convective part (sans pressure term) of the momentum equation boundary integral evaluated at specified stagnation temperature, stagnation pressure, and flow direction values.
- NSMomentumInviscidNoPressureImplicitFlowBCMomentum equation boundary condition used when pressure
*is not*integrated by parts. - NSMomentumInviscidSpecifiedNormalFlowBCMomentum equation boundary condition in which pressure is specified (given) and the value of the convective part is allowed to vary (is computed implicitly).
- NSMomentumInviscidSpecifiedPressureBCMomentum equation boundary condition in which pressure is specified (given) and the value of the convective part is allowed to vary (is computed implicitly).
- NSMomentumPressureWeakStagnationBCThis class implements the pressure term of the momentum equation boundary integral for use in weak stagnation boundary conditions.
- NSMomentumViscousBCThis class corresponds to the viscous part of the 'natural' boundary condition for the momentum equations.
- NSPenalizedNormalFlowBCThis class penalizes the the value of u.n on the boundary so that it matches some desired value.
- NSPressureNeumannBCThis kernel is appropriate for use with a 'zero normal flow' boundary condition in the context of the Euler equations.
- NSStagnationPressureBCThis Dirichlet condition imposes the condition p_0 = p_0_desired.
- NSStagnationTemperatureBCThis Dirichlet condition imposes the condition T_0 = T_0_desired.
- NSThermalBCNS thermal BC.
- Chemical Reactions App
- ChemicalOutFlowBCChemical flux boundary condition
- Porous Flow App
- PorousFlowHalfCubicSinkApplies a flux sink to a boundary. The base flux defined by PorousFlowSink is multiplied by a cubic.
- PorousFlowHalfGaussianSinkApplies a flux sink to a boundary. The base flux defined by PorousFlowSink is multiplied by a Gaussian.
- PorousFlowPiecewiseLinearSinkApplies a flux sink to a boundary. The base flux defined by PorousFlowSink is multiplied by a piecewise linear function.
- PorousFlowSinkApplies a flux sink to a boundary.

- Moose App
- Periodic
- Tensor Mechanics App
- CavityPressure
- CoupledPressure
- Pressure

- Moose App
- AddBCAction