https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
15template <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;
29template <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
39template <bool is_ad>
42{
43 return -_scale_factor[_qp] * _coef * _test[_i][_qp] * _coupled_var[_qp];
44}
45
46Real
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
registerMooseObject("MooseApp", CoupledVarNeumannBC)
typename std::conditional< is_ad, ADIntegratedBC, IntegratedBC >::type IntegratedBCParent
Moose::GenericType< Real, is_ad > GenericReal
Definition MooseTypes.h:698
Implements a Neumann BC where grad(u)=_coupled_var on the boundary.
virtual GenericReal< is_ad > computeQpResidual() override
const unsigned int _coupled_num
The identifying number of the coupled variable.
const GenericVariableValue< is_ad > & _scale_factor
Scale factor.
const Real _coef
A coefficient that is multiplied with the residual contribution.
CoupledVarNeumannBCTempl(const InputParameters &parameters)
static InputParameters validParams()
virtual Real computeQpOffDiagJacobian(const unsigned int jvar_num) override
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
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.
void addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.