23 "Enforces a prescribed average value for a finite element variable on a boundary using a "
24 "scalar Lagrange multiplier.");
25 params.
addParam<PostprocessorName>(
"phi0",
"0",
"The value that the constraint will enforce.");
32 _phi0(getPostprocessorValue(
"phi0")),
33 _lambda_var(*getScalarVar(
"lambda", 0)),
34 _lambda(coupledScalarValue(
"lambda"))
37 paramError(
"lambda",
"The lambda variable must be a first-order scalar variable.");
99 std::array<Real, 1> residual{{0.0}};
112 DenseMatrix<Real> zero(1, 1);
125 DenseMatrix<Real> jacobian(
_test.size(), 1);
140 DenseMatrix<Real> jacobian(1,
_phi.size());
registerMooseObject("MooseApp", BoundaryIntegralValueConstraint)
Enforces the average value of a finite element variable on a boundary using a scalar Lagrange multipl...
virtual void computeResidualAndJacobian() override
Compute this object's contribution to the residual and Jacobian simultaneously.
const VariableValue & _lambda
Lagrange multiplier scalar variable value.
void computeScalarResidual()
Compute the Lagrange multiplier residual contribution.
static InputParameters validParams()
void computeScalarFieldJacobian()
Compute the Jacobian contribution from the field variable to the Lagrange multiplier equation.
virtual void computeResidual() override
Compute this object's contribution to the residual.
BoundaryIntegralValueConstraint(const InputParameters ¶meters)
virtual void computeOffDiagJacobian(unsigned int jvar) override
Computes d-ivar-residual / d-jvar...
const MooseVariableScalar & _lambda_var
Lagrange multiplier scalar variable.
void computeScalarJacobian()
Compute the zero diagonal block for the Lagrange multiplier equation.
virtual Real computeQpResidual() override
Method for computing the residual at quadrature points.
virtual std::set< std::string > additionalROVariables() override
const PostprocessorValue & _phi0
The value that the boundary average of the field variable is constrained to.
void computeFieldScalarJacobian()
Compute the Jacobian contribution from the Lagrange multiplier to the field equation.
virtual void computeOffDiagJacobianScalar(unsigned int jvar) override
Computes jacobian block with respect to a scalar variable.
const QBase *const & _qrule
active quadrature rule
unsigned int _qp
quadrature point index
const MooseArray< Real > & _JxW
transformed Jacobian weights
void prepareShapes(unsigned int var_num) override final
Prepare shape functions.
unsigned int _i
i-th, j-th index for enumerating test and shape functions
const MooseArray< Real > & _coord
coordinate transformation
Base class for deriving any boundary condition of a integrated type.
const VariableValue & _u
the values of the unknown variable this BC is acting on
static InputParameters validParams()
virtual void computeJacobian() override
Compute this object's contribution to the diagonal Jacobian entries.
virtual void computeResidual() override
Compute this object's contribution to the residual.
const VariablePhiValue & _phi
shape function values (in QPs)
const VariableTestValue & _test
test function values (in QPs)
const std::string & name() const
Get the name of the class.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
void scalingFactor(const std::vector< Real > &factor)
Set the scaling factor for this variable.
libMesh::Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int.
unsigned int number() const
Get variable number coming from libMesh.
const std::vector< dof_id_type > & dofIndices() const final
Get local DoF indices.
Assembly & _assembly
Reference to this Kernel's assembly object.
void addJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided residual derivatives into the Jacobian for the provided dof indices.
void addResiduals(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided incoming residuals corresponding to the provided dof indices.
bool _is_implicit
If the object is using implicit or explicit form.