# PenaltyDirichletBC

Enforces a Dirichlet boundary condition in a weak sense by penalizing differences between the current solution and the Dirichlet data.

## Description

PenaltyDirichletBC is a NodalBC used for enforcing Dirichlet boundary conditions which differs from the DirichletBC class in the way in which it handles the enforcement. It is appropriate for partial differential equations (PDEs) in the form

\begin{aligned} -\nabla^2 u &= f && \quad \in \Omega \\ u &= g && \quad \in \partial \Omega_D \\ \frac{\partial u}{\partial n} &= h && \quad \in \partial \Omega_N \end{aligned}

Instead of imposing the Dirichlet condition directly on the basis by replacing the equations associated with those degrees of freedom (DOFs) by the auxiliary equation , the PenaltyDirichletBC is based on the variational statement: find such that (1) holds for every . In Eq. 2, is a user-selected parameter which must be taken small enough to ensure that on . The user-selectable class parameter penalty corresponds to , and must be chosen large enough to ensure good agreement with the Dirichlet data, but not so large that the resulting Jacobian becomes ill-conditioned, resulting in failed solves and overall accuracy losses.

Benefits of the penatly-based approach include simplified Dirichlet boundary condition enforcement for non-Lagrange finite element bases, maintaining the symmetry (if any) of the original problem, and avoiding the need to zero out contributions from other rows in a special post-assembly step. Integrating by parts "in reverse" from Eq. 2, one obtains

(2)

We therefore recover a "perturbed" version of the original problem with the flux boundary condition

(3)

replacing the original Dirichlet boundary condition. It has been shown Juntunen and Stenberg (2009) that in order for the solution to this perturbed problem to converge to the solution of the original problem in the limit as , the penalty parameter must depend on the mesh size, and that as we refine the mesh, the problem becomes increasingly ill-conditioned. A related method for imposing Dirichlet boundary conditions, known as Nitsche's method Juntunen and Stenberg (2009), does not suffer from the same ill-conditioning issues, and is slated for inclusion in MOOSE some time in the future.

## References

1. M. Juntunen and R. Stenberg. Nitsche's method for general boundary conditions. Mathematics of Computation, 78(267):1353â€“1374, July 2009. URL: http://dx.doi.org/10.1090/S0025-5718-08-02183-2.[BibTeX]

## Example Input Syntax


[BCs]
active = 'bc_all'
[./bc_all]
type = PenaltyDirichletBC
variable = u
value = 0
boundary = 'top left right bottom'
penalty = 1e5
[../]
[]
(moose/test/tests/bcs/penalty_dirichlet_bc/penalty_dirichlet_bc_test.i)

## Input Parameters

• penaltyPenalty scalar

C++ Type:double

Description:Penalty scalar

• variableThe name of the variable that this boundary condition applies to

C++ Type:NonlinearVariableName

Description:The name of the variable that this boundary condition applies to

• boundaryThe list of boundary IDs from the mesh where this boundary condition applies

C++ Type:std::vector

Description:The list of boundary IDs from the mesh where this boundary condition applies

### Required Parameters

• value0Boundary value of the variable

Default:0

C++ Type:double

Description:Boundary value of the variable

### Optional Parameters

• enableTrueSet the enabled status of the MooseObject.

Default:True

C++ Type:bool

Description:Set the enabled status of the MooseObject.

• save_inThe name of auxiliary variables to save this BC's residual contributions to. Everything about that variable must match everything about this variable (the type, what blocks it's on, etc.)

C++ Type:std::vector

Description:The name of auxiliary variables to save this BC's residual contributions to. Everything about that variable must match everything about this variable (the type, what blocks it's on, etc.)

• use_displaced_meshFalseWhether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.

Default:False

C++ Type:bool

Description:Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.

• control_tagsAdds user-defined labels for accessing object parameters via control logic.

C++ Type:std::vector

Description:Adds user-defined labels for accessing object parameters via control logic.

• seed0The seed for the master random number generator

Default:0

C++ Type:unsigned int

Description:The seed for the master random number generator

• diag_save_inThe name of auxiliary variables to save this BC's diagonal jacobian contributions to. Everything about that variable must match everything about this variable (the type, what blocks it's on, etc.)

C++ Type:std::vector

Description:The name of auxiliary variables to save this BC's diagonal jacobian contributions to. Everything about that variable must match everything about this variable (the type, what blocks it's on, etc.)

• implicitTrueDetermines whether this object is calculated using an implicit or explicit form

Default:True

C++ Type:bool

Description:Determines whether this object is calculated using an implicit or explicit form

• vector_tagsnontimeThe tag for the vectors this Kernel should fill

Default:nontime

C++ Type:MultiMooseEnum

Description:The tag for the vectors this Kernel should fill

• extra_vector_tagsThe extra tags for the vectors this Kernel should fill

C++ Type:std::vector

Description:The extra tags for the vectors this Kernel should fill

• matrix_tagssystemThe tag for the matrices this Kernel should fill

Default:system

C++ Type:MultiMooseEnum

Description:The tag for the matrices this Kernel should fill

• extra_matrix_tagsThe extra tags for the matrices this Kernel should fill

C++ Type:std::vector

Description:The extra tags for the matrices this Kernel should fill