https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ScalarComponentIC.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 "ScalarComponentIC.h"
11#include "MooseVariableScalar.h"
12
14
17{
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
35Real
registerMooseObject("MooseApp", ScalarComponentIC)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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...
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.
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition MooseBase.h:271
libMesh::Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int.
Initial condition to set different values on each component of scalar variable.
virtual Real value()
The value of the variable.
ScalarComponentIC(const InputParameters &parameters)
std::vector< Real > _initial_values
static InputParameters validParams()
InitialConditions are objects that set the initial value of variables.
static InputParameters validParams()
MooseVariableScalar & _var
Scalar variable this initial condition works on.