www.mooseframework.org
ScalarComponentIC.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "ScalarComponentIC.h"
16 #include "MooseVariableScalar.h"
17 
18 template <>
21 {
23  params.addRequiredParam<std::vector<Real>>("values",
24  "Initial values to initialize the scalar variable.");
25 
26  return params;
27 }
28 
30  : ScalarInitialCondition(parameters), _initial_values(getParam<std::vector<Real>>("values"))
31 {
32  if (_initial_values.size() < _var.order())
33  mooseError("The initial vector values size given to the scalar variable '",
34  name(),
35  "' has wrong size.");
36 }
37 
38 Real
40 {
41  return _initial_values[_i];
42 }
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:47
virtual Real value()
The value of the variable.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< ScalarComponentIC >()
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...
std::vector< Real > _initial_values
Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int...
InitialConditions are objects that set the initial value of variables.
ScalarComponentIC(const InputParameters &parameters)
InputParameters validParams< ScalarInitialCondition >()
MooseVariableScalar & _var
Scalar variable this initial condition works on.
void mooseError(Args &&...args) const
Definition: MooseObject.h:80