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 "IntegratedBCBase.h" 13 : #include "MooseVariableInterface.h" 14 : 15 : /** 16 : * Base class for deriving any boundary condition of a integrated type 17 : */ 18 : class IntegratedBC : public IntegratedBCBase, public MooseVariableInterface<Real> 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : IntegratedBC(const InputParameters & parameters); 24 : 25 463824 : virtual const MooseVariable & variable() const override { return _var; } 26 : 27 : virtual void computeResidual() override; 28 : virtual void computeJacobian() override; 29 : /** 30 : * Computes d-ivar-residual / d-jvar... 31 : */ 32 : virtual void computeOffDiagJacobian(unsigned int jvar) override; 33 : /** 34 : * Computes jacobian block with respect to a scalar variable 35 : * @param jvar The number of the scalar variable 36 : */ 37 : void computeOffDiagJacobianScalar(unsigned int jvar) override; 38 : virtual void computeResidualAndJacobian() override; 39 : 40 : protected: 41 : /** 42 : * Method for computing the residual at quadrature points 43 : */ 44 : virtual Real computeQpResidual() = 0; 45 : 46 : /** 47 : * Method for computing the diagonal Jacobian at quadrature points 48 : */ 49 61476023 : virtual Real computeQpJacobian() { return 0; } 50 : 51 : /** 52 : * Method for computing an off-diagonal jacobian component at quadrature points. 53 : */ 54 551204 : virtual Real computeQpOffDiagJacobian(unsigned int /*jvar*/) { return 0; } 55 : 56 : /** 57 : * Method for computing an off-diagonal jacobian component from a scalar var. 58 : */ 59 0 : virtual Real computeQpOffDiagJacobianScalar(unsigned int jvar) 60 : { 61 : // Backwards compatibility 62 0 : return computeQpOffDiagJacobian(jvar); 63 : } 64 : 65 : /** 66 : * Insertion point for evaluations that depend on qp but are independent of the test functions. 67 : */ 68 5398525 : virtual void precalculateQpResidual() {} 69 : 70 : /** 71 : * Insertion point for evaluations that depend on qp but are independent of the test and shape 72 : * functions. 73 : */ 74 673968 : virtual void precalculateQpJacobian() {} 75 : 76 : /** 77 : * Insertion point for evaluations that depend on qp but are independent of the test and shape 78 : * functions for off-diagonal Jacobian assembly. 79 : */ 80 34298 : virtual void precalculateQpOffDiagJacobian(const MooseVariableFEBase & /*jvar*/) {} 81 : 82 : MooseVariable & _var; 83 : 84 : /// normals at quadrature points 85 : const MooseArray<Point> & _normals; 86 : 87 : // shape functions 88 : 89 : /// shape function values (in QPs) 90 : const VariablePhiValue & _phi; 91 : /// gradients of shape functions (in QPs) 92 : const VariablePhiGradient & _grad_phi; 93 : 94 : // test functions 95 : 96 : /// test function values (in QPs) 97 : const VariableTestValue & _test; 98 : /// gradients of test functions (in QPs) 99 : const VariableTestGradient & _grad_test; 100 : 101 : // unknown 102 : 103 : /// the values of the unknown variable this BC is acting on 104 : const VariableValue & _u; 105 : /// the gradient of the unknown variable this BC is acting on 106 : const VariableGradient & _grad_u; 107 : };