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 "INSFVFluxKernel.h" 11 : #include "SystemBase.h" 12 : #include "MooseVariableFE.h" 13 : #include "Assembly.h" 14 : #include "SubProblem.h" 15 : 16 : InputParameters 17 51549 : INSFVFluxKernel::validParams() 18 : { 19 51549 : auto params = FVFluxKernel::validParams(); 20 51549 : params += INSFVMomentumResidualObject::validParams(); 21 51549 : return params; 22 0 : } 23 : 24 19585 : INSFVFluxKernel::INSFVFluxKernel(const InputParameters & params) 25 19585 : : FVFluxKernel(params), INSFVMomentumResidualObject(*this) 26 : { 27 19585 : } 28 : 29 : void 30 64718254 : INSFVFluxKernel::computeResidual(const FaceInfo & fi) 31 : { 32 64718254 : if (_rc_uo.segregated()) 33 0 : FVFluxKernel::computeResidual(fi); 34 64718254 : } 35 : 36 : void 37 63941800 : INSFVFluxKernel::computeJacobian(const FaceInfo & fi) 38 : { 39 63941800 : if (_rc_uo.segregated()) 40 14724073 : FVFluxKernel::computeJacobian(fi); 41 63941800 : } 42 : 43 : void 44 14877273 : INSFVFluxKernel::computeResidualAndJacobian(const FaceInfo & fi) 45 : { 46 14877273 : if (_rc_uo.segregated()) 47 14724073 : FVFluxKernel::computeResidualAndJacobian(fi); 48 14877273 : } 49 : 50 : ADReal 51 13803684 : INSFVFluxKernel::computeQpResidual() 52 : { 53 : mooseAssert(_rc_uo.segregated(), "We should not get here if we are not segregated!"); 54 13803684 : return computeSegregatedContribution(); 55 : } 56 : 57 : void 58 111231190 : INSFVFluxKernel::addResidualAndJacobian(const ADReal & residual) 59 : { 60 216287013 : auto process_residual = [this](const ADReal & residual, const Elem & elem) 61 : { 62 216287013 : const auto dof_index = elem.dof_number(_sys.number(), _var.number(), 0); 63 216287013 : addResidualsAndJacobian(_assembly, 64 432574026 : std::array<ADReal, 1>{{residual}}, 65 216287013 : std::array<dof_id_type, 1>{{dof_index}}, 66 216287013 : _var.scalingFactor()); 67 327518203 : }; 68 : 69 111231190 : if (_face_type == FaceInfo::VarFaceNeighbors::ELEM || 70 : _face_type == FaceInfo::VarFaceNeighbors::BOTH) 71 111230260 : process_residual(residual, _face_info->elem()); 72 111231190 : if (_face_type == FaceInfo::VarFaceNeighbors::NEIGHBOR || 73 : _face_type == FaceInfo::VarFaceNeighbors::BOTH) 74 105056753 : process_residual(-residual, _face_info->neighbor()); 75 111231190 : }