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 "LinearFVFunctorRadiativeBC.h" 11 : #include "MathUtils.h" 12 : 13 : registerMooseObject("HeatTransferApp", LinearFVFunctorRadiativeBC); 14 : 15 : InputParameters 16 64 : LinearFVFunctorRadiativeBC::validParams() 17 : { 18 64 : InputParameters params = LinearFVAdvectionDiffusionFunctorRobinBCBase::validParams(); 19 64 : params.addClassDescription( 20 : "Boundary condition for radiative heat flux in a linear finite volume system. " 21 : "The nonlinear radiative flux q = sigma * emissivity * (T^4 - Tinfinity^4) is " 22 : "linearized via first-order Taylor expansion around the extrapolated boundary face " 23 : "temperature from the previous iteration, yielding a Robin-type condition with " 24 : "second-order spatial accuracy. The lagged coefficients are updated on every linear system " 25 : "assembly. Fixed point iterations can be used to converge the nonlinear problem every time " 26 : "step."); 27 128 : params.addRequiredParam<MooseFunctorName>( 28 : "emissivity", 29 : "Functor describing the surface emissivity for the radiative boundary condition"); 30 128 : params.addRequiredParam<MooseFunctorName>( 31 : "Tinfinity", "Functor for the far-field temperature of the body in radiative heat transfer"); 32 128 : params.addParam<Real>( 33 128 : "stefan_boltzmann_constant", 5.670374419e-8, "The Stefan-Boltzmann constant"); 34 128 : params.addRequiredParam<MooseFunctorName>( 35 : "diffusion_coeff", 36 : "Functor for the thermal conductivity. Must match the diffusion_coeff used in " 37 : "LinearFVDiffusion, as it serves as the alpha coefficient in the Robin formulation."); 38 64 : return params; 39 0 : } 40 : 41 32 : LinearFVFunctorRadiativeBC::LinearFVFunctorRadiativeBC(const InputParameters & parameters) 42 : : LinearFVAdvectionDiffusionFunctorRobinBCBase(parameters), 43 32 : _emissivity(getFunctor<Real>("emissivity")), 44 64 : _tinf(getFunctor<Real>("Tinfinity")), 45 64 : _sigma(getParam<Real>("stefan_boltzmann_constant")), 46 96 : _diffusion_coeff(getFunctor<Real>("diffusion_coeff")) 47 : { 48 32 : _var.computeCellGradients(); 49 32 : } 50 : 51 : Real 52 219114 : LinearFVFunctorRadiativeBC::extrapolateFaceTemperature(Moose::StateArg state) const 53 : { 54 219114 : const auto & elem_info = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM) 55 219114 : ? _current_face_info->elemInfo() 56 0 : : _current_face_info->neighborInfo(); 57 219114 : return _var.getElemValue(*elem_info, state) + 58 219114 : _var.gradSln(*elem_info, state) * computeCellToFaceVector(); 59 : } 60 : 61 : Real 62 125208 : LinearFVFunctorRadiativeBC::getAlpha(Moose::FaceArg face, Moose::StateArg state) const 63 : { 64 125208 : return _diffusion_coeff(face, state); 65 : } 66 : 67 : Real 68 125208 : LinearFVFunctorRadiativeBC::getBeta(Moose::FaceArg face, Moose::StateArg state) const 69 : { 70 125208 : const Real T_b_old = extrapolateFaceTemperature(state); 71 125208 : return 4.0 * _sigma * _emissivity(face, state) * Utility::pow<3>(T_b_old); 72 : } 73 : 74 : Real 75 93906 : LinearFVFunctorRadiativeBC::getGamma(Moose::FaceArg face, Moose::StateArg state) const 76 : { 77 93906 : const Real T_b_old = extrapolateFaceTemperature(state); 78 93906 : return _sigma * _emissivity(face, state) * 79 93906 : (3.0 * Utility::pow<4>(T_b_old) + Utility::pow<4>(_tinf(face, state))); 80 : }