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 46721 : INSFVFluxKernel::validParams() 18 : { 19 46721 : auto params = FVFluxKernel::validParams(); 20 46721 : params += INSFVMomentumResidualObject::validParams(); 21 46721 : return params; 22 0 : } 23 : 24 17953 : INSFVFluxKernel::INSFVFluxKernel(const InputParameters & params) 25 17953 : : FVFluxKernel(params), INSFVMomentumResidualObject(*this) 26 : { 27 17953 : } 28 : 29 : void 30 58882608 : INSFVFluxKernel::computeResidual(const FaceInfo & fi) 31 : { 32 58882608 : if (_rc_uo.segregated()) 33 0 : FVFluxKernel::computeResidual(fi); 34 58882608 : } 35 : 36 : void 37 55317743 : INSFVFluxKernel::computeJacobian(const FaceInfo & fi) 38 : { 39 55317743 : if (_rc_uo.segregated()) 40 10540286 : FVFluxKernel::computeJacobian(fi); 41 55317743 : } 42 : 43 : void 44 10676686 : INSFVFluxKernel::computeResidualAndJacobian(const FaceInfo & fi) 45 : { 46 10676686 : if (_rc_uo.segregated()) 47 10540286 : FVFluxKernel::computeResidualAndJacobian(fi); 48 10676686 : } 49 : 50 : ADReal 51 9851532 : INSFVFluxKernel::computeQpResidual() 52 : { 53 : mooseAssert(_rc_uo.segregated(), "We should not get here if we are not segregated!"); 54 9851532 : return computeSegregatedContribution(); 55 : } 56 : 57 : void 58 101378726 : INSFVFluxKernel::addResidualAndJacobian(const ADReal & residual) 59 : { 60 394482458 : auto process_residual = [this](const ADReal & residual, const Elem & elem) 61 : { 62 197241229 : const auto dof_index = elem.dof_number(_sys.number(), _var.number(), 0); 63 197241229 : addResidualsAndJacobian(_assembly, 64 197241229 : std::array<ADReal, 1>{{residual}}, 65 394482458 : std::array<dof_id_type, 1>{{dof_index}}, 66 197241229 : _var.scalingFactor()); 67 197241229 : }; 68 : 69 101378726 : if (_face_type == FaceInfo::VarFaceNeighbors::ELEM || 70 : _face_type == FaceInfo::VarFaceNeighbors::BOTH) 71 101377928 : process_residual(residual, _face_info->elem()); 72 101378726 : if (_face_type == FaceInfo::VarFaceNeighbors::NEIGHBOR || 73 : _face_type == FaceInfo::VarFaceNeighbors::BOTH) 74 95863301 : process_residual(-residual, _face_info->neighbor()); 75 101378726 : }