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 "INSElementIntegralEnergyAdvection.h" 11 : #include "NS.h" 12 : 13 : #include "metaphysicl/raw_type.h" 14 : 15 : registerMooseObject("NavierStokesApp", INSElementIntegralEnergyAdvection); 16 : registerMooseObject("NavierStokesApp", INSADElementIntegralEnergyAdvection); 17 : 18 : template <bool is_ad> 19 : InputParameters 20 82 : INSElementIntegralEnergyAdvectionTempl<is_ad>::validParams() 21 : { 22 82 : InputParameters params = ElementIntegralPostprocessor::validParams(); 23 82 : params.addClassDescription( 24 : "Computes the net volumetric balance of energy transported by advection"); 25 82 : params.addRequiredParam<MaterialPropertyName>(NS::cp, 26 : "The constant-pressure specific heat capacity"); 27 82 : params.addRequiredParam<MaterialPropertyName>(NS::density, "The density"); 28 82 : params.addRequiredCoupledVar(NS::temperature, "The temperature"); 29 82 : params.addRequiredCoupledVar(NS::velocity, "The velocity"); 30 82 : return params; 31 0 : } 32 : 33 : template <bool is_ad> 34 44 : INSElementIntegralEnergyAdvectionTempl<is_ad>::INSElementIntegralEnergyAdvectionTempl( 35 : const InputParameters & parameters) 36 : : ElementIntegralPostprocessor(parameters), 37 44 : _cp(getGenericMaterialProperty<Real, is_ad>(NS::cp)), 38 44 : _rho(getGenericMaterialProperty<Real, is_ad>(NS::density)), 39 44 : _grad_T(coupledGradient(NS::temperature)), 40 88 : _velocity(coupledVectorValue(NS::velocity)) 41 : { 42 44 : } 43 : 44 : template <bool is_ad> 45 : Real 46 5850 : INSElementIntegralEnergyAdvectionTempl<is_ad>::computeQpIntegral() 47 : { 48 5850 : return MetaPhysicL::raw_value(_cp[_qp]) * MetaPhysicL::raw_value(_rho[_qp]) * 49 5850 : (_grad_T[_qp] * _velocity[_qp]); 50 : } 51 : 52 : template class INSElementIntegralEnergyAdvectionTempl<false>; 53 : template class INSElementIntegralEnergyAdvectionTempl<true>;