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 : #include "INSADDisplaceBoundaryBC.h" 11 : #include "SystemBase.h" 12 : #include "ImplicitEuler.h" 13 : 14 : registerMooseObject("NavierStokesApp", INSADDisplaceBoundaryBC); 15 : 16 : InputParameters 17 266 : INSADDisplaceBoundaryBC::validParams() 18 : { 19 266 : InputParameters params = ADNodalBC::validParams(); 20 266 : params.addClassDescription("Boundary condition for displacing a boundary"); 21 532 : params.addRequiredParam<MooseFunctorName>("velocity", "The velocity at which to displace"); 22 532 : params.addRequiredParam<unsigned short>( 23 : "component", "What component of velocity/displacement this object is acting on."); 24 532 : params.addRequiredParam<SubdomainName>( 25 : "associated_subdomain", 26 : "The subdomain that the boundary nodeset is associated with. This will be passed to the " 27 : "coupled functor for unambigious evaluation (e.g. at the edge of the node-patch where we " 28 : "might run into the intersection of subdomains"); 29 266 : return params; 30 0 : } 31 : 32 133 : INSADDisplaceBoundaryBC::INSADDisplaceBoundaryBC(const InputParameters & parameters) 33 : : ADNodalBC(parameters), 34 133 : _velocity(getFunctor<ADRealVectorValue>("velocity")), 35 133 : _u_old(_var.nodalValueOld()), 36 266 : _component(getParam<unsigned short>("component")), 37 399 : _sub_id(_mesh.getSubdomainID(getParam<SubdomainName>("associated_subdomain"))) 38 : { 39 133 : if (!dynamic_cast<const ImplicitEuler *>(&_sys.getTimeIntegrator(_var.number()))) 40 0 : mooseError("This boundary condition hard-codes a displacement update with the form of an " 41 : "implicit Euler discretization. Consequently please use the default time " 42 : "integrator, ImplicitEuler."); 43 133 : } 44 : 45 : ADReal 46 55979 : INSADDisplaceBoundaryBC::computeQpResidual() 47 : { 48 55979 : const std::set<SubdomainID> sub_id_set = {_sub_id}; 49 55979 : const Moose::NodeArg nd{_current_node, &sub_id_set}; 50 223916 : return _u - (_u_old + this->_dt * _velocity(nd, determineState())(_component)); 51 : }