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 "NSFVUtils.h" 11 : #include "MooseObject.h" 12 : #include "InputParameters.h" 13 : #include "MooseEnum.h" 14 : #include "MooseUtils.h" 15 : 16 : namespace Moose 17 : { 18 : namespace FV 19 : { 20 : bool 21 33420 : setInterpolationMethods(const MooseObject & obj, 22 : Moose::FV::InterpMethod & advected_interp_method, 23 : Moose::FV::InterpMethod & velocity_interp_method) 24 : { 25 : const bool need_more_ghosting = 26 33420 : setInterpolationMethod(obj, advected_interp_method, "advected_interp_method"); 27 : 28 33420 : const auto & velocity_interp_method_in = obj.getParam<MooseEnum>("velocity_interp_method"); 29 33420 : if (velocity_interp_method_in == "average") 30 694 : velocity_interp_method = InterpMethod::Average; 31 32726 : else if (velocity_interp_method_in == "rc") 32 32726 : velocity_interp_method = InterpMethod::RhieChow; 33 : else 34 0 : obj.mooseError("Unrecognized interpolation type ", 35 : static_cast<std::string>(velocity_interp_method_in)); 36 : 37 33420 : return need_more_ghosting; 38 : } 39 : 40 : InputParameters 41 66274 : interpolationParameters() 42 : { 43 66274 : auto params = advectedInterpolationParameter(); 44 132548 : MooseEnum velocity_interp_method("average rc", "rc"); 45 132548 : params.addParam<MooseEnum>( 46 : "velocity_interp_method", 47 : velocity_interp_method, 48 : "The interpolation to use for the velocity. Options are " 49 : "'average' and 'rc' which stands for Rhie-Chow. The default is Rhie-Chow."); 50 66274 : return params; 51 66274 : } 52 : } 53 : } 54 : 55 : namespace NS 56 : { 57 : template <class T> 58 : std::tuple<bool, T, T> 59 338600036 : isPorosityJumpFace(const Moose::FunctorBase<T> & porosity, 60 : const FaceInfo & fi, 61 : const Moose::StateArg & time) 62 : { 63 338600036 : if (!fi.neighborPtr() || (fi.elem().subdomain_id() == fi.neighbor().subdomain_id())) 64 : // We've agreed to only support porosity jump treatment at subdomain boundaries 65 337868948 : return {false, 0, 0}; 66 : 67 : mooseAssert(porosity.hasBlocks(fi.elem().subdomain_id()) && 68 : porosity.hasBlocks(fi.neighbor().subdomain_id()), 69 : "Porosity should have blocks on both elem and neighbor"); 70 : 71 730332 : const Moose::FaceArg face_elem{ 72 : &fi, Moose::FV::LimiterType::CentralDifference, true, false, fi.elemPtr(), nullptr}; 73 730332 : const Moose::FaceArg face_neighbor{ 74 : &fi, Moose::FV::LimiterType::CentralDifference, true, false, fi.neighborPtr(), nullptr}; 75 730332 : const auto eps_elem = porosity(face_elem, time), eps_neighbor = porosity(face_neighbor, time); 76 730332 : return {!MooseUtils::relativeFuzzyEqual(eps_elem, eps_neighbor), eps_elem, eps_neighbor}; 77 : } 78 : 79 : template std::tuple<bool, Real, Real> isPorosityJumpFace<Real>( 80 : const Moose::FunctorBase<Real> & porosity, const FaceInfo & fi, const Moose::StateArg & time); 81 : template std::tuple<bool, ADReal, ADReal> isPorosityJumpFace<ADReal>( 82 : const Moose::FunctorBase<ADReal> & porosity, const FaceInfo & fi, const Moose::StateArg & time); 83 : }