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 "INSFVEnergyAdvection.h" 11 : #include "INSFVEnergyVariable.h" 12 : #include "NS.h" 13 : 14 : registerMooseObject("NavierStokesApp", INSFVEnergyAdvection); 15 : 16 : InputParameters 17 4415 : INSFVEnergyAdvection::validParams() 18 : { 19 4415 : auto params = INSFVAdvectionKernel::validParams(); 20 4415 : params.addClassDescription("Advects energy, e.g. rho*cp*T. A user may still override what " 21 : "quantity is advected, but the default is rho*cp*T"); 22 8830 : params.addParam<MooseFunctorName>( 23 : "advected_quantity", NS::enthalpy_density, "The heat quantity to advect."); 24 4415 : return params; 25 0 : } 26 : 27 2401 : INSFVEnergyAdvection::INSFVEnergyAdvection(const InputParameters & params) 28 4802 : : INSFVAdvectionKernel(params), _adv_quant(getFunctor<ADReal>("advected_quantity")) 29 : { 30 2401 : if (!dynamic_cast<INSFVEnergyVariable *>(&_var)) 31 0 : mooseError("PINSFVEnergyAdvection may only be used with a fluid temperature variable, " 32 : "of variable type INSFVEnergyVariable."); 33 2401 : } 34 : 35 : ADReal 36 17416739 : INSFVEnergyAdvection::computeQpResidual() 37 : { 38 17416739 : const auto v = velocity(); 39 17416739 : const auto & limiter_time = _subproblem.isTransient() 40 17416739 : ? Moose::StateArg(1, Moose::SolutionIterationType::Time) 41 : : Moose::StateArg(1, Moose::SolutionIterationType::Nonlinear); 42 17416739 : const auto adv_quant_face = _adv_quant(makeFace(*_face_info, 43 : limiterType(_advected_interp_method), 44 17416739 : MetaPhysicL::raw_value(v) * _normal > 0, 45 : false, 46 : &limiter_time), 47 34833478 : determineState()); 48 34833478 : return _normal * v * adv_quant_face; 49 : }