https://mooseframework.inl.gov
HeatStructureBase.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 "HeatStructureBase.h"
12 #include "ConstantFunction.h"
13 
16 {
19  return params;
20 }
21 
23  : Component2D(params),
25  _number_of_hs(_n_regions)
26 {
27 }
28 
29 void
31 {
34 }
35 
36 void
38 {
41 }
42 
43 const unsigned int &
44 HeatStructureBase::getIndexFromName(const std::string & name) const
45 {
46  return _name_index.at(name);
47 }
48 
49 bool
51 {
53 }
54 
55 void
57 {
59 }
60 
61 void
63 {
65 
66  if (isParamValid("materials"))
67  {
68  _hc_model->addMaterials();
69 
70  for (unsigned int i = 0; i < _n_regions; i++)
71  {
72  const SolidMaterialProperties & smp =
74 
75  Component * comp = (_parent != nullptr) ? _parent : this;
76  // if the values were given as constant, allow them to be controlled
77  const ConstantFunction * k_fn = dynamic_cast<const ConstantFunction *>(&smp.getKFunction());
78  if (k_fn != nullptr)
79  comp->connectObject(k_fn->parameters(), k_fn->name(), "k", "value");
80 
81  const ConstantFunction * cp_fn = dynamic_cast<const ConstantFunction *>(&smp.getCpFunction());
82  if (cp_fn != nullptr)
83  comp->connectObject(cp_fn->parameters(), cp_fn->name(), "cp", "value");
84 
85  const ConstantFunction * rho_fn =
86  dynamic_cast<const ConstantFunction *>(&smp.getRhoFunction());
87  if (rho_fn != nullptr)
88  comp->connectObject(rho_fn->parameters(), rho_fn->name(), "rho", "value");
89  }
90  }
91 
92  if (isParamValid("solid_properties"))
93  {
94  const auto sp_names = getParam<std::vector<UserObjectName>>("solid_properties");
95  const auto T_ref = getParam<std::vector<Real>>("solid_properties_T_ref");
96  for (unsigned int i = 0; i < sp_names.size(); i++)
97  addConstantDensitySolidPropertiesMaterial(sp_names[i], T_ref[i], i);
98  }
99 }
100 
101 void
103  const Real & T_ref,
104  unsigned int i_region) const
105 {
106  const auto blocks = getSubdomainNames();
107  const auto region_names = getNames();
108 
109  const std::string class_name = "ADConstantDensityThermalSolidPropertiesMaterial";
110  InputParameters params = _factory.getValidParams(class_name);
111  params.set<std::vector<SubdomainName>>("block") = {blocks[i_region]};
112  params.set<std::vector<VariableName>>("temperature") = {HeatConductionModel::TEMPERATURE};
113  params.set<UserObjectName>("sp") = sp_name;
114  params.set<Real>("T_ref") = T_ref;
116  class_name, genName(name(), class_name, region_names[i_region]), params);
117 }
void addConstantDensitySolidPropertiesMaterial(const UserObjectName &sp_name, const Real &T_ref, unsigned int i_region) const
Adds a ADConstantDensityThermalSolidPropertiesMaterial for a heat structure region.
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.
T & getUserObject(const std::string &name, unsigned int tid=0) const
char ** blocks
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition: Component.C:135
virtual void check() const override
Check the component integrity.
Definition: Component2D.C:47
const Function & getRhoFunction() const
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters)
T & set(const std::string &name, bool quiet_mode=false)
InputParameters getValidParams(const std::string &name) const
OrderWrapper order
Component * _parent
Pointer to a parent component (used in composed components)
Definition: Component.h:438
std::vector< std::string > _material_names
Material names.
const unsigned int & getIndexFromName(const std::string &name) const
Get index of the block from its name.
SECOND
virtual const std::string & name() const
bool isParamValid(const std::string &name) const
void check() const
Method to be called in the component&#39;s check() method.
unsigned int _n_regions
Number of transverse regions.
Definition: Component2D.h:157
const Function & getKFunction() const
static const std::string TEMPERATURE
const std::string name
Definition: Setup.h:20
static InputParameters validParams()
virtual void init()
Initializes the component.
Definition: Component.h:290
HeatStructureBase(const InputParameters &params)
Interface class for heat structure components.
Base class for THM components.
Definition: Component.h:27
std::shared_ptr< HeatConductionModel > _hc_model
The heat conduction model used by this heat structure.
static const libMesh::FEType & feType()
Get the FE type used for heat conduction.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void init()
Method to be called in the component&#39;s init() method.
Factory & _factory
The Factory associated with the MooseApp.
Definition: Component.h:446
void addMooseObjects()
Method to be called in the component&#39;s addMooseObjects() method.
void addVariables()
Method to be called in the component&#39;s addVariables() method.
virtual void check() const override
Check the component integrity.
const Function & getCpFunction() const
virtual void addVariables() override
virtual bool usingSecondOrderMesh() const override
Check if second order mesh is being used by this geometrical component.
static InputParameters validParams()
Definition: Component2D.C:35
const InputParameters & parameters() const
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition: Component.C:307
std::map< std::string, unsigned int > _name_index
Map from block name to block index.
virtual void addMooseObjects() override
virtual void init() override
Initializes the component.
const std::vector< std::string > & getNames() const
Gets the names of the transverse regions.
Definition: Component2D.h:50