PenaltyDirichletNodalKernel

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

Description

The PenaltyDirichletNodalKernel object is to apply Dirichlet boundary conditions using the penalty method for nodesets. It is similar to the PenaltyDirichletBC class which operates on sidesets.

Example Syntax

#In order to compare the solution generated using preset BC, the penalty was set to 1e10.
#Large penalty number should be used with caution.

[Mesh<<<{"href": "../../syntax/Mesh/index.html"}>>>]
  type = GeneratedMesh
  dim = 2
  xmin = -1
  xmax = 1
  ymin = -1
  ymax = 1
  nx = 10
  ny = 10
  elem_type = QUAD4
[]

[Functions<<<{"href": "../../syntax/Functions/index.html"}>>>]
  [./forcing_fn]
    type = ParsedFunction<<<{"description": "Function created by parsing a string", "href": "../functions/MooseParsedFunction.html"}>>>
    expression<<<{"description": "The user defined function."}>>> = -2*(x*x+y*y-2)
  [../]

  [./solution]
    type = ParsedGradFunction<<<{"description": "Defines a function and its gradient using input file parameters.", "href": "../functions/MooseParsedGradFunction.html"}>>>
    value<<<{"description": "User defined function."}>>> = (1-x*x)*(1-y*y)
    grad_x<<<{"description": "Partial derivative with respect to x."}>>> = 2*(x*y*y-x)
    grad_y<<<{"description": "Partial derivative with respect to y."}>>> = 2*(x*x*y-y)
  [../]
[]

[Variables<<<{"href": "../../syntax/Variables/index.html"}>>>]
  [./u]
  [../]
[]

[Kernels<<<{"href": "../../syntax/Kernels/index.html"}>>>]
  [./diff]
    type = Diffusion<<<{"description": "The Laplacian operator ($-\\nabla \\cdot \\nabla u$), with the weak form of $(\\nabla \\phi_i, \\nabla u_h)$.", "href": "../kernels/Diffusion.html"}>>>
    variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = u
  [../]
  [./forcing]
    type = BodyForce<<<{"description": "Demonstrates the multiple ways that scalar values can be introduced into kernels, e.g. (controllable) constants, functions, and postprocessors. Implements the weak form $(\\psi_i, -f)$.", "href": "../kernels/BodyForce.html"}>>>
    variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = u
    function<<<{"description": "A function that describes the body force"}>>> = forcing_fn
  [../]
[]

[NodalKernels<<<{"href": "../../syntax/NodalKernels/index.html"}>>>]
  [./bc_all]
    type = PenaltyDirichletNodalKernel<<<{"description": "Enforces a Dirichlet boundary condition in a weak sense by penalizing differences between the current solution and the Dirichlet value on nodesets.", "href": "PenaltyDirichletNodalKernel.html"}>>>
    variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = u
    value<<<{"description": "Boundary value of the variable"}>>> = 0
    boundary<<<{"description": "The list of boundaries (ids or names) from the mesh where this object applies"}>>> = 'top left right bottom'
    penalty<<<{"description": "Penalty scalar"}>>> = 1e10
  [../]
[]

# [BCs]
#   [./fix]
#     type = DirichletBC
#     preset = true
#     variable = u
#     value = 0
#     boundary = 'top left right bottom'
#   [../]
# []

[Postprocessors<<<{"href": "../../syntax/Postprocessors/index.html"}>>>]
  [./L2error]
    type = ElementL2Error<<<{"description": "Computes L2 error between a field variable and an analytical function", "href": "../postprocessors/ElementL2Error.html"}>>>
    variable<<<{"description": "The name of the variable that this object operates on"}>>> = u
    function<<<{"description": "The analytic solution to compare against"}>>> = solution
  [../]
  [./H1error]
    type = ElementH1Error<<<{"description": "Computes the H1 error between a variable and a function", "href": "../postprocessors/ElementH1Error.html"}>>>
    variable<<<{"description": "The name of the variable that this object operates on"}>>> = u
    function<<<{"description": "The analytic solution to compare against"}>>> = solution
  [../]
  [./H1Semierror]
    type = ElementH1SemiError<<<{"description": "Returns the gradient difference norm part of the H1 error", "href": "../postprocessors/ElementH1SemiError.html"}>>>
    variable<<<{"description": "The name of the variable that this object operates on"}>>> = u
    function<<<{"description": "The analytic solution to compare against"}>>> = solution
  [../]
[]

[Executioner<<<{"href": "../../syntax/Executioner/index.html"}>>>]
  type = Steady
  solve_type = 'PJFNK'
  nl_rel_tol = 1e-14
[]

[Outputs<<<{"href": "../../syntax/Outputs/index.html"}>>>]
  file_base<<<{"description": "Common file base name to be utilized with all output objects"}>>> = nodal_preset_bc_out
  exodus<<<{"description": "Output the results using the default settings for Exodus output."}>>> = true
[]
(moose/test/tests/nodalkernels/penalty_dirichlet/nodal_penalty_dirichlet.i)

Input Parameters

  • penaltyPenalty scalar

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:Penalty scalar

  • variableThe name of the variable that this residual object operates on

    C++ Type:NonlinearVariableName

    Unit:(no unit assumed)

    Controllable:No

    Description:The name of the variable that this residual object operates on

Required Parameters

  • blockThe list of blocks (ids or names) that this object will be applied

    C++ Type:std::vector<SubdomainName>

    Controllable:No

    Description:The list of blocks (ids or names) that this object will be applied

  • boundaryThe list of boundaries (ids or names) from the mesh where this object applies

    C++ Type:std::vector<BoundaryName>

    Controllable:No

    Description:The list of boundaries (ids or names) from the mesh where this object applies

  • value0Boundary value of the variable

    Default:0

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:Yes

    Description:Boundary value of the variable

Optional Parameters

  • absolute_value_vector_tagsThe tags for the vectors this residual object should fill with the absolute value of the residual contribution

    C++ Type:std::vector<TagName>

    Controllable:No

    Description:The tags for the vectors this residual object should fill with the absolute value of the residual contribution

  • extra_matrix_tagsThe extra tags for the matrices this Kernel should fill

    C++ Type:std::vector<TagName>

    Controllable:No

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

  • extra_vector_tagsThe extra tags for the vectors this Kernel should fill

    C++ Type:std::vector<TagName>

    Controllable:No

    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

    Options:nontime, system

    Controllable:No

    Description:The tag for the matrices this Kernel should fill

  • vector_tagsnontimeThe tag for the vectors this Kernel should fill

    Default:nontime

    C++ Type:MultiMooseEnum

    Options:nontime, time

    Controllable:No

    Description:The tag for the vectors this Kernel should fill

Contribution To Tagged Field Data Parameters

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

    C++ Type:std::vector<std::string>

    Controllable:No

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

  • 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<AuxVariableName>

    Unit:(no unit assumed)

    Controllable:No

    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.)

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Controllable:Yes

    Description:Set the enabled status of the MooseObject.

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

    Default:True

    C++ Type:bool

    Controllable:No

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

  • 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<AuxVariableName>

    Unit:(no unit assumed)

    Controllable:No

    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.)

  • seed0The seed for the master random number generator

    Default:0

    C++ Type:unsigned int

    Controllable:No

    Description:The seed for the master random number generator

  • 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

    Controllable:No

    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.

Advanced Parameters