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 "MooseEnum.h" 11 : #include "VanLeerLimiter.h" 12 : #include "UpwindLimiter.h" 13 : #include "CentralDifferenceLimiter.h" 14 : #include "MinModLimiter.h" 15 : #include "SOULimiter.h" 16 : #include "QUICKLimiter.h" 17 : #include "VenkatakrishnanLimiter.h" 18 : #include "MooseError.h" 19 : #include "MathFVUtils.h" 20 : 21 : #include <memory> 22 : 23 : namespace Moose 24 : { 25 : namespace FV 26 : { 27 : const MooseEnum moose_limiter_type( 28 : "vanLeer=0 upwind=1 central_difference=2 min_mod=3 sou=4 quick=5 venkatakrishnan=6", "upwind"); 29 : 30 : template <typename T> 31 : std::unique_ptr<Limiter<T>> 32 6283843 : Limiter<T>::build(const LimiterType limiter) 33 : { 34 6283843 : switch (limiter) 35 : { 36 818336 : case LimiterType::VanLeer: 37 818336 : return std::make_unique<VanLeerLimiter<T>>(); 38 : 39 419816 : case LimiterType::Upwind: 40 419816 : return std::make_unique<UpwindLimiter<T>>(); 41 : 42 419829 : case LimiterType::CentralDifference: 43 419829 : return std::make_unique<CentralDifferenceLimiter<T>>(); 44 : 45 795196 : case LimiterType::MinMod: 46 795196 : return std::make_unique<MinModLimiter<T>>(); 47 : 48 596666 : case LimiterType::SOU: 49 596666 : return std::make_unique<SOULimiter<T>>(); 50 : 51 807400 : case LimiterType::QUICK: 52 807400 : return std::make_unique<QUICKLimiter<T>>(); 53 : 54 2426600 : case LimiterType::Venkatakrishnan: 55 2426600 : return std::make_unique<VenkatakrishnanLimiter<T>>(); 56 : 57 0 : default: 58 0 : mooseError("Unrecognized limiter type ", unsigned(limiter)); 59 : } 60 : } 61 : 62 : LimiterType 63 15104946 : limiterType(const InterpMethod interp_method) 64 : { 65 15104946 : switch (interp_method) 66 : { 67 8797573 : case InterpMethod::Average: 68 : case InterpMethod::SkewCorrectedAverage: 69 8797573 : return LimiterType::CentralDifference; 70 : 71 420277 : case InterpMethod::Upwind: 72 420277 : return LimiterType::Upwind; 73 : 74 853293 : case InterpMethod::VanLeer: 75 853293 : return LimiterType::VanLeer; 76 : 77 843813 : case InterpMethod::MinMod: 78 843813 : return LimiterType::MinMod; 79 : 80 632589 : case InterpMethod::SOU: 81 632589 : return LimiterType::SOU; 82 : 83 888141 : case InterpMethod::QUICK: 84 888141 : return LimiterType::QUICK; 85 : 86 2669260 : case InterpMethod::Venkatakrishnan: 87 2669260 : return LimiterType::Venkatakrishnan; 88 : 89 0 : default: 90 0 : mooseError("Unrecognized interpolation method type."); 91 : } 92 : } 93 : 94 : // instantiations we care about 95 : template std::unique_ptr<Limiter<Real>> Limiter<Real>::build(const LimiterType limiter); 96 : template std::unique_ptr<Limiter<ADReal>> Limiter<ADReal>::build(const LimiterType limiter); 97 : } 98 : }