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 "ADIntegratedBC.h" 13 : 14 : class ElementAndTraceScalarHDGAssemblyHelper; 15 : 16 : /** 17 : * Base boundary condition for element-and-trace scalar hybridized DG discretizations assembled 18 : * with automatic differentiation. 19 : */ 20 : class ElementAndTraceScalarHDGBC : public ADIntegratedBC 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : 25 : ElementAndTraceScalarHDGBC(const InputParameters & parameters); 26 : 27 : virtual void computeResidual() override; 28 : virtual void computeJacobian() override; 29 : virtual void computeOffDiagJacobian(unsigned int jvar) override; 30 : virtual void computeResidualAndJacobian() override; 31 : virtual void jacobianSetup() override; 32 : virtual const std::unordered_set<unsigned int> & getMatPropDependencies() const override; 33 : virtual bool getMaterialPropertyCalled() const override; 34 : 35 : private: 36 : /// Computes the boundary residual data using the supplied assembly helper. 37 : virtual void compute(ElementAndTraceScalarHDGAssemblyHelper & helper) = 0; 38 : 39 : /// Returns the helper used for common element-and-trace scalar HDG assembly. 40 : virtual ElementAndTraceScalarHDGAssemblyHelper & hdgHelper() = 0; 41 : const ElementAndTraceScalarHDGAssemblyHelper & hdgHelper() const; 42 : 43 0 : virtual ADReal computeQpResidual() override { mooseError("this will never be called"); } 44 : 45 : /// Element for which the complete AD Jacobian was most recently assembled. 46 : const Elem * _cached_elem; 47 : 48 : /// Side for which the complete AD Jacobian was most recently assembled. 49 : unsigned int _cached_side; 50 : }; 51 : 52 : inline const ElementAndTraceScalarHDGAssemblyHelper & 53 6093 : ElementAndTraceScalarHDGBC::hdgHelper() const 54 : { 55 6093 : return const_cast<ElementAndTraceScalarHDGBC *>(this)->hdgHelper(); 56 : }