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 5299497 : Limiter<T>::build(const LimiterType limiter) 33 : { 34 5299497 : switch (limiter) 35 : { 36 698837 : case LimiterType::VanLeer: 37 698837 : return std::make_unique<VanLeerLimiter<T>>(); 38 : 39 371887 : case LimiterType::Upwind: 40 371887 : return std::make_unique<UpwindLimiter<T>>(); 41 : 42 215859 : case LimiterType::CentralDifference: 43 215859 : return std::make_unique<CentralDifferenceLimiter<T>>(); 44 : 45 669764 : case LimiterType::MinMod: 46 669764 : return std::make_unique<MinModLimiter<T>>(); 47 : 48 512630 : case LimiterType::SOU: 49 512630 : return std::make_unique<SOULimiter<T>>(); 50 : 51 706640 : case LimiterType::QUICK: 52 706640 : return std::make_unique<QUICKLimiter<T>>(); 53 : 54 2123880 : case LimiterType::Venkatakrishnan: 55 2123880 : return std::make_unique<VenkatakrishnanLimiter<T>>(); 56 : 57 0 : default: 58 0 : mooseError("Unrecognized limiter type ", unsigned(limiter)); 59 : } 60 : } 61 : 62 : LimiterType 63 5874070 : limiterType(const InterpMethod interp_method) 64 : { 65 5874070 : switch (interp_method) 66 : { 67 363916 : case InterpMethod::Average: 68 : case InterpMethod::SkewCorrectedAverage: 69 363916 : return LimiterType::CentralDifference; 70 : 71 374694 : case InterpMethod::Upwind: 72 374694 : return LimiterType::Upwind; 73 : 74 746814 : case InterpMethod::VanLeer: 75 746814 : return LimiterType::VanLeer; 76 : 77 721374 : case InterpMethod::MinMod: 78 721374 : return LimiterType::MinMod; 79 : 80 553698 : case InterpMethod::SOU: 81 553698 : return LimiterType::SOU; 82 : 83 777306 : case InterpMethod::QUICK: 84 777306 : return LimiterType::QUICK; 85 : 86 2336268 : case InterpMethod::Venkatakrishnan: 87 2336268 : 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 : }