www.mooseframework.org
VectorFunctionDirichletBC.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
11 #include "Function.h"
12 
15  LagrangeVecFunctionDirichletBC,
16  "05/01/2019 00:01",
18 
21 {
23  params.addClassDescription(
24  "Imposes the essential boundary condition $\\vec{u}=\\vec{g}$, where $\\vec{g}$ "
25  "components are calculated with functions.");
26 
27  params.addParam<FunctionName>("function",
28  "The boundary condition vector function. This cannot be supplied "
29  "with the component parameters.");
30 
31  params.addParam<FunctionName>("function_x", 0, "The function for the x component");
32  params.addParam<FunctionName>("function_y", 0, "The function for the y component");
33  params.addParam<FunctionName>("function_z", 0, "The function for the z component");
34 
35  params.addDeprecatedParam<FunctionName>(
36  "x_exact_soln", "The exact solution for the x component", "Use 'function_x' instead.");
37  params.addDeprecatedParam<FunctionName>(
38  "y_exact_soln", "The exact solution for the y component", "Use 'function_y' instead.");
39  params.addDeprecatedParam<FunctionName>(
40  "z_exact_soln", "The exact solution for the z component", "Use 'function_z' instead.");
41  return params;
42 }
43 
45  : VectorNodalBC(parameters),
46  _function(isParamValid("function") ? &getFunction("function") : nullptr),
47  _function_x(isParamValid("x_exact_soln") ? getFunction("x_exact_soln")
48  : getFunction("function_x")),
49  _function_y(isParamValid("y_exact_soln") ? getFunction("y_exact_soln")
50  : getFunction("function_y")),
51  _function_z(isParamValid("z_exact_soln") ? getFunction("z_exact_soln")
52  : getFunction("function_z"))
53 {
54  if (_function &&
55  (parameters.isParamSetByUser("function_x") || parameters.isParamSetByUser("x_exact_soln")))
56  paramError("function_x", "The 'function' and 'function_x' parameters cannot both be set.");
57  if (_function &&
58  (parameters.isParamSetByUser("function_y") || parameters.isParamSetByUser("y_exact_soln")))
59  paramError("function_y", "The 'function' and 'function_y' parameters cannot both be set.");
60  if (_function &&
61  (parameters.isParamSetByUser("function_z") || parameters.isParamSetByUser("z_exact_soln")))
62  paramError("function_z", "The 'function' and 'function_z' parameters cannot both be set.");
63 }
64 
67 {
68  if (_function)
70  else
74 
75  return _u - _values;
76 }
const RealVectorValue & _u
Value of the unknown variable this BC is acting on.
Definition: VectorNodalBC.h:41
Boundary condition of a Dirichlet type.
registerMooseObject("MooseApp", VectorFunctionDirichletBC)
registerMooseObjectRenamed("MooseApp", LagrangeVecFunctionDirichletBC, "05/01/2019 00:01", VectorFunctionDirichletBC)
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
static InputParameters validParams()
static InputParameters validParams()
Definition: VectorNodalBC.C:18
VectorFunctionDirichletBC(const InputParameters &parameters)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Function & _function_y
y component function
virtual RealVectorValue computeQpResidual() override
Base class for deriving any boundary condition that works at nodes on vector variables.
Definition: VectorNodalBC.h:18
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 ...
const Function & _function_x
x component function
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was by the user.
const Function *const _function
Optional vectorValue function.
virtual RealVectorValue vectorValue(Real t, const Point &p) const
Override this to evaluate the vector function at a point (t,x,y,z), by default this returns a zero ve...
Definition: Function.C:87
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...
const InputParameters & parameters() const
Get the parameters of the object.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
const Function & _function_z
z component function
RealVectorValue _values
The value for this BC.
virtual Real value(Real t, const Point &p) const
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero...
Definition: Function.C:41
const Node *const & _current_node
current node being processed
Definition: VectorNodalBC.h:38