Line data Source code
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 "ScalarSolutionIC.h" 11 : #include "SolutionUserObjectBase.h" 12 : #include "MooseMesh.h" 13 : 14 : registerMooseObject("MooseApp", ScalarSolutionIC); 15 : registerMooseObjectRenamed("MooseApp", 16 : ScalarSolutionInitialCondition, 17 : "06/30/2024 24:00", 18 : ScalarSolutionIC); 19 : 20 : InputParameters 21 28578 : ScalarSolutionIC::validParams() 22 : { 23 28578 : InputParameters params = ScalarInitialCondition::validParams(); 24 28578 : params.addRequiredParam<UserObjectName>("solution_uo", 25 : "The SolutionUserObject to extract data from."); 26 28578 : params.addRequiredParam<VariableName>( 27 : "from_variable", "The name of the variable in the file that is to be extracted"); 28 28578 : params.addClassDescription( 29 : "Sets the initial condition from a scalar variable stored in an Exodus file, " 30 : "retrieved by a SolutionUserObject"); 31 : 32 28578 : return params; 33 0 : } 34 : 35 24 : ScalarSolutionIC::ScalarSolutionIC(const InputParameters & parameters) 36 : : ScalarInitialCondition(parameters), 37 24 : _solution_object(getUserObject<SolutionUserObjectBase>("solution_uo")), 38 48 : _solution_object_var_name(getParam<VariableName>("from_variable")) 39 : { 40 24 : } 41 : 42 : Real 43 16 : ScalarSolutionIC::value() 44 : { 45 16 : return _solution_object.scalarValue(0., _solution_object_var_name); 46 : }