https://mooseframework.inl.gov
INSADObjectTracker.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 "INSADObjectTracker.h"
11 
12 registerMooseObject("NavierStokesApp", INSADObjectTracker);
13 
16 {
18  params.addClassDescription("User object used to track the kernels added to an INS simulation "
19  "and determine what properties to calculate in INSADMaterial");
20  return params;
21 }
22 
25 {
27  params.addParam<bool>("integrate_p_by_parts", "Whether to integrate the pressure by parts");
28  MooseEnum viscous_form("traction laplace", "laplace");
29  params.addParam<MooseEnum>("viscous_form",
30  viscous_form,
31  "The form of the viscous term. Options are 'traction' or 'laplace'");
32  params.addParam<bool>(
33  "has_boussinesq", false, "Whether the simulation has the boussinesq approximation");
34  params.addParam<MaterialPropertyName>(
35  "alpha", "The alpha material property for the boussinesq approximation");
36  params.addParam<MaterialPropertyName>("ref_temp", "The reference temperature material property");
37  params.addParam<std::string>("temperature", "The temperature variable");
38  params.addParam<RealVectorValue>("gravity", "Direction of the gravity vector");
39  params.addParam<bool>(
40  "has_gravity",
41  false,
42  "Whether the simulation has a gravity force imposed on the momentum equation");
43  params.addParam<bool>("has_transient", false, "Whether the momentum equations are transient");
44  params.addParam<bool>("has_energy_transient", false, "Whether the energy equation is transient");
45 
47 
48  params.addParam<bool>(
49  "has_heat_source", false, "Whether there is a heat source function object in the simulation");
50  params.addParam<FunctionName>("heat_source_function", "The function describing the heat source");
51  params.addParam<std::string>(
52  "heat_source_var",
53  "Variable describing the volumetric heat source. Note that if this variable evaluates to a "
54  "negative number, then this object will be an energy sink");
55 
56  params.addParam<bool>(
57  "has_coupled_force",
58  false,
59  "Whether the simulation has a force due to a coupled vector variable/vector function");
60  params.addParam<std::vector<VariableName>>("coupled_force_var",
61  "Variables imposing coupled forces");
62  params.addParam<std::vector<FunctionName>>("coupled_force_vector_function",
63  "The function(s) standing in as a coupled force(s)");
64 
65  params.addParam<bool>("has_advected_mesh",
66  false,
67  "Whether the fluid domain is undergoing displacement in which case we must "
68  "add an advecting mesh term to correct the material velocity.");
69  params.addParam<VariableName>("disp_x", "The x displacement");
70  params.addParam<VariableName>("disp_y", "The y displacement");
71  params.addParam<VariableName>("disp_z", "The z displacement");
72  params.addParamNamesToGroup("has_advected_mesh disp_x disp_y disp_z", "Moving mesh");
73  return params;
74 }
75 
77  : GeneralUserObject(parameters)
78 {
79 }
80 
81 void
83 {
84  params.addParam<bool>(
85  "has_ambient_convection",
86  false,
87  "Whether for the energy equation there is a heat source/sink due to convection "
88  "from ambient surroundings");
89  params.addParam<Real>("ambient_convection_alpha",
90  "The heat transfer coefficient from from ambient surroundings");
91  params.addParam<Real>("ambient_temperature", "The ambient temperature");
92 }
93 
94 template <>
95 bool
97 {
98  return !val1.compareCurrent(val2);
99 }
100 
101 void
102 INSADObjectTracker::addBlockIDs(const std::set<SubdomainID> & additional_block_ids)
103 {
104  for (const auto sub_id : additional_block_ids)
105  _block_id_to_params.emplace(sub_id, validTrackerParams());
106 }
107 
108 bool
109 INSADObjectTracker::isTrackerParamValid(const std::string & name, const SubdomainID sub_id) const
110 {
111  return getParams(sub_id).isParamValid(name);
112 }
113 
114 const InputParameters &
116 {
117  auto map_it = _block_id_to_params.find(sub_id);
118  if (map_it == _block_id_to_params.end())
119  mooseError("The requested sub_id is not a key in INSADObjectTracker::_block_id_to_params. Make "
120  "sure that your INSAD residual objects have block restrictions that are covered by "
121  "INSADMaterial (and derived) material objects");
122 
123  return map_it->second;
124 }
static InputParameters validTrackerParams()
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
const InputParameters & getParams(SubdomainID sub_id) const
virtual const std::string & name() const
InputParameters emptyInputParameters()
INSADObjectTracker(const InputParameters &parameters)
const std::string name
Definition: Setup.h:20
static bool notEqual(const T &val1, const T &val2)
bool isTrackerParamValid(const std::string &name, SubdomainID sub_id) const
std::unordered_map< SubdomainID, InputParameters > _block_id_to_params
registerMooseObject("NavierStokesApp", INSADObjectTracker)
void addAmbientConvectionParams(InputParameters &params)
Global for adding ambient convection parameters.
void addBlockIDs(const std::set< SubdomainID > &additional_block_ids)
Add additional block coverage to this.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool compareCurrent(const MooseEnum &other, CompareMode mode=CompareMode::COMPARE_NAME) const
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
Object for tracking what kernels have been added to an INSAD simulation.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
bool isParamValid(const std::string &name) const