https://mooseframework.inl.gov
Loading...
Searching...
No Matches
DirichletBCBase.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "DirichletBCBase.h"
11
14{
16 params.addParam<bool>(
17 "preset", true, "Whether or not to preset the BC (apply the value before the solve begins).");
18 return params;
19}
20
22 : NodalBC(parameters), _preset(getParam<bool>("preset"))
23{
24}
25
26void
27DirichletBCBase::computeValue(NumericVector<Number> & current_solution)
28{
29 mooseAssert(_preset, "BC is not preset");
30
31 if (_var.isNodalDefined())
32 {
33 const dof_id_type & dof_idx = _var.nodalDofIndex();
34 current_solution.set(dof_idx, computeQpValue());
35 }
36}
37
38Real
const bool _preset
Whether or not the value is to be preset.
DirichletBCBase(const InputParameters &parameters)
static InputParameters validParams()
virtual Real computeQpResidual() override
void computeValue(NumericVector< Number > &current_solution)
Method to preset the nodal value if applicable.
virtual Real computeQpValue()=0
Compute the value of the DirichletBC at the current quadrature point.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
const dof_id_type & nodalDofIndex() const override
virtual bool isNodalDefined() const override
Is this variable defined at nodes.
Base class for deriving any boundary condition that works at nodes.
Definition NodalBC.h:21
MooseVariable & _var
Definition NodalBC.h:38
const VariableValue & _u
Value of the unknown variable this BC is acting on.
Definition NodalBC.h:47
static InputParameters validParams()
Definition NodalBC.C:19
const unsigned int _qp
Pseudo-"quadrature point" index (Always zero for the current node)
Definition NodalBC.h:44