Documentation a537f1bdf2
Loading...
Searching...
No Matches
computeLimiters.hpp
Go to the documentation of this file.
1/*!
2 * \file computeLimiters.hpp
3 * \brief Compute limiters wrapper function.
4 * \author P. Gomes
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28#include "CLimiterDetails.hpp"
30
31/*!
32 * \brief A wrapper funtion that calls specialized implementations depending
33 * on "LimiterKind". Those implementations are generated by instantiating
34 * versions of "computeLimiters_impl" with appropriate specializations
35 * of "CLimiterDetails". See corresponding hpp files for further details.
36 * \ingroup FvmAlgos
37 */
38template<class FieldType, class GradientType>
39void computeLimiters(LIMITER LimiterKind,
40 CSolver* solver,
41 MPI_QUANTITIES kindMpiComm,
42 PERIODIC_QUANTITIES kindPeriodicComm1,
43 PERIODIC_QUANTITIES kindPeriodicComm2,
44 CGeometry& geometry,
45 const CConfig& config,
46 size_t varBegin,
47 size_t varEnd,
48 su2double umusclKappa,
49 const FieldType& field,
50 const GradientType& gradient,
51 FieldType& fieldMin,
52 FieldType& fieldMax,
53 FieldType& limiter)
54{
55 if (geometry.GetnDim() != 2 && geometry.GetnDim() != 3)
56 SU2_MPI::Error("Too many dimensions to compute limiters.", CURRENT_FUNCTION);
57
58#define INSTANTIATE(KIND)\
59if (geometry.GetnDim() == 2) {\
60 computeLimiters_impl<2,KIND>(solver, kindMpiComm, kindPeriodicComm1, kindPeriodicComm2, geometry,\
61 config, varBegin, varEnd, umusclKappa, field, gradient, fieldMin, fieldMax, limiter);\
62} else {\
63 computeLimiters_impl<3,KIND>(solver, kindMpiComm, kindPeriodicComm1, kindPeriodicComm2, geometry,\
64 config, varBegin, varEnd, umusclKappa, field, gradient, fieldMin, fieldMax, limiter);\
65}
66 switch (LimiterKind) {
67 case LIMITER::NONE:
68 {
70 for(size_t iPoint = 0; iPoint < geometry.GetnPoint(); ++iPoint)
71 for(size_t iVar = varBegin; iVar < varEnd; ++iVar)
72 limiter(iPoint, iVar) = 1.0;
74 break;
75 }
77 {
79 break;
80 }
82 {
84 break;
85 }
87 {
89 break;
90 }
92 {
94 break;
95 }
97 {
99 break;
100 }
102 {
104 break;
105 }
107 {
109 break;
110 }
112 {
114 break;
115 }
116 default:
117 {
118 SU2_MPI::Error("Unknown limiter type.", CURRENT_FUNCTION);
119 break;
120 }
121 }
122#undef INSTANTIATE
123}
A class template that allows defining limiters via specialization of particular details.
static void Error(const std::string &ErrorMsg, const std::string &FunctionName)
Definition mpi_structure.cpp:131
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
unsigned long GetnPoint() const
Get number of points.
Definition CGeometry.hpp:587
unsigned short GetnDim() const
Get number of coordinates.
Definition CGeometry.hpp:575
Definition CSolver.hpp:71
passivedouble su2double
Definition code_config.hpp:181
#define INSTANTIATE(KIND)
Generic computation of limiters.
void computeLimiters(LIMITER LimiterKind, CSolver *solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm1, PERIODIC_QUANTITIES kindPeriodicComm2, CGeometry &geometry, const CConfig &config, size_t varBegin, size_t varEnd, su2double umusclKappa, const FieldType &field, const GradientType &gradient, FieldType &fieldMin, FieldType &fieldMax, FieldType &limiter)
A wrapper funtion that calls specialized implementations depending on "LimiterKind"....
Definition computeLimiters.hpp:39
#define CURRENT_FUNCTION
Definition mpi_structure.hpp:59
#define END_SU2_OMP_FOR
Definition omp_structure.hpp:158
#define SU2_OMP_FOR_STAT(CHUNK)
Definition omp_structure.hpp:151
LIMITER
Types of slope limiters.
Definition option_structure.hpp:1038
@ VENKATAKRISHNAN
Slope limiter using Venkatakrisnan method (stencil formulation).
@ NISHIKAWA_R3
Slope limiter using Nishikawa's R3 method (stencil formulation).
@ NISHIKAWA_R4
Slope limiter using Nishikawa's R4 method (stencil formulation).
@ SHARP_EDGES
Slope limiter using sharp edges.
@ NISHIKAWA_R5
Slope limiter using Nishikawa's R5 method (stencil formulation).
@ VENKATAKRISHNAN_WANG
Slope limiter using Venkatakrisnan method, eps based on solution (stencil formulation).
@ WALL_DISTANCE
Slope limiter using wall distance.
@ NONE
No limiter.
@ BARTH_JESPERSEN
Slope limiter using Barth-Jespersen method (stencil formulation).
PERIODIC_QUANTITIES
Vertex-based quantities exchanged during periodic marker communications.
Definition option_structure.hpp:2843
MPI_QUANTITIES
Vertex-based quantities exchanged in MPI point-to-point communications.
Definition option_structure.hpp:2873