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 "FVOrthogonalBoundaryDiffusion.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("MooseApp", FVOrthogonalBoundaryDiffusion); 14 : 15 : InputParameters 16 14319 : FVOrthogonalBoundaryDiffusion::validParams() 17 : { 18 14319 : InputParameters params = FVFluxBC::validParams(); 19 14319 : params.addClassDescription( 20 : "Imposes an orthogonal diffusion boundary term with specified boundary function."); 21 14319 : params.addRequiredParam<FunctionName>("function", 22 : "The value of the quantity of interest on the boundary."); 23 14319 : params.addRequiredParam<MaterialPropertyName>("coeff", "diffusion coefficient"); 24 14319 : params.addParam<MaterialPropertyName>( 25 : "diffusing_quantity", 26 : "The quantity that is diffusing. By default, the 'variable' solution value will be used."); 27 14319 : return params; 28 0 : } 29 : 30 28 : FVOrthogonalBoundaryDiffusion::FVOrthogonalBoundaryDiffusion(const InputParameters & parameters) 31 : : FVFluxBC(parameters), 32 28 : _function(getFunction("function")), 33 28 : _coeff_elem(getADMaterialProperty<Real>("coeff")), 34 28 : _coeff_neighbor(getNeighborADMaterialProperty<Real>("coeff")), 35 56 : _diff_quant_elem(isParamValid("diffusing_quantity") 36 28 : ? getADMaterialProperty<Real>("diffusing_quantity").get() 37 : : _u), 38 56 : _diff_quant_neighbor(isParamValid("diffusing_quantity") 39 28 : ? getNeighborADMaterialProperty<Real>("diffusing_quantity").get() 40 28 : : _u_neighbor) 41 : { 42 28 : } 43 : 44 : ADReal 45 2880 : FVOrthogonalBoundaryDiffusion::computeQpResidual() 46 : { 47 2880 : const bool elem_is_interior = (_face_type == FaceInfo::VarFaceNeighbors::ELEM); 48 : 49 2880 : const auto & diff_quant = elem_is_interior ? _diff_quant_elem[_qp] : _diff_quant_neighbor[_qp]; 50 2880 : const auto & coeff = elem_is_interior ? _coeff_elem[_qp] : _coeff_neighbor[_qp]; 51 : const auto & interior_centroid = 52 2880 : elem_is_interior ? _face_info->elemCentroid() : _face_info->neighborCentroid(); 53 : 54 5760 : return -coeff * (_function.value(_t, _face_info->faceCentroid()) - diff_quant) / 55 8640 : (_face_info->faceCentroid() - interior_centroid).norm(); 56 : }