https://mooseframework.inl.gov
FormLoss1PhaseBase.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 "FormLoss1PhaseBase.h"
11 #include "FlowModelSinglePhase.h"
12 #include "FlowChannel1Phase.h"
13 
16 {
18  params.addRequiredParam<std::string>("flow_channel",
19  "Flow channel where form loss will be applied");
20  params.addClassDescription("Base class for prescribing a form loss over a 1-phase flow channel");
21 
22  return params;
23 }
24 
26  : Component(params), _flow_channel_name(getParam<std::string>("flow_channel"))
27 {
28 }
29 
30 void
32 {
34 
35  if (hasComponentByName<FlowChannel1Phase>(_flow_channel_name))
36  {
37  const FlowChannel1Phase & fch = getComponentByName<FlowChannel1Phase>(_flow_channel_name);
39  }
40 }
41 
42 void
44 {
45  checkComponentOfTypeExistsByName<FlowChannel1Phase>(_flow_channel_name);
46 }
47 
48 void
50 {
51  {
52  const std::string class_name = "ADOneD3EqnMomentumFormLoss";
53  InputParameters params = _factory.getValidParams(class_name);
54  params.set<NonlinearVariableName>("variable") = FlowModelSinglePhase::RHOUA;
55  params.set<std::vector<SubdomainName>>("block") = _flow_channel_subdomains;
56  params.set<std::vector<VariableName>>("A") = {FlowModel::AREA};
57  params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
58  params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
60  class_name, genName(name(), FlowModelSinglePhase::RHOUA, "form_loss"), params);
61  }
62 }
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.
static const std::string AREA
Definition: FlowModel.h:102
const std::string & _flow_channel_name
Name of the flow channel component.
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition: Component.C:135
static const std::string VELOCITY
T & set(const std::string &name, bool quiet_mode=false)
InputParameters getValidParams(const std::string &name) const
virtual void addMooseObjects() override
static const std::string DENSITY
virtual void addKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
static InputParameters validParams()
static InputParameters validParams()
Definition: Component.C:18
virtual const std::string & name() const
FormLoss1PhaseBase(const InputParameters &params)
void addRequiredParam(const std::string &name, const std::string &doc_string)
Single-component, single-phase flow channel.
static const std::string RHOUA
virtual void init()
Initializes the component.
Definition: Component.h:290
Base class for THM components.
Definition: Component.h:27
std::vector< SubdomainName > _flow_channel_subdomains
Subdomains corresponding to the connected flow channel.
virtual void check() const override
Check the component integrity.
Factory & _factory
The Factory associated with the MooseApp.
Definition: Component.h:446
void addClassDescription(const std::string &doc_string)
virtual void init() override
Initializes the component.
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition: Component.C:307