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