https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
80
81void
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
94template <>
95bool
97{
98 return !val1.compareCurrent(val2);
99}
100
101void
102INSADObjectTracker::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
108bool
109INSADObjectTracker::isTrackerParamValid(const std::string & name, const SubdomainID sub_id) const
110{
111 return getParams(sub_id).isParamValid(name);
112}
113
114const 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}
registerMooseObject("NavierStokesApp", INSADObjectTracker)
void addAmbientConvectionParams(InputParameters &params)
Global for adding ambient convection parameters.
void addAmbientConvectionParams(InputParameters &params)
Global for adding ambient convection parameters.
InputParameters emptyInputParameters()
const std::string name
Definition Setup.h:21
static InputParameters validParams()
Object for tracking what kernels have been added to an INSAD simulation.
std::unordered_map< SubdomainID, InputParameters > _block_id_to_params
static bool notEqual(const T &val1, const T &val2)
bool isTrackerParamValid(const std::string &name, SubdomainID sub_id) const
const InputParameters & getParams(SubdomainID sub_id) const
INSADObjectTracker(const InputParameters &parameters)
void addBlockIDs(const std::set< SubdomainID > &additional_block_ids)
Add additional block coverage to this.
static InputParameters validParams()
static InputParameters validTrackerParams()
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
bool isParamValid(const std::string &name) const
const std::string & name() const
void mooseError(Args &&... args) const
bool compareCurrent(const MooseEnum &other, CompareMode mode=CompareMode::COMPARE_NAME) const