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 "LinearFVDivergence.h" 11 : 12 : registerMooseObject("NavierStokesApp", LinearFVDivergence); 13 : 14 : InputParameters 15 1784 : LinearFVDivergence::validParams() 16 : { 17 1784 : InputParameters params = LinearFVFluxKernel::validParams(); 18 1784 : params.addClassDescription("Represents a divergence term. Note, this term does not contribute to " 19 : "the system matrix, only takes the divergence of a face flux field " 20 : "and adds it to the right hand side of the linear system."); 21 3568 : params.addRequiredParam<MooseFunctorName>("face_flux", "Functor for the face flux."); 22 1784 : return params; 23 0 : } 24 : 25 892 : LinearFVDivergence::LinearFVDivergence(const InputParameters & params) 26 1784 : : LinearFVFluxKernel(params), _face_flux(getFunctor<Real>("face_flux")) 27 : 28 : { 29 892 : } 30 : 31 : Real 32 28370011 : LinearFVDivergence::computeElemMatrixContribution() 33 : { 34 28370011 : return 0; 35 : } 36 : 37 : Real 38 28370011 : LinearFVDivergence::computeNeighborMatrixContribution() 39 : { 40 28370011 : return 0; 41 : } 42 : 43 : Real 44 28370011 : LinearFVDivergence::computeElemRightHandSideContribution() 45 : { 46 28370011 : return computeFaceFlux(); 47 : } 48 : 49 : Real 50 28370011 : LinearFVDivergence::computeNeighborRightHandSideContribution() 51 : { 52 28370011 : return -computeFaceFlux(); 53 : } 54 : 55 : Real 56 3695966 : LinearFVDivergence::computeBoundaryMatrixContribution(const LinearFVBoundaryCondition & /*bc*/) 57 : { 58 3695966 : return 0.0; 59 : } 60 : 61 : Real 62 3695966 : LinearFVDivergence::computeBoundaryRHSContribution(const LinearFVBoundaryCondition & /*bc*/) 63 : { 64 3695966 : return computeFaceFlux(); 65 : } 66 : 67 : Real 68 60435988 : LinearFVDivergence::computeFaceFlux() 69 : { 70 60435988 : const auto face_arg = makeCDFace(*_current_face_info); 71 60435988 : const auto state_arg = determineState(); 72 : 73 60435988 : if (!_cached_rhs_contribution) 74 : { 75 32065977 : _cached_rhs_contribution = true; 76 32065977 : _flux_rhs_contribution = _face_flux(face_arg, state_arg) * _current_face_area; 77 : } 78 : 79 60435988 : return _flux_rhs_contribution; 80 : }