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 "RandomInterface.h" 14 : #include "CoupleableMooseVariableDependencyIntermediateInterface.h" 15 : #include "MooseVariableInterface.h" 16 : 17 : /** 18 : * Base class for deriving any boundary condition that works at nodes 19 : */ 20 : class NodalBC : public NodalBCBase, public MooseVariableInterface<Real> 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : 25 : NodalBC(const InputParameters & parameters); 26 : 27 : /** 28 : * Gets the variable this BC is active on 29 : * @return the variable 30 : */ 31 13574351 : virtual const MooseVariable & variable() const override { return _var; } 32 : virtual void computeResidual() override; 33 : virtual void computeJacobian() override; 34 : virtual void computeOffDiagJacobian(unsigned int jvar) override; 35 : virtual void computeResidualAndJacobian() override; 36 : 37 : protected: 38 : MooseVariable & _var; 39 : 40 : /// current node being processed 41 : const Node * const & _current_node; 42 : 43 : /// Pseudo-"quadrature point" index (Always zero for the current node) 44 : const unsigned int _qp = 0; 45 : 46 : /// Value of the unknown variable this BC is acting on 47 : const VariableValue & _u; 48 : 49 : virtual Real computeQpResidual() = 0; 50 : /** 51 : * The user can override this function to compute the "on-diagonal" 52 : * Jacobian contribution for this NodalBC. If not overriden, 53 : * returns 1. 54 : */ 55 : virtual Real computeQpJacobian(); 56 : 57 : /** 58 : * This is the virtual that derived classes should override for 59 : * computing an off-diagonal jacobian component. 60 : */ 61 : virtual Real computeQpOffDiagJacobian(unsigned int jvar); 62 : };