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 "ConjugateHeatTransfer.h" 11 : 12 : #include "metaphysicl/raw_type.h" 13 : 14 : using MetaPhysicL::raw_value; 15 : 16 : registerMooseObject("HeatTransferApp", ConjugateHeatTransfer); 17 : 18 : InputParameters 19 82 : ConjugateHeatTransfer::validParams() 20 : { 21 82 : InputParameters params = InterfaceKernel::validParams(); 22 164 : params.addRequiredParam<MaterialPropertyName>("htc", "heat transfer coefficient"); 23 164 : params.addRequiredCoupledVar("T_fluid", 24 : "The fluid temperature. It is not always identical to neighbor_var, " 25 : "e.g. when the fluid heat equation is solved for internal energy"); 26 82 : params.addClassDescription( 27 : "This InterfaceKernel models conjugate heat transfer. Fluid side must " 28 : "be primary side and solid side must be secondary side. T_fluid is provided in case that " 29 : "variable " 30 : "(== fluid energy variable) is not temperature but e.g. internal energy."); 31 82 : return params; 32 0 : } 33 : 34 44 : ConjugateHeatTransfer::ConjugateHeatTransfer(const InputParameters & parameters) 35 : : InterfaceKernel(parameters), 36 44 : _h(getADMaterialProperty<Real>("htc")), 37 44 : _T_fluid(coupledValue("T_fluid")), 38 132 : _apply_element_jacobian(_var.name() == getParam<std::vector<VariableName>>("T_fluid")[0]) 39 : { 40 44 : } 41 : 42 : Real 43 20160 : ConjugateHeatTransfer::computeQpResidual(Moose::DGResidualType type) 44 : { 45 20160 : switch (type) 46 : { 47 10080 : case Moose::Element: 48 10080 : return raw_value(_h[_qp]) * (_T_fluid[_qp] - _neighbor_value[_qp]) * _test[_i][_qp]; 49 : 50 10080 : case Moose::Neighbor: 51 10080 : return raw_value(_h[_qp]) * (_neighbor_value[_qp] - _T_fluid[_qp]) * _test_neighbor[_i][_qp]; 52 : 53 : default: 54 : return 0.0; 55 : } 56 : } 57 : 58 : Real 59 46080 : ConjugateHeatTransfer::computeQpJacobian(Moose::DGJacobianType type) 60 : { 61 46080 : switch (type) 62 : { 63 11520 : case Moose::ElementElement: 64 11520 : return _apply_element_jacobian ? raw_value(_h[_qp]) * _phi[_j][_qp] * _test[_i][_qp] : 0; 65 : 66 11520 : case Moose::NeighborNeighbor: 67 11520 : return raw_value(_h[_qp]) * _phi_neighbor[_j][_qp] * _test_neighbor[_i][_qp]; 68 : 69 11520 : case Moose::NeighborElement: 70 11520 : return _apply_element_jacobian ? raw_value(_h[_qp]) * -_phi[_j][_qp] * _test_neighbor[_i][_qp] 71 : : 0; 72 : 73 11520 : case Moose::ElementNeighbor: 74 11520 : return raw_value(_h[_qp]) * -_phi_neighbor[_j][_qp] * _test[_i][_qp]; 75 : 76 : default: 77 : return 0.0; 78 : } 79 : }