Skip to content

Commit e3d2dc8

Browse files
committed
Merge branch 'feature_custom_species_walls' of https://github.com/su2code/su2 into feature_custom_species_walls
2 parents 5f7c4c9 + b88877b commit e3d2dc8

32 files changed

+188
-167
lines changed

Common/include/geometry/CGeometry.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*!
1+
/*!
22
* \file CGeometry.hpp
33
* \brief Headers of the main subroutines for creating the geometrical structure.
44
* The subroutines and functions are in the <i>CGeometry.cpp</i> file.
@@ -51,6 +51,7 @@ extern "C" {
5151
#include <climits>
5252
#include <memory>
5353
#include <unordered_map>
54+
#include <cstdint>
5455

5556
#include "primal_grid/CPrimalGrid.hpp"
5657
#include "dual_grid/CDualGrid.hpp"

Common/include/geometry/primal_grid/CPrimalGrid.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828

2929
#pragma once
3030

31+
#include <cstdint>
3132
#include <iostream>
3233
#include <vector>
3334
#include <limits>
3435
#include <cstdlib>
35-
#include <limits>
3636
#include <memory>
3737

3838
#include "../../option_structure.hpp"

Common/include/toolboxes/graph_toolbox.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,16 @@ T createNaturalColoring(Index_t numInnerIndexes) {
479479
* pattern is returned.
480480
* \param[in] pattern - Sparse pattern to be colored.
481481
* \param[in] groupSize - Size of the outer index groups, default 1.
482+
* \param[in] includeOuterIdx - If the outer indices are the same type of entity as
483+
* the inner indices this must be true. For example, when both are point
484+
* indices, i.e. the pattern is the adjacency matrix.
482485
* \param[in] balanceColors - Try to balance number of indexes per color,
483486
* tends to result in worse locality (thus false by default).
484487
* \param[out] indexColor - Optional, vector with colors given to the outer indices.
485488
* \return Coloring in the same type of the input pattern.
486489
*/
487490
template <typename Color_t = unsigned char, size_t MaxColors = 255, size_t MaxMB = 128, class T>
488-
T colorSparsePattern(const T& pattern, size_t groupSize = 1, bool balanceColors = false,
491+
T colorSparsePattern(const T& pattern, size_t groupSize = 1, bool includeOuterIdx = false, bool balanceColors = false,
489492
std::vector<Color_t>* indexColor = nullptr) {
490493
static_assert(std::is_integral<Color_t>::value, "");
491494
static_assert(std::numeric_limits<Color_t>::max() >= MaxColors, "");
@@ -538,6 +541,11 @@ T colorSparsePattern(const T& pattern, size_t groupSize = 1, bool balanceColors
538541

539542
for (; it != searchOrder.end(); ++it) {
540543
bool free = true;
544+
if (includeOuterIdx) {
545+
for (Index_t k = iOuter; k < grpEnd && free; ++k) {
546+
free = !innerInColor[*it][k];
547+
}
548+
}
541549
/*--- Traverse entire group as a large outer index. ---*/
542550
for (Index_t k = outerPtr[iOuter]; k < outerPtr[grpEnd] && free; ++k) {
543551
free = !innerInColor[*it][innerIdx[k] - minIdx];

Common/src/CConfig.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6210,8 +6210,8 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) {
62106210
}
62116211
}
62126212

6213-
/*--- Idenftification fo Giles Markers ---*/
6214-
// This is seperate from MP and Turbomachinery Markers as all mixing plane markers are Giles,
6213+
/*--- Identification of Giles Markers ---*/
6214+
// This is separate from MP and Turbomachinery Markers as all mixing plane markers are Giles,
62156215
// but not all Giles markers are mixing plane
62166216
for (iMarker_CfgFile = 0; iMarker_CfgFile < nMarker_CfgFile; iMarker_CfgFile++) {
62176217
Marker_CfgFile_Giles[iMarker_CfgFile] = NO;
@@ -10057,8 +10057,8 @@ void CConfig::SetProfilingCSV() {
1005710057

1005810058
/*--- Allocate and initialize memory ---*/
1005910059

10060-
double *l_min_red = NULL, *l_max_red = NULL, *l_tot_red = NULL, *l_avg_red = NULL;
10061-
int *n_calls_red = NULL;
10060+
double *l_min_red = nullptr, *l_max_red = nullptr, *l_tot_red = nullptr, *l_avg_red = nullptr;
10061+
int *n_calls_red = nullptr;
1006210062
double* l_min = new double[map_size];
1006310063
double* l_max = new double[map_size];
1006410064
double* l_tot = new double[map_size];

Common/src/geometry/CGeometry.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3772,7 +3772,7 @@ const CCompressedSparsePatternUL& CGeometry::GetEdgeColoring(su2double* efficien
37723772
bool admissibleColoring = false; /* keep track wether the last tested coloring is admissible */
37733773

37743774
while (true) {
3775-
edgeColoring = colorSparsePattern(pattern, nextEdgeColorGroupSize, balanceColors);
3775+
edgeColoring = colorSparsePattern(pattern, nextEdgeColorGroupSize, false, balanceColors);
37763776

37773777
/*--- If the coloring fails, reduce the color group size. ---*/
37783778
if (edgeColoring.empty()) {
@@ -3809,12 +3809,12 @@ const CCompressedSparsePatternUL& CGeometry::GetEdgeColoring(su2double* efficien
38093809

38103810
/*--- If the last tested coloring was not admissible, recompute the final coloring. ---*/
38113811
if (!admissibleColoring) {
3812-
edgeColoring = colorSparsePattern(pattern, edgeColorGroupSize, balanceColors);
3812+
edgeColoring = colorSparsePattern(pattern, edgeColorGroupSize, false, balanceColors);
38133813
}
38143814
}
38153815
/*--- No adaptivity. ---*/
38163816
else {
3817-
edgeColoring = colorSparsePattern(pattern, edgeColorGroupSize, balanceColors);
3817+
edgeColoring = colorSparsePattern(pattern, edgeColorGroupSize, false, balanceColors);
38183818
}
38193819

38203820
/*--- If the coloring fails use the natural coloring. This is a
@@ -3867,7 +3867,7 @@ const CCompressedSparsePatternUL& CGeometry::GetElementColoring(su2double* effic
38673867

38683868
/*--- Color the elements. ---*/
38693869
constexpr bool balanceColors = true;
3870-
elemColoring = colorSparsePattern(pattern, elemColorGroupSize, balanceColors);
3870+
elemColoring = colorSparsePattern(pattern, elemColorGroupSize, false, balanceColors);
38713871

38723872
/*--- Same as for the edge coloring. ---*/
38733873
if (elemColoring.empty()) SetNaturalElementColoring();
@@ -3896,7 +3896,7 @@ void CGeometry::ColorMGLevels(unsigned short nMGLevels, const CGeometry* const*
38963896
/*--- Color the coarse points. ---*/
38973897
vector<tColor> color;
38983898
const auto& adjacency = geometry[iMesh]->nodes->GetPoints();
3899-
if (colorSparsePattern<tColor, nColor>(adjacency, 1, false, &color).empty()) continue;
3899+
if (colorSparsePattern<tColor, nColor>(adjacency, 1, true, false, &color).empty()) continue;
39003900

39013901
/*--- Propagate colors to fine mesh. ---*/
39023902
for (auto step = 0u; step < iMesh; ++step) {
@@ -4042,8 +4042,8 @@ const CGeometry::CLineletInfo& CGeometry::GetLineletInfo(const CConfig* config)
40424042
}
40434043
}
40444044

4045-
const auto coloring =
4046-
colorSparsePattern<uint8_t, std::numeric_limits<uint8_t>::max()>(CCompressedSparsePatternUL(adjacency), 1, true);
4045+
const auto coloring = colorSparsePattern<uint8_t, std::numeric_limits<uint8_t>::max()>(
4046+
CCompressedSparsePatternUL(adjacency), 1, false, true);
40474047
const auto nColors = coloring.getOuterSize();
40484048

40494049
/*--- Sort linelets by color. ---*/

Common/src/geometry/CPhysicalGeometry.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4642,7 +4642,7 @@ void CPhysicalGeometry::SetElement_Connectivity() {
46424642

46434643
if ((elem[iElem]->GetNeighbor_Elements(iFace) == -1) && (iElem < Test_Elem) &&
46444644
FindFace(iElem, Test_Elem, first_elem_face, second_elem_face)) {
4645-
/*--- Localice which faces are sharing both elements ---*/
4645+
/*--- Localize which faces are sharing both elements ---*/
46464646

46474647
elem[iElem]->SetNeighbor_Elements(Test_Elem, first_elem_face);
46484648

@@ -4666,7 +4666,7 @@ void CPhysicalGeometry::SetBoundVolume() {
46664666
CheckVol = false;
46674667

46684668
for (iElem = 0; iElem < nodes->GetnElem(Point); iElem++) {
4669-
/*--- Look for elements surronding that point --*/
4669+
/*--- Look for elements surrounding that point --*/
46704670
cont = 0;
46714671
iElem_Domain = nodes->GetElem(Point, iElem);
46724672
for (iNode_Domain = 0; iNode_Domain < elem[iElem_Domain]->GetnNodes(); iNode_Domain++) {
@@ -4775,10 +4775,10 @@ void CPhysicalGeometry::ComputeNSpan(CConfig* config, unsigned short val_iZone,
47754775
nSpan_loc = 0;
47764776
if (nDim == 2) {
47774777
nSpanWiseSections[marker_flag - 1] = 1;
4778-
// TODO (turbo) make it more genral
4778+
// TODO (turbo) make it more general
47794779
if (marker_flag == OUTFLOW) config->SetnSpanWiseSections(1);
47804780

4781-
/*---Initilize the vector of span-wise values that will be ordered ---*/
4781+
/*---Initialize the vector of span-wise values that will be ordered ---*/
47824782
SpanWiseValue[marker_flag - 1] = new su2double[1];
47834783
for (iSpan = 0; iSpan < 1; iSpan++) {
47844784
SpanWiseValue[marker_flag - 1][iSpan] = 0;
@@ -4792,7 +4792,7 @@ void CPhysicalGeometry::ComputeNSpan(CConfig* config, unsigned short val_iZone,
47924792
if (config->GetMarker_All_TurbomachineryFlag(iMarker) != marker_flag) continue;
47934793

47944794
/*--- loop to find the vertex that ar both of inflow or outflow marker and on the periodic
4795-
* in order to caount the number of Span ---*/
4795+
* in order to count the number of Span ---*/
47964796
for (jMarker = 0; jMarker < nMarker; jMarker++) {
47974797
if (config->GetMarker_All_KindBC(jMarker) != PERIODIC_BOUNDARY) continue;
47984798

SU2_CFD/include/numerics_simd/flow/convection/common.hpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ FORCEINLINE Double umusclProjection(Double grad_proj,
5151
/*--- To maintain proper scaling for edge limiters, the result of ---*/
5252
/*--- this function is 0.5 * dV_ij^kap. ---*/
5353
/*-------------------------------------------------------------------*/
54-
const Double cent = 0.5 * delta;
55-
const Double upw = grad_proj - cent;
56-
return (1.0 - kappa) * upw + (1.0 + kappa) * cent;
54+
return (1.0 - kappa) * grad_proj + kappa * delta;
5755
}
5856

5957
/*!
@@ -216,7 +214,7 @@ FORCEINLINE CPair<ReconVarType> reconstructPrimitives(Int iEdge, Int iPoint, Int
216214
}
217215

218216
if (muscl) {
219-
/*--- Recompute density and enthalpy instead of reconstructing. ---*/
217+
/*--- Reconstruct density and enthalpy without using their gradients. ---*/
220218
constexpr auto nVarGrad = ReconVarType::nVar - 2;
221219
switch (limiterType) {
222220
case LIMITER::NONE:
@@ -229,12 +227,23 @@ FORCEINLINE CPair<ReconVarType> reconstructPrimitives(Int iEdge, Int iPoint, Int
229227
musclPointLimited<nVarGrad>(iPoint, jPoint, vector_ij, limiters, gradients, V, kappa, relax);
230228
break;
231229
}
230+
/*--- Recompute density using the reconstructed pressure and temperature. ---*/
232231
V.i.density() = V.i.pressure() / (gasConst * V.i.temperature());
233232
V.j.density() = V.j.pressure() / (gasConst * V.j.temperature());
234233

234+
/*--- Reconstruct enthalpy using dH/dT = Cp and dH/dv = v. Recomputing enthalpy would cause
235+
* stability issues because we use rho E = rho H - P, which loses its relation to temperature
236+
* if both rho and H are recomputed. This only seems to be an issue for wall-function meshes.
237+
* NOTE: This "one-sided" reconstruction does not lose much of the U-MUSCL benefit, because
238+
* the static enthalpy is linear, and for the KE term we do the equivalent of using the
239+
* average dH/dv, which is exact for quadratic functions. ---*/
235240
const su2double cp = gasConst * gamma / (gamma - 1);
236-
V.i.enthalpy() = cp * V.i.temperature() + 0.5 * squaredNorm<nDim>(V.i.velocity());
237-
V.j.enthalpy() = cp * V.j.temperature() + 0.5 * squaredNorm<nDim>(V.j.velocity());
241+
V.i.enthalpy() += cp * (V.i.temperature() - V1st.i.temperature());
242+
V.j.enthalpy() += cp * (V.j.temperature() - V1st.j.temperature());
243+
for (size_t iDim = 0; iDim < nDim; ++iDim) {
244+
V.i.enthalpy() += 0.5 * (pow(V.i.velocity(iDim), 2) - pow(V1st.i.velocity(iDim), 2));
245+
V.j.enthalpy() += 0.5 * (pow(V.j.velocity(iDim), 2) - pow(V1st.j.velocity(iDim), 2));
246+
}
238247

239248
/*--- Detect a non-physical reconstruction based on negative pressure or density. ---*/
240249
const Double neg_p_or_rho = fmax(fmin(V.i.pressure(), V.j.pressure()) < 0.0,

SU2_CFD/include/solvers/CGradientSmoothingSolver.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class CGradientSmoothingSolver final : public CFEASolverBase {
275275
}
276276

277277
/*!
278-
* \brief Set the current working dimension, if the seperate dimension option is set.
278+
* \brief Set the current working dimension, if the separate dimension option is set.
279279
* \param[in] iDim - the dimension we are currently working in.
280280
*/
281281
inline void SetCurrentDim(unsigned int iDim) {

SU2_CFD/include/variables/CFlowVariable.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
#pragma once
2828

29+
#include <algorithm>
30+
#include <cstdint>
31+
2932
#include "CVariable.hpp"
3033

3134
/*!

SU2_CFD/src/solvers/CGradientSmoothingSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ CGradientSmoothingSolver::CGradientSmoothingSolver(CGeometry *geometry, CConfig
9393
element_container[GRAD_TERM][EL_PYRAM2] = new CPYRAM6();
9494
}
9595

96-
/*--- For operations on surfaces we initalize the structures for nDim-1 ---*/
96+
/*--- For operations on surfaces we initialize the structures for nDim-1 ---*/
9797
if (config->GetSmoothOnSurface()) {
9898
if (nDim == 2) {
9999
element_container[GRAD_TERM][EL_LINE] = new CLINE();

0 commit comments

Comments
 (0)