www.mooseframework.org
ScalarComponentIC.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 "ScalarComponentIC.h"
11 #include "MooseVariableScalar.h"
12 
14 
15 template <>
18 {
20  params.addRequiredParam<std::vector<Real>>("values",
21  "Initial values to initialize the scalar variable.");
22 
23  return params;
24 }
25 
27  : ScalarInitialCondition(parameters), _initial_values(getParam<std::vector<Real>>("values"))
28 {
29  if (_initial_values.size() < _var.order())
30  mooseError("The initial vector values size given to the scalar variable '",
31  name(),
32  "' has wrong size.");
33 }
34 
35 Real
37 {
38  return _initial_values[_i];
39 }
Initial condition to set different values on each component of scalar variable.
virtual Real value()
The value of the variable.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void mooseError(Args &&... args) const
Definition: MooseObject.h:147
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
InitialConditions are objects that set the initial value of variables.
ScalarComponentIC(const InputParameters &parameters)
Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int...
InputParameters validParams< ScalarInitialCondition >()
registerMooseObject("MooseApp", ScalarComponentIC)
MooseVariableScalar & _var
Scalar variable this initial condition works on.
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:59