Line data Source code
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 "HeatStructureEnergyBase.h" 11 : #include "HeatConductionModel.h" 12 : 13 : InputParameters 14 4 : HeatStructureEnergyBase::validParams() 15 : { 16 4 : InputParameters params = ElementIntegralPostprocessor::validParams(); 17 : 18 4 : params.addClassDescription("Computes the total energy for a heat structure."); 19 : 20 8 : params.addParam<Real>("n_units", 1., "Number of units of heat structure represents"); 21 8 : params.addParam<Real>("T_ref", 0, "Reference temperature"); 22 : 23 4 : return params; 24 0 : } 25 : 26 0 : HeatStructureEnergyBase::HeatStructureEnergyBase(const InputParameters & parameters) 27 : : ElementIntegralPostprocessor(parameters), 28 0 : _n_units(getParam<Real>("n_units")), 29 0 : _T_ref(getParam<Real>("T_ref")), 30 0 : _rho(getMaterialPropertyByName<Real>(HeatConductionModel::DENSITY)), 31 0 : _cp(getMaterialPropertyByName<Real>(HeatConductionModel::SPECIFIC_HEAT_CONSTANT_PRESSURE)), 32 0 : _T_var(&_fe_problem.getStandardVariable(_tid, HeatConductionModel::TEMPERATURE)), 33 0 : _T(_T_var->sln()) 34 : { 35 0 : addMooseVariableDependency(_T_var); 36 0 : } 37 : 38 : Real 39 0 : HeatStructureEnergyBase::computeQpIntegral() 40 : { 41 0 : return _rho[_qp] * _cp[_qp] * (_T[_qp] - _T_ref) * _n_units; 42 : }