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
20{
22 params.addPrivateParam<THMProblem *>("_thm_problem");
24 params.addRequiredParam<Real>("scaling_factor_temperature",
25 "Scaling factor for solid temperature variable.");
26 params.registerBase("THM:heat_conduction_model");
27 return params;
28}
29
31
32const std::string HeatConductionModel::DENSITY = "density";
33const std::string HeatConductionModel::TEMPERATURE = "T_solid";
34const std::string HeatConductionModel::THERMAL_CONDUCTIVITY = "thermal_conductivity";
35const std::string HeatConductionModel::SPECIFIC_HEAT_CONSTANT_PRESSURE = "specific_heat";
36
37FEType HeatConductionModel::_fe_type(FIRST, LAGRANGE);
38
40 : MooseObject(params),
41 _sim(*params.getCheckedPointerParam<THMProblem *>("_thm_problem")),
42 _factory(_app.getFactory()),
43 _hs_interface(*params.getCheckedPointerParam<HeatStructureInterface *>("_hs")),
44 _geometrical_component(
45 dynamic_cast<GeometricalComponent &>(_hs_interface)), // TODO: do something safer
46 _comp_name(name())
47{
48}
49
50void
52{
53 const auto & subdomain_names = _geometrical_component.getSubdomainNames();
54 const Real & scaling_factor = getParam<Real>("scaling_factor_temperature");
55
56 _sim.addSimVariable(true, TEMPERATURE, _fe_type, subdomain_names, scaling_factor);
57}
58
59void
65
66void
68{
70
71 // add transient term
73 {
74 std::string class_name = "ADHeatConductionTimeDerivative";
75 InputParameters pars = _factory.getValidParams(class_name);
76 pars.set<NonlinearVariableName>("variable") = TEMPERATURE;
77 pars.set<std::vector<SubdomainName>>("block") = blocks;
78 pars.set<MaterialPropertyName>("specific_heat") = SPECIFIC_HEAT_CONSTANT_PRESSURE;
79 pars.set<MaterialPropertyName>("density_name") = DENSITY;
80 pars.set<bool>("use_displaced_mesh") = false;
81 _sim.addKernel(class_name, genName(_comp_name, "td"), pars);
82 }
83 // add diffusion term
84 {
85 std::string class_name = "ADHeatConduction";
86 InputParameters pars = _factory.getValidParams(class_name);
87 pars.set<NonlinearVariableName>("variable") = TEMPERATURE;
88 pars.set<std::vector<SubdomainName>>("block") = blocks;
89 pars.set<MaterialPropertyName>("thermal_conductivity") = THERMAL_CONDUCTIVITY;
90 pars.set<bool>("use_displaced_mesh") = false;
91 _sim.addKernel(class_name, genName(_comp_name, "hc"), pars);
92 }
93}
94
95void
97{
100
101 const auto & blocks = hs_cyl.getSubdomainNames();
102 const auto & position = hs_cyl.getPosition();
103 const auto & direction = hs_cyl.getDirection();
104
105 // add transient term
107 {
108 std::string class_name = "ADHeatConductionTimeDerivativeRZ";
109 InputParameters pars = _factory.getValidParams(class_name);
110 pars.set<NonlinearVariableName>("variable") = TEMPERATURE;
111 pars.set<std::vector<SubdomainName>>("block") = blocks;
112 pars.set<MaterialPropertyName>("specific_heat") = SPECIFIC_HEAT_CONSTANT_PRESSURE;
113 pars.set<MaterialPropertyName>("density_name") = DENSITY;
114 pars.set<bool>("use_displaced_mesh") = false;
115 pars.set<Point>("axis_point") = position;
116 pars.set<RealVectorValue>("axis_dir") = direction;
117 _sim.addKernel(class_name, genName(_comp_name, "td"), pars);
118 }
119 // add diffusion term
120 {
121 std::string class_name = "ADHeatConductionRZ";
122 InputParameters pars = _factory.getValidParams(class_name);
123 pars.set<NonlinearVariableName>("variable") = TEMPERATURE;
124 pars.set<std::vector<SubdomainName>>("block") = blocks;
125 pars.set<MaterialPropertyName>("thermal_conductivity") = THERMAL_CONDUCTIVITY;
126 pars.set<bool>("use_displaced_mesh") = false;
127 pars.set<Point>("axis_point") = position;
128 pars.set<RealVectorValue>("axis_dir") = direction;
129 _sim.addKernel(class_name, genName(_comp_name, "hc"), pars);
130 }
131}
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)
InputParameters getValidParams(const std::string &name) const
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:529
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.
Specialization of FEProblem to run with component subsystem.
Definition THMProblem.h:19