https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADArrayRobinBC.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 "ADArrayRobinBC.h"
11
13
16{
18 params.addParam<RealEigenVector>("value", "The prescribed flux $h$ of each component");
19 params.addParam<RealEigenVector>("alpha", "The Robin coefficient $\\alpha$ of each component");
20 params.addClassDescription("Imposes the integrated boundary condition "
21 "$\\nabla u \\cdot \\vec{n} = h - \\alpha u$ on every component of an "
22 "array variable, using automatic differentiation.");
23 return params;
24}
25
27 : ADArrayIntegratedBC(parameters),
28 _value(isParamValid("value") ? getParam<RealEigenVector>("value")
29 : RealEigenVector::Zero(_count)),
30 _alpha(isParamValid("alpha") ? getParam<RealEigenVector>("alpha")
31 : RealEigenVector::Zero(_count))
32{
33 if (_value.size() != _count)
34 paramError("value", "Must have as many entries as the variable has components");
35 if (_alpha.size() != _count)
36 paramError("alpha", "Must have as many entries as the variable has components");
37}
38
39void
40ADArrayRobinBC::computeQpResidual(ADRealEigenVector & residual)
41{
42 residual = (_alpha.cwiseProduct(_u[_qp]) - _value) * _test[_i][_qp];
43}
registerMooseObject("MooseApp", ADArrayRobinBC)
Base class for integrated boundary conditions on array variables whose Jacobians are computed with au...
const ArrayVariableTestValue & _test
test function values (in QPs)
const unsigned int _count
Number of components of the array variable.
static InputParameters validParams()
const ADArrayVariableValue & _u
the values of the unknown variable this BC is acting on
Robin boundary condition for all components of an array variable, grad(u) .
static InputParameters validParams()
const RealEigenVector _alpha
Robin coefficient alpha.
virtual void computeQpResidual(ADRealEigenVector &residual) override
Compute this boundary condition's contribution to the residual at the current quadrature point,...
ADArrayRobinBC(const InputParameters &parameters)
const RealEigenVector _value
prescribed flux h
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.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
unsigned int _qp
quadrature point index
unsigned int _i
i-th, j-th index for enumerating test and shape functions
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:457