https://mooseframework.inl.gov
InletDensityVelocity1Phase.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 
11 #include "FlowModelSinglePhase.h"
12 
13 registerMooseObject("ThermalHydraulicsApp", InletDensityVelocity1Phase);
14 
17 {
19  params.addRequiredParam<Real>("rho", "Prescribed density [kg/m^3]");
20  params.addRequiredParam<Real>("vel", "Prescribed velocity [m/s]");
21  params.addParam<bool>("reversible", true, "True for reversible, false for pure inlet");
22  params.declareControllable("rho vel");
23  params.addClassDescription(
24  "Boundary condition with prescribed density and velocity for 1-phase flow channels.");
25  return params;
26 }
27 
29  : FlowBoundary1Phase(params), _reversible(getParam<bool>("reversible"))
30 {
31 }
32 
33 void
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 
44 void
46 {
48  execute_on = {EXEC_INITIAL, EXEC_LINEAR, EXEC_NONLINEAR};
49 
50  // boundary flux user object
51  {
52  const std::string class_name = "ADBoundaryFlux3EqnGhostDensityVelocity";
53  InputParameters params = _factory.getValidParams(class_name);
54  params.set<Real>("rho") = getParam<Real>("rho");
55  params.set<Real>("vel") = getParam<Real>("vel");
56  params.set<Real>("normal") = _normal;
57  params.set<bool>("reversible") = _reversible;
58  params.set<UserObjectName>("fluid_properties") = _fp_name;
59  params.set<UserObjectName>("numerical_flux") = _numerical_flux_name;
60  params.set<ExecFlagEnum>("execute_on") = execute_on;
61  getTHMProblem().addUserObject(class_name, _boundary_uo_name, params);
62 
63  connectObject(params, _boundary_uo_name, "rho");
64  connectObject(params, _boundary_uo_name, "vel");
65  }
66 
67  // BCs
68  addWeakBCs();
69 }
registerMooseObject("ThermalHydraulicsApp", InletDensityVelocity1Phase)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition: Component.C:135
T & set(const std::string &name, bool quiet_mode=false)
Real _normal
Outward normal on this boundary.
static InputParameters validParams()
InputParameters getValidParams(const std::string &name) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
ExecFlagEnum getDefaultExecFlagEnum()
void logError(Args &&... args) const
Logs an error.
Definition: Component.h:215
Boundary condition with prescribed density and velocity for 1-phase flow channels.
const UserObjectName _boundary_uo_name
Name of boundary user object name.
static InputParameters validParams()
const ExecFlagType EXEC_LINEAR
const ExecFlagType EXEC_NONLINEAR
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
InletDensityVelocity1Phase(const InputParameters &params)
UserObjectName _numerical_flux_name
Numerical flux user object name.
std::shared_ptr< const FlowModel > _flow_model
Flow model.
Definition: FlowBoundary.h:36
Factory & _factory
The Factory associated with the MooseApp.
Definition: Component.h:446
void connectObject(const InputParameters &params, const std::string &mooseName, const std::string &name) const
Connect with control logic.
Definition: Component.C:98
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters &parameters)
virtual void check() const override
Check the component integrity.
virtual void addMooseObjects() override
void addClassDescription(const std::string &doc_string)
Flow model for a single-component, single-phase fluid using the Euler equations.
bool _reversible
True to allow the flow to reverse, otherwise false.
UserObjectName _fp_name
Fluid property user object name.
Definition: FlowBoundary.h:38
virtual void addWeakBCs()
Creates the boundary condition objects for 1-phase flow.
virtual void check() const override
Check the component integrity.
Base class for boundary components connected to FlowChannel1Phase components.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
const ExecFlagType EXEC_INITIAL