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