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 "FVPorousFlowHeatConduction.h" 11 : #include "PorousFlowDictator.h" 12 : 13 : registerADMooseObject("PorousFlowApp", FVPorousFlowHeatConduction); 14 : 15 : InputParameters 16 82 : FVPorousFlowHeatConduction::validParams() 17 : { 18 82 : InputParameters params = FVFluxKernel::validParams(); 19 164 : params.addRequiredParam<UserObjectName>("PorousFlowDictator", 20 : "The PorousFlowDictator UserObject"); 21 82 : params.set<unsigned short>("ghost_layers") = 2; 22 82 : params.addClassDescription("Conductive heat flux"); 23 82 : return params; 24 0 : } 25 : 26 44 : FVPorousFlowHeatConduction::FVPorousFlowHeatConduction(const InputParameters & params) 27 : : FVFluxKernel(params), 28 44 : _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")), 29 88 : _lambda_element(getADMaterialProperty<RealTensorValue>("PorousFlow_thermal_conductivity_qp")), 30 44 : _lambda_neighbor( 31 44 : getNeighborADMaterialProperty<RealTensorValue>("PorousFlow_thermal_conductivity_qp")), 32 88 : _temperature_element(getADMaterialProperty<Real>("PorousFlow_temperature_qp")), 33 88 : _temperature_neighbor(getNeighborADMaterialProperty<Real>("PorousFlow_temperature_qp")), 34 132 : _grad_T(getADMaterialProperty<RealGradient>("PorousFlow_grad_temperature_qp")) 35 : { 36 44 : } 37 : 38 : ADReal 39 5460 : FVPorousFlowHeatConduction::computeQpResidual() 40 : { 41 : ADRealGradient gradT; 42 : ADRealTensorValue coeff; 43 : 44 : // If we are on a boundary face, use the gradient computed in _grad_T 45 5460 : if (onBoundary(*_face_info)) 46 : { 47 546 : gradT = -_grad_T[_qp]; 48 : 49 546 : coeff = _lambda_element[_qp]; 50 : } 51 : else 52 : { 53 : // If we are on an internal face, calculate the temperature gradient explicitly 54 4914 : const auto & T_elem = _temperature_element[_qp]; 55 4914 : const auto & T_neighbor = _temperature_neighbor[_qp]; 56 : 57 9828 : gradT = (T_elem - T_neighbor) * _face_info->eCN() / _face_info->dCNMag(); 58 : 59 4914 : interpolate(Moose::FV::InterpMethod::Average, 60 : coeff, 61 4914 : _lambda_element[_qp], 62 4914 : _lambda_neighbor[_qp], 63 : gradT, 64 4914 : *_face_info, 65 : true); 66 : } 67 : 68 5460 : return coeff * gradT * _normal; 69 : }