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 : #pragma once 11 : 12 : #include "LinearFVKernel.h" 13 : #include "FaceArgInterface.h" 14 : 15 : /** 16 : * Finite volume kernel that contributes approximations of discretized face flux terms to the matrix 17 : * and right hand side of a linear system. 18 : */ 19 : class LinearFVFluxKernel : public LinearFVKernel, public FaceArgProducerInterface 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : 24 : /** 25 : * Class constructor. 26 : * @param parameters The InputParameters for the object 27 : */ 28 : LinearFVFluxKernel(const InputParameters & params); 29 : 30 : virtual void addMatrixContribution() override; 31 : 32 : virtual void addRightHandSideContribution() override; 33 : 34 : virtual bool hasFaceSide(const FaceInfo & fi, bool fi_elem_side) const override; 35 : 36 : /** 37 : * Set the current FaceInfo object 38 : * @param face_info The face info which will be used as current face info 39 : */ 40 : virtual void setupFaceData(const FaceInfo * face_info); 41 : 42 : /** 43 : * Set the coordinate system specific face area for the assembly 44 : * @param area the face area 45 : */ 46 2881612 : void setCurrentFaceArea(const Real area) { _current_face_area = area; }; 47 : 48 : /// Computes the system matrix contribution from an element side on an internal face 49 : virtual Real computeElemMatrixContribution() = 0; 50 : 51 : /// Computes the system matrix contribution from the neighbor side on an internal face 52 : virtual Real computeNeighborMatrixContribution() = 0; 53 : 54 : /// Computes the right hand side contribution from the element side on an internal face 55 : virtual Real computeElemRightHandSideContribution() = 0; 56 : 57 : /// Computes the right hand side contribution from the neighbor side on an internal face 58 : virtual Real computeNeighborRightHandSideContribution() = 0; 59 : 60 : /** 61 : * Computes the matrix contribution from a boundary face 62 : * @param bc The boundary condition on the given face 63 : */ 64 : virtual Real computeBoundaryMatrixContribution(const LinearFVBoundaryCondition & bc) = 0; 65 : 66 : /** 67 : * Computes the right hand side contribution from a boundary face 68 : * @param bc The boundary condition on the given face 69 : */ 70 : virtual Real computeBoundaryRHSContribution(const LinearFVBoundaryCondition & bc) = 0; 71 : 72 : protected: 73 : /** 74 : * Determine the single sided face argument when evaluating a functor on a face. 75 : * @param fi the FaceInfo for this face 76 : * @param limiter_type the limiter type, to be specified if more than the default average 77 : * interpolation is required for the parameters of the functor 78 : * @param correct_skewness whether to perform skew correction at the face 79 : */ 80 : Moose::FaceArg singleSidedFaceArg( 81 : const FaceInfo * fi, 82 : Moose::FV::LimiterType limiter_type = Moose::FV::LimiterType::CentralDifference, 83 : bool correct_skewness = false) const; 84 : 85 : /// Pointer to the face info we are operating on right now 86 : const FaceInfo * _current_face_info; 87 : 88 : /// The current, coordinate system specific face area 89 : Real _current_face_area; 90 : 91 : /// Face ownership information for the current face 92 : FaceInfo::VarFaceNeighbors _current_face_type; 93 : 94 : /// If we already built the matrix contribution. This switch can be used to 95 : /// check if cached quantities are already available in the kernel. 96 : bool _cached_matrix_contribution; 97 : 98 : /// If we already built the right hand side contribution. This switch can be used to 99 : /// check if cached quantities are already available in the kernel. 100 : bool _cached_rhs_contribution; 101 : 102 : /// Whether to force execution of this kernel on all external boundaries 103 : const bool _force_boundary_execution; 104 : 105 : /// A vector of dof indices that describe where to add the 106 : /// matrix and right hand side batch contribution 107 : DenseVector<dof_id_type> _dof_indices; 108 : 109 : /// Cache for a batch of matrix contributions for faster assembly 110 : DenseMatrix<Real> _matrix_contribution; 111 : 112 : /// Cache for a batch of vector contributions for faster assembly 113 : DenseVector<Real> _rhs_contribution; 114 : };