https://mooseframework.inl.gov
CoupledVarNeumannBC.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 "CoupledVarNeumannBC.h"
11 
14 
15 template <bool is_ad>
18 {
20  params.addRequiredCoupledVar("v", "Coupled variable setting the gradient on the boundary.");
21  params.addCoupledVar("scale_factor", 1., "Scale factor to multiply the heat flux with");
22  params.addParam<Real>(
23  "coef", 1.0, "Coefficent ($\\sigma$) multiplier for the coupled force term.");
24  params.addClassDescription("Imposes the integrated boundary condition "
25  "$\\frac{\\partial u}{\\partial n}=v$, "
26  "where $v$ is a variable.");
27  return params;
28 }
29 template <bool is_ad>
31  : IntegratedBCParent<is_ad>(parameters),
32  _coupled_var(this->template coupledGenericValue<is_ad>("v")),
33  _coupled_num(this->coupled("v")),
34  _coef(this->template getParam<Real>("coef")),
35  _scale_factor(this->template coupledGenericValue<is_ad>("scale_factor"))
36 {
37 }
38 
39 template <bool is_ad>
42 {
43  return -_scale_factor[_qp] * _coef * _test[_i][_qp] * _coupled_var[_qp];
44 }
45 
46 Real
48 {
49  if (jvar == _coupled_num)
50  return -_scale_factor[_qp] * _coef * _test[_i][_qp] * _phi[_j][_qp];
51  else
52  return 0;
53 }
54 
55 template class CoupledVarNeumannBCTempl<false>;
56 template class CoupledVarNeumannBCTempl<true>;
Moose::GenericType< Real, is_ad > GenericReal
Definition: MooseTypes.h:648
registerMooseObject("MooseApp", CoupledVarNeumannBC)
Implements a Neumann BC where grad(u)=_coupled_var on the boundary.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams()
static InputParameters validParams()
virtual GenericReal< is_ad > computeQpResidual() override
void addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
virtual Real computeQpOffDiagJacobian(const unsigned int jvar_num) override
const Real _coef
A coefficient that is multiplied with the residual contribution.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...
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 GenericVariableValue< is_ad > & _scale_factor
Scale factor.
const unsigned int _coupled_num
The identifying number of the coupled variable.
CoupledVarNeumannBCTempl(const InputParameters &parameters)
typename std::conditional< is_ad, ADIntegratedBC, IntegratedBC >::type IntegratedBCParent