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 "MathFVUtils.h" 11 : #include "MooseVariableFV.h" 12 : 13 : namespace Moose 14 : { 15 : namespace FV 16 : { 17 : ADReal 18 10686490 : gradUDotNormal(const FaceInfo & face_info, 19 : const MooseVariableFV<Real> & fv_var, 20 : const Moose::StateArg & time, 21 : bool correct_skewness) 22 : 23 : { 24 21372980 : return fv_var.adGradSln(face_info, time, correct_skewness) * face_info.normal(); 25 : } 26 : 27 : bool 28 0 : onBoundary(const std::set<SubdomainID> & subs, const FaceInfo & fi) 29 : { 30 0 : if (!fi.neighborPtr()) 31 : // We're on the exterior boundary 32 0 : return true; 33 : 34 0 : if (subs.empty()) 35 : // The face is internal and our functor lives on all subdomains 36 0 : return false; 37 : 38 : const auto sub_count = 39 0 : subs.count(fi.elem().subdomain_id()) + subs.count(fi.neighbor().subdomain_id()); 40 : 41 0 : switch (sub_count) 42 : { 43 0 : case 0: 44 0 : mooseError("We should not be calling isExtrapolatedBoundaryFace on a functor that doesn't " 45 : "live on either of the face information's neighboring elements"); 46 : 47 0 : case 1: 48 : // We only live on one of the subs 49 0 : return true; 50 : 51 0 : case 2: 52 : // We live on both of the subs 53 0 : return false; 54 : 55 0 : default: 56 0 : mooseError("There should be no other sub_count options"); 57 : } 58 : } 59 : 60 : MooseEnum 61 31220 : interpolationMethods() 62 : { 63 : return MooseEnum("average upwind sou min_mod vanLeer quick venkatakrishnan skewness-corrected", 64 31220 : "upwind"); 65 : } 66 : 67 : InputParameters 68 31220 : advectedInterpolationParameter() 69 : { 70 31220 : auto params = emptyInputParameters(); 71 93660 : params.addParam<MooseEnum>("advected_interp_method", 72 62440 : interpolationMethods(), 73 : "The interpolation to use for the advected quantity. Options are " 74 : "'upwind', 'average', 'sou' (for second-order upwind), 'min_mod', " 75 : "'vanLeer', 'quick', 'venkatakrishnan', and " 76 : "'skewness-corrected' with the default being 'upwind'."); 77 31220 : return params; 78 0 : } 79 : 80 : InterpMethod 81 19952 : selectInterpolationMethod(const std::string & interp_method) 82 : { 83 19952 : if (interp_method == "average") 84 14635 : return InterpMethod::Average; 85 5317 : else if (interp_method == "harmonic") 86 3048 : return InterpMethod::HarmonicAverage; 87 2269 : else if (interp_method == "skewness-corrected") 88 700 : return InterpMethod::SkewCorrectedAverage; 89 1569 : else if (interp_method == "upwind") 90 375 : return InterpMethod::Upwind; 91 1194 : else if (interp_method == "rc") 92 0 : return InterpMethod::RhieChow; 93 1194 : else if (interp_method == "vanLeer") 94 82 : return InterpMethod::VanLeer; 95 1112 : else if (interp_method == "min_mod") 96 866 : return InterpMethod::MinMod; 97 246 : else if (interp_method == "sou") 98 82 : return InterpMethod::SOU; 99 164 : else if (interp_method == "quick") 100 82 : return InterpMethod::QUICK; 101 82 : else if (interp_method == "venkatakrishnan") 102 82 : return InterpMethod::Venkatakrishnan; 103 : else 104 0 : mooseError("Interpolation method ", 105 : interp_method, 106 : " is not currently an option in Moose::FV::selectInterpolationMethod"); 107 : } 108 : 109 : bool 110 1353 : setInterpolationMethod(const MooseObject & obj, 111 : Moose::FV::InterpMethod & interp_method, 112 : const std::string & param_name) 113 : { 114 1353 : bool need_more_ghosting = false; 115 : 116 1353 : const auto & interp_method_in = obj.getParam<MooseEnum>(param_name); 117 1353 : interp_method = selectInterpolationMethod(interp_method_in); 118 : 119 1353 : if (interp_method == InterpMethod::SOU || interp_method == InterpMethod::MinMod || 120 1113 : interp_method == InterpMethod::VanLeer || interp_method == InterpMethod::QUICK || 121 1069 : interp_method == InterpMethod::Venkatakrishnan) 122 306 : need_more_ghosting = true; 123 : 124 1353 : return need_more_ghosting; 125 : } 126 : } 127 : }