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, ora 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
- Marlin App
- AnisotropicGBEnergyEvaluates anisotropic grain-boundary energy from a TorchScript model.
- AnisotropyTorqueComputes the anisotropy torque as the sum of FFT gradient components of dmu_dn * g.
- ComputeDisplacementsCompute updated displacements from the deformation gradient tensor.
- ComputeGroupGroup of operators with internal dependency resolution and optional JIT tracing support.
- ComputeVonMisesStressCompute vonMises stress.
- ConstantReciprocalTensorConstant tensor in reciprocal space.
- ConstantTensorConstant tensor in real space.
- DeAliasingTensorCreate a de-aliasing filter.
- FCCPFCLinearReciprocal space linear prefactor for the two-mode FCC phase-field crystal model.
- FCCPFCNonlinearReciprocal space nonlinear term for the two-mode FCC phase-field crystal model.
- FFTElasticChemicalPotentialFFT based elastic strain energy chemical potential solve.
- FFTGradientTensor gradient.
- FFTGradientSquareTensor gradient.
- FFTMechanicsdeGeus variational mechanics solve. Updates the coupled buffer holding the deformation gradient tensor.
- FFTQuasistaticElasticityFFT based monolithic homogeneous quasistatic elasticity solve.
- FiniteDifferenceBiharmonicComputes the biharmonic Laplacian(Laplacian(u)) using finite differences.
- FiniteDifferenceLaplacianComputes the Laplacian using finite differences.
- ForwardFFTPerformFFT object.
- GradientEnergyDensityComputes the gradient energy density 0.5 * kappa * sum_i |grad eta_i|^2 from a set of gradient vector buffers.
- GradientVectorGradient of the coupled tensor buffer returned as a stacked torch tensor.
- HyperElasticIsotropicHyperelastic isotropic constitutive model.
- InverseFFTPerformFFT object.
- LBMAllenCahnSourceCompute Allen-Cahn source term for phase field model.
- LBMApplyForcesCompute object for LB forces
- LBMBGKCollisionTemplate object for LBM collision dynamics
- LBMBounceBackLBMBounceBack object
- LBMComputeChemicalPotentialCompute LB checmial potential for pahse field coupling.
- LBMComputeDensityCompute object for macroscopic density reconstruction.
- LBMComputeEffectiveRelaxationCompute local effective relaxation time matrix based on local pore size and Knudsen number.
- LBMComputeForcesCompute object for LB forces
- LBMComputeSurfaceForcesCompute object for LB surface forces
- LBMComputeVelocityCompute object for macroscopic velocity reconstruction.
- LBMComputeVelocityMagnitudeLBMComputeVelocityMagnitude object.
- LBMConstantTensorLBMConstantTensor object.
- LBMConvectiveOutflowConvective outflow boundary condition. Applies df/dt + U_c * df/dn = 0 at the boundary, discretized as f(x_b, t) = (f(x_b, t-1) + U_c * f(x_n, t)) / (1 + U_c). U_c can be a fixed value or computed automatically as the mean normal velocity at the boundary plane.
- LBMDirichletBCLBMDirichletBC object
- LBMEquilibriumCompute LB equilibrium distribution object.
- LBMFixedFirstOrderBCLBMFixedFirstOrderBC object
- LBMFixedZerothOrderBCLBMFixedZerothOrderBC object
- LBMForceDistributionCompute object for the force distribution function (source term) for phase field model..
- LBMIsotropicGradientCompute isotropic gradient object.
- LBMIsotropicLaplacianCompute isotropic Laplacian object.
- LBMMRTCollisionTemplate object for LBM collision dynamics
- LBMMicroscopicZeroGradientBCLBMMicroscopicZeroGradientBC object
- LBMNeumannBCLBMNeumannBC object
- LBMNonEquilibriumExtrapolationNon-equilibrium extrapolation boundary condition (Guo et al., 2002). Reconstructs the boundary distribution as f = feq(prescribed) + fneq(interior), where the missing moment is extrapolated from interior nodes. Density, velocity, and equilibrium are computed on-the-fly from the streamed population.
- LBMPhaseEquilibriumCompute LB equilibrium distribution object for phase field parameter.
- LBMPhaseFieldPressureCompute pressure for phase field model.
- LBMPressureCorrectedEquilibriumCompute object for correcting the equilibrium distribution function for phase field model.
- LBMSmagorinskyCollisionTemplate object for LBM collision dynamics
- LBMSmagorinskyMRTCollisionTemplate object for LBM collision dynamics
- LBMSpecularReflectionBoundaryLBM combination of bounce-back and specular reflection boundary condition. Uses a precomputed lookup table to determine specular reflection directions for each boundary node type in complex geometries (D2Q9 only).
- LBMStackTensorsStack given scalar tensor buffers and output vectorial tensor.
- LibtorchGibbsEnergyCalculates Gibbs energy, chemical potential, and driving force for order parameters using a Libtorch model.
- MacroscopicShearTensorDeGeus mechanics test material.
- MooseFunctionTensorMap a MooseFunction to a tensor.
- NEML2GradientVectorGradient of the coupled tensor buffer returned as a NEML2 vector.
- NEML2TensorComputeCompute object wrapper for a NEML2 model
- PairwiseAnisotropicGBEnergyEvaluates anisotropic grain-boundary energy between a pair of grains from a TorchScript model, given the gradient buffers of each grain's order parameter.
- ParsedComputeParsedCompute object.
- PhaseMechanicsTestDeGeus mechanics test material.
- RandomTensorUniform random IC with values between
minandmax. - RankTwoIdentityRank two identity tensor in real space.
- ReciprocalAllenCahnCalculates the Allen-Cahn bulk driving force masked using psi.
- ReciprocalLaplacianFactorReciprocal space Laplacian IC.
- ReciprocalLaplacianSquareFactorReciprocal space Laplacian squared IC.
- ReciprocalMatDiffusionCalculates the divergence of flux for a variable mobility in reciprocal space.
- SmoothRectangleComputeInterpolate a value between the inside and outside of a rectangle smoothly.
- SwiftHohenbergLinearReciprocal space linear term in the semi-implicit time integration of the Swift-Hohenberg equation IC.
- TensorDirichletBCDirichlet boundary condition (u = value) on a non-periodic domain face.
- TensorNeumannBCNeumann boundary condition (du/dn = flux) on a non-periodic domain face.
- TensorRobinBCGeneral Robin boundary condition a*u + b*du/dn = c on a non-periodic domain face.
- TimeDerivativeOperatorBackward Euler time derivative term u/dt for implicit solves, contributing u_old/dt to the right-hand side.
Available Actions
- Marlin App
- AddTensorBCActionAdd a TensorBoundaryCondition object to the simulation.