https://mooseframework.inl.gov
ElementIntegralVariablePostprocessor.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 
11 
13 
16 {
18  params.addRequiredCoupledVar("variable", "The name of the variable that this object operates on");
19  params.addClassDescription("Computes a volume integral of the specified variable");
20  params.addParam<bool>(
21  "use_absolute_value", false, "Whether to use absolute value of the variable or not");
22  return params;
23 }
24 
26  const InputParameters & parameters)
27  : ElementIntegralPostprocessor(parameters),
29  false,
30  "variable",
33  _u(coupledValue("variable")),
34  _grad_u(coupledGradient("variable")),
35  _use_abs_value(getParam<bool>("use_absolute_value"))
36 {
38 }
39 
40 Real
42 {
43  if (_use_abs_value)
44  return std::abs(_u[_qp]);
45  else
46  return _u[_qp];
47 }
VarFieldType
Definition: MooseTypes.h:721
This postprocessor computes a volume integral of the specified variable.
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:42
registerMooseObject("MooseApp", ElementIntegralVariablePostprocessor)
This postprocessor computes a volume integral of the specified variable.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:714
const VariableValue & _u
Holds the solution at current quadrature points.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool _use_abs_value
Option to use absolute variable value.
Interface for objects that need to get values of MooseVariables.
MooseVariableField< Real > & mooseVariableField()
Return the MooseVariableField object that this interface acts on.
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...
ElementIntegralVariablePostprocessor(const InputParameters &parameters)
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...