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 VectorNodalBC : public NodalBCBase, public MooseVariableInterface<RealVectorValue> 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : VectorNodalBC(const InputParameters & parameters); 24 : 25 : /** 26 : * Gets the variable this BC is active on 27 : * @return the variable 28 : */ 29 123705 : virtual const VectorMooseVariable & 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 : const VectorMooseVariable & _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 RealVectorValue & _u; 42 : 43 : virtual RealVectorValue computeQpResidual() = 0; 44 : 45 : /** 46 : * The user can override this function to compute the "on-diagonal" 47 : * Jacobian contribution for this VectorNodalBC. If not overriden, 48 : * returns (1, 1, 1). 49 : */ 50 : virtual RealVectorValue computeQpJacobian(); 51 : 52 : /** 53 : * This is the virtual that derived classes should override for 54 : * computing an off-diagonal jacobian component. 55 : */ 56 : virtual Real computeQpOffDiagJacobian(unsigned int jvar); 57 : };