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 "FVScalarLagrangeMultiplierConstraint.h" 13 : 14 : #include "libmesh/enum_point_locator_type.h" 15 : 16 : /** 17 : * This Kernel implements the residuals that enforce the constraint 18 : * 19 : * \phi(element E containing point P) = phi_0 20 : * 21 : * using a Lagrange multiplier approach. E.g. this kernel enforces the constraint that the 22 : * elemental value of \phi, in the element containing P, matches \phi_0 23 : * 24 : * In particular, this Kernel implements the residual contribution for 25 : * the lambda term in Eq. (5), and both terms in Eq. (6) where \int \phi_0 = V_0 26 : * 27 : * [0]: https://github.com/idaholab/large_media/blob/master/framework/scalar_constraint_kernel.pdf 28 : */ 29 : class FVPointValueConstraint : public FVScalarLagrangeMultiplierConstraint 30 : { 31 : public: 32 : static InputParameters validParams(); 33 : 34 : FVPointValueConstraint(const InputParameters & parameters); 35 0 : virtual void meshChanged() override { setMyElem(); } 36 : 37 : private: 38 : void setMyElem(); 39 : ADReal computeQpResidual() override final; 40 : 41 : /// The point where the constraint should be enforced 42 : const Point _point; 43 : 44 : /// We use a point locator in case the constraint is a point value 45 : std::unique_ptr<libMesh::PointLocatorBase> _point_locator; 46 : 47 : /// Pointer to the element in case we have a point constraint 48 : const Elem * _my_elem; 49 : };