Skip to content

Commit 79b824e

Browse files
committed
fix EPS bug
1 parent b6d331f commit 79b824e

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

Common/src/geometry/CGeometry.cpp

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,7 +2470,7 @@ void CGeometry::ComputeModifiedSymmetryNormals(const CConfig* config) {
24702470
}
24712471
}
24722472

2473-
// first check Euler walls, we 'merge' all euler walls with other euler walls
2473+
// first check Euler walls, we 'merge' all curver euler walls with other curved euler walls
24742474

24752475
/*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/
24762476
/*--- The first symmetry does not need a corrected normal vector, hence start at 1. ---*/
@@ -2486,10 +2486,10 @@ void CGeometry::ComputeModifiedSymmetryNormals(const CConfig* config) {
24862486
std::array<su2double, MAXNDIM> iNormal = {};
24872487
std::array<su2double, MAXNDIM> kNormal = {};
24882488
vertex[iMarker][iVertex]->GetNormal(iNormal.data());
2489-
const su2double area = GeometryToolbox::Norm(nDim, iNormal.data());
2490-
for (auto iDim = 0u; iDim < nDim; iDim++) iNormal[iDim] /= area;
2489+
const su2double iarea = GeometryToolbox::Norm(nDim, iNormal.data());
2490+
for (auto iDim = 0u; iDim < nDim; iDim++) iNormal[iDim] /= iarea;
24912491

2492-
/*--- Loop over previous symmetries and if this point shares them, make this normal orthogonal to them. ---*/
2492+
/*--- Loop over previous symmetries and if this point shares them, sum the normals. ---*/
24932493
bool isShared = false;
24942494

24952495
for (size_t j = 0; j < i; ++j) {
@@ -2498,10 +2498,12 @@ void CGeometry::ComputeModifiedSymmetryNormals(const CConfig* config) {
24982498
if (jVertex < 0) continue;
24992499

25002500
/*--- If both symmetries are curved, we sum the normals. ---*/
2501-
if ((bound_is_straight[iMarker]) == true && (bound_is_straight[jMarker]) == true) {
2501+
if ((bound_is_straight[iMarker]) == false && (bound_is_straight[jMarker]) == false) {
25022502
isShared = true;
25032503
}
25042504

2505+
if (!isShared) continue;
2506+
25052507
std::array<su2double, MAXNDIM> jNormal = {};
25062508
// check if jvertex is already in symmetrynormals array
25072509
const auto it = symmetryNormals[jMarker].find(jVertex);
@@ -2510,22 +2512,20 @@ void CGeometry::ComputeModifiedSymmetryNormals(const CConfig* config) {
25102512
jNormal = it->second;
25112513
} else {
25122514
vertex[jMarker][jVertex]->GetNormal(jNormal.data());
2513-
const su2double area = GeometryToolbox::Norm(nDim, jNormal.data());
2514-
for (auto iDim = 0u; iDim < nDim; iDim++) jNormal[iDim] /= area;
2515+
const su2double jarea = GeometryToolbox::Norm(nDim, jNormal.data());
2516+
for (auto iDim = 0u; iDim < nDim; iDim++) jNormal[iDim] /= jarea;
25152517
}
25162518

25172519
// averaging
25182520
for (auto iDim = 0u; iDim < nDim; iDim++) kNormal[iDim] = iNormal[iDim] + jNormal[iDim];
2519-
const su2double areak = GeometryToolbox::Norm(nDim, kNormal.data());
2520-
for (auto iDim = 0u; iDim < nDim; iDim++) kNormal[iDim] /= areak;
2521+
const su2double karea = GeometryToolbox::Norm(nDim, kNormal.data());
2522+
for (auto iDim = 0u; iDim < nDim; iDim++) kNormal[iDim] /= karea;
25212523

25222524
for (auto iDim = 0u; iDim < nDim; iDim++) {
25232525
symmetryNormals[iMarker][iVertex][iDim] += kNormal[iDim];
25242526
symmetryNormals[jMarker][jVertex][iDim] += kNormal[iDim];
25252527
}
25262528
}
2527-
2528-
if (!isShared) continue;
25292529
}
25302530
}
25312531

@@ -2545,8 +2545,8 @@ void CGeometry::ComputeModifiedSymmetryNormals(const CConfig* config) {
25452545
/*--- Get the vertex normal on the current symmetry. ---*/
25462546
std::array<su2double, MAXNDIM> iNormal = {};
25472547
vertex[iMarker][iVertex]->GetNormal(iNormal.data());
2548-
const su2double area = GeometryToolbox::Norm(nDim, iNormal.data());
2549-
for (auto iDim = 0u; iDim < nDim; iDim++) iNormal[iDim] /= area;
2548+
const su2double iarea = GeometryToolbox::Norm(nDim, iNormal.data());
2549+
for (auto iDim = 0u; iDim < nDim; iDim++) iNormal[iDim] /= iarea;
25502550

25512551
/*--- Loop over previous symmetries and if this point shares them, make this normal orthogonal to them. ---*/
25522552
bool isShared = false;
@@ -2569,10 +2569,11 @@ void CGeometry::ComputeModifiedSymmetryNormals(const CConfig* config) {
25692569

25702570
if (it != symmetryNormals[jMarker].end()) {
25712571
jNormal = it->second;
2572+
25722573
} else {
25732574
vertex[jMarker][jVertex]->GetNormal(jNormal.data());
2574-
const su2double area = GeometryToolbox::Norm(nDim, jNormal.data());
2575-
for (auto iDim = 0u; iDim < nDim; iDim++) jNormal[iDim] /= area;
2575+
const su2double jarea = GeometryToolbox::Norm(nDim, jNormal.data());
2576+
for (auto iDim = 0u; iDim < nDim; iDim++) jNormal[iDim] /= jarea;
25762577
}
25772578

25782579
const auto proj = GeometryToolbox::DotProduct(nDim, jNormal.data(), iNormal.data());
@@ -2584,9 +2585,9 @@ void CGeometry::ComputeModifiedSymmetryNormals(const CConfig* config) {
25842585
/*--- Normalize. If the norm is close to zero it means the normal is a linear combination of previous
25852586
* normals, in this case we don't need to store the corrected normal, using the original in the gradient
25862587
* correction will have no effect since previous corrections will remove components in this direction). ---*/
2587-
const su2double iarea = GeometryToolbox::Norm(nDim, iNormal.data());
2588-
if (area > EPS) {
2589-
for (auto iDim = 0u; iDim < nDim; iDim++) iNormal[iDim] /= iarea;
2588+
const su2double area = GeometryToolbox::Norm(nDim, iNormal.data());
2589+
if (area > 1.0e-12) {
2590+
for (auto iDim = 0u; iDim < nDim; iDim++) iNormal[iDim] /= area;
25902591
symmetryNormals[iMarker][iVertex] = iNormal;
25912592
}
25922593
}

0 commit comments

Comments
 (0)