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 : #include "libmesh/nemesis_io.h" 33 : 34 : registerMooseObject("MooseApp", SolutionUserObject); 35 : 36 : InputParameters 37 4063 : SolutionUserObject::validParams() 38 : { 39 : // Get the input parameters from the parent class 40 4063 : InputParameters params = SolutionUserObjectBase::validParams(); 41 4063 : params += FunctionParserUtils<false>::validParams(); 42 : 43 28441 : params.addCustomTypeParam<std::string>( 44 : "time_transformation", 45 : "t", 46 : "FunctionExpression", 47 : "Expression to transform from current simulation time to time at " 48 : "which to sample the solution."); 49 : 50 4063 : return params; 51 0 : } 52 : 53 501 : SolutionUserObject::SolutionUserObject(const InputParameters & parameters) 54 501 : : SolutionUserObjectBase(parameters), FunctionParserUtils<false>(parameters) 55 : { 56 : // Create parsed function 57 501 : _time_transformation = std::make_shared<SymFunction>(); 58 1503 : parsedFunctionSetup( 59 1503 : _time_transformation, getParam<std::string>("time_transformation"), "t", {}, {}, comm()); 60 : 61 : // the only parameter is time 62 501 : _func_params.resize(1); 63 501 : } 64 : 65 : Real 66 879 : SolutionUserObject::solutionSampleTime() 67 : { 68 879 : _func_params[0] = _t; 69 2637 : return evaluate(_time_transformation); 70 : }