https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NormalizationAux.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 "NormalizationAux.h"
11
13
16{
18 params.addClassDescription("Normalizes a variable based on a Postprocessor value.");
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
35Real
37{
38 Real denominator = _pp_on_source ? *_pp_on_source : 1.0;
39 mooseAssert(denominator != 0., "postprocessor value is zero");
40 Real shift = _shift ? *_shift : 0.0;
41 return _src[_qp] * _normal_factor / denominator - shift;
42}
registerMooseObject("MooseApp", NormalizationAux)
unsigned int _qp
Quadrature point index.
Definition AuxKernel.h:155
static InputParameters validParams()
Definition AuxKernel.C:27
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.
This auxiliary kernel normalizes a variable based on a postprocessor.
const VariableValue & _src
static InputParameters validParams()
const Real *const _pp_on_source
const Real *const _shift
virtual Real computeValue() override
Compute and return the value of the aux variable.
NormalizationAux(const InputParameters &parameters)