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 "SolutionUserObject.h" 11 : 12 : // MOOSE includes 13 : #include "ConsoleUtils.h" 14 : #include "MooseError.h" 15 : #include "MooseMesh.h" 16 : #include "MooseUtils.h" 17 : #include "MooseVariableFE.h" 18 : #include "RotationMatrix.h" 19 : #include "Function.h" 20 : 21 : // libMesh includes 22 : #include "libmesh/equation_systems.h" 23 : #include "libmesh/mesh_function.h" 24 : #include "libmesh/numeric_vector.h" 25 : #include "libmesh/nonlinear_implicit_system.h" 26 : #include "libmesh/transient_system.h" 27 : #include "libmesh/parallel_mesh.h" 28 : #include "libmesh/serial_mesh.h" 29 : #include "libmesh/exodusII_io.h" 30 : #include "libmesh/exodusII_io_helper.h" 31 : #include "libmesh/enum_xdr_mode.h" 32 : 33 : registerMooseObject("MooseApp", SolutionUserObject); 34 : 35 : InputParameters 36 15181 : SolutionUserObject::validParams() 37 : { 38 : // Get the input parameters from the parent class 39 15181 : InputParameters params = SolutionUserObjectBase::validParams(); 40 15181 : params += FunctionParserUtils<false>::validParams(); 41 : 42 15181 : params.addCustomTypeParam<std::string>( 43 : "time_transformation", 44 : "t", 45 : "FunctionExpression", 46 : "Expression to transform from current simulation time to time at " 47 : "which to sample the solution."); 48 : 49 15181 : return params; 50 0 : } 51 : 52 458 : SolutionUserObject::SolutionUserObject(const InputParameters & parameters) 53 458 : : SolutionUserObjectBase(parameters), FunctionParserUtils<false>(parameters) 54 : { 55 : // Create parsed function 56 458 : _time_transformation = std::make_shared<SymFunction>(); 57 916 : parsedFunctionSetup( 58 458 : _time_transformation, getParam<std::string>("time_transformation"), "t", {}, {}, comm()); 59 : 60 : // the only parameter is time 61 458 : _func_params.resize(1); 62 458 : } 63 : 64 : Real 65 742 : SolutionUserObject::solutionSampleTime() 66 : { 67 742 : _func_params[0] = _t; 68 742 : return evaluate(_time_transformation); 69 : }