https://mooseframework.inl.gov
SubChannelAddVariablesAction.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 "ActionWarehouse.h"
12 #include "ActionFactory.h"
13 #include "AddAuxVariableAction.h"
14 #include "SubChannelApp.h"
15 
16 registerMooseAction("SubChannelApp", SubChannelAddVariablesAction, "meta_action");
17 
20 {
22  params.addClassDescription("Adds the variables associated with the subchannel problem");
23  return params;
24 }
25 
27  : Action(parameters),
28  _fe_family(AddVariableAction::getNonlinearVariableFamilies()),
29  _fe_order(AddVariableAction::getNonlinearVariableOrders())
30 {
31 }
32 
33 void
35 {
36  std::vector<std::string> var_names = {SubChannelApp::MASS_FLOW_RATE,
52 
53  // Get a list of the already existing AddAuxVariableAction
54  const auto & aux_actions = _awh.getActions<AddAuxVariableAction>();
55 
56  for (auto & vn : var_names)
57  {
58  const std::string class_name = "AddAuxVariableAction";
59  InputParameters params = _action_factory.getValidParams(class_name);
60  params.set<MooseEnum>("family") = _fe_family;
61  params.set<MooseEnum>("order") = _fe_order;
62 
63  std::shared_ptr<Action> action =
64  std::static_pointer_cast<Action>(_action_factory.create(class_name, vn, params));
65 
66  // Avoid trying (and failing) to override the user variable selection
67  bool add_action = true;
68  for (const auto aux_action : aux_actions)
69  if (aux_action->name() == vn)
70  add_action = false;
71 
72  if (add_action)
73  _awh.addActionBlock(action);
74  }
75 }
static const std::string PRESSURE_DROP
pressure drop
Definition: SubChannelApp.h:37
static const std::string MASS_FLOW_RATE
mass flow rate
Definition: SubChannelApp.h:29
static const std::string DENSITY
density
Definition: SubChannelApp.h:47
const MooseEnum _fe_order
FE order of the aux variables added by this action.
ActionWarehouse & _awh
InputParameters getValidParams(const std::string &name)
T & set(const std::string &name, bool quiet_mode=false)
static const std::string PIN_DIAMETER
pin diameter
Definition: SubChannelApp.h:45
static const std::string DUCT_LINEAR_HEAT_RATE
duct linear heat rate
Definition: SubChannelApp.h:55
void addActionBlock(std::shared_ptr< Action > blk)
registerMooseAction("SubChannelApp", SubChannelAddVariablesAction, "meta_action")
std::shared_ptr< Action > create(const std::string &action, const std::string &action_name, InputParameters &parameters)
const MooseEnum _fe_family
FE family of the aux variables added by this action.
static const std::string DUCT_TEMPERATURE
duct temperature
Definition: SubChannelApp.h:57
static const std::string WETTED_PERIMETER
wetted perimeter
Definition: SubChannelApp.h:51
static const std::string VISCOSITY
viscosity
Definition: SubChannelApp.h:49
static const std::string PIN_TEMPERATURE
pin temperature
Definition: SubChannelApp.h:43
static InputParameters validParams()
static const std::string LINEAR_HEAT_RATE
linear heat rate
Definition: SubChannelApp.h:53
static const std::string ENTHALPY
enthalpy
Definition: SubChannelApp.h:39
ActionFactory & _action_factory
static const std::string SUM_CROSSFLOW
sum of diversion crossflow
Definition: SubChannelApp.h:33
static const std::string PRESSURE
pressure
Definition: SubChannelApp.h:35
static const std::string SURFACE_AREA
surface area
Definition: SubChannelApp.h:31
void addClassDescription(const std::string &doc_string)
SubChannelAddVariablesAction(const InputParameters &parameters)
static const std::string DISPLACEMENT
subchannel displacement
Definition: SubChannelApp.h:59
Action that adds SubChannel variables needs for the solve.
std::vector< const T *> getActions()
static const std::string TEMPERATURE
temperature
Definition: SubChannelApp.h:41