https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
SubChannelAddVariablesAction Class Reference

Action that adds SubChannel variables needs for the solve. More...

#include <SubChannelAddVariablesAction.h>

Inheritance diagram for SubChannelAddVariablesAction:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 SubChannelAddVariablesAction (const InputParameters &parameters)
 
virtual void act () override
 
void timedAct ()
 
virtual void addRelationshipManagers (Moose::RelationshipManagerType when_type)
 
MooseObjectName uniqueActionName () const
 
const std::string & specificTaskName () const
 
const std::set< std::string > & getAllTasks () const
 
void appendTask (const std::string &task)
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
const std::string & name () const
 
std::string typeAndName () const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
MooseObjectName uniqueName () const
 
const InputParametersparameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () const
 
const TgetParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const TqueryParam (const std::string &name) const
 
const TgetRenamedParam (const std::string &old_name, const std::string &new_name) const
 
T getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool haveParameter (const std::string &name) const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &name) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
std::string messagePrefix (const bool hit_prefix=true) const
 
std::string errorPrefix (const std::string &) const
 
void mooseError (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecatedNoTrace (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
void callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
PerfGraphperfGraph ()
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static void callMooseError (MooseApp *const app, const InputParameters &params, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true)
 

Public Attributes

 usingCombinedWarningSolutionWarnings
 
const ConsoleStream _console
 

Static Public Attributes

static const std::string unique_action_name_param
 
static const std::string type_param
 
static const std::string name_param
 
static const std::string unique_name_param
 
static const std::string app_param
 
static const std::string moose_base_param
 
static const std::string kokkos_object_param
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Member Functions

void addAuxVariable (const std::string &var_name, const std::vector< SubdomainName > &blocks)
 Add a block-restricted auxiliary variable unless the user already defined it. More...
 
bool addRelationshipManagers (Moose::RelationshipManagerType when_type, const InputParameters &moose_object_pars)
 
void associateWithParameter (const std::string &param_name, InputParameters &params) const
 
void associateWithParameter (const InputParameters &from_params, const std::string &param_name, InputParameters &params) const
 
const TgetMeshProperty (const std::string &data_name, const std::string &prefix)
 
const TgetMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 
void flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const
 
InvalidSolutionID registerInvalidSolutionInternal (const std::string &message, const bool warning) const
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

const MooseEnum _fe_family
 FE family of the aux variables added by this action. More...
 
const MooseEnum _fe_order
 FE order of the aux variables added by this action. More...
 
std::string _registered_identifier
 
std::string _specific_task_name
 
std::set< std::string > _all_tasks
 
ActionWarehouse_awh
 
const std::string & _current_task
 
std::shared_ptr< MooseMesh > & _mesh
 
std::shared_ptr< MooseMesh > & _displaced_mesh
 
std::shared_ptr< FEProblemBase > & _problem
 
PerfID _act_timer
 
MooseApp_app
 
Factory_factory
 
ActionFactory_action_factory
 
const std::string & _type
 
const std::string & _name
 
const InputParameters_pars
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
const Parallel::Communicator & _communicator
 

Detailed Description

Action that adds SubChannel variables needs for the solve.

Definition at line 19 of file SubChannelAddVariablesAction.h.

Constructor & Destructor Documentation

◆ SubChannelAddVariablesAction()

SubChannelAddVariablesAction::SubChannelAddVariablesAction ( const InputParameters parameters)

Definition at line 29 of file SubChannelAddVariablesAction.C.

30  : Action(parameters),
33 {
34 }
const MooseEnum _fe_order
FE order of the aux variables added by this action.
Action(const InputParameters &parameters)
static MooseEnum getAuxVariableFamilies()
const InputParameters & parameters() const
const MooseEnum _fe_family
FE family of the aux variables added by this action.
static MooseEnum getAuxVariableOrders()

Member Function Documentation

◆ act()

void SubChannelAddVariablesAction::act ( )
overridevirtual

Implements Action.

Definition at line 55 of file SubChannelAddVariablesAction.C.

56 {
57  bool pin_mesh_exist = false;
58  bool duct_mesh_exist = false;
59 
60  std::vector<SubdomainName> fluid_blocks;
61  std::vector<SubdomainName> pin_blocks;
62  std::vector<SubdomainName> duct_blocks;
63 
64  const auto & mesh_actions = _awh.getActions<AddMeshGeneratorAction>();
65 
66  for (const auto * mesh_action : mesh_actions)
67  {
68  if (!mesh_action->parameters().isParamValid("type"))
69  continue;
70 
71  const auto & generator_type = mesh_action->getParam<std::string>("type");
72 
73  if (generator_type == "SCMQuadSubChannelMeshGenerator" ||
74  generator_type == "SCMTriSubChannelMeshGenerator")
75  {
76  // Use the user-provided mesh generator block name
77  fluid_blocks = {mesh_action->name()};
78  }
79 
80  if (generator_type == "SCMTriPinMeshGenerator" || generator_type == "SCMQuadPinMeshGenerator")
81  {
82  pin_mesh_exist = true;
83  // Use the user-provided mesh generator block name
84  pin_blocks = {mesh_action->name()};
85  }
86 
87  if (generator_type == "SCMTriDuctMeshGenerator" || generator_type == "SCMQuadDuctMeshGenerator")
88  {
89  duct_mesh_exist = true;
90  // Use the user-provided mesh generator block name
91  duct_blocks = {mesh_action->name()};
92  }
93  }
94 
95  // Backward-compatible fallback if no explicit subchannel mesh generator name was found
96  if (fluid_blocks.empty())
97  fluid_blocks = {"sub_channel"};
98 
99  std::vector<std::pair<std::string, std::vector<SubdomainName>>> vars_to_add;
100 
101  // Always-fluid variables
102  vars_to_add.push_back({SubChannelApp::MASS_FLOW_RATE, fluid_blocks});
103  vars_to_add.push_back({SubChannelApp::SURFACE_AREA, fluid_blocks});
104  vars_to_add.push_back({SubChannelApp::SUM_CROSSFLOW, fluid_blocks});
105  vars_to_add.push_back({SubChannelApp::PRESSURE, fluid_blocks});
106  vars_to_add.push_back({SubChannelApp::WETTED_PERIMETER, fluid_blocks});
107  vars_to_add.push_back({SubChannelApp::ENTHALPY, fluid_blocks});
108  vars_to_add.push_back({SubChannelApp::TEMPERATURE, fluid_blocks});
109  vars_to_add.push_back({SubChannelApp::DENSITY, fluid_blocks});
110  vars_to_add.push_back({SubChannelApp::VISCOSITY, fluid_blocks});
111  vars_to_add.push_back({SubChannelApp::DISPLACEMENT, fluid_blocks});
112 
113  // q_prime lives on pins if pins exist, otherwise on the fluid mesh
114  if (pin_mesh_exist)
115  vars_to_add.push_back({SubChannelApp::LINEAR_HEAT_RATE, pin_blocks});
116  else
117  vars_to_add.push_back({SubChannelApp::LINEAR_HEAT_RATE, fluid_blocks});
118 
119  // Pin-only variables
120  if (pin_mesh_exist)
121  {
122  vars_to_add.push_back({SubChannelApp::PIN_TEMPERATURE, pin_blocks});
123  vars_to_add.push_back({SubChannelApp::PIN_DIAMETER, pin_blocks});
124  // HTC is a subchannel-average output stored on the fluid mesh.
125  vars_to_add.push_back({SubChannelApp::HEAT_TRANSFER_COEFFICIENT, fluid_blocks});
126  }
127 
128  // Duct-only variables
129  if (duct_mesh_exist)
130  {
131  vars_to_add.push_back({SubChannelApp::DUCT_HEAT_FLUX, duct_blocks});
132  vars_to_add.push_back({SubChannelApp::DUCT_TEMPERATURE, duct_blocks});
133  }
134 
135  if (getParam<bool>("full_output"))
136  {
137  vars_to_add.push_back({SubChannelApp::PRESSURE_DROP, fluid_blocks});
138  vars_to_add.push_back({SubChannelApp::FRICTION_FACTOR, fluid_blocks});
139  }
140 
141  for (const auto & var_info : vars_to_add)
142  addAuxVariable(var_info.first, var_info.second);
143 }
static const std::string PRESSURE_DROP
Definition: SubChannelApp.h:32
static const std::string FRICTION_FACTOR
Definition: SubChannelApp.h:44
static const std::string MASS_FLOW_RATE
Definition: SubChannelApp.h:28
static const std::string DENSITY
Definition: SubChannelApp.h:37
ActionWarehouse & _awh
const T & getParam(const std::string &name) const
void addAuxVariable(const std::string &var_name, const std::vector< SubdomainName > &blocks)
Add a block-restricted auxiliary variable unless the user already defined it.
static const std::string PIN_DIAMETER
Definition: SubChannelApp.h:36
static const std::string DUCT_HEAT_FLUX
Definition: SubChannelApp.h:41
static const std::string DUCT_TEMPERATURE
Definition: SubChannelApp.h:42
static const std::string WETTED_PERIMETER
Definition: SubChannelApp.h:39
static const std::string VISCOSITY
Definition: SubChannelApp.h:38
static const std::string PIN_TEMPERATURE
Definition: SubChannelApp.h:35
static const std::string LINEAR_HEAT_RATE
Definition: SubChannelApp.h:40
static const std::string ENTHALPY
Definition: SubChannelApp.h:33
static const std::string SUM_CROSSFLOW
Definition: SubChannelApp.h:30
static const std::string PRESSURE
Definition: SubChannelApp.h:31
static const std::string SURFACE_AREA
Definition: SubChannelApp.h:29
static const std::string HEAT_TRANSFER_COEFFICIENT
Definition: SubChannelApp.h:45
static const std::string DISPLACEMENT
Definition: SubChannelApp.h:43
std::vector< const T *> getActions()
static const std::string TEMPERATURE
Definition: SubChannelApp.h:34

◆ addAuxVariable()

void SubChannelAddVariablesAction::addAuxVariable ( const std::string &  var_name,
const std::vector< SubdomainName > &  blocks 
)
protected

Add a block-restricted auxiliary variable unless the user already defined it.

Definition at line 37 of file SubChannelAddVariablesAction.C.

Referenced by act().

39 {
40  const auto & aux_actions = _awh.getActions<AddAuxVariableAction>();
41 
42  for (const auto * aux_action : aux_actions)
43  if (aux_action->name() == var_name)
44  return;
45 
46  auto params = _factory.getValidParams("MooseVariable");
47  params.set<MooseEnum>("family") = _fe_family;
48  params.set<MooseEnum>("order") = _fe_order;
49  params.set<std::vector<SubdomainName>>("block") = blocks;
50 
51  _problem->addAuxVariable("MooseVariable", var_name, params);
52 }
const MooseEnum _fe_order
FE order of the aux variables added by this action.
ActionWarehouse & _awh
Factory & _factory
T & set(const std::string &name, bool quiet_mode=false)
InputParameters getValidParams(const std::string &name) const
const MooseEnum _fe_family
FE family of the aux variables added by this action.
std::shared_ptr< FEProblemBase > & _problem
std::vector< const T *> getActions()

◆ validParams()

InputParameters SubChannelAddVariablesAction::validParams ( )
static

Definition at line 21 of file SubChannelAddVariablesAction.C.

22 {
24  params.addClassDescription("Adds the variables associated with the subchannel problem");
25  params.addParam<bool>("full_output", false, "Add optional subchannel output variables");
26  return params;
27 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _fe_family

const MooseEnum SubChannelAddVariablesAction::_fe_family
protected

FE family of the aux variables added by this action.

Definition at line 33 of file SubChannelAddVariablesAction.h.

Referenced by addAuxVariable().

◆ _fe_order

const MooseEnum SubChannelAddVariablesAction::_fe_order
protected

FE order of the aux variables added by this action.

Definition at line 35 of file SubChannelAddVariablesAction.h.

Referenced by addAuxVariable().


The documentation for this class was generated from the following files: