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 "LinearFVRobinCHTBC.h" 11 : #include "NS.h" 12 : 13 : registerMooseObject("NavierStokesApp", LinearFVRobinCHTBC); 14 : 15 : InputParameters 16 104 : LinearFVRobinCHTBC::validParams() 17 : { 18 104 : InputParameters params = LinearFVAdvectionDiffusionBC::validParams(); 19 208 : params.addRequiredParam<MooseFunctorName>("h", "The convective heat transfer coefficient."); 20 208 : params.addRequiredParam<MooseFunctorName>("incoming_flux", 21 : "The incoming diffusive flux on the interface."); 22 208 : params.addRequiredParam<MooseFunctorName>("surface_temperature", 23 : "The prescribed temperature on the interface."); 24 208 : params.addRequiredParam<MooseFunctorName>( 25 : "thermal_conductivity", 26 : "The thermal conductivity of the material. Only used to compute the pure normal gradient of " 27 : "the variable on the boundary."); 28 : 29 104 : params.addClassDescription( 30 : "Conjugate heat transfer BC for Robin boundary condition-based coupling."); 31 104 : return params; 32 0 : } 33 : 34 52 : LinearFVRobinCHTBC::LinearFVRobinCHTBC(const InputParameters & parameters) 35 : : LinearFVAdvectionDiffusionBC(parameters), 36 : LinearFVCHTBCInterface(), 37 52 : _htc(getFunctor<Real>("h")), 38 104 : _k(getFunctor<Real>("thermal_conductivity")), 39 104 : _incoming_flux(getFunctor<Real>("incoming_flux")), 40 156 : _surface_temperature(getFunctor<Real>("surface_temperature")) 41 : { 42 52 : } 43 : 44 : Real 45 264690 : LinearFVRobinCHTBC::computeBoundaryValue() const 46 : { 47 264690 : const auto elem_info = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM) 48 264690 : ? _current_face_info->elemInfo() 49 156858 : : _current_face_info->neighborInfo(); 50 : 51 264690 : return _var.getElemValue(*elem_info, determineState()); 52 : } 53 : 54 : Real 55 0 : LinearFVRobinCHTBC::computeBoundaryNormalGradient() const 56 : { 57 0 : const auto elem_info = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM) 58 0 : ? _current_face_info->elemInfo() 59 0 : : _current_face_info->neighborInfo(); 60 0 : const auto state = determineState(); 61 0 : const auto current_face = singleSidedFaceArg(_current_face_info); 62 0 : const auto surface_temperature_face = functorFaceArg(_surface_temperature, _current_face_info); 63 0 : const auto incoming_flux_face = functorFaceArg(_incoming_flux, _current_face_info); 64 : 65 0 : return (_htc(current_face, state) * (_var.getElemValue(*elem_info, determineState()) - 66 0 : _surface_temperature(surface_temperature_face, state)) + 67 0 : _incoming_flux(incoming_flux_face, state)) / 68 0 : _k(current_face, state); 69 : } 70 : 71 : Real 72 33216 : LinearFVRobinCHTBC::computeBoundaryValueMatrixContribution() const 73 : { 74 : // We approximate the face value with the cell value here. 75 : // TODO: we can extend this to a 2-term expansion at some point when the need arises. 76 33216 : return 1.0; 77 : } 78 : 79 : Real 80 33216 : LinearFVRobinCHTBC::computeBoundaryValueRHSContribution() const 81 : { 82 : // We approximate the face value with the cell value, we 83 : // don't need to add anything to the right hand side. 84 33216 : return 0.0; 85 : } 86 : 87 : Real 88 232272 : LinearFVRobinCHTBC::computeBoundaryGradientMatrixContribution() const 89 : { 90 232272 : const auto face = singleSidedFaceArg(_current_face_info); 91 232272 : const auto state = determineState(); 92 : 93 : // We just put the heat transfer coefficient on the diagonal (multiplication with the 94 : // surface area is taken care of in the kernel). 95 232272 : return _htc(face, state); 96 : } 97 : Real 98 232272 : LinearFVRobinCHTBC::computeBoundaryGradientRHSContribution() const 99 : { 100 232272 : const auto state = determineState(); 101 232272 : const auto current_face = singleSidedFaceArg(_current_face_info); 102 232272 : const auto surface_temperature_face = functorFaceArg(_surface_temperature, _current_face_info); 103 232272 : const auto incoming_flux_face = functorFaceArg(_incoming_flux, _current_face_info); 104 : 105 232272 : return _htc(current_face, state) * _surface_temperature(surface_temperature_face, state) + 106 232272 : _incoming_flux(incoming_flux_face, state); 107 : }