https://mooseframework.inl.gov
TemperaturePressureFunctionFluidPropertiesTest.h
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 #pragma once
11 
12 #include "MooseObjectUnitTest.h"
14 #include "MooseParsedFunction.h"
15 
17 {
18 public:
20  {
21  InputParameters params = _factory.getValidParams("ParsedFunction");
22  params.set<std::string>("_object_name") = "k_function";
23  params.set<FEProblem *>("_fe_problem") = _fe_problem.get();
24  params.set<FEProblemBase *>("_fe_problem_base") = _fe_problem.get();
25  params.set<SubProblem *>("_subproblem") = _fe_problem.get();
26  params.set<std::string>("expression") = "14 + 2e-2 * x + 3e-5 * y";
27  params.set<std::string>("_type") = "MooseParsedFunction";
28  _fe_problem->addFunction("ParsedFunction", "k_function", params);
29 
30  params.set<std::string>("expression") = "1400 + 2.5 * x + 32e-5 * y";
31  params.set<std::string>("_object_name") = "rho_function";
32  _fe_problem->addFunction("ParsedFunction", "rho_function", params);
33 
34  params.set<std::string>("expression") = "1e-3 + 1e-5 * x - 3e-9 * y";
35  params.set<std::string>("_object_name") = "mu_function";
36  _fe_problem->addFunction("ParsedFunction", "mu_function", params);
37 
38  params.set<std::string>("expression") = "3000. + 3*x + 5e-4*y";
39  params.set<std::string>("_object_name") = "cp_function";
40  _fe_problem->addFunction("ParsedFunction", "cp_function", params);
41 
42  _fe_problem->getFunction("k_function").initialSetup();
43  _fe_problem->getFunction("rho_function").initialSetup();
44  _fe_problem->getFunction("mu_function").initialSetup();
45  _fe_problem->getFunction("cp_function").initialSetup();
46 
47  buildObjects();
48  }
49 
50 protected:
51  void buildObjects()
52  {
53  InputParameters uo_params =
54  _factory.getValidParams("TemperaturePressureFunctionFluidProperties");
55  // Set the three functions and the specific isobaric heat capacity
56  uo_params.set<FunctionName>("k") = "k_function";
57  uo_params.set<FunctionName>("rho") = "rho_function";
58  uo_params.set<FunctionName>("mu") = "mu_function";
59  uo_params.set<Real>("cv") = 4186;
60 
61  _fe_problem->addUserObject("TemperaturePressureFunctionFluidProperties", "fp", uo_params);
63 
64  InputParameters uo_params2 =
65  _factory.getValidParams("TemperaturePressureFunctionFluidProperties");
66  // Set the three functions and the specific heat capacity
67  uo_params2.set<FunctionName>("k") = "k_function";
68  uo_params2.set<FunctionName>("rho") = "rho_function";
69  uo_params2.set<FunctionName>("mu") = "mu_function";
70  uo_params2.set<FunctionName>("cp") = "cp_function";
71  uo_params2.set<Real>("T_initial_guess") = 250;
72  uo_params2.set<Real>("p_initial_guess") = 1e7;
73  uo_params2.set<Real>("dT_integration_intervals") = 0.01;
74 
75  _fe_problem->addUserObject("TemperaturePressureFunctionFluidProperties", "fp_cp", uo_params2);
77  }
78 
81 };
std::shared_ptr< FEProblem > _fe_problem
T & set(const std::string &name, bool quiet_mode=false)
Fluid properties provided as multiple-variable functions of temperature and pressure.
InputParameters getValidParams(const std::string &name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real