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 126 : INSADDisplaceBoundaryBC::validParams() 18 : { 19 126 : InputParameters params = ADNodalBC::validParams(); 20 126 : params.addClassDescription("Boundary condition for displacing a boundary"); 21 252 : params.addRequiredParam<MooseFunctorName>("velocity", "The velocity at which to displace"); 22 252 : params.addRequiredParam<unsigned short>( 23 : "component", "What component of velocity/displacement this object is acting on."); 24 252 : 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 126 : return params; 30 0 : } 31 : 32 63 : INSADDisplaceBoundaryBC::INSADDisplaceBoundaryBC(const InputParameters & parameters) 33 : : ADNodalBC(parameters), 34 63 : _velocity(getFunctor<ADRealVectorValue>("velocity")), 35 63 : _u_old(_var.nodalValueOld()), 36 126 : _component(getParam<unsigned short>("component")), 37 189 : _sub_id(_mesh.getSubdomainID(getParam<SubdomainName>("associated_subdomain"))) 38 : { 39 63 : 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 63 : } 44 : 45 : ADReal 46 37712 : INSADDisplaceBoundaryBC::computeQpResidual() 47 : { 48 37712 : const std::set<SubdomainID> sub_id_set = {_sub_id}; 49 37712 : const Moose::NodeArg nd{_current_node, &sub_id_set}; 50 150848 : return _u - (_u_old + this->_dt * _velocity(nd, determineState())(_component)); 51 : }