65template<
size_t nDim, LIMITER LimiterKind,
class FieldType,
class GradientType>
75 const FieldType& field,
76 const GradientType& gradient,
81 constexpr size_t MAXNVAR = 32;
87 const size_t nPoint = geometry.
GetnPoint();
92 const bool periodic = (solver !=
nullptr) &&
97 constexpr size_t OMP_MAX_CHUNK = 512;
103 bool wasActive =
false;
110 limiterDetails.
preprocess(geometry, config, varBegin, varEnd, field);
126 if (periodicProj !=
nullptr)
129 for (
auto iPoint = 0ul; iPoint < periodicProj->
rows(); ++iPoint)
130 for (
auto iVar = 0ul; iVar < periodicProj->
cols(); ++iVar)
131 (*periodicProj)(iPoint,iVar) = 0.0;
136 for (
size_t iPoint = 0; iPoint < nPoint; ++iPoint)
137 for (
size_t iVar = varBegin; iVar < varEnd; ++iVar)
138 fieldMax(iPoint,iVar) = fieldMin(iPoint,iVar) = field(iPoint,iVar);
151 for (
size_t iPoint = 0; iPoint < nPointDomain; ++iPoint)
153 auto nodes = geometry.
nodes;
154 const auto coord_i = nodes->
GetCoord(iPoint);
160 for (
size_t iVar = varBegin; iVar < varEnd; ++iVar)
171 fieldMax(iPoint,iVar) = field(iPoint,iVar);
172 fieldMin(iPoint,iVar) = field(iPoint,iVar);
175 for(
size_t iDim = 0; iDim < nDim; ++iDim)
181 su2double projMax[MAXNVAR], projMin[MAXNVAR];
183 for (
size_t iVar = varBegin; iVar < varEnd; ++iVar)
184 projMax[iVar] = projMin[iVar] = 0.0;
186 if (periodicProj !=
nullptr && nodes->GetPeriodicBoundary(iPoint))
191 if (projections !=
nullptr) {
192 for (
auto iVar = varBegin; iVar < varEnd; ++iVar) {
193 const auto& periodicMin = projections[iVar];
194 const auto& periodicMax = projections[periodicProj->
cols()/2 + iVar];
197 projMin[iVar] = periodicMin;
198 projMax[iVar] = periodicMax;
213 for (
size_t iDim = 0; iDim < nDim; ++iDim)
214 dist_ij[iDim] = 0.5 * (coord_j[iDim] - coord_i[iDim]);
218 for(
size_t iVar = varBegin; iVar < varEnd; ++iVar)
222 gradient[iPoint][iVar], field(iPoint,iVar), field(jPoint,iVar), umusclKappa);
224 projMax[iVar] = max(projMax[iVar], proj);
225 projMin[iVar] = min(projMin[iVar], proj);
227 fieldMax(iPoint,iVar) = max(fieldMax(iPoint,iVar), field(jPoint,iVar));
228 fieldMin(iPoint,iVar) = min(fieldMin(iPoint,iVar), field(jPoint,iVar));
239 for(
size_t iVar = varBegin; iVar < varEnd; ++iVar)
242 fieldMax(iPoint,iVar) - field(iPoint,iVar));
245 fieldMin(iPoint,iVar) - field(iPoint,iVar));
247 limiter(iPoint,iVar) = geoFactor * min(limMax, limMin);
269 if (solver !=
nullptr)
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
Index_t cols() const noexcept
Definition C2DContainer.hpp:222
Index_t rows() const noexcept
Definition C2DContainer.hpp:222
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
bool GetFrozen_Limiter_Disc(void) const
Provides information about the way in which the limiter will be treated by the disc....
Definition CConfig.hpp:5223
unsigned short GetnMarker_Periodic(void) const
Get the total number of periodic markers.
Definition CConfig.hpp:3309
bool GetDiscrete_Adjoint(void) const
Get the indicator whether we are solving an discrete adjoint problem.
Definition CConfig.hpp:9299
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
CPoint * nodes
Node vector (dual grid information).
Definition CGeometry.hpp:253
unsigned long GetnPointDomain() const
Get number of real points (that belong to the domain).
Definition CGeometry.hpp:593
const CCompressedSparsePatternUL & GetPoints() const
Get the entire point adjacency information in compressed format (CSR).
Definition CPoint.hpp:241
su2double GetCoord(unsigned long iPoint, unsigned long iDim) const
Get the coordinates dor the control volume.
Definition CPoint.hpp:158
Definition CSolver.hpp:71
void InitiatePeriodicComms(CGeometry *geometry, const CConfig *config, unsigned short val_periodic_index, unsigned short commType)
Routine to load a solver quantity into the data structures for MPI periodic communication and to laun...
Definition CSolver.cpp:368
void CompleteComms(CGeometry *geometry, const CConfig *config, MPI_QUANTITIES commType)
Routine to complete the set of non-blocking communications launched by InitiateComms() and unpacking ...
Definition CSolver.cpp:1724
su2double * GetPeriodicProjection(unsigned long iPoint)
Reconstruction increment bounds for a periodic receive point, nullptr for other points.
Definition CSolver.hpp:4249
void CompletePeriodicComms(CGeometry *geometry, const CConfig *config, unsigned short val_periodic_index, unsigned short commType)
Routine to complete the set of non-blocking periodic communications launched by InitiatePeriodicComms...
Definition CSolver.cpp:1113
su2activematrix * GetPeriodicProjections(const CGeometry &geometry, const CConfig &config)
Storage for the limiters with rotational periodicity: the min and max, over the edges of the periodic...
Definition CSolver.cpp:351
void InitiateComms(CGeometry *geometry, const CConfig *config, MPI_QUANTITIES commType)
Routine to load a solver quantity into the data structures for MPI point-to-point communication and t...
Definition CSolver.cpp:1563
passivedouble su2double
Definition code_config.hpp:181
void computeLimiters_impl(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)
Generic limiter computation for methods based on one limiter value per point (as opposed to one per e...
Definition computeLimiters_impl.hpp:66
#define CURRENT_FUNCTION
Definition mpi_structure.hpp:59
bool BeginPassive()
Start a passive region, i.e. stop recording.
Definition ad_structure.hpp:381
void StartPreacc()
Starts a new preaccumulation section and sets the input variables.
Definition ad_structure.hpp:215
void EndPreacc()
Ends a preaccumulation section and computes the local Jacobi matrix of a code section using the varia...
Definition ad_structure.hpp:243
void SetPreaccOut(Ts &&... data)
Sets the scalar outputs of a preaccumulation section.
Definition ad_structure.hpp:222
void SetPreaccIn(Ts &&... data)
Sets the scalar inputs of a preaccumulation section.
Definition ad_structure.hpp:186
void EndPassive(bool wasActive)
End a passive region, i.e. start recording if we were recording before.
Definition ad_structure.hpp:387
constexpr int omp_get_num_threads()
Number of threads in current team.
Definition omp_structure.hpp:75
#define END_SU2_OMP_FOR
Definition omp_structure.hpp:158
constexpr int omp_get_max_threads()
Maximum number of threads available.
Definition omp_structure.hpp:70
size_t computeStaticChunkSize(size_t totalWork, size_t numThreads, size_t maxChunkSize)
Compute a chunk size based on totalWork and number of threads such that all threads get the same numb...
Definition omp_structure.hpp:223
#define SU2_OMP_FOR_DYN(CHUNK)
Definition omp_structure.hpp:150
#define SU2_OMP_FOR_STAT(CHUNK)
Definition omp_structure.hpp:151
PERIODIC_QUANTITIES
Vertex-based quantities exchanged during periodic marker communications.
Definition option_structure.hpp:2843
@ PERIODIC_NONE
No periodic communication required.
Definition option_structure.hpp:2844
@ PERIODIC_LIM_PRIM_1
Primitive limiter communication phase 1 of 2 (periodic only).
Definition option_structure.hpp:2865
MPI_QUANTITIES
Vertex-based quantities exchanged in MPI point-to-point communications.
Definition option_structure.hpp:2873
A traits class for limiters, see notes for "computeLimiters_impl()".
Definition CLimiterDetails.hpp:39
su2double geometricFactor(size_t iPoint, CGeometry &) const
Geometric modifier (e.g. increase limiting near sharp edges).
void preprocess(CGeometry &, CConfig &, size_t varBegin, size_t varEnd, const FieldType &)
Compute any global value that may be needed by the other functions.
su2double limiterFunction(size_t iVar, su2double proj, su2double delta) const
Smooth (usually) function of the maximum/minimum (positive/negative) gradient projections onto the ed...
static FORCEINLINE Type reconstructionIncrement(Int nDim, const Type *halfEdge, const Type *gradient, const Type &value_i, const Type &value_j, const Type &kappa)
MUSCL reconstruction increment using the displacement to the middle of an edge.
Definition CLimiterDetails.hpp:77