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 "FVKernel.h" 13 : #include "MooseVariableFV.h" 14 : #include "MooseVariableInterface.h" 15 : #include "CoupleableMooseVariableDependencyIntermediateInterface.h" 16 : #include "MaterialPropertyInterface.h" 17 : 18 : /// FVElemental is used for calculating residual contributions from volume 19 : /// integral terms of a PDE where the divergence theorem is not applied (e.g. 20 : /// time derivative terms, source terms, etc.). As with finite element 21 : /// kernels, all solution values and material properties must be indexed using 22 : /// the _qp member. Note that all interfaces for finite volume kernels are 23 : /// AD-based - be sure to use AD material properties and other AD values to 24 : /// maintain good jacobian/derivative quality. 25 : class FVElementalKernel : public FVKernel, 26 : public MooseVariableInterface<Real>, 27 : public CoupleableMooseVariableDependencyIntermediateInterface, 28 : public MaterialPropertyInterface 29 : { 30 : public: 31 : static InputParameters validParams(); 32 : FVElementalKernel(const InputParameters & parameters); 33 : 34 : /// Usually you should not override these functions - they have some 35 : /// tricky stuff in them that you don't want to mess up! 36 : ///@{ 37 : void computeResidual() override; 38 : void computeResidualAndJacobian() override; 39 : void computeJacobian() override; 40 : virtual void computeOffDiagJacobian(); 41 : void computeOffDiagJacobian(unsigned int) override; 42 : ///@} 43 : 44 3821 : const MooseVariableFV<Real> & variable() const override { return _var; } 45 : 46 : protected: 47 : /// This is the primary function that must be implemented for flux kernel 48 : /// terms. Note that solution gradients will be zero unless you are using a 49 : /// higher-order reconstruction. Material properties and other values 50 : /// should be initialized just like they are for finite element kernels here - 51 : /// since this is a FE-like volumetric integration term. 52 : virtual ADReal computeQpResidual() = 0; 53 : 54 : MooseVariableFV<Real> & _var; 55 : const ADVariableValue & _u; 56 : const Moose::Functor<ADReal> & _u_functor; 57 : const unsigned int _qp = 0; 58 : const Elem * const & _current_elem; 59 : 60 : /// The physical location of the element's quadrature Points, indexed by _qp 61 : const MooseArray<Point> & _q_point; 62 : };