https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CopyValueAux.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 "CopyValueAux.h"
11#include "SystemBase.h"
12
14
17{
19 params.addClassDescription("Returns the specified variable as an auxiliary variable with a "
20 "simple copy of the variable values.");
21 params.addRequiredCoupledVar("source", "Variable to take the value of.");
22 MooseEnum stateEnum("CURRENT=0 OLD=1 OLDER=2", "CURRENT");
23 params.addParam<MooseEnum>(
24 "state",
25 stateEnum,
26 "This parameter specifies the state being copied. CURRENT=0 OLD=1 OLDER=2. Copying an older "
27 "state allows access to previous solution information if necessary.");
28 return params;
29}
30
32 : AuxKernel(parameters),
33 _state(getParam<MooseEnum>("state")),
34 _v(_state == 0 ? coupledValue("source")
35 : _state == 1 ? coupledValueOld("source")
36 : coupledValueOlder("source")),
37 _source_variable(*getVar("source", 0))
38{
40 paramError("variable",
41 "Source (" + Moose::stringify(_source_variable.feType().family) + ") and target (" +
43 ") variable have different families. You may use a ProjectionAux "
44 "instead of the CopyValueAux");
46 paramError("variable",
47 "Source (" + Moose::stringify(_source_variable.feType().order) + ") and target (" +
49 ") variable are of different orders. You may use a ProjectionAux "
50 "instead of the CopyValueAux");
51}
52
53Real
55{
56 return _v[_qp];
57}
registerMooseObject("MooseApp", CopyValueAux)
unsigned int _qp
Quadrature point index.
Definition AuxKernel.h:155
MooseVariableField< Real > & _var
This is a regular kernel so we cast to a regular MooseVariable, hides base _var.
Definition AuxKernel.h:113
static InputParameters validParams()
Definition AuxKernel.C:27
Copies one variable onto an auxiliary variable.
static InputParameters validParams()
const MooseVariable & _source_variable
A reference to the variable to project from.
const VariableValue & _v
The variable to project from.
virtual Real computeValue() override
Compute and return the value of the aux variable.
CopyValueAux(const InputParameters &parameters)
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.
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:457
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
const libMesh::FEType & feType() const
Get the type of finite element object.
OrderWrapper order
std::string stringify(const T &t)
conversion to string
Definition Conversion.h:64