www.mooseframework.org
NormalizationAux.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 
10 #include "NormalizationAux.h"
11 
13 
14 template <>
17 {
19  params.addRequiredCoupledVar("source_variable", "The variable to be normalized");
20  params.addParam<PostprocessorName>("normalization", "The postprocessor on the source");
21  params.addParam<PostprocessorName>("shift", "The postprocessor to shift the source");
22  params.addParam<Real>("normal_factor", 1.0, "The normalization factor");
23  return params;
24 }
25 
27  : AuxKernel(parameters),
28  _src(coupledValue("source_variable")),
29  _pp_on_source(isParamValid("normalization") ? &getPostprocessorValue("normalization") : NULL),
30  _shift(isParamValid("shift") ? &getPostprocessorValue("shift") : NULL),
31  _normal_factor(getParam<Real>("normal_factor"))
32 {
33 }
34 
35 Real
37 {
38  Real denominator = _pp_on_source ? *_pp_on_source : 1.0;
39  Real shift = _shift ? *_shift : 0.0;
40  return _src[_qp] * _normal_factor / denominator - shift;
41 }
registerMooseObject("MooseApp", NormalizationAux)
virtual Real computeValue() override
Compute and return the value of the aux variable.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const VariableValue & _src
InputParameters validParams< AuxKernel >()
Definition: AuxKernel.C:25
This auxiliary kernel normalizes a variable based on a postprocessor.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
NormalizationAux(const InputParameters &parameters)
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:219
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 Real * _pp_on_source
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:33
const Real * _shift
InputParameters validParams< NormalizationAux >()