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 5575531 : Limiter<T>::build(const LimiterType limiter) 33 : { 34 5575531 : switch (limiter) 35 : { 36 719817 : case LimiterType::VanLeer: 37 719817 : return std::make_unique<VanLeerLimiter<T>>(); 38 : 39 379867 : case LimiterType::Upwind: 40 379867 : return std::make_unique<UpwindLimiter<T>>(); 41 : 42 417585 : case LimiterType::CentralDifference: 43 417585 : return std::make_unique<CentralDifferenceLimiter<T>>(); 44 : 45 710276 : case LimiterType::MinMod: 46 710276 : return std::make_unique<MinModLimiter<T>>(); 47 : 48 523626 : case LimiterType::SOU: 49 523626 : return std::make_unique<SOULimiter<T>>(); 50 : 51 705320 : case LimiterType::QUICK: 52 705320 : return std::make_unique<QUICKLimiter<T>>(); 53 : 54 2119040 : case LimiterType::Venkatakrishnan: 55 2119040 : return std::make_unique<VenkatakrishnanLimiter<T>>(); 56 : 57 0 : default: 58 0 : mooseError("Unrecognized limiter type ", unsigned(limiter)); 59 : } 60 : } 61 : 62 : LimiterType 63 14331953 : limiterType(const InterpMethod interp_method) 64 : { 65 14331953 : switch (interp_method) 66 : { 67 8797066 : case InterpMethod::Average: 68 : case InterpMethod::SkewCorrectedAverage: 69 8797066 : return LimiterType::CentralDifference; 70 : 71 380083 : case InterpMethod::Upwind: 72 380083 : return LimiterType::Upwind; 73 : 74 745361 : case InterpMethod::VanLeer: 75 745361 : return LimiterType::VanLeer; 76 : 77 750401 : case InterpMethod::MinMod: 78 750401 : return LimiterType::MinMod; 79 : 80 552245 : case InterpMethod::SOU: 81 552245 : return LimiterType::SOU; 82 : 83 775853 : case InterpMethod::QUICK: 84 775853 : return LimiterType::QUICK; 85 : 86 2330944 : case InterpMethod::Venkatakrishnan: 87 2330944 : 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 : }