https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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"
17
18using namespace libMesh;
19
22{
24 params.addPrivateParam<THMProblem *>("_thm_problem");
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
33
34const std::string HeatConductionModel::DENSITY = "density";
35const std::string HeatConductionModel::TEMPERATURE = "T_solid";
36const std::string HeatConductionModel::THERMAL_CONDUCTIVITY = "thermal_conductivity";
37const 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
52void
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
61void
67
68void
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
97void
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}
registerMooseObject("ThermalHydraulicsApp", HeatConductionModel)
char ** blocks
const std::string name
Definition Setup.h:21
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition Component.C:345
bool problemIsTransient() const
Whether the problem is transient.
Definition Component.h:264
virtual RealVectorValue getDirection() const
virtual void addKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
Intermediate class for components that have mesh.
Provides functions to setup the heat conduction model.
HeatConductionModel(const InputParameters &params)
static const std::string THERMAL_CONDUCTIVITY
virtual void addHeatEquationRZ()
Add heat conduction equation for RZ coordinate system.
static InputParameters validParams()
static const std::string TEMPERATURE
virtual void addInitialConditions()
Add initial conditions.
static libMesh::FEType _fe_type
static const std::string SPECIFIC_HEAT_CONSTANT_PRESSURE
Factory & _factory
The Factory associated with the MooseApp.
const std::string _comp_name
Name of the component.
GeometricalComponent & _geometrical_component
The geometrical component that built this class.
static const std::string DENSITY
virtual void addVariables()
Add field variables used by this model.
HeatStructureInterface & _hs_interface
The heat structure interface that built this class.
virtual void addHeatEquationXYZ()
Add heat conduction equation for cartesian coordinate system.
Base class for cylindrical heat structure components.
Interface class for heat structure components.
FunctionName getInitialT() const
Gets the initial temperature function name.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addPrivateParam(const std::string &name, const T &value)
void registerBase(const std::string &value)
T & set(const std::string &name, bool quiet_mode=false)
static InputParameters validParams()
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.
void addFunctionIC(const VariableName &var_name, const std::string &func_name, const std::vector< SubdomainName > &block_names)
Definition Simulation.C:532
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
Specialization of FEProblem to run with component subsystem.
Definition THMProblem.h:19
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real