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 
17 {
19  params.addClassDescription(
20  "Initial condition to set different values on each component of scalar variable.");
21  params.addRequiredParam<std::vector<Real>>("values",
22  "Initial values to initialize the scalar variable.");
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...
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:56
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
static InputParameters validParams()
InitialConditions are objects that set the initial value of variables.
static InputParameters validParams()
ScalarComponentIC(const InputParameters &parameters)
Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("MooseApp", ScalarComponentIC)
MooseVariableScalar & _var
Scalar variable this initial condition works on.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
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...