https://mooseframework.inl.gov
HeatConductionModel.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 "HeatConductionModel.h"
11 #include "THMProblem.h"
12 #include "Factory.h"
13 #include "Component.h"
14 #include "ThermalHydraulicsApp.h"
15 #include "HeatStructureInterface.h"
17 
18 using namespace libMesh;
19 
22 {
24  params.addPrivateParam<THMProblem *>("_thm_problem");
25  params.addPrivateParam<HeatStructureInterface *>("_hs");
26  params.addRequiredParam<Real>("scaling_factor_temperature",
27  "Scaling factor for solid temperature variable.");
28  params.registerBase("THM:heat_conduction_model");
29  return params;
30 }
31 
32 registerMooseObject("ThermalHydraulicsApp", HeatConductionModel);
33 
34 const std::string HeatConductionModel::DENSITY = "density";
35 const std::string HeatConductionModel::TEMPERATURE = "T_solid";
36 const std::string HeatConductionModel::THERMAL_CONDUCTIVITY = "thermal_conductivity";
37 const std::string HeatConductionModel::SPECIFIC_HEAT_CONSTANT_PRESSURE = "specific_heat";
38 
40 
42  : MooseObject(params),
43  _sim(*params.getCheckedPointerParam<THMProblem *>("_thm_problem")),
44  _factory(_app.getFactory()),
45  _hs_interface(*params.getCheckedPointerParam<HeatStructureInterface *>("_hs")),
46  _geometrical_component(
47  dynamic_cast<GeometricalComponent &>(_hs_interface)), // TODO: do something safer
48  _comp_name(name())
49 {
50 }
51 
52 void
54 {
55  const auto & subdomain_names = _geometrical_component.getSubdomainNames();
56  const Real & scaling_factor = getParam<Real>("scaling_factor_temperature");
57 
58  _sim.addSimVariable(true, TEMPERATURE, _fe_type, subdomain_names, scaling_factor);
59 }
60 
61 void
63 {
64  const auto & subdomain_names = _geometrical_component.getSubdomainNames();
66 }
67 
68 void
70 {
72 
73  // add transient term
75  {
76  std::string class_name = "ADHeatConductionTimeDerivative";
77  InputParameters pars = _factory.getValidParams(class_name);
78  pars.set<NonlinearVariableName>("variable") = TEMPERATURE;
79  pars.set<std::vector<SubdomainName>>("block") = blocks;
80  pars.set<MaterialPropertyName>("specific_heat") = SPECIFIC_HEAT_CONSTANT_PRESSURE;
81  pars.set<MaterialPropertyName>("density_name") = DENSITY;
82  pars.set<bool>("use_displaced_mesh") = false;
83  _sim.addKernel(class_name, genName(_comp_name, "td"), pars);
84  }
85  // add diffusion term
86  {
87  std::string class_name = "ADHeatConduction";
88  InputParameters pars = _factory.getValidParams(class_name);
89  pars.set<NonlinearVariableName>("variable") = TEMPERATURE;
90  pars.set<std::vector<SubdomainName>>("block") = blocks;
91  pars.set<MaterialPropertyName>("thermal_conductivity") = THERMAL_CONDUCTIVITY;
92  pars.set<bool>("use_displaced_mesh") = false;
93  _sim.addKernel(class_name, genName(_comp_name, "hc"), pars);
94  }
95 }
96 
97 void
99 {
102 
103  const auto & blocks = hs_cyl.getSubdomainNames();
104  const auto & position = hs_cyl.getPosition();
105  const auto & direction = hs_cyl.getDirection();
106 
107  // add transient term
109  {
110  std::string class_name = "ADHeatConductionTimeDerivativeRZ";
111  InputParameters pars = _factory.getValidParams(class_name);
112  pars.set<NonlinearVariableName>("variable") = TEMPERATURE;
113  pars.set<std::vector<SubdomainName>>("block") = blocks;
114  pars.set<MaterialPropertyName>("specific_heat") = SPECIFIC_HEAT_CONSTANT_PRESSURE;
115  pars.set<MaterialPropertyName>("density_name") = DENSITY;
116  pars.set<bool>("use_displaced_mesh") = false;
117  pars.set<Point>("axis_point") = position;
118  pars.set<RealVectorValue>("axis_dir") = direction;
119  _sim.addKernel(class_name, genName(_comp_name, "td"), pars);
120  }
121  // add diffusion term
122  {
123  std::string class_name = "ADHeatConductionRZ";
124  InputParameters pars = _factory.getValidParams(class_name);
125  pars.set<NonlinearVariableName>("variable") = TEMPERATURE;
126  pars.set<std::vector<SubdomainName>>("block") = blocks;
127  pars.set<MaterialPropertyName>("thermal_conductivity") = THERMAL_CONDUCTIVITY;
128  pars.set<bool>("use_displaced_mesh") = false;
129  pars.set<Point>("axis_point") = position;
130  pars.set<RealVectorValue>("axis_dir") = direction;
131  _sim.addKernel(class_name, genName(_comp_name, "hc"), pars);
132  }
133 }
virtual void addHeatEquationXYZ()
Add heat conduction equation for cartesian coordinate system.
Specialization of FEProblem to run with component subsystem.
Definition: THMProblem.h:18
registerMooseObject("ThermalHydraulicsApp", HeatConductionModel)
static const std::string DENSITY
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.
char ** blocks
void addPrivateParam(const std::string &name, const T &value)
HeatConductionModel(const InputParameters &params)
T & set(const std::string &name, bool quiet_mode=false)
virtual void addInitialConditions()
Add initial conditions.
FunctionName getInitialT() const
Gets the initial temperature function name.
virtual RealVectorValue getDirection() const
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
virtual void addKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
const std::string _comp_name
Name of the component.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addFunctionIC(const VariableName &var_name, const std::string &func_name, const std::vector< SubdomainName > &block_names)
Definition: Simulation.C:532
void registerBase(const std::string &value)
void addSimVariable(bool nl, const VariableName &name, libMesh::FEType fe_type, Real scaling_factor=1.0)
Queues a variable of type MooseVariableScalar to be added to the nonlinear or aux system...
Definition: Simulation.C:271
Base class for cylindrical heat structure components.
static const std::string THERMAL_CONDUCTIVITY
static const std::string TEMPERATURE
const std::string name
Definition: Setup.h:21
bool problemIsTransient() const
Whether the problem is transient.
Definition: Component.h:264
virtual void addHeatEquationRZ()
Add heat conduction equation for RZ coordinate system.
Factory & _factory
The Factory associated with the MooseApp.
static InputParameters validParams()
Interface class for heat structure components.
GeometricalComponent & _geometrical_component
The geometrical component that built this class.
virtual void addVariables()
Add field variables used by this model.
static const std::string SPECIFIC_HEAT_CONSTANT_PRESSURE
HeatStructureInterface & _hs_interface
The heat structure interface that built this class.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Intermediate class for components that have mesh.
static libMesh::FEType _fe_type
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition: Component.C:345
static InputParameters validParams()
Provides functions to setup the heat conduction model.