https://mooseframework.inl.gov
InitialConditionInterface.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 
11 #include "InputParameters.h"
12 #include "MooseEnum.h"
13 
16 {
18 
19  MooseEnum stateEnum("CURRENT=0 OLD=1 OLDER=2", "CURRENT");
20  params.addParam<MooseEnum>(
21  "state",
22  stateEnum,
23  "This parameter is used to set old state solutions at the start of simulation. If specifying "
24  "multiple states at the start of simulation, use one IC object for each state being "
25  "specified. The states are CURRENT=0 OLD=1 OLDER=2. States older than 2 are not currently "
26  "supported. When the user only specifies current state, the solution is copied to the old "
27  "and older states, as expected. This functionality is mainly used for dynamic simulations "
28  "with explicit time integration schemes, where old solution states are used in the velocity "
29  "and acceleration approximations.");
30 
31  return params;
32 }
33 
35  : _my_state(parameters.get<MooseEnum>("state"))
36 {
37 }
38 
40 
41 unsigned short
43 {
44  return _my_state;
45 }
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1155
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters emptyInputParameters()
InitialConditionInterface(const InputParameters &parameters)
Constructor.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
unsigned short getState() const
Retrieves the state of this initial condition.
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...
static InputParameters validParams()