https://mooseframework.inl.gov
SolutionUserObject.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 "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 
34 
37 {
38  // Get the input parameters from the parent class
41 
42  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  return params;
50 }
51 
53  : SolutionUserObjectBase(parameters), FunctionParserUtils<false>(parameters)
54 {
55  // Create parsed function
56  _time_transformation = std::make_shared<SymFunction>();
58  _time_transformation, getParam<std::string>("time_transformation"), "t", {}, {}, comm());
59 
60  // the only parameter is time
61  _func_params.resize(1);
62 }
63 
64 Real
66 {
67  _func_params[0] = _t;
69 }
GenericReal< is_ad > evaluate(SymFunctionPtr &, const std::string &object_name="")
Evaluate FParser object and check EvalError.
static InputParameters validParams()
static InputParameters validParams()
User object that reads an existing solution from an input file and uses it in the current simulation...
registerMooseObject("MooseApp", SolutionUserObject)
void addCustomTypeParam(const std::string &name, const T &value, const std::string &custom_type, const std::string &doc_string)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Parallel::Communicator & comm() const
void parsedFunctionSetup(SymFunctionPtr &function, const std::string &expression, const std::string &variables, const std::vector< std::string > &constant_names, const std::vector< std::string > &constant_expressions, const libMesh::Parallel::Communicator &comm) const
Performs setup steps on a SymFunction.
SolutionUserObject(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< GenericReal< is_ad > > _func_params
Array to stage the parameters passed to the functions when calling Eval.
static InputParameters validParams()
User object that reads an existing solution from an input file and uses it in the current simulation...
virtual Real solutionSampleTime() override
Get the time at which to sample the solution.
SymFunctionPtr _time_transformation
function parser object for transforming the solution sample time