https://mooseframework.inl.gov
TagVectorAux.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 "TagVectorAux.h"
11 
13 
16 {
18  params.addClassDescription("Extract DOF values from a tagged vector into an AuxVariable");
19  params.addRequiredParam<TagName>("vector_tag", "Name of the vector tag to extract values from");
20  params.addParam<bool>(
21  "remove_variable_scaling",
22  false,
23  "Whether to remove variable scaling from DOF value. If false, values are directly extracted "
24  "from the tag vector, and potentially with scaling applied. If true, any scaling of "
25  "variables is undone in the reported values.");
26  return params;
27 }
28 
30  : TagAuxBase<AuxKernel>(parameters),
31  _remove_variable_scaling(isParamSetByUser("scaled")
32  ? !getParam<bool>("scaled")
33  : getParam<bool>("remove_variable_scaling")),
34  _v(coupledVectorTagValue("v", "vector_tag")),
35  _v_var(*getFieldVar("v", 0))
36 {
38 
39  if (isParamSetByUser("scaled"))
40  {
41  mooseDeprecated("The 'scaled' parameter has been deprecated. Please use the "
42  "'remove_variable_scaling' parameter instead.");
43  if (isParamSetByUser("remove_variable_scaling"))
44  paramError("You cannot set both the 'scaled' and 'remove_variable_scaling' parameters. "
45  "Please use only the 'remove_variable_scaling' parameter.");
46  }
47 
49  {
50  const auto vector_tag_id = _subproblem.getVectorTagID(getParam<TagName>("vector_tag"));
51  const auto vector_tag_type = _subproblem.vectorTagType(vector_tag_id);
52  if (vector_tag_type != Moose::VECTOR_TAG_RESIDUAL)
53  paramError("vector_tag",
54  "The provided vector tag does not correspond to a tagged residual vector, which "
55  "is the only kind of vector tag type for which scaling is applicable, yet "
56  "variable scaling is requested to be removed.");
57  }
58 }
59 
60 Real
62 {
64 }
const bool _remove_variable_scaling
Whether to remove variable scaling from the returned value.
Definition: TagVectorAux.h:29
virtual TagID getVectorTagID(const TagName &tag_name) const
Get a TagID from a TagName.
Definition: SubProblem.C:203
registerMooseObject("MooseApp", TagVectorAux)
virtual Real computeValue() override
Compute and return the value of the aux variable.
Definition: TagVectorAux.C:61
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:439
The value of a tagged vector for a given node and a given variable is coupled to the current AuxVaria...
Definition: TagAuxBase.h:21
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
void checkCoupledVariable(const MooseVariableBase *input_var, const MooseVariableFieldBase *aux_var)
check the aux variable acting on this auxkernl has the consistent properties with the input coupled v...
Definition: TagAuxBase.h:70
static InputParameters validParams()
Definition: TagVectorAux.C:15
void mooseDeprecated(Args &&... args) const
Definition: MooseBase.h:314
TagVectorAux returns the coupled DOF value of a tagged vector.
Definition: TagVectorAux.h:18
virtual Moose::VectorTagType vectorTagType(const TagID tag_id) const
Definition: SubProblem.C:231
TagVectorAux(const InputParameters &parameters)
Definition: TagVectorAux.C:29
MooseVariableField< Real > & _var
This is a regular kernel so we cast to a regular MooseVariable.
Definition: AuxKernel.h:174
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableValue & _v
Definition: TagVectorAux.h:30
static InputParameters validParams()
Definition: TagAuxBase.h:45
const MooseVariableBase & _v_var
Definition: TagVectorAux.h:31
SubProblem & _subproblem
Subproblem this kernel is part of.
Definition: AuxKernel.h:164
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:230
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...
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
Definition: MooseBase.h:205
void scalingFactor(const std::vector< Real > &factor)
Set the scaling factor for this variable.