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 "NodalBCBase.h" 13 : #include "MooseVariableInterface.h" 14 : 15 : /** 16 : * Base class for deriving any boundary condition that works at nodes on vector variables 17 : */ 18 : class ArrayNodalBC : public NodalBCBase, public MooseVariableInterface<RealEigenVector> 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : ArrayNodalBC(const InputParameters & parameters); 24 : 25 : /** 26 : * Gets the variable this BC is active on 27 : * @return the variable 28 : */ 29 205499 : virtual const ArrayMooseVariable & variable() const override { return _var; } 30 : virtual void computeResidual() override; 31 : virtual void computeJacobian() override; 32 : virtual void computeOffDiagJacobian(unsigned int jvar) override; 33 : 34 : protected: 35 : ArrayMooseVariable & _var; 36 : 37 : /// current node being processed 38 : const Node * const & _current_node; 39 : 40 : /// Value of the unknown variable this BC is acting on 41 : const RealEigenVector & _u; 42 : 43 : /** 44 : * Compute this BC's contribution to the residual at the current quadrature point, 45 : * to be filled in \p residual. 46 : */ 47 : virtual void computeQpResidual(RealEigenVector & residual) = 0; 48 : 49 : /** 50 : * The user can override this function to compute the "on-diagonal" 51 : * Jacobian contribution for this VectorNodalBC. If not overriden, 52 : * returns one. 53 : */ 54 : virtual RealEigenVector computeQpJacobian(); 55 : 56 : /** 57 : * This is the virtual that derived classes should override for 58 : * computing an off-diagonal jacobian component. 59 : */ 60 : virtual RealEigenMatrix computeQpOffDiagJacobian(MooseVariableFEBase & jvar); 61 : 62 : /// Number of components of the array variable 63 : const unsigned int _count; 64 : 65 : private: 66 : /// Work vector for residual 67 : RealEigenVector _work_vector; 68 : };