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 108 : LinearFVRobinCHTBC::validParams() 17 : { 18 108 : InputParameters params = LinearFVAdvectionDiffusionBC::validParams(); 19 216 : params.addRequiredParam<MooseFunctorName>("h", "The convective heat transfer coefficient."); 20 216 : params.addRequiredParam<MooseFunctorName>("incoming_flux", 21 : "The incoming diffusive flux on the interface."); 22 216 : params.addRequiredParam<MooseFunctorName>("surface_temperature", 23 : "The prescribed temperature on the interface."); 24 216 : 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 108 : params.addClassDescription( 30 : "Conjugate heat transfer BC for Robin boundary condition-based coupling."); 31 108 : return params; 32 0 : } 33 : 34 54 : LinearFVRobinCHTBC::LinearFVRobinCHTBC(const InputParameters & parameters) 35 : : LinearFVAdvectionDiffusionBC(parameters), 36 : LinearFVCHTBCInterface(), 37 54 : _htc(getFunctor<Real>("h")), 38 108 : _k(getFunctor<Real>("thermal_conductivity")), 39 108 : _incoming_flux(getFunctor<Real>("incoming_flux")), 40 162 : _surface_temperature(getFunctor<Real>("surface_temperature")) 41 : { 42 54 : } 43 : 44 : Real 45 390816 : LinearFVRobinCHTBC::computeBoundaryValue() const 46 : { 47 390816 : const auto elem_info = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM) 48 390816 : ? _current_face_info->elemInfo() 49 225648 : : _current_face_info->neighborInfo(); 50 : 51 390816 : 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 : auto face = singleSidedFaceArg(_current_face_info); 62 0 : face.face_side = elem_info->elem(); 63 : 64 0 : return (_htc(face, state) * (_var.getElemValue(*elem_info, determineState()) - 65 0 : _surface_temperature(face, state)) + 66 0 : _incoming_flux(face, state)) / 67 0 : _k(face, state); 68 : } 69 : 70 : Real 71 49824 : LinearFVRobinCHTBC::computeBoundaryValueMatrixContribution() const 72 : { 73 : // We approximate the face value with the cell value here. 74 : // TODO: we can extend this to a 2-term expansion at some point when the need arises. 75 49824 : return 1.0; 76 : } 77 : 78 : Real 79 49824 : LinearFVRobinCHTBC::computeBoundaryValueRHSContribution() const 80 : { 81 : // We approximate the face value with the cell value, we 82 : // don't need to add anything to the right hand side. 83 49824 : return 0.0; 84 : } 85 : 86 : Real 87 339840 : LinearFVRobinCHTBC::computeBoundaryGradientMatrixContribution() const 88 : { 89 339840 : const auto face = singleSidedFaceArg(_current_face_info); 90 339840 : const auto state = determineState(); 91 : 92 : // We just put the heat transfer coefficient on the diagonal (multiplication with the 93 : // surface area is taken care of in the kernel). 94 339840 : return _htc(face, state); 95 : } 96 : Real 97 339840 : LinearFVRobinCHTBC::computeBoundaryGradientRHSContribution() const 98 : { 99 : // We check where the functor contributing to the right hand side lives. We do this 100 : // because this functor lives on the domain where the variable of this kernel doesn't. 101 339840 : const auto * elem_info = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM) 102 339840 : ? _current_face_info->elemInfo() 103 216768 : : _current_face_info->neighborInfo(); 104 : 105 339840 : const auto state = determineState(); 106 339840 : auto face = singleSidedFaceArg(_current_face_info); 107 339840 : face.face_side = elem_info->elem(); 108 : 109 339840 : return _htc(face, state) * _surface_temperature(face, state) + _incoming_flux(face, state); 110 : }