https://mooseframework.inl.gov
Loading...
Searching...
No Matches
InletVelocityTemperature1Phase.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
12
14
17{
19 params.addRequiredParam<Real>("vel", "Prescribed velocity [m/s]");
20 params.addRequiredParam<Real>("T", "Prescribed temperature [K]");
21 params.addParam<bool>("reversible", true, "True for reversible, false for pure inlet");
22 params.declareControllable("vel T");
23 params.addClassDescription("Boundary condition with prescribed velocity and temperature "
24 "for 1-phase flow channels.");
25 return params;
26}
27
29 : FlowBoundary1Phase(params), _reversible(getParam<bool>("reversible"))
30{
31}
32
33void
35{
37
38 auto fm = dynamic_cast<const FlowModelSinglePhase *>(_flow_model.get());
39 if (fm == nullptr)
40 logError("Incompatible flow model. Make sure you use this component with single phase flow "
41 "channel.");
42}
43
44void
46{
47 ExecFlagEnum userobject_execute_on(MooseUtils::getDefaultExecFlagEnum());
48 userobject_execute_on = {EXEC_INITIAL, EXEC_LINEAR, EXEC_NONLINEAR};
49
50 // boundary flux user object
51 const std::string boundary_flux_name = genName(name(), "boundary_flux");
52 {
53 const std::string class_name = "ADBoundaryFlux3EqnGhostVelocityTemperature";
54 InputParameters params = _factory.getValidParams(class_name);
55 params.set<Real>("vel") = getParam<Real>("vel");
56 params.set<Real>("T") = getParam<Real>("T");
57 params.set<Real>("normal") = _normal;
58 params.set<bool>("reversible") = _reversible;
59 params.set<UserObjectName>("numerical_flux") = _numerical_flux_name;
60 params.set<UserObjectName>("fluid_properties") = _fp_name;
61 params.set<ExecFlagEnum>("execute_on") = userobject_execute_on;
62 getTHMProblem().addUserObject(class_name, _boundary_uo_name, params);
63 connectObject(params, _boundary_uo_name, "vel");
64 connectObject(params, _boundary_uo_name, "T");
65 }
66
67 // BCs
68 addWeakBCs();
69}
registerMooseObject("ThermalHydraulicsApp", InletVelocityTemperature1Phase)
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_LINEAR
const ExecFlagType EXEC_NONLINEAR
const std::string name
Definition Setup.h:21
Real _normal
Outward normal on this boundary.
void logError(Args &&... args) const
Logs an error.
Definition Component.h:226
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition Component.C:135
Factory & _factory
The Factory associated with the MooseApp.
Definition Component.h:497
void connectObject(const InputParameters &obj_params, const std::string &obj_name, const std::string &param) const
Connects a controllable parameter of the component to a controllable parameter of a constituent objec...
Definition Component.C:98
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters &parameters)
InputParameters getValidParams(const std::string &name) const
UserObjectName _numerical_flux_name
Numerical flux user object name.
const UserObjectName _boundary_uo_name
Name of boundary user object name.
Base class for boundary components connected to FlowChannel1Phase components.
virtual void check() const override
Check the component integrity.
static InputParameters validParams()
virtual void addWeakBCs()
Creates the boundary condition objects for 1-phase flow.
UserObjectName _fp_name
Fluid property user object name.
std::shared_ptr< const FlowModel > _flow_model
Flow model.
Flow model for a single-component, single-phase fluid using the Euler equations.
Boundary condition with prescribed velocity and temperature for 1-phase flow channels.
InletVelocityTemperature1Phase(const InputParameters &params)
bool _reversible
True to allow the flow to reverse, otherwise false.
virtual void check() const override
Check the component integrity.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
std::string genName(const std::string &prefix, unsigned int id, const std::string &suffix="") const
Build a name from a prefix, number and possible suffix.
ExecFlagEnum getDefaultExecFlagEnum()