https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
18public:
20 {
21 InputParameters params = _factory.getValidParams("ParsedFunction");
22 params.set<std::string>(MooseBase::name_param) = "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>(MooseBase::type_param) = "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>(MooseBase::name_param) = "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>(MooseBase::name_param) = "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>(MooseBase::name_param) = "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
48 }
49
50protected:
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 InputParameters uo_params3 =
79 _factory.getValidParams("TemperaturePressureFunctionFluidProperties");
80 // Set the three functions and the specific heat capacity
81 uo_params3.set<FunctionName>("k") = "k_function";
82 uo_params3.set<FunctionName>("rho") = "2000";
83 uo_params3.set<FunctionName>("mu") = "mu_function";
84 uo_params3.set<FunctionName>("cp") = "cp_function";
85 uo_params3.set<Real>("T_initial_guess") = 250;
86 uo_params3.set<Real>("p_initial_guess") = 1e7;
87 uo_params3.set<Real>("dT_integration_intervals") = 0.001;
88
89 _fe_problem->addUserObject(
90 "TemperaturePressureFunctionFluidProperties", "fp_incompressible", uo_params3);
92 "fp_incompressible");
93 }
94
98};
InputParameters getValidParams(const std::string &name) const
T & set(const std::string &name, bool quiet_mode=false)
static const std::string name_param
static const std::string type_param
std::shared_ptr< FEProblem > _fe_problem
Fluid properties provided as multiple-variable functions of temperature and pressure.
const T & getUserObject(const std::string &param_name, bool is_dependency=true) const