From d3c9c41652a0f12a78150ce76590b528e814488a Mon Sep 17 00:00:00 2001 From: vikram Date: Wed, 26 Feb 2025 19:01:57 +0000 Subject: [PATCH 1/2] CPhysicalGeometry been modified to for refArea <=0 --- Common/src/geometry/CPhysicalGeometry.cpp | 34 ++++++++++++++--------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 6e34e715be5..adbd906d04d 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -4348,20 +4348,28 @@ void CPhysicalGeometry::SetPositive_ZArea(CConfig* config) { const string A = (config->GetSystemMeasurements() == SI) ? " m^2" : " ft^2"; const bool D3 = (nDim == 3); - if (config->GetRefArea() == 0.0) { - if (D3) - config->SetRefArea(TotalPositiveZArea); - else - config->SetRefArea(TotalPositiveYArea); - - if (rank == MASTER_NODE) { - if (D3) - cout << "Reference area = " << TotalPositiveZArea << A << ".\n"; - else - cout << "Reference length = " << TotalPositiveYArea << L << ".\n"; +if (config->GetRefArea() == 0.0) { + if (D3) { + // Check if the area is valid + if (TotalPositiveZArea <= 0.0) { + SU2_MPI::Error("ERROR: Total positive Z area is zero or negative! Please check the geometry and ensure the area is valid.", "CPhysicalGeometry::SetPositive_ZArea"); + } + + config->SetRefArea(TotalPositiveZArea); + if (rank == MASTER_NODE) { + cout << "Reference area = " << TotalPositiveZArea << A << ".\n"; + } + } else { + // Check if the area is valid in 2D + if (TotalPositiveYArea <= 0.0) { + SU2_MPI::Error("ERROR: Total positive Y area is zero or negative! Please check the geometry and ensure the area is valid.", "CPhysicalGeometry::SetPositive_ZArea"); + } + config->SetRefArea(TotalPositiveYArea); + if (rank == MASTER_NODE) { + cout << "Reference length = " << TotalPositiveYArea << L << ".\n"; + } } - } - +} /*--- Set a semi-span value if no value is provided ---*/ if (config->GetSemiSpan() == 0.0) { From 23336b222966468847bb298a57f3e48649d72997 Mon Sep 17 00:00:00 2001 From: vikram Date: Wed, 26 Feb 2025 19:11:08 +0000 Subject: [PATCH 2/2] The CPhysicalGeometry class has been modified to handle immediate divergence when refArea <= 0 --- Common/src/geometry/CPhysicalGeometry.cpp | 42 +++++++++++++---------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index adbd906d04d..0ff8ebbe39e 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -4348,28 +4348,32 @@ void CPhysicalGeometry::SetPositive_ZArea(CConfig* config) { const string A = (config->GetSystemMeasurements() == SI) ? " m^2" : " ft^2"; const bool D3 = (nDim == 3); -if (config->GetRefArea() == 0.0) { + if (config->GetRefArea() == 0.0) { if (D3) { - // Check if the area is valid - if (TotalPositiveZArea <= 0.0) { - SU2_MPI::Error("ERROR: Total positive Z area is zero or negative! Please check the geometry and ensure the area is valid.", "CPhysicalGeometry::SetPositive_ZArea"); - } - - config->SetRefArea(TotalPositiveZArea); - if (rank == MASTER_NODE) { - cout << "Reference area = " << TotalPositiveZArea << A << ".\n"; - } + // Check if the area is valid + if (TotalPositiveZArea <= 0.0) { + SU2_MPI::Error( + "ERROR: Total positive Z area is zero or negative! Please check the geometry and ensure the area is valid.", + "CPhysicalGeometry::SetPositive_ZArea"); + } + + config->SetRefArea(TotalPositiveZArea); + if (rank == MASTER_NODE) { + cout << "Reference area = " << TotalPositiveZArea << A << ".\n"; + } } else { - // Check if the area is valid in 2D - if (TotalPositiveYArea <= 0.0) { - SU2_MPI::Error("ERROR: Total positive Y area is zero or negative! Please check the geometry and ensure the area is valid.", "CPhysicalGeometry::SetPositive_ZArea"); - } - config->SetRefArea(TotalPositiveYArea); - if (rank == MASTER_NODE) { - cout << "Reference length = " << TotalPositiveYArea << L << ".\n"; - } + // Check if the area is valid in 2D + if (TotalPositiveYArea <= 0.0) { + SU2_MPI::Error( + "ERROR: Total positive Y area is zero or negative! Please check the geometry and ensure the area is valid.", + "CPhysicalGeometry::SetPositive_ZArea"); + } + config->SetRefArea(TotalPositiveYArea); + if (rank == MASTER_NODE) { + cout << "Reference length = " << TotalPositiveYArea << L << ".\n"; + } } -} + } /*--- Set a semi-span value if no value is provided ---*/ if (config->GetSemiSpan() == 0.0) {