From 21644d9bd8faf3abb05fa024b2f9de7bd6b6cb06 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 2 Jan 2024 12:39:56 +0100 Subject: [PATCH 001/194] initial test --- Common/src/geometry/CPhysicalGeometry.cpp | 15 ++ .../gradients/computeGradientsGreenGauss.hpp | 137 +++++++++++++++++- .../include/solvers/CFVMFlowSolverBase.inl | 31 +++- 3 files changed, 178 insertions(+), 5 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 54d667e0fbd..dceb62f0771 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7268,6 +7268,21 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } } END_SU2_OMP_FOR + + /*--- For symmetry planes, correct the normal ---*/ + + SU2_OMP_FOR_DYN(1) + for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { + if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + + for (unsigned long iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { + //auto Area2 = GeometryToolbox::SquaredNorm(nDim, vertex[iMarker][iVertex]->GetNormal()); + //su2double DefaultArea[MAXNDIM] = {EPS * EPS}; + //if (Area2 == 0.0) vertex[iMarker][iVertex]->SetNormal(DefaultArea); + } + } + } + END_SU2_OMP_FOR } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index d2e3762997f..6e35e15d506 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -28,6 +28,7 @@ */ #include "../../../Common/include/parallelization/omp_structure.hpp" +#include "../../../Common/include/toolboxes/geometry_toolbox.hpp" namespace detail { @@ -72,11 +73,19 @@ void computeGradientsGreenGauss(CSolver* solver, /*--- For each (non-halo) volume integrate over its faces (edges). ---*/ + + // ******************************************************************** + // loop over all cells + // ******************************************************************** SU2_OMP_FOR_DYN(chunkSize) for (size_t iPoint = 0; iPoint < nPointDomain; ++iPoint) { auto nodes = geometry.nodes; + if (iPoint==255){ + cout << "iPoint = "<GetVolume(iPoint)); @@ -114,7 +123,8 @@ void computeGradientsGreenGauss(CSolver* solver, for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { AD::SetPreaccIn(field(jPoint,iVar)); - + su2double vali = field(iPoint,iVar); + su2double valj = field(jPoint,iVar); su2double flux = weight * (field(iPoint,iVar) + field(jPoint,iVar)); for (size_t iDim = 0; iDim < nDim; ++iDim) @@ -131,14 +141,65 @@ void computeGradientsGreenGauss(CSolver* solver, } END_SU2_OMP_FOR - /*--- Add boundary fluxes. ---*/ + // ******************************************************************** + // loop over all cells on a symmetry plane + // ******************************************************************** + + /*--- Add GG boundary fluxes on symmetry. ---*/ + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) + { + if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + //cout << "symmetry plane found" <GetNode(); + // recompute gradients on symmetry plane + auto nodes = geometry.nodes; + /*--- Clear the gradient. --*/ + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) + for (size_t iDim = 0; iDim < nDim; ++iDim) + gradient(iPoint, iVar, iDim) = 0.0; + /*--- Handle averaging and division by volume in one constant. ---*/ + su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint)+nodes->GetPeriodicVolume(iPoint)); + /*--- Add a contribution due to each neighbor. ---*/ + for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) + { + size_t iEdge = nodes->GetEdge(iPoint,iNeigh); + size_t jPoint = nodes->GetPoint(iPoint,iNeigh); + su2double *coordi={nodes->GetCoord(iPoint)}; + su2double *coordj={nodes->GetCoord(jPoint)}; + /*--- Determine if edge points inwards or outwards of iPoint. + * If inwards we need to flip the area vector. ---*/ + su2double dir = (iPoint < jPoint)? 1.0 : -1.0; + su2double weight = dir * halfOnVol; + const auto area = geometry.edges->GetNormal(iEdge); + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) + { + su2double vali = field(iPoint,iVar); + su2double valj = field(jPoint,iVar); + su2double flux = weight * (field(iPoint,iVar) + field(jPoint,iVar)); + for (size_t iDim = 0; iDim < nDim; ++iDim) + gradient(iPoint, iVar, iDim) += flux * area[iDim]; + } + } + } + END_SU2_OMP_FOR + } + } + + // ******************************************************************** + // loop over all cells on other boundaries + // ******************************************************************** + /*--- Add boundary fluxes. ---*/ for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if ((config.GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && (config.GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && + (config.GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && (config.GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { + /*--- Work is shared in inner loop as two markers * may try to update the same point. ---*/ @@ -154,7 +215,7 @@ void computeGradientsGreenGauss(CSolver* solver, su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); + const su2double* area = geometry.vertex[iMarker][iVertex]->GetNormal(); for (size_t iVar = varBegin; iVar < varEnd; iVar++) { @@ -168,6 +229,76 @@ void computeGradientsGreenGauss(CSolver* solver, } } + + + /*--- Add boundary flux correction for symmetry. ---*/ + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) + { + if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + //cout << "symmetry plane found" <GetNode(); + // recompute gradients on symmetry plane + auto nodes = geometry.nodes; + /*--- Halo points do not need to be considered. ---*/ + if (!nodes->GetDomain(iPoint)) continue; + /*--- get the reflected state [phi_x,phi_y,phi_z]---*/ + su2double Area; + su2double value; + su2double gradphi[3] = {0.0}; + su2double phi[3] = {0.0}; + su2double phi_reflected[3]={0.0}; + su2double Normal[3]={0.0}; + su2double UnitNormal[3]={0.0}; + // now we construct field_x,field_y from field(iPoint,iVar) + /*--- Normal vector for this vertex (negate for outward convention). ---*/ + geometry.vertex[iMarker][iVertex]->GetNormal(Normal); + for (size_t iDim = 0; iDim < nDim; iDim++) + Normal[iDim] = -Normal[iDim]; + Area = GeometryToolbox::Norm(nDim, Normal); + for (size_t iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = -Normal[iDim] / Area; + + // loop over all iVar and set gradient normal to the boundary to zero + // But for velocity, the velocity gradient normal to the wall is not zero, + // only the velocity gradient tangential to the wall is zero + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + value = field(iPoint,iVar); + for (size_t iDim = 0; iDim < nDim; iDim++) + gradphi[iDim] = gradient(iPoint, iVar, iDim); + // we can now project the vector gradphi to the wall-aligned coordinates + // compute grad(phi).n + su2double Projphi = 0.0; + for (size_t iDim = 0; iDim < nDim; iDim++) + Projphi += gradphi[iDim]*UnitNormal[iDim]; + // mirror reflection + for (size_t iDim = 0; iDim < nDim; iDim++) + // complete reflection: + //phi_reflected[iDim] = gradphi[iDim] - 2.0 * Projphi * UnitNormal[iDim]; + // tangential component only: + // this can only work when the wall is aligned with the cartesian coordinates + //if (iVar==2){ + // // for the velocity normal to the symmetry, the tangential gradient is zero. + // phi_reflected[iDim] = Projphi * UnitNormal[iDim]; + // + // } + // else{ + // all scalars and the tangential velocity gradients have normal component zero (only tangential component left) + phi_reflected[iDim] = gradphi[iDim] - 1.0 * Projphi * UnitNormal[iDim]; + // } + + //cout << "modify gradient" << endl; + for (size_t iDim = 0; iDim < nDim; iDim++) + gradient(iPoint, iVar, iDim) = phi_reflected[iDim]; + } + } + END_SU2_OMP_FOR + } + } + + + /*--- If no solver was provided we do not communicate ---*/ if (solver == nullptr) return; diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 40af46827be..bf8cb5d64d6 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1173,7 +1173,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve normal direction is substracted twice. ---*/ for (iVar = 0; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); - /*--- Compute velocity in normal direction (ProjVelcity_i=(v*n)) und substract twice from + /*--- Compute velocity in normal direction (ProjVelocity_i=(v*n)) und substract twice from velocity in normal direction: v_r = v - 2 (v*n)n ---*/ ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); @@ -1182,9 +1182,14 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); } + // this is a perfect reflection of the velocity for (iDim = 0; iDim < nDim; iDim++) V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 2.0 * ProjVelocity_i * UnitNormal[iDim]; - + // V_t = b -b_n = b-(an.n).n + // V_t = -(v-(v.n).n) + //for (iDim = 0; iDim < nDim; iDim++) + // V_reflected[iDim + 1] = -(nodes->GetVelocity(iPoint, iDim) - 1.0 * ProjVelocity_i * UnitNormal[iDim]); + // V_reflected[iDim] = 0.0; /*--- Set Primitive and Secondary for numerics class. ---*/ conv_numerics->SetPrimitive(V_domain, V_reflected); conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); @@ -1201,6 +1206,28 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); } + + + // su2double Vn = 0.0; + // su2double zero[MAXNDIM] = {0.0}; + + // nodes->SetVelocity_Old(iPoint, zero); + + // for (iDim = 0; iDim < nDim; iDim++){ + // nodes->SetSolution(iPoint, iDim+1, Vn); + // nodes->SetSolution_Old(iPoint, iDim+1, Vn); + // LinSysRes(iPoint, iDim+1) = 0.0; + // nodes->SetVel_ResTruncError_Zero(iPoint); + // } + // if (implicit) { + // for (unsigned short iVar = 1; iVar <= nDim; iVar++) + // Jacobian.DeleteValsRowi(iPoint*nVar+iVar); + // } + + + + + if (viscous) { /*-------------------------------------------------------------------------------*/ /*--- Step 2: The viscous fluxes of the Navier-Stokes equations depend on the ---*/ From a07dd6acf24f0f789b53e38405f34d8ef41a4a45 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 2 Jan 2024 23:10:47 +0100 Subject: [PATCH 002/194] symmetry -do not reflect normal components --- .../gradients/computeGradientsGreenGauss.hpp | 163 +++++++++++------- .../include/solvers/CFVMFlowSolverBase.inl | 9 +- 2 files changed, 102 insertions(+), 70 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 6e35e15d506..dce31b84bb4 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -156,6 +156,24 @@ void computeGradientsGreenGauss(CSolver* solver, size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); // recompute gradients on symmetry plane auto nodes = geometry.nodes; + + // **************************************** + su2double Normal[3]={0.0}; + su2double UnitNormal[3]={0.0}; + su2double AreaReflected[3]={0.0}; + /*--- Normal vector for this vertex (negate for outward convention). ---*/ + geometry.vertex[iMarker][iVertex]->GetNormal(Normal); + for (size_t iDim = 0; iDim < nDim; iDim++) + Normal[iDim] = -Normal[iDim]; + const auto Area = GeometryToolbox::Norm(nDim, Normal); + for (size_t iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = -Normal[iDim] / Area; + // **************************************** + + + // **************************************** + + /*--- Clear the gradient. --*/ for (size_t iVar = varBegin; iVar < varEnd; ++iVar) for (size_t iDim = 0; iDim < nDim; ++iDim) @@ -173,14 +191,29 @@ void computeGradientsGreenGauss(CSolver* solver, * If inwards we need to flip the area vector. ---*/ su2double dir = (iPoint < jPoint)? 1.0 : -1.0; su2double weight = dir * halfOnVol; + const auto area = geometry.edges->GetNormal(iEdge); + + // normal = U + // reflected normal V=U - 2U_t + // V=U - 2(U-(n.U)*n) + // this is a perfect reflection of the velocity + su2double ProjArea = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + ProjArea += area[iDim]*UnitNormal[iDim]; + + + for (size_t iDim = 0; iDim < nDim; iDim++) + AreaReflected[iDim] = area[iDim] - 2.0 * ProjArea*UnitNormal[iDim]; + + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { su2double vali = field(iPoint,iVar); su2double valj = field(jPoint,iVar); su2double flux = weight * (field(iPoint,iVar) + field(jPoint,iVar)); for (size_t iDim = 0; iDim < nDim; ++iDim) - gradient(iPoint, iVar, iDim) += flux * area[iDim]; + gradient(iPoint, iVar, iDim) += 0.5*flux * (area[iDim] + AreaReflected[iDim]); } } } @@ -231,71 +264,71 @@ void computeGradientsGreenGauss(CSolver* solver, - /*--- Add boundary flux correction for symmetry. ---*/ - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) - { - if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { - //cout << "symmetry plane found" <GetNode(); - // recompute gradients on symmetry plane - auto nodes = geometry.nodes; - /*--- Halo points do not need to be considered. ---*/ - if (!nodes->GetDomain(iPoint)) continue; - /*--- get the reflected state [phi_x,phi_y,phi_z]---*/ - su2double Area; - su2double value; - su2double gradphi[3] = {0.0}; - su2double phi[3] = {0.0}; - su2double phi_reflected[3]={0.0}; - su2double Normal[3]={0.0}; - su2double UnitNormal[3]={0.0}; - // now we construct field_x,field_y from field(iPoint,iVar) - /*--- Normal vector for this vertex (negate for outward convention). ---*/ - geometry.vertex[iMarker][iVertex]->GetNormal(Normal); - for (size_t iDim = 0; iDim < nDim; iDim++) - Normal[iDim] = -Normal[iDim]; - Area = GeometryToolbox::Norm(nDim, Normal); - for (size_t iDim = 0; iDim < nDim; iDim++) - UnitNormal[iDim] = -Normal[iDim] / Area; - - // loop over all iVar and set gradient normal to the boundary to zero - // But for velocity, the velocity gradient normal to the wall is not zero, - // only the velocity gradient tangential to the wall is zero - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - value = field(iPoint,iVar); - for (size_t iDim = 0; iDim < nDim; iDim++) - gradphi[iDim] = gradient(iPoint, iVar, iDim); - // we can now project the vector gradphi to the wall-aligned coordinates - // compute grad(phi).n - su2double Projphi = 0.0; - for (size_t iDim = 0; iDim < nDim; iDim++) - Projphi += gradphi[iDim]*UnitNormal[iDim]; - // mirror reflection - for (size_t iDim = 0; iDim < nDim; iDim++) - // complete reflection: - //phi_reflected[iDim] = gradphi[iDim] - 2.0 * Projphi * UnitNormal[iDim]; - // tangential component only: - // this can only work when the wall is aligned with the cartesian coordinates - //if (iVar==2){ - // // for the velocity normal to the symmetry, the tangential gradient is zero. - // phi_reflected[iDim] = Projphi * UnitNormal[iDim]; - // - // } - // else{ - // all scalars and the tangential velocity gradients have normal component zero (only tangential component left) - phi_reflected[iDim] = gradphi[iDim] - 1.0 * Projphi * UnitNormal[iDim]; - // } + // /*--- Add boundary flux correction for symmetry. ---*/ + // for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) + // { + // if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + // //cout << "symmetry plane found" <GetNode(); + // // recompute gradients on symmetry plane + // auto nodes = geometry.nodes; + // /*--- Halo points do not need to be considered. ---*/ + // if (!nodes->GetDomain(iPoint)) continue; + // /*--- get the reflected state [phi_x,phi_y,phi_z]---*/ + // su2double Area; + // su2double value; + // su2double gradphi[3] = {0.0}; + // su2double phi[3] = {0.0}; + // su2double phi_reflected[3]={0.0}; + // su2double Normal[3]={0.0}; + // su2double UnitNormal[3]={0.0}; + // // now we construct field_x,field_y from field(iPoint,iVar) + // /*--- Normal vector for this vertex (negate for outward convention). ---*/ + // geometry.vertex[iMarker][iVertex]->GetNormal(Normal); + // for (size_t iDim = 0; iDim < nDim; iDim++) + // Normal[iDim] = -Normal[iDim]; + // Area = GeometryToolbox::Norm(nDim, Normal); + // for (size_t iDim = 0; iDim < nDim; iDim++) + // UnitNormal[iDim] = -Normal[iDim] / Area; + + // // loop over all iVar and set gradient normal to the boundary to zero + // // But for velocity, the velocity gradient normal to the wall is not zero, + // // only the velocity gradient tangential to the wall is zero + // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + // value = field(iPoint,iVar); + // for (size_t iDim = 0; iDim < nDim; iDim++) + // gradphi[iDim] = gradient(iPoint, iVar, iDim); + // // we can now project the vector gradphi to the wall-aligned coordinates + // // compute grad(phi).n + // su2double Projphi = 0.0; + // for (size_t iDim = 0; iDim < nDim; iDim++) + // Projphi += gradphi[iDim]*UnitNormal[iDim]; + // // mirror reflection + // for (size_t iDim = 0; iDim < nDim; iDim++) + // // complete reflection: + // //phi_reflected[iDim] = gradphi[iDim] - 2.0 * Projphi * UnitNormal[iDim]; + // // tangential component only: + // // this can only work when the wall is aligned with the cartesian coordinates + // //if (iVar==2){ + // // // for the velocity normal to the symmetry, the tangential gradient is zero. + // // phi_reflected[iDim] = Projphi * UnitNormal[iDim]; + // // + // // } + // // else{ + // // all scalars and the tangential velocity gradients have normal component zero (only tangential component left) + // phi_reflected[iDim] = gradphi[iDim] - 1.0 * Projphi * UnitNormal[iDim]; + // // } - //cout << "modify gradient" << endl; - for (size_t iDim = 0; iDim < nDim; iDim++) - gradient(iPoint, iVar, iDim) = phi_reflected[iDim]; - } - } - END_SU2_OMP_FOR - } - } + // //cout << "modify gradient" << endl; + // for (size_t iDim = 0; iDim < nDim; iDim++) + // gradient(iPoint, iVar, iDim) = phi_reflected[iDim]; + // } + // } + // END_SU2_OMP_FOR + // } + // } diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index bf8cb5d64d6..611f755d65a 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1182,14 +1182,13 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); } - // this is a perfect reflection of the velocity + // Note that we do not want a perfect reflection but the normal component to be set to zero. + // so instead of u-2*v.n we reflect only the tangential component u-1*v.n for (iDim = 0; iDim < nDim; iDim++) - V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 2.0 * ProjVelocity_i * UnitNormal[iDim]; + V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 1.0 * ProjVelocity_i * UnitNormal[iDim]; // V_t = b -b_n = b-(an.n).n // V_t = -(v-(v.n).n) - //for (iDim = 0; iDim < nDim; iDim++) - // V_reflected[iDim + 1] = -(nodes->GetVelocity(iPoint, iDim) - 1.0 * ProjVelocity_i * UnitNormal[iDim]); - // V_reflected[iDim] = 0.0; + /*--- Set Primitive and Secondary for numerics class. ---*/ conv_numerics->SetPrimitive(V_domain, V_reflected); conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); From 0fa9438ed0df8a144f2f0e351beb46bd65b357e9 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 2 Jan 2024 23:12:16 +0100 Subject: [PATCH 003/194] remove unused GG code --- .../gradients/computeGradientsGreenGauss.hpp | 70 ------------------- 1 file changed, 70 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index dce31b84bb4..cbb5d95580c 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -262,76 +262,6 @@ void computeGradientsGreenGauss(CSolver* solver, } } - - - // /*--- Add boundary flux correction for symmetry. ---*/ - // for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) - // { - // if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { - // //cout << "symmetry plane found" <GetNode(); - // // recompute gradients on symmetry plane - // auto nodes = geometry.nodes; - // /*--- Halo points do not need to be considered. ---*/ - // if (!nodes->GetDomain(iPoint)) continue; - // /*--- get the reflected state [phi_x,phi_y,phi_z]---*/ - // su2double Area; - // su2double value; - // su2double gradphi[3] = {0.0}; - // su2double phi[3] = {0.0}; - // su2double phi_reflected[3]={0.0}; - // su2double Normal[3]={0.0}; - // su2double UnitNormal[3]={0.0}; - // // now we construct field_x,field_y from field(iPoint,iVar) - // /*--- Normal vector for this vertex (negate for outward convention). ---*/ - // geometry.vertex[iMarker][iVertex]->GetNormal(Normal); - // for (size_t iDim = 0; iDim < nDim; iDim++) - // Normal[iDim] = -Normal[iDim]; - // Area = GeometryToolbox::Norm(nDim, Normal); - // for (size_t iDim = 0; iDim < nDim; iDim++) - // UnitNormal[iDim] = -Normal[iDim] / Area; - - // // loop over all iVar and set gradient normal to the boundary to zero - // // But for velocity, the velocity gradient normal to the wall is not zero, - // // only the velocity gradient tangential to the wall is zero - // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // value = field(iPoint,iVar); - // for (size_t iDim = 0; iDim < nDim; iDim++) - // gradphi[iDim] = gradient(iPoint, iVar, iDim); - // // we can now project the vector gradphi to the wall-aligned coordinates - // // compute grad(phi).n - // su2double Projphi = 0.0; - // for (size_t iDim = 0; iDim < nDim; iDim++) - // Projphi += gradphi[iDim]*UnitNormal[iDim]; - // // mirror reflection - // for (size_t iDim = 0; iDim < nDim; iDim++) - // // complete reflection: - // //phi_reflected[iDim] = gradphi[iDim] - 2.0 * Projphi * UnitNormal[iDim]; - // // tangential component only: - // // this can only work when the wall is aligned with the cartesian coordinates - // //if (iVar==2){ - // // // for the velocity normal to the symmetry, the tangential gradient is zero. - // // phi_reflected[iDim] = Projphi * UnitNormal[iDim]; - // // - // // } - // // else{ - // // all scalars and the tangential velocity gradients have normal component zero (only tangential component left) - // phi_reflected[iDim] = gradphi[iDim] - 1.0 * Projphi * UnitNormal[iDim]; - // // } - - // //cout << "modify gradient" << endl; - // for (size_t iDim = 0; iDim < nDim; iDim++) - // gradient(iPoint, iVar, iDim) = phi_reflected[iDim]; - // } - // } - // END_SU2_OMP_FOR - // } - // } - - - /*--- If no solver was provided we do not communicate ---*/ if (solver == nullptr) return; From 43229077f446a4e0bc71433d108191813bf865c0 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 3 Jan 2024 22:49:26 +0100 Subject: [PATCH 004/194] GG wall --- .../gradients/computeGradientsGreenGauss.hpp | 121 ++++++++++++++++-- 1 file changed, 109 insertions(+), 12 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index cbb5d95580c..6759d6296f6 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -82,10 +82,6 @@ void computeGradientsGreenGauss(CSolver* solver, { auto nodes = geometry.nodes; - if (iPoint==255){ - cout << "iPoint = "<GetVolume(iPoint)); @@ -143,7 +139,7 @@ void computeGradientsGreenGauss(CSolver* solver, // ******************************************************************** - // loop over all cells on a symmetry plane + // loop over all cells on a symmetry plane and mirror the faces of the cell on the symmetry plane // ******************************************************************** /*--- Add GG boundary fluxes on symmetry. ---*/ @@ -170,10 +166,6 @@ void computeGradientsGreenGauss(CSolver* solver, UnitNormal[iDim] = -Normal[iDim] / Area; // **************************************** - - // **************************************** - - /*--- Clear the gradient. --*/ for (size_t iVar = varBegin; iVar < varEnd; ++iVar) for (size_t iDim = 0; iDim < nDim; ++iDim) @@ -197,16 +189,14 @@ void computeGradientsGreenGauss(CSolver* solver, // normal = U // reflected normal V=U - 2U_t // V=U - 2(U-(n.U)*n) - // this is a perfect reflection of the velocity + // this is a perfect reflection of the velocity gradients su2double ProjArea = 0.0; for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim]*UnitNormal[iDim]; - for (size_t iDim = 0; iDim < nDim; iDim++) AreaReflected[iDim] = area[iDim] - 2.0 * ProjArea*UnitNormal[iDim]; - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { su2double vali = field(iPoint,iVar); @@ -221,6 +211,113 @@ void computeGradientsGreenGauss(CSolver* solver, } } + // ******************************************************************** + // loop over all cells on other boundaries + // ******************************************************************** + /*--- Add boundary fluxes. ---*/ + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) + { + if ((config.GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && + (config.GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && + (config.GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && + (config.GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) + { + + /*--- Work is shared in inner loop as two markers + * may try to update the same point. ---*/ + + SU2_OMP_FOR_STAT(32) + for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) + { + size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); + auto nodes = geometry.nodes; + + /*--- Halo points do not need to be considered. ---*/ + + if (!nodes->GetDomain(iPoint)) continue; + + su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); + + const su2double* area = geometry.vertex[iMarker][iVertex]->GetNormal(); + + for (size_t iVar = varBegin; iVar < varEnd; iVar++) + { + su2double flux = field(iPoint,iVar) / volume; + + for (size_t iDim = 0; iDim < nDim; iDim++) + gradient(iPoint, iVar, iDim) -= flux * area[iDim]; + } + } + END_SU2_OMP_FOR + } + else if ( (config.GetMarker_All_KindBC(iMarker) == HEAT_FLUX) || + (config.GetMarker_All_KindBC(iMarker) == ISOTHERMAL)) { + cout << "wall plane found" <GetNode(); + + auto nodes = geometry.nodes; + + // **************************************** + su2double Normal[3]={0.0}; + su2double UnitNormal[3]={0.0}; + su2double AreaReflected[3]={0.0}; + /*--- Normal vector for this vertex (negate for outward convention). ---*/ + geometry.vertex[iMarker][iVertex]->GetNormal(Normal); + for (size_t iDim = 0; iDim < nDim; iDim++) + Normal[iDim] = -Normal[iDim]; + const auto Area = GeometryToolbox::Norm(nDim, Normal); + for (size_t iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = -Normal[iDim] / Area; + // **************************************** + + /*--- Clear the gradient. --*/ + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) + for (size_t iDim = 0; iDim < nDim; ++iDim) + gradient(iPoint, iVar, iDim) = 0.0; + /*--- Handle averaging and division by volume in one constant. ---*/ + su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint)+nodes->GetPeriodicVolume(iPoint)); + /*--- Add a contribution due to each neighbor. ---*/ + for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) + { + + // for a wall, we have to set the edge normals normal to the wall to zero + + size_t iEdge = nodes->GetEdge(iPoint,iNeigh); + size_t jPoint = nodes->GetPoint(iPoint,iNeigh); + su2double *coordi={nodes->GetCoord(iPoint)}; + su2double *coordj={nodes->GetCoord(jPoint)}; + /*--- Determine if edge points inwards or outwards of iPoint. + * If inwards we need to flip the area vector. ---*/ + su2double dir = (iPoint < jPoint)? 1.0 : -1.0; + su2double weight = dir * halfOnVol; + + // this is the normal of the edge + const auto area = geometry.edges->GetNormal(iEdge); + + // this is a projection of the normal to the tangential direction + su2double ProjArea = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + ProjArea += area[iDim]*UnitNormal[iDim]; + + for (size_t iDim = 0; iDim < nDim; iDim++) + AreaReflected[iDim] = area[iDim] - ProjArea*UnitNormal[iDim]; + + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) + { + su2double vali = field(iPoint,iVar); + su2double valj = field(jPoint,iVar); + su2double flux = weight * (field(iPoint,iVar) + field(jPoint,iVar)); + for (size_t iDim = 0; iDim < nDim; ++iDim) + gradient(iPoint, iVar, iDim) += flux * AreaReflected[iDim]; + } + } + } + END_SU2_OMP_FOR + } + } + // ******************************************************************** // loop over all cells on other boundaries // ******************************************************************** From 0ee6dbdc3ff1249dbd8234407e3b13caf104200e Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 3 Jan 2024 22:49:42 +0100 Subject: [PATCH 005/194] viscous sym_plane --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 611f755d65a..a99edea3b05 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1162,7 +1162,9 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Normal vector for this vertex (negate for outward convention). ---*/ geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + // set component normal to the wall to zero. conv_numerics->SetNormal(Normal); /*--- Get current solution at this boundary node ---*/ @@ -1258,7 +1260,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Reflect the gradients for all scalars including the velocity components. The gradients of the velocity components are set later with the - correct values: grad(V)_r = grad(V) - 2 [grad(V)*n]n, V beeing any primitive ---*/ + correct values: grad(V)_r = grad(V) - 2 [grad(V)*n]n, V being any primitive ---*/ for (iVar = 0; iVar < nPrimVarGrad; iVar++) { if (iVar == 0 || iVar > nDim) { // Exclude velocity component gradients @@ -1267,7 +1269,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for (iDim = 0; iDim < nDim; iDim++) ProjGradient += Grad_Reflected[iVar][iDim] * UnitNormal[iDim]; for (iDim = 0; iDim < nDim; iDim++) - Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; + //Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; + Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 1.0 * ProjGradient * UnitNormal[iDim]; } } @@ -1283,7 +1286,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve } } - /*--- Refelect gradients in tangential and normal direction by substracting the normal/tangential + /*--- Reflect gradients in tangential and normal direction by substracting the normal/tangential component twice, just as done with velocity above. grad(v*n)_r = grad(v*n) - 2 {grad([v*n])*t}t grad(v*t)_r = grad(v*t) - 2 {grad([v*t])*n}n ---*/ @@ -1295,8 +1298,10 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve } for (iDim = 0; iDim < nDim; iDim++) { - GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; - GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; + //GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; + //GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; + GradNormVel[iDim] = GradNormVel[iDim] - 1.0 * ProjNormVelGrad * Tangential[iDim]; + GradTangVel[iDim] = GradTangVel[iDim] - 1.0 * ProjTangVelGrad * UnitNormal[iDim]; } /*--- Transfer reflected gradients back into the Cartesian Coordinate system: From 5de7c243ce66fd4d65d021802a83b586108624bf Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 3 Jan 2024 22:50:10 +0100 Subject: [PATCH 006/194] edge normal correction --- Common/src/geometry/CPhysicalGeometry.cpp | 62 ++++++++++++++++++++--- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index dceb62f0771..9106c0ad623 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7269,19 +7269,65 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } END_SU2_OMP_FOR - /*--- For symmetry planes, correct the normal ---*/ + + /*--- For symmetry planes, + * correct the normal.vectors of the faces of the control volume which touch the boundary. + * This means remove all components of the face vector which are normal to the symmetry plane */ SU2_OMP_FOR_DYN(1) + for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + for (unsigned long iElem = 0; iElem < nElem_Bound[iMarker]; iElem++) { + // const auto nNodes = bound[iMarker][iElem]->GetnNodes(); + // /*--- Get pointers to the coordinates of all the element nodes ---*/ + // //array Coord; + // for (unsigned short iNode = 0; iNode < nNodes; iNode++) { + // const auto iPoint = bound[iMarker][iElem]->GetNode(iNode); + // const auto iVertex = nodes->GetVertex(iPoint, iMarker); + + // const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); + // su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); + // su2double UnitNormal_Sym[MAXNDIM] = {0.0}; + // for(unsigned short iDim = 0; iDimGetnNeighbor_Nodes(iNode); ++iNeigh){ + // su2double Product = 0.0; + // unsigned long jPoint = nodes->GetPoint(iPoint,iNeigh); + // /*---Check if neighbour point is on the same plane as the Symmetry_Plane + // by computing the internal product and of the Normal Vertex vector and + // the vector connecting iPoint and jPoint. If the product is lower than + // estabilished tolerance (to account for Numerical errors) both points are + // in the same plane as SYMMETRY_PLANE---*/ + // su2double Tangent[MAXNDIM]={0.0}; + // for(unsigned short iDim = 0; iDimGetCoord(jPoint,iDim) - nodes->GetCoord(iPoint,iDim); + // Product += Tangent[iDim] * Normal_Sym[iDim]; + // } + + // if (abs(Product) < EPS) { + // Product = 0.0; + + // unsigned long iEdge = nodes->GetEdge(iPoint,iNeigh); + // su2double Normal[MAXNDIM] = {0.0}; + // edges->GetNormal(iEdge,Normal); + + // for(unsigned short iDim = 0; iDimSetNormal(iEdge,Normal); + // } + // } + // } + } // loop over elements + } // if symmetry + } // loop over markers + - for (unsigned long iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { - //auto Area2 = GeometryToolbox::SquaredNorm(nDim, vertex[iMarker][iVertex]->GetNormal()); - //su2double DefaultArea[MAXNDIM] = {EPS * EPS}; - //if (Area2 == 0.0) vertex[iMarker][iVertex]->SetNormal(DefaultArea); - } - } - } END_SU2_OMP_FOR } From 9ba8f8ed3ad827f9fd3d66be1d2f095c9f3b48b9 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 3 Jan 2024 23:54:48 +0100 Subject: [PATCH 007/194] copy normal correction from nemo --- Common/src/geometry/CPhysicalGeometry.cpp | 90 +++--- .../gradients/computeGradientsGreenGauss.hpp | 107 ------- .../include/solvers/CFVMFlowSolverBase.inl | 284 +++++++++--------- 3 files changed, 189 insertions(+), 292 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 9106c0ad623..9ca5ebb3621 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7279,50 +7279,52 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { for (unsigned long iElem = 0; iElem < nElem_Bound[iMarker]; iElem++) { - // const auto nNodes = bound[iMarker][iElem]->GetnNodes(); - // /*--- Get pointers to the coordinates of all the element nodes ---*/ - // //array Coord; - // for (unsigned short iNode = 0; iNode < nNodes; iNode++) { - // const auto iPoint = bound[iMarker][iElem]->GetNode(iNode); - // const auto iVertex = nodes->GetVertex(iPoint, iMarker); - - // const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); - // su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); - // su2double UnitNormal_Sym[MAXNDIM] = {0.0}; - // for(unsigned short iDim = 0; iDimGetnNeighbor_Nodes(iNode); ++iNeigh){ - // su2double Product = 0.0; - // unsigned long jPoint = nodes->GetPoint(iPoint,iNeigh); - // /*---Check if neighbour point is on the same plane as the Symmetry_Plane - // by computing the internal product and of the Normal Vertex vector and - // the vector connecting iPoint and jPoint. If the product is lower than - // estabilished tolerance (to account for Numerical errors) both points are - // in the same plane as SYMMETRY_PLANE---*/ - // su2double Tangent[MAXNDIM]={0.0}; - // for(unsigned short iDim = 0; iDimGetCoord(jPoint,iDim) - nodes->GetCoord(iPoint,iDim); - // Product += Tangent[iDim] * Normal_Sym[iDim]; - // } - - // if (abs(Product) < EPS) { - // Product = 0.0; - - // unsigned long iEdge = nodes->GetEdge(iPoint,iNeigh); - // su2double Normal[MAXNDIM] = {0.0}; - // edges->GetNormal(iEdge,Normal); - - // for(unsigned short iDim = 0; iDimSetNormal(iEdge,Normal); - // } - // } - // } + + const auto nNodes = bound[iMarker][iElem]->GetnNodes(); + for (unsigned short iNode = 0; iNode < nNodes; iNode++) { + + const auto iPoint = bound[iMarker][iElem]->GetNode(iNode); + const auto iVertex = nodes->GetVertex(iPoint, iMarker); + + const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); + su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); + su2double UnitNormal_Sym[MAXNDIM] = {0.0}; + + for(unsigned short iDim = 0; iDimGetnNeighbor_Nodes(iNode); ++iNeigh){ + su2double Product = 0.0; + unsigned long jPoint = nodes->GetPoint(iPoint,iNeigh); + /*---Check if neighbour point is on the same plane as the Symmetry_Plane + by computing the internal product and of the Normal Vertex vector and + the vector connecting iPoint and jPoint. If the product is lower than + estabilished tolerance (to account for Numerical errors) both points are + in the same plane as SYMMETRY_PLANE---*/ + su2double Tangent[MAXNDIM]={0.0}; + for(unsigned short iDim = 0; iDimGetCoord(jPoint,iDim) - nodes->GetCoord(iPoint,iDim); + Product += Tangent[iDim] * Normal_Sym[iDim]; + } + + if (abs(Product) < EPS) { + Product = 0.0; + + unsigned long iEdge = nodes->GetEdge(iPoint,iNeigh); + su2double Normal[MAXNDIM] = {0.0}; + edges->GetNormal(iEdge,Normal); + + for(unsigned short iDim = 0; iDimSetNormal(iEdge,Normal); + } + } + } } // loop over elements } // if symmetry } // loop over markers diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 6759d6296f6..7f70eccf81c 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -211,113 +211,6 @@ void computeGradientsGreenGauss(CSolver* solver, } } - // ******************************************************************** - // loop over all cells on other boundaries - // ******************************************************************** - /*--- Add boundary fluxes. ---*/ - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) - { - if ((config.GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && - (config.GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && - (config.GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && - (config.GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) - { - - /*--- Work is shared in inner loop as two markers - * may try to update the same point. ---*/ - - SU2_OMP_FOR_STAT(32) - for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) - { - size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - auto nodes = geometry.nodes; - - /*--- Halo points do not need to be considered. ---*/ - - if (!nodes->GetDomain(iPoint)) continue; - - su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - - const su2double* area = geometry.vertex[iMarker][iVertex]->GetNormal(); - - for (size_t iVar = varBegin; iVar < varEnd; iVar++) - { - su2double flux = field(iPoint,iVar) / volume; - - for (size_t iDim = 0; iDim < nDim; iDim++) - gradient(iPoint, iVar, iDim) -= flux * area[iDim]; - } - } - END_SU2_OMP_FOR - } - else if ( (config.GetMarker_All_KindBC(iMarker) == HEAT_FLUX) || - (config.GetMarker_All_KindBC(iMarker) == ISOTHERMAL)) { - cout << "wall plane found" <GetNode(); - - auto nodes = geometry.nodes; - - // **************************************** - su2double Normal[3]={0.0}; - su2double UnitNormal[3]={0.0}; - su2double AreaReflected[3]={0.0}; - /*--- Normal vector for this vertex (negate for outward convention). ---*/ - geometry.vertex[iMarker][iVertex]->GetNormal(Normal); - for (size_t iDim = 0; iDim < nDim; iDim++) - Normal[iDim] = -Normal[iDim]; - const auto Area = GeometryToolbox::Norm(nDim, Normal); - for (size_t iDim = 0; iDim < nDim; iDim++) - UnitNormal[iDim] = -Normal[iDim] / Area; - // **************************************** - - /*--- Clear the gradient. --*/ - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - for (size_t iDim = 0; iDim < nDim; ++iDim) - gradient(iPoint, iVar, iDim) = 0.0; - /*--- Handle averaging and division by volume in one constant. ---*/ - su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint)+nodes->GetPeriodicVolume(iPoint)); - /*--- Add a contribution due to each neighbor. ---*/ - for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) - { - - // for a wall, we have to set the edge normals normal to the wall to zero - - size_t iEdge = nodes->GetEdge(iPoint,iNeigh); - size_t jPoint = nodes->GetPoint(iPoint,iNeigh); - su2double *coordi={nodes->GetCoord(iPoint)}; - su2double *coordj={nodes->GetCoord(jPoint)}; - /*--- Determine if edge points inwards or outwards of iPoint. - * If inwards we need to flip the area vector. ---*/ - su2double dir = (iPoint < jPoint)? 1.0 : -1.0; - su2double weight = dir * halfOnVol; - - // this is the normal of the edge - const auto area = geometry.edges->GetNormal(iEdge); - - // this is a projection of the normal to the tangential direction - su2double ProjArea = 0.0; - for (unsigned long iDim = 0; iDim < nDim; iDim++) - ProjArea += area[iDim]*UnitNormal[iDim]; - - for (size_t iDim = 0; iDim < nDim; iDim++) - AreaReflected[iDim] = area[iDim] - ProjArea*UnitNormal[iDim]; - - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - { - su2double vali = field(iPoint,iVar); - su2double valj = field(jPoint,iVar); - su2double flux = weight * (field(iPoint,iVar) + field(jPoint,iVar)); - for (size_t iDim = 0; iDim < nDim; ++iDim) - gradient(iPoint, iVar, iDim) += flux * AreaReflected[iDim]; - } - } - } - END_SU2_OMP_FOR - } - } - // ******************************************************************** // loop over all cells on other boundaries // ******************************************************************** diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index a99edea3b05..beec4b04e60 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1153,183 +1153,185 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- axis. Based on the Upwind_Residual routine. ---*/ /*-------------------------------------------------------------------------------*/ - /*--- Allocate the reflected state at the symmetry boundary. ---*/ - V_reflected = GetCharacPrimVar(val_marker, iVertex); + // /*--- Allocate the reflected state at the symmetry boundary. ---*/ + // V_reflected = GetCharacPrimVar(val_marker, iVertex); - /*--- Grid movement ---*/ - if (dynamic_grid) - conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); + // /*--- Grid movement ---*/ + // if (dynamic_grid) + // conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); - /*--- Normal vector for this vertex (negate for outward convention). ---*/ - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + // /*--- Normal vector for this vertex (negate for outward convention). ---*/ + // geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - // set component normal to the wall to zero. - conv_numerics->SetNormal(Normal); + // for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + // // set component normal to the wall to zero. + // conv_numerics->SetNormal(Normal); - /*--- Get current solution at this boundary node ---*/ - V_domain = nodes->GetPrimitive(iPoint); + // /*--- Get current solution at this boundary node ---*/ + // V_domain = nodes->GetPrimitive(iPoint); - /*--- Set the reflected state based on the boundary node. Scalars are copied and - the velocity is mirrored along the symmetry boundary, i.e. the velocity in - normal direction is substracted twice. ---*/ - for (iVar = 0; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); + // /*--- Set the reflected state based on the boundary node. Scalars are copied and + // the velocity is mirrored along the symmetry boundary, i.e. the velocity in + // normal direction is substracted twice. ---*/ + // for (iVar = 0; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); - /*--- Compute velocity in normal direction (ProjVelocity_i=(v*n)) und substract twice from - velocity in normal direction: v_r = v - 2 (v*n)n ---*/ - ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); + // /*--- Compute velocity in normal direction (ProjVelocity_i=(v*n)) und substract twice from + // velocity in normal direction: v_r = v - 2 (v*n)n ---*/ + // ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); - /*--- Adjustment to v.n due to grid movement. ---*/ - if (dynamic_grid) { - ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); - } + // /*--- Adjustment to v.n due to grid movement. ---*/ + // if (dynamic_grid) { + // ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); + // } - // Note that we do not want a perfect reflection but the normal component to be set to zero. - // so instead of u-2*v.n we reflect only the tangential component u-1*v.n - for (iDim = 0; iDim < nDim; iDim++) - V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 1.0 * ProjVelocity_i * UnitNormal[iDim]; - // V_t = b -b_n = b-(an.n).n - // V_t = -(v-(v.n).n) + // // Note that we do not want a perfect reflection but the normal component to be set to zero. + // // so instead of u-2*v.n we reflect only the tangential component u-1*v.n + // for (iDim = 0; iDim < nDim; iDim++) + // V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 1.0 * ProjVelocity_i * UnitNormal[iDim]; + // // V_t = b -b_n = b-(an.n).n + // // V_t = -(v-(v.n).n) - /*--- Set Primitive and Secondary for numerics class. ---*/ - conv_numerics->SetPrimitive(V_domain, V_reflected); - conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); + // /*--- Set Primitive and Secondary for numerics class. ---*/ + // conv_numerics->SetPrimitive(V_domain, V_reflected); + // conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); - /*--- Compute the residual using an upwind scheme. ---*/ + // /*--- Compute the residual using an upwind scheme. ---*/ - auto residual = conv_numerics->ComputeResidual(config); + // auto residual = conv_numerics->ComputeResidual(config); /*--- Update residual value ---*/ - LinSysRes.AddBlock(iPoint, residual); + //LinSysRes.AddBlock(iPoint, residual); - /*--- Jacobian contribution for implicit integration. ---*/ - if (implicit) { - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); - } + // new + const su2double* Residual_Old; + Residual_Old = LinSysRes.GetBlock(iPoint); - // su2double Vn = 0.0; - // su2double zero[MAXNDIM] = {0.0}; + su2double Normal_Product = 0.0; - // nodes->SetVelocity_Old(iPoint, zero); + for (iDim = 0; iDim < nDim; iDim++){ + UnitNormal[iDim] = Normal[iDim] / Area; + Normal_Product += Residual_Old[1+iDim]*UnitNormal[iDim]; + } - // for (iDim = 0; iDim < nDim; iDim++){ - // nodes->SetSolution(iPoint, iDim+1, Vn); - // nodes->SetSolution_Old(iPoint, iDim+1, Vn); - // LinSysRes(iPoint, iDim+1) = 0.0; - // nodes->SetVel_ResTruncError_Zero(iPoint); - // } - // if (implicit) { - // for (unsigned short iVar = 1; iVar <= nDim; iVar++) - // Jacobian.DeleteValsRowi(iPoint*nVar+iVar); - // } + su2double Residual[MAXNVAR] = {0.0}; + for(iDim = 0; iDim < nDim; iDim++) + Residual[1+iDim] = Normal_Product*UnitNormal[iDim]; + LinSysRes.SubtractBlock(iPoint, Residual); - if (viscous) { - /*-------------------------------------------------------------------------------*/ - /*--- Step 2: The viscous fluxes of the Navier-Stokes equations depend on the ---*/ - /*--- Primitive variables and their gradients. The viscous numerics ---*/ - /*--- container is filled just as the convective numerics container, ---*/ - /*--- but the primitive gradients of the reflected state have to be ---*/ - /*--- determined additionally such that symmetry at the boundary is ---*/ - /*--- enforced. Based on the Viscous_Residual routine. ---*/ - /*-------------------------------------------------------------------------------*/ - - /*--- Set the normal vector and the coordinates. ---*/ - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); - visc_numerics->SetNormal(Normal); - - /*--- Set the primitive and Secondary variables. ---*/ - visc_numerics->SetPrimitive(V_domain, V_reflected); - visc_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); - - /*--- For viscous Fluxes also the gradients of the primitives need to be determined. - 1. The gradients of scalars are mirrored along the sym plane just as velocity for the primitives - 2. The gradients of the velocity components need more attention, i.e. the gradient of the - normal velocity in tangential direction is mirrored and the gradient of the tangential velocity in - normal direction is mirrored. ---*/ - - /*--- Get gradients of primitives of boundary cell ---*/ - for (iVar = 0; iVar < nPrimVarGrad; iVar++) - for (iDim = 0; iDim < nDim; iDim++) - Grad_Reflected[iVar][iDim] = nodes->GetGradient_Primitive(iPoint, iVar, iDim); - /*--- Reflect the gradients for all scalars including the velocity components. - The gradients of the velocity components are set later with the - correct values: grad(V)_r = grad(V) - 2 [grad(V)*n]n, V being any primitive ---*/ - for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - if (iVar == 0 || iVar > nDim) { // Exclude velocity component gradients + // /*--- Jacobian contribution for implicit integration. ---*/ + // if (implicit) { + // Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + // } - /*--- Compute projected part of the gradient in a dot product ---*/ - ProjGradient = 0.0; - for (iDim = 0; iDim < nDim; iDim++) ProjGradient += Grad_Reflected[iVar][iDim] * UnitNormal[iDim]; - for (iDim = 0; iDim < nDim; iDim++) - //Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; - Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 1.0 * ProjGradient * UnitNormal[iDim]; - } - } + // if (viscous) { + // /*-------------------------------------------------------------------------------*/ + // /*--- Step 2: The viscous fluxes of the Navier-Stokes equations depend on the ---*/ + // /*--- Primitive variables and their gradients. The viscous numerics ---*/ + // /*--- container is filled just as the convective numerics container, ---*/ + // /*--- but the primitive gradients of the reflected state have to be ---*/ + // /*--- determined additionally such that symmetry at the boundary is ---*/ + // /*--- enforced. Based on the Viscous_Residual routine. ---*/ + // /*-------------------------------------------------------------------------------*/ + + // /*--- Set the normal vector and the coordinates. ---*/ + // visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); + // visc_numerics->SetNormal(Normal); + + // /*--- Set the primitive and Secondary variables. ---*/ + // visc_numerics->SetPrimitive(V_domain, V_reflected); + // visc_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); + + // /*--- For viscous Fluxes also the gradients of the primitives need to be determined. + // 1. The gradients of scalars are mirrored along the sym plane just as velocity for the primitives + // 2. The gradients of the velocity components need more attention, i.e. the gradient of the + // normal velocity in tangential direction is mirrored and the gradient of the tangential velocity in + // normal direction is mirrored. ---*/ + + // /*--- Get gradients of primitives of boundary cell ---*/ + // for (iVar = 0; iVar < nPrimVarGrad; iVar++) + // for (iDim = 0; iDim < nDim; iDim++) + // Grad_Reflected[iVar][iDim] = nodes->GetGradient_Primitive(iPoint, iVar, iDim); + + // /*--- Reflect the gradients for all scalars including the velocity components. + // The gradients of the velocity components are set later with the + // correct values: grad(V)_r = grad(V) - 2 [grad(V)*n]n, V being any primitive ---*/ + // for (iVar = 0; iVar < nPrimVarGrad; iVar++) { + // if (iVar == 0 || iVar > nDim) { // Exclude velocity component gradients + + // /*--- Compute projected part of the gradient in a dot product ---*/ + // ProjGradient = 0.0; + // for (iDim = 0; iDim < nDim; iDim++) ProjGradient += Grad_Reflected[iVar][iDim] * UnitNormal[iDim]; + + // for (iDim = 0; iDim < nDim; iDim++) + // //Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; + // Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 1.0 * ProjGradient * UnitNormal[iDim]; + // } + // } - /*--- Compute gradients of normal and tangential velocity: - grad(v*n) = grad(v_x) n_x + grad(v_y) n_y (+ grad(v_z) n_z) - grad(v*t) = grad(v_x) t_x + grad(v_y) t_y (+ grad(v_z) t_z) ---*/ - for (iVar = 0; iVar < nDim; iVar++) { // counts gradient components - GradNormVel[iVar] = 0.0; - GradTangVel[iVar] = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { // counts sum with unit normal/tangential - GradNormVel[iVar] += Grad_Reflected[iDim + 1][iVar] * UnitNormal[iDim]; - GradTangVel[iVar] += Grad_Reflected[iDim + 1][iVar] * Tangential[iDim]; - } - } + // /*--- Compute gradients of normal and tangential velocity: + // grad(v*n) = grad(v_x) n_x + grad(v_y) n_y (+ grad(v_z) n_z) + // grad(v*t) = grad(v_x) t_x + grad(v_y) t_y (+ grad(v_z) t_z) ---*/ + // for (iVar = 0; iVar < nDim; iVar++) { // counts gradient components + // GradNormVel[iVar] = 0.0; + // GradTangVel[iVar] = 0.0; + // for (iDim = 0; iDim < nDim; iDim++) { // counts sum with unit normal/tangential + // GradNormVel[iVar] += Grad_Reflected[iDim + 1][iVar] * UnitNormal[iDim]; + // GradTangVel[iVar] += Grad_Reflected[iDim + 1][iVar] * Tangential[iDim]; + // } + // } - /*--- Reflect gradients in tangential and normal direction by substracting the normal/tangential - component twice, just as done with velocity above. - grad(v*n)_r = grad(v*n) - 2 {grad([v*n])*t}t - grad(v*t)_r = grad(v*t) - 2 {grad([v*t])*n}n ---*/ - ProjNormVelGrad = 0.0; - ProjTangVelGrad = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - ProjNormVelGrad += GradNormVel[iDim] * Tangential[iDim]; // grad([v*n])*t - ProjTangVelGrad += GradTangVel[iDim] * UnitNormal[iDim]; // grad([v*t])*n - } + // /*--- Reflect gradients in tangential and normal direction by substracting the normal/tangential + // component twice, just as done with velocity above. + // grad(v*n)_r = grad(v*n) - 2 {grad([v*n])*t}t + // grad(v*t)_r = grad(v*t) - 2 {grad([v*t])*n}n ---*/ + // ProjNormVelGrad = 0.0; + // ProjTangVelGrad = 0.0; + // for (iDim = 0; iDim < nDim; iDim++) { + // ProjNormVelGrad += GradNormVel[iDim] * Tangential[iDim]; // grad([v*n])*t + // ProjTangVelGrad += GradTangVel[iDim] * UnitNormal[iDim]; // grad([v*t])*n + // } - for (iDim = 0; iDim < nDim; iDim++) { - //GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; - //GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; - GradNormVel[iDim] = GradNormVel[iDim] - 1.0 * ProjNormVelGrad * Tangential[iDim]; - GradTangVel[iDim] = GradTangVel[iDim] - 1.0 * ProjTangVelGrad * UnitNormal[iDim]; - } + // for (iDim = 0; iDim < nDim; iDim++) { + // //GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; + // //GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; + // GradNormVel[iDim] = GradNormVel[iDim] - 1.0 * ProjNormVelGrad * Tangential[iDim]; + // GradTangVel[iDim] = GradTangVel[iDim] - 1.0 * ProjTangVelGrad * UnitNormal[iDim]; + // } - /*--- Transfer reflected gradients back into the Cartesian Coordinate system: - grad(v_x)_r = grad(v*n)_r n_x + grad(v*t)_r t_x - grad(v_y)_r = grad(v*n)_r n_y + grad(v*t)_r t_y - ( grad(v_z)_r = grad(v*n)_r n_z + grad(v*t)_r t_z ) ---*/ - for (iVar = 0; iVar < nDim; iVar++) // loops over the velocity component gradients - for (iDim = 0; iDim < nDim; iDim++) // loops over the entries of the above - Grad_Reflected[iVar + 1][iDim] = - GradNormVel[iDim] * UnitNormal[iVar] + GradTangVel[iDim] * Tangential[iVar]; + // /*--- Transfer reflected gradients back into the Cartesian Coordinate system: + // grad(v_x)_r = grad(v*n)_r n_x + grad(v*t)_r t_x + // grad(v_y)_r = grad(v*n)_r n_y + grad(v*t)_r t_y + // ( grad(v_z)_r = grad(v*n)_r n_z + grad(v*t)_r t_z ) ---*/ + // for (iVar = 0; iVar < nDim; iVar++) // loops over the velocity component gradients + // for (iDim = 0; iDim < nDim; iDim++) // loops over the entries of the above + // Grad_Reflected[iVar + 1][iDim] = + // GradNormVel[iDim] * UnitNormal[iVar] + GradTangVel[iDim] * Tangential[iVar]; - /*--- Set the primitive gradients of the boundary and reflected state. ---*/ - visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), CMatrixView(Grad_Reflected)); + // /*--- Set the primitive gradients of the boundary and reflected state. ---*/ + // visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), CMatrixView(Grad_Reflected)); - /*--- Turbulent kinetic energy. ---*/ - if (config->GetKind_Turb_Model() == TURB_MODEL::SST) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0), - solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0)); + // /*--- Turbulent kinetic energy. ---*/ + // if (config->GetKind_Turb_Model() == TURB_MODEL::SST) + // visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0), + // solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0)); - /*--- Compute and update residual. Note that the viscous shear stress tensor is computed in the - following routine based upon the velocity-component gradients. ---*/ - auto residual = visc_numerics->ComputeResidual(config); + // /*--- Compute and update residual. Note that the viscous shear stress tensor is computed in the + // following routine based upon the velocity-component gradients. ---*/ + // auto residual = visc_numerics->ComputeResidual(config); - LinSysRes.SubtractBlock(iPoint, residual); + // LinSysRes.SubtractBlock(iPoint, residual); - /*--- Jacobian contribution for implicit integration. ---*/ - if (implicit) Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); - } // if viscous + // /*--- Jacobian contribution for implicit integration. ---*/ + // if (implicit) Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); + // } // if viscous } // if GetDomain } // for iVertex END_SU2_OMP_FOR From fd2fbb75931bf5b83d34baec380c98d4bad36261 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 4 Jan 2024 00:28:36 +0100 Subject: [PATCH 008/194] remove unused variables --- Common/src/geometry/CPhysicalGeometry.cpp | 11 ++-- .../gradients/computeGradientsGreenGauss.hpp | 54 ++++++++----------- 2 files changed, 28 insertions(+), 37 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 9ca5ebb3621..f3f6f69d98b 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7270,10 +7270,11 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh END_SU2_OMP_FOR - /*--- For symmetry planes, - * correct the normal.vectors of the faces of the control volume which touch the boundary. - * This means remove all components of the face vector which are normal to the symmetry plane */ - + /*--- For symmetry planes: Blazek chapter 8.6: + * It is also necessary to correct the normal vectors of those faces + * of the control volume, which touch the boundary. The + * modification consists of removing all components of the face vector, which are normal + * to the symmetry plane. ---*/ SU2_OMP_FOR_DYN(1) for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { @@ -7297,7 +7298,7 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh for (unsigned short iNeigh = 0; iNeigh < bound[iMarker][iElem]->GetnNeighbor_Nodes(iNode); ++iNeigh){ su2double Product = 0.0; unsigned long jPoint = nodes->GetPoint(iPoint,iNeigh); - /*---Check if neighbour point is on the same plane as the Symmetry_Plane + /*---Check if neighbour point is on the same plane as the symmetry plane by computing the internal product and of the Normal Vertex vector and the vector connecting iPoint and jPoint. If the product is lower than estabilished tolerance (to account for Numerical errors) both points are diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 7f70eccf81c..6dc718f1b57 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -73,10 +73,6 @@ void computeGradientsGreenGauss(CSolver* solver, /*--- For each (non-halo) volume integrate over its faces (edges). ---*/ - - // ******************************************************************** - // loop over all cells - // ******************************************************************** SU2_OMP_FOR_DYN(chunkSize) for (size_t iPoint = 0; iPoint < nPointDomain; ++iPoint) { @@ -119,8 +115,6 @@ void computeGradientsGreenGauss(CSolver* solver, for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { AD::SetPreaccIn(field(jPoint,iVar)); - su2double vali = field(iPoint,iVar); - su2double valj = field(jPoint,iVar); su2double flux = weight * (field(iPoint,iVar) + field(jPoint,iVar)); for (size_t iDim = 0; iDim < nDim; ++iDim) @@ -138,47 +132,50 @@ void computeGradientsGreenGauss(CSolver* solver, END_SU2_OMP_FOR - // ******************************************************************** - // loop over all cells on a symmetry plane and mirror the faces of the cell on the symmetry plane - // ******************************************************************** + /* For symmetry planes, we need to impose the conditions (Blazek eq. 8.40): + * 1. n.grad(phi) = 0 + * 2. n.grad(v.t) = 0 + * 3. t.grad(v.n) = 0 + */ - /*--- Add GG boundary fluxes on symmetry. ---*/ - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) - { + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { - //cout << "symmetry plane found" <GetNode(); - // recompute gradients on symmetry plane + auto nodes = geometry.nodes; - // **************************************** - su2double Normal[3]={0.0}; - su2double UnitNormal[3]={0.0}; - su2double AreaReflected[3]={0.0}; + su2double Normal[3] = {0.0}; + su2double UnitNormal[3] = {0.0}; + su2double AreaReflected[3] = {0.0}; + /*--- Normal vector for this vertex (negate for outward convention). ---*/ geometry.vertex[iMarker][iVertex]->GetNormal(Normal); + for (size_t iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + const auto Area = GeometryToolbox::Norm(nDim, Normal); + for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = -Normal[iDim] / Area; - // **************************************** /*--- Clear the gradient. --*/ for (size_t iVar = varBegin; iVar < varEnd; ++iVar) for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) = 0.0; + /*--- Handle averaging and division by volume in one constant. ---*/ + /*--- For symmetry we mirror the cell so the volume is twice as large.---*/ su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint)+nodes->GetPeriodicVolume(iPoint)); + /*--- Add a contribution due to each neighbor. ---*/ for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { size_t iEdge = nodes->GetEdge(iPoint,iNeigh); size_t jPoint = nodes->GetPoint(iPoint,iNeigh); - su2double *coordi={nodes->GetCoord(iPoint)}; - su2double *coordj={nodes->GetCoord(jPoint)}; + /*--- Determine if edge points inwards or outwards of iPoint. * If inwards we need to flip the area vector. ---*/ su2double dir = (iPoint < jPoint)? 1.0 : -1.0; @@ -186,24 +183,22 @@ void computeGradientsGreenGauss(CSolver* solver, const auto area = geometry.edges->GetNormal(iEdge); - // normal = U // reflected normal V=U - 2U_t // V=U - 2(U-(n.U)*n) - // this is a perfect reflection of the velocity gradients su2double ProjArea = 0.0; for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim]*UnitNormal[iDim]; + /*--- The mirrored half of the dual cell ---*/ for (size_t iDim = 0; iDim < nDim; iDim++) AreaReflected[iDim] = area[iDim] - 2.0 * ProjArea*UnitNormal[iDim]; for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - su2double vali = field(iPoint,iVar); - su2double valj = field(jPoint,iVar); su2double flux = weight * (field(iPoint,iVar) + field(jPoint,iVar)); + /*--- gradient is the sum of the original and the mirrored contribution. ---*/ for (size_t iDim = 0; iDim < nDim; ++iDim) - gradient(iPoint, iVar, iDim) += 0.5*flux * (area[iDim] + AreaReflected[iDim]); + gradient(iPoint, iVar, iDim) += flux * 0.5 * (area[iDim] + AreaReflected[iDim]); } } } @@ -211,10 +206,6 @@ void computeGradientsGreenGauss(CSolver* solver, } } - // ******************************************************************** - // loop over all cells on other boundaries - // ******************************************************************** - /*--- Add boundary fluxes. ---*/ for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if ((config.GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && @@ -222,7 +213,6 @@ void computeGradientsGreenGauss(CSolver* solver, (config.GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && (config.GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { - /*--- Work is shared in inner loop as two markers * may try to update the same point. ---*/ @@ -238,7 +228,7 @@ void computeGradientsGreenGauss(CSolver* solver, su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - const su2double* area = geometry.vertex[iMarker][iVertex]->GetNormal(); + const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); for (size_t iVar = varBegin; iVar < varEnd; iVar++) { From 576919da414d7ea47abb555afa01cc74ed3b12c1 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 4 Jan 2024 17:53:31 +0100 Subject: [PATCH 009/194] GG test --- Common/src/geometry/CPhysicalGeometry.cpp | 112 ++++--- .../gradients/computeGradientsGreenGauss.hpp | 188 +++++------ .../include/solvers/CFVMFlowSolverBase.inl | 302 +++++++++--------- 3 files changed, 300 insertions(+), 302 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index f3f6f69d98b..c8a37831ef6 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7269,69 +7269,65 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } END_SU2_OMP_FOR - /*--- For symmetry planes: Blazek chapter 8.6: * It is also necessary to correct the normal vectors of those faces * of the control volume, which touch the boundary. The * modification consists of removing all components of the face vector, which are normal * to the symmetry plane. ---*/ - SU2_OMP_FOR_DYN(1) - - for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { - if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { - for (unsigned long iElem = 0; iElem < nElem_Bound[iMarker]; iElem++) { - - const auto nNodes = bound[iMarker][iElem]->GetnNodes(); - for (unsigned short iNode = 0; iNode < nNodes; iNode++) { - - const auto iPoint = bound[iMarker][iElem]->GetNode(iNode); - const auto iVertex = nodes->GetVertex(iPoint, iMarker); - - const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); - su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); - su2double UnitNormal_Sym[MAXNDIM] = {0.0}; - - for(unsigned short iDim = 0; iDimGetnNeighbor_Nodes(iNode); ++iNeigh){ - su2double Product = 0.0; - unsigned long jPoint = nodes->GetPoint(iPoint,iNeigh); - /*---Check if neighbour point is on the same plane as the symmetry plane - by computing the internal product and of the Normal Vertex vector and - the vector connecting iPoint and jPoint. If the product is lower than - estabilished tolerance (to account for Numerical errors) both points are - in the same plane as SYMMETRY_PLANE---*/ - su2double Tangent[MAXNDIM]={0.0}; - for(unsigned short iDim = 0; iDimGetCoord(jPoint,iDim) - nodes->GetCoord(iPoint,iDim); - Product += Tangent[iDim] * Normal_Sym[iDim]; - } - - if (abs(Product) < EPS) { - Product = 0.0; - - unsigned long iEdge = nodes->GetEdge(iPoint,iNeigh); - su2double Normal[MAXNDIM] = {0.0}; - edges->GetNormal(iEdge,Normal); - - for(unsigned short iDim = 0; iDimSetNormal(iEdge,Normal); - } - } - } - } // loop over elements - } // if symmetry - } // loop over markers - - - END_SU2_OMP_FOR + // SU2_OMP_FOR_DYN(1) + // for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { + // if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + // for (unsigned long iElem = 0; iElem < nElem_Bound[iMarker]; iElem++) { + + // const auto nNodes = bound[iMarker][iElem]->GetnNodes(); + // for (unsigned short iNode = 0; iNode < nNodes; iNode++) { + + // const auto iPoint = bound[iMarker][iElem]->GetNode(iNode); + // const auto iVertex = nodes->GetVertex(iPoint, iMarker); + + // const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); + // su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); + // su2double UnitNormal_Sym[MAXNDIM] = {0.0}; + + // for(unsigned short iDim = 0; iDimGetnNeighbor_Nodes(iNode); ++iNeigh){ + // su2double Product = 0.0; + // unsigned long jPoint = nodes->GetPoint(iPoint,iNeigh); + // /*---Check if neighbour point is on the same plane as the symmetry plane + // by computing the internal product and of the Normal Vertex vector and + // the vector connecting iPoint and jPoint. If the product is lower than + // estabilished tolerance (to account for Numerical errors) both points are + // in the same plane as SYMMETRY_PLANE---*/ + // su2double Tangent[MAXNDIM]={0.0}; + // for(unsigned short iDim = 0; iDimGetCoord(jPoint,iDim) - nodes->GetCoord(iPoint,iDim); + // Product += Tangent[iDim] * Normal_Sym[iDim]; + // } + + // if (abs(Product) < EPS) { + // Product = 0.0; + + // unsigned long iEdge = nodes->GetEdge(iPoint,iNeigh); + // su2double Normal[MAXNDIM] = {0.0}; + // edges->GetNormal(iEdge,Normal); + + // for(unsigned short iDim = 0; iDimSetNormal(iEdge,Normal); + // } + // } + // } + // } // loop over elements + // } // if symmetry + // } // loop over markers + // END_SU2_OMP_FOR } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 6dc718f1b57..59ea9f5adb4 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -52,17 +52,10 @@ namespace detail { * \param[in] varEnd - Index of last variable for which to compute the gradient. * \param[out] gradient - Generic object implementing operator (iPoint, iVar, iDim). */ -template -void computeGradientsGreenGauss(CSolver* solver, - MPI_QUANTITIES kindMpiComm, - PERIODIC_QUANTITIES kindPeriodicComm, - CGeometry& geometry, - const CConfig& config, - const FieldType& field, - size_t varBegin, - size_t varEnd, - GradientType& gradient) -{ +template +void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, + CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, + size_t varEnd, GradientType& gradient) { const size_t nPointDomain = geometry.GetnPointDomain(); #ifdef HAVE_OMP @@ -74,8 +67,7 @@ void computeGradientsGreenGauss(CSolver* solver, /*--- For each (non-halo) volume integrate over its faces (edges). ---*/ SU2_OMP_FOR_DYN(chunkSize) - for (size_t iPoint = 0; iPoint < nPointDomain; ++iPoint) - { + for (size_t iPoint = 0; iPoint < nPointDomain; ++iPoint) { auto nodes = geometry.nodes; /*--- Cannot preaccumulate if hybrid parallel due to shared reading. ---*/ @@ -83,55 +75,47 @@ void computeGradientsGreenGauss(CSolver* solver, AD::SetPreaccIn(nodes->GetVolume(iPoint)); AD::SetPreaccIn(nodes->GetPeriodicVolume(iPoint)); - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - AD::SetPreaccIn(field(iPoint,iVar)); + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) AD::SetPreaccIn(field(iPoint, iVar)); /*--- Clear the gradient. --*/ for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - for (size_t iDim = 0; iDim < nDim; ++iDim) - gradient(iPoint, iVar, iDim) = 0.0; + for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) = 0.0; /*--- Handle averaging and division by volume in one constant. ---*/ - su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint)+nodes->GetPeriodicVolume(iPoint)); + su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint)); /*--- Add a contribution due to each neighbor. ---*/ - for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) - { - size_t iEdge = nodes->GetEdge(iPoint,iNeigh); - size_t jPoint = nodes->GetPoint(iPoint,iNeigh); + for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { + size_t iEdge = nodes->GetEdge(iPoint, iNeigh); + size_t jPoint = nodes->GetPoint(iPoint, iNeigh); /*--- Determine if edge points inwards or outwards of iPoint. * If inwards we need to flip the area vector. ---*/ - su2double dir = (iPoint < jPoint)? 1.0 : -1.0; + su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; su2double weight = dir * halfOnVol; const auto area = geometry.edges->GetNormal(iEdge); AD::SetPreaccIn(area, nDim); - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - { - AD::SetPreaccIn(field(jPoint,iVar)); - su2double flux = weight * (field(iPoint,iVar) + field(jPoint,iVar)); + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + AD::SetPreaccIn(field(jPoint, iVar)); + su2double flux = weight * (field(iPoint, iVar) + field(jPoint, iVar)); - for (size_t iDim = 0; iDim < nDim; ++iDim) - gradient(iPoint, iVar, iDim) += flux * area[iDim]; + for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) += flux * area[iDim]; } - } for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - for (size_t iDim = 0; iDim < nDim; ++iDim) - AD::SetPreaccOut(gradient(iPoint,iVar,iDim)); + for (size_t iDim = 0; iDim < nDim; ++iDim) AD::SetPreaccOut(gradient(iPoint, iVar, iDim)); AD::EndPreacc(); } END_SU2_OMP_FOR - /* For symmetry planes, we need to impose the conditions (Blazek eq. 8.40): * 1. n.grad(phi) = 0 * 2. n.grad(v.t) = 0 @@ -146,59 +130,76 @@ void computeGradientsGreenGauss(CSolver* solver, auto nodes = geometry.nodes; - su2double Normal[3] = {0.0}; - su2double UnitNormal[3] = {0.0}; - su2double AreaReflected[3] = {0.0}; + su2double Normal[nDim] = {0.0}; + su2double UnitNormal[nDim] = {0.0}; + su2double AreaReflected[nDim] = {0.0}; + + auto Flux = solver->GetCharacPrimVar(iMarker, iVertex); + auto FluxReflected = solver->GetCharacPrimVar(iMarker, iVertex); /*--- Normal vector for this vertex (negate for outward convention). ---*/ geometry.vertex[iMarker][iVertex]->GetNormal(Normal); - for (size_t iDim = 0; iDim < nDim; iDim++) - Normal[iDim] = -Normal[iDim]; + for (size_t iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; const auto Area = GeometryToolbox::Norm(nDim, Normal); - for (size_t iDim = 0; iDim < nDim; iDim++) - UnitNormal[iDim] = -Normal[iDim] / Area; + for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = -Normal[iDim] / Area; /*--- Clear the gradient. --*/ for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - for (size_t iDim = 0; iDim < nDim; ++iDim) - gradient(iPoint, iVar, iDim) = 0.0; + for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) = 0.0; /*--- Handle averaging and division by volume in one constant. ---*/ /*--- For symmetry we mirror the cell so the volume is twice as large.---*/ - su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint)+nodes->GetPeriodicVolume(iPoint)); + su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint)); /*--- Add a contribution due to each neighbor. ---*/ - for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) - { - size_t iEdge = nodes->GetEdge(iPoint,iNeigh); - size_t jPoint = nodes->GetPoint(iPoint,iNeigh); + for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { + size_t iEdge = nodes->GetEdge(iPoint, iNeigh); + size_t jPoint = nodes->GetPoint(iPoint, iNeigh); /*--- Determine if edge points inwards or outwards of iPoint. * If inwards we need to flip the area vector. ---*/ - su2double dir = (iPoint < jPoint)? 1.0 : -1.0; + su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; su2double weight = dir * halfOnVol; const auto area = geometry.edges->GetNormal(iEdge); // reflected normal V=U - 2U_t - // V=U - 2(U-(n.U)*n) su2double ProjArea = 0.0; - for (unsigned long iDim = 0; iDim < nDim; iDim++) - ProjArea += area[iDim]*UnitNormal[iDim]; + for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim] * UnitNormal[iDim]; /*--- The mirrored half of the dual cell ---*/ for (size_t iDim = 0; iDim < nDim; iDim++) - AreaReflected[iDim] = area[iDim] - 2.0 * ProjArea*UnitNormal[iDim]; + AreaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; + + /*--- reflect velocity components ---*/ + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + Flux[iVar] = weight * (field(iPoint, iVar) + field(jPoint, iVar)); + FluxReflected[iVar] = weight * (field(iPoint, iVar) + field(jPoint, iVar)); + } + + su2double ProjFlux = 0.0; + for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += Flux[iDim + 1] * UnitNormal[iDim]; + + for (size_t iDim = 0; iDim < nDim; iDim++) + FluxReflected[iDim + 1] = Flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - { - su2double flux = weight * (field(iPoint,iVar) + field(jPoint,iVar)); + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { /*--- gradient is the sum of the original and the mirrored contribution. ---*/ - for (size_t iDim = 0; iDim < nDim; ++iDim) - gradient(iPoint, iVar, iDim) += flux * 0.5 * (area[iDim] + AreaReflected[iDim]); + for (size_t iDim = 0; iDim < nDim; ++iDim) { + cout << "old:gradient(" << iPoint << "," << iVar << "," << iDim << ") = " << gradient(iPoint, iVar, iDim) + << endl; + gradient(iPoint, iVar, iDim) += + 0.5 * (Flux[iVar] * area[iDim] + FluxReflected[iVar] * AreaReflected[iDim]); + cout << "new:gradient(" << iPoint << "," << iVar << "," << iDim << ") = " << gradient(iPoint, iVar, iDim) + << endl; + } + // du/dy = 0 + gradient(iPoint, 1, 1) = 0.0; + // dv/dx = 0 + gradient(iPoint, 2, 0) = 0.0; } } } @@ -206,19 +207,16 @@ void computeGradientsGreenGauss(CSolver* solver, } } - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) - { + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if ((config.GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && (config.GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && (config.GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && - (config.GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) - { + (config.GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { /*--- Work is shared in inner loop as two markers * may try to update the same point. ---*/ SU2_OMP_FOR_STAT(32) - for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) - { + for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); auto nodes = geometry.nodes; @@ -230,26 +228,37 @@ void computeGradientsGreenGauss(CSolver* solver, const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); - for (size_t iVar = varBegin; iVar < varEnd; iVar++) - { - su2double flux = field(iPoint,iVar) / volume; + for (size_t iVar = varBegin; iVar < varEnd; iVar++) { + su2double flux = field(iPoint, iVar) / volume; - for (size_t iDim = 0; iDim < nDim; iDim++) - gradient(iPoint, iVar, iDim) -= flux * area[iDim]; + for (size_t iDim = 0; iDim < nDim; iDim++) gradient(iPoint, iVar, iDim) -= flux * area[iDim]; } } END_SU2_OMP_FOR } } + // for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { + // if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + // SU2_OMP_FOR_STAT(32) + // for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { + // size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); + // auto nodes = geometry.nodes; + // if (!nodes->GetDomain(iPoint)) continue; + // gradient(iPoint, 1, 1) = 0.0; + // gradient(iPoint, 2, 0) = 0.0; + // } + // END_SU2_OMP_FOR + // } + // } + /*--- If no solver was provided we do not communicate ---*/ if (solver == nullptr) return; /*--- Account for periodic contributions. ---*/ - for (size_t iPeriodic = 1; iPeriodic <= config.GetnMarker_Periodic()/2; ++iPeriodic) - { + for (size_t iPeriodic = 1; iPeriodic <= config.GetnMarker_Periodic() / 2; ++iPeriodic) { solver->InitiatePeriodicComms(&geometry, &config, iPeriodic, kindPeriodicComm); solver->CompletePeriodicComms(&geometry, &config, iPeriodic, kindPeriodicComm); } @@ -258,35 +267,28 @@ void computeGradientsGreenGauss(CSolver* solver, solver->InitiateComms(&geometry, &config, kindMpiComm); solver->CompleteComms(&geometry, &config, kindMpiComm); - } -} // end namespace +} // namespace detail /*! * \brief Instantiations for 2D and 3D. * \ingroup FvmAlgos */ -template -void computeGradientsGreenGauss(CSolver* solver, - MPI_QUANTITIES kindMpiComm, - PERIODIC_QUANTITIES kindPeriodicComm, - CGeometry& geometry, - const CConfig& config, - const FieldType& field, - size_t varBegin, - size_t varEnd, - GradientType& gradient) { +template +void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, + CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, + size_t varEnd, GradientType& gradient) { switch (geometry.GetnDim()) { - case 2: - detail::computeGradientsGreenGauss<2>(solver, kindMpiComm, kindPeriodicComm, geometry, - config, field, varBegin, varEnd, gradient); - break; - case 3: - detail::computeGradientsGreenGauss<3>(solver, kindMpiComm, kindPeriodicComm, geometry, - config, field, varBegin, varEnd, gradient); - break; - default: - SU2_MPI::Error("Too many dimensions to compute gradients.", CURRENT_FUNCTION); - break; + case 2: + detail::computeGradientsGreenGauss<2>(solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, + varEnd, gradient); + break; + case 3: + detail::computeGradientsGreenGauss<3>(solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, + varEnd, gradient); + break; + default: + SU2_MPI::Error("Too many dimensions to compute gradients.", CURRENT_FUNCTION); + break; } } diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 035eac48907..37e8ef0e7cf 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1185,185 +1185,185 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- axis. Based on the Upwind_Residual routine. ---*/ /*-------------------------------------------------------------------------------*/ - // /*--- Allocate the reflected state at the symmetry boundary. ---*/ - // V_reflected = GetCharacPrimVar(val_marker, iVertex); + /*--- Allocate the reflected state at the symmetry boundary. ---*/ + V_reflected = GetCharacPrimVar(val_marker, iVertex); - // /*--- Grid movement ---*/ - // if (dynamic_grid) - // conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); + /*--- Grid movement ---*/ + if (dynamic_grid) + conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); - // /*--- Normal vector for this vertex (negate for outward convention). ---*/ - // geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + /*--- Normal vector for this vertex (negate for outward convention). ---*/ + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - // for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - // // set component normal to the wall to zero. - // conv_numerics->SetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + // set component normal to the wall to zero. + conv_numerics->SetNormal(Normal); - // /*--- Get current solution at this boundary node ---*/ - // V_domain = nodes->GetPrimitive(iPoint); + /*--- Get current solution at this boundary node ---*/ + V_domain = nodes->GetPrimitive(iPoint); - // /*--- Set the reflected state based on the boundary node. Scalars are copied and - // the velocity is mirrored along the symmetry boundary, i.e. the velocity in - // normal direction is substracted twice. ---*/ - // for (iVar = 0; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); + /*--- Set the reflected state based on the boundary node. Scalars are copied and + the velocity is mirrored along the symmetry boundary, i.e. the velocity in + normal direction is substracted twice. ---*/ + for (iVar = 0; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); - // /*--- Compute velocity in normal direction (ProjVelocity_i=(v*n)) und substract twice from - // velocity in normal direction: v_r = v - 2 (v*n)n ---*/ - // ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); + /*--- Compute velocity in normal direction (ProjVelocity_i=(v*n)) und substract twice from + velocity in normal direction: v_r = v - 2 (v*n)n ---*/ + ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); - // /*--- Adjustment to v.n due to grid movement. ---*/ - // if (dynamic_grid) { - // ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); - // } + /*--- Adjustment to v.n due to grid movement. ---*/ + if (dynamic_grid) { + ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); + } - // // Note that we do not want a perfect reflection but the normal component to be set to zero. - // // so instead of u-2*v.n we reflect only the tangential component u-1*v.n - // for (iDim = 0; iDim < nDim; iDim++) - // V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 1.0 * ProjVelocity_i * UnitNormal[iDim]; - // // V_t = b -b_n = b-(an.n).n - // // V_t = -(v-(v.n).n) + // Note that we do not want a perfect reflection but the normal component to be set to zero. + // so instead of u-2*v.n we reflect only the tangential component u-1*v.n + for (iDim = 0; iDim < nDim; iDim++) + V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 2.0 * ProjVelocity_i * UnitNormal[iDim]; + // V_t = b -b_n = b-(an.n).n + // V_t = -(v-(v.n).n) - // /*--- Set Primitive and Secondary for numerics class. ---*/ - // conv_numerics->SetPrimitive(V_domain, V_reflected); - // conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); + /*--- Set Primitive and Secondary for numerics class. ---*/ + conv_numerics->SetPrimitive(V_domain, V_reflected); + conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); - // /*--- Compute the residual using an upwind scheme. ---*/ + /*--- Compute the residual using an upwind scheme. ---*/ - // auto residual = conv_numerics->ComputeResidual(config); + auto residual = conv_numerics->ComputeResidual(config); /*--- Update residual value ---*/ - //LinSysRes.AddBlock(iPoint, residual); + LinSysRes.AddBlock(iPoint, residual); - // new - const su2double* Residual_Old; - Residual_Old = LinSysRes.GetBlock(iPoint); + // // new + // const su2double* Residual_Old; + // Residual_Old = LinSysRes.GetBlock(iPoint); - su2double Normal_Product = 0.0; + // su2double Normal_Product = 0.0; - for (iDim = 0; iDim < nDim; iDim++){ - UnitNormal[iDim] = Normal[iDim] / Area; - Normal_Product += Residual_Old[1+iDim]*UnitNormal[iDim]; + // for (iDim = 0; iDim < nDim; iDim++){ + // UnitNormal[iDim] = Normal[iDim] / Area; + // Normal_Product += Residual_Old[1+iDim]*UnitNormal[iDim]; + // } + + // su2double Residual[MAXNVAR] = {0.0}; + + // for(iDim = 0; iDim < nDim; iDim++) + // Residual[1+iDim] = Normal_Product*UnitNormal[iDim]; + + // LinSysRes.SubtractBlock(iPoint, Residual); + + + + + /*--- Jacobian contribution for implicit integration. ---*/ + if (implicit) { + Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); } - su2double Residual[MAXNVAR] = {0.0}; - for(iDim = 0; iDim < nDim; iDim++) - Residual[1+iDim] = Normal_Product*UnitNormal[iDim]; + if (viscous) { + /*-------------------------------------------------------------------------------*/ + /*--- Step 2: The viscous fluxes of the Navier-Stokes equations depend on the ---*/ + /*--- Primitive variables and their gradients. The viscous numerics ---*/ + /*--- container is filled just as the convective numerics container, ---*/ + /*--- but the primitive gradients of the reflected state have to be ---*/ + /*--- determined additionally such that symmetry at the boundary is ---*/ + /*--- enforced. Based on the Viscous_Residual routine. ---*/ + /*-------------------------------------------------------------------------------*/ + + /*--- Set the normal vector and the coordinates. ---*/ + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); + visc_numerics->SetNormal(Normal); + + /*--- Set the primitive and Secondary variables. ---*/ + visc_numerics->SetPrimitive(V_domain, V_reflected); + visc_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); + + /*--- For viscous Fluxes also the gradients of the primitives need to be determined. + 1. The gradients of scalars are mirrored along the sym plane just as velocity for the primitives + 2. The gradients of the velocity components need more attention, i.e. the gradient of the + normal velocity in tangential direction is mirrored and the gradient of the tangential velocity in + normal direction is mirrored. ---*/ + + /*--- Get gradients of primitives of boundary cell ---*/ + for (iVar = 0; iVar < nPrimVarGrad; iVar++) + for (iDim = 0; iDim < nDim; iDim++) + Grad_Reflected[iVar][iDim] = nodes->GetGradient_Primitive(iPoint, iVar, iDim); + + /*--- Reflect the gradients for all scalars including the velocity components. + The gradients of the velocity components are set later with the + correct values: grad(V)_r = grad(V) - 2 [grad(V)*n]n, V being any primitive ---*/ + for (iVar = 0; iVar < nPrimVarGrad; iVar++) { + if (iVar == 0 || iVar > nDim) { // Exclude velocity component gradients - LinSysRes.SubtractBlock(iPoint, Residual); + /*--- Compute projected part of the gradient in a dot product ---*/ + ProjGradient = 0.0; + for (iDim = 0; iDim < nDim; iDim++) ProjGradient += Grad_Reflected[iVar][iDim] * UnitNormal[iDim]; + for (iDim = 0; iDim < nDim; iDim++) + //Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; + Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; + } + } + /*--- Compute gradients of normal and tangential velocity: + grad(v*n) = grad(v_x) n_x + grad(v_y) n_y (+ grad(v_z) n_z) + grad(v*t) = grad(v_x) t_x + grad(v_y) t_y (+ grad(v_z) t_z) ---*/ + for (iVar = 0; iVar < nDim; iVar++) { // counts gradient components + GradNormVel[iVar] = 0.0; + GradTangVel[iVar] = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { // counts sum with unit normal/tangential + GradNormVel[iVar] += Grad_Reflected[iDim + 1][iVar] * UnitNormal[iDim]; + GradTangVel[iVar] += Grad_Reflected[iDim + 1][iVar] * Tangential[iDim]; + } + } + /*--- Reflect gradients in tangential and normal direction by substracting the normal/tangential + component twice, just as done with velocity above. + grad(v*n)_r = grad(v*n) - 2 {grad([v*n])*t}t + grad(v*t)_r = grad(v*t) - 2 {grad([v*t])*n}n ---*/ + ProjNormVelGrad = 0.0; + ProjTangVelGrad = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + ProjNormVelGrad += GradNormVel[iDim] * Tangential[iDim]; // grad([v*n])*t + ProjTangVelGrad += GradTangVel[iDim] * UnitNormal[iDim]; // grad([v*t])*n + } - // /*--- Jacobian contribution for implicit integration. ---*/ - // if (implicit) { - // Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); - // } + for (iDim = 0; iDim < nDim; iDim++) { + //GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; + //GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; + GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; + GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; + } + + /*--- Transfer reflected gradients back into the Cartesian Coordinate system: + grad(v_x)_r = grad(v*n)_r n_x + grad(v*t)_r t_x + grad(v_y)_r = grad(v*n)_r n_y + grad(v*t)_r t_y + ( grad(v_z)_r = grad(v*n)_r n_z + grad(v*t)_r t_z ) ---*/ + for (iVar = 0; iVar < nDim; iVar++) // loops over the velocity component gradients + for (iDim = 0; iDim < nDim; iDim++) // loops over the entries of the above + Grad_Reflected[iVar + 1][iDim] = + GradNormVel[iDim] * UnitNormal[iVar] + GradTangVel[iDim] * Tangential[iVar]; + + /*--- Set the primitive gradients of the boundary and reflected state. ---*/ + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), CMatrixView(Grad_Reflected)); + + /*--- Turbulent kinetic energy. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0)); + + /*--- Compute and update residual. Note that the viscous shear stress tensor is computed in the + following routine based upon the velocity-component gradients. ---*/ + auto residual = visc_numerics->ComputeResidual(config); + LinSysRes.SubtractBlock(iPoint, residual); - // if (viscous) { - // /*-------------------------------------------------------------------------------*/ - // /*--- Step 2: The viscous fluxes of the Navier-Stokes equations depend on the ---*/ - // /*--- Primitive variables and their gradients. The viscous numerics ---*/ - // /*--- container is filled just as the convective numerics container, ---*/ - // /*--- but the primitive gradients of the reflected state have to be ---*/ - // /*--- determined additionally such that symmetry at the boundary is ---*/ - // /*--- enforced. Based on the Viscous_Residual routine. ---*/ - // /*-------------------------------------------------------------------------------*/ - - // /*--- Set the normal vector and the coordinates. ---*/ - // visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); - // visc_numerics->SetNormal(Normal); - - // /*--- Set the primitive and Secondary variables. ---*/ - // visc_numerics->SetPrimitive(V_domain, V_reflected); - // visc_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); - - // /*--- For viscous Fluxes also the gradients of the primitives need to be determined. - // 1. The gradients of scalars are mirrored along the sym plane just as velocity for the primitives - // 2. The gradients of the velocity components need more attention, i.e. the gradient of the - // normal velocity in tangential direction is mirrored and the gradient of the tangential velocity in - // normal direction is mirrored. ---*/ - - // /*--- Get gradients of primitives of boundary cell ---*/ - // for (iVar = 0; iVar < nPrimVarGrad; iVar++) - // for (iDim = 0; iDim < nDim; iDim++) - // Grad_Reflected[iVar][iDim] = nodes->GetGradient_Primitive(iPoint, iVar, iDim); - - // /*--- Reflect the gradients for all scalars including the velocity components. - // The gradients of the velocity components are set later with the - // correct values: grad(V)_r = grad(V) - 2 [grad(V)*n]n, V being any primitive ---*/ - // for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - // if (iVar == 0 || iVar > nDim) { // Exclude velocity component gradients - - // /*--- Compute projected part of the gradient in a dot product ---*/ - // ProjGradient = 0.0; - // for (iDim = 0; iDim < nDim; iDim++) ProjGradient += Grad_Reflected[iVar][iDim] * UnitNormal[iDim]; - - // for (iDim = 0; iDim < nDim; iDim++) - // //Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; - // Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 1.0 * ProjGradient * UnitNormal[iDim]; - // } - // } - - // /*--- Compute gradients of normal and tangential velocity: - // grad(v*n) = grad(v_x) n_x + grad(v_y) n_y (+ grad(v_z) n_z) - // grad(v*t) = grad(v_x) t_x + grad(v_y) t_y (+ grad(v_z) t_z) ---*/ - // for (iVar = 0; iVar < nDim; iVar++) { // counts gradient components - // GradNormVel[iVar] = 0.0; - // GradTangVel[iVar] = 0.0; - // for (iDim = 0; iDim < nDim; iDim++) { // counts sum with unit normal/tangential - // GradNormVel[iVar] += Grad_Reflected[iDim + 1][iVar] * UnitNormal[iDim]; - // GradTangVel[iVar] += Grad_Reflected[iDim + 1][iVar] * Tangential[iDim]; - // } - // } - - // /*--- Reflect gradients in tangential and normal direction by substracting the normal/tangential - // component twice, just as done with velocity above. - // grad(v*n)_r = grad(v*n) - 2 {grad([v*n])*t}t - // grad(v*t)_r = grad(v*t) - 2 {grad([v*t])*n}n ---*/ - // ProjNormVelGrad = 0.0; - // ProjTangVelGrad = 0.0; - // for (iDim = 0; iDim < nDim; iDim++) { - // ProjNormVelGrad += GradNormVel[iDim] * Tangential[iDim]; // grad([v*n])*t - // ProjTangVelGrad += GradTangVel[iDim] * UnitNormal[iDim]; // grad([v*t])*n - // } - - // for (iDim = 0; iDim < nDim; iDim++) { - // //GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; - // //GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; - // GradNormVel[iDim] = GradNormVel[iDim] - 1.0 * ProjNormVelGrad * Tangential[iDim]; - // GradTangVel[iDim] = GradTangVel[iDim] - 1.0 * ProjTangVelGrad * UnitNormal[iDim]; - // } - - // /*--- Transfer reflected gradients back into the Cartesian Coordinate system: - // grad(v_x)_r = grad(v*n)_r n_x + grad(v*t)_r t_x - // grad(v_y)_r = grad(v*n)_r n_y + grad(v*t)_r t_y - // ( grad(v_z)_r = grad(v*n)_r n_z + grad(v*t)_r t_z ) ---*/ - // for (iVar = 0; iVar < nDim; iVar++) // loops over the velocity component gradients - // for (iDim = 0; iDim < nDim; iDim++) // loops over the entries of the above - // Grad_Reflected[iVar + 1][iDim] = - // GradNormVel[iDim] * UnitNormal[iVar] + GradTangVel[iDim] * Tangential[iVar]; - - // /*--- Set the primitive gradients of the boundary and reflected state. ---*/ - // visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), CMatrixView(Grad_Reflected)); - - // /*--- Turbulent kinetic energy. ---*/ - // if (config->GetKind_Turb_Model() == TURB_MODEL::SST) - // visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0), - // solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0)); - - // /*--- Compute and update residual. Note that the viscous shear stress tensor is computed in the - // following routine based upon the velocity-component gradients. ---*/ - // auto residual = visc_numerics->ComputeResidual(config); - - // LinSysRes.SubtractBlock(iPoint, residual); - - // /*--- Jacobian contribution for implicit integration. ---*/ - // if (implicit) Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); - // } // if viscous + /*--- Jacobian contribution for implicit integration. ---*/ + if (implicit) Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); + } // if viscous } // if GetDomain } // for iVertex END_SU2_OMP_FOR From 7166b660ad79f466743fc0398f21663be3530814 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 4 Jan 2024 22:13:30 +0100 Subject: [PATCH 010/194] GG correct velocity mirroring --- .../gradients/computeGradientsGreenGauss.hpp | 83 +++++++++++-------- 1 file changed, 49 insertions(+), 34 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 59ea9f5adb4..1d4401b8e4a 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -130,78 +130,91 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER auto nodes = geometry.nodes; - su2double Normal[nDim] = {0.0}; - su2double UnitNormal[nDim] = {0.0}; - su2double AreaReflected[nDim] = {0.0}; + /*--- Cannot preaccumulate if hybrid parallel due to shared reading. ---*/ + if (omp_get_num_threads() == 1) AD::StartPreacc(); + AD::SetPreaccIn(nodes->GetVolume(iPoint)); + AD::SetPreaccIn(nodes->GetPeriodicVolume(iPoint)); - auto Flux = solver->GetCharacPrimVar(iMarker, iVertex); - auto FluxReflected = solver->GetCharacPrimVar(iMarker, iVertex); - - /*--- Normal vector for this vertex (negate for outward convention). ---*/ - geometry.vertex[iMarker][iVertex]->GetNormal(Normal); - - for (size_t iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - - const auto Area = GeometryToolbox::Norm(nDim, Normal); - - for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = -Normal[iDim] / Area; + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) AD::SetPreaccIn(field(iPoint, iVar)); /*--- Clear the gradient. --*/ + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) = 0.0; /*--- Handle averaging and division by volume in one constant. ---*/ - /*--- For symmetry we mirror the cell so the volume is twice as large.---*/ + su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint)); /*--- Add a contribution due to each neighbor. ---*/ + for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { size_t iEdge = nodes->GetEdge(iPoint, iNeigh); size_t jPoint = nodes->GetPoint(iPoint, iNeigh); + su2double* icoord=nodes->GetCoord(iPoint); + su2double* jcoord=nodes->GetCoord(jPoint); + su2double Veli[nDim]={0.0}; + for (size_t iDim = 0; iDim < nDim; ++iDim) Veli[iDim] = field(iPoint,iDim+1); + su2double Velj[nDim]={0.0}; + for (size_t iDim = 0; iDim < nDim; ++iDim) Velj[iDim] = field(jPoint,iDim+1); /*--- Determine if edge points inwards or outwards of iPoint. * If inwards we need to flip the area vector. ---*/ + su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; su2double weight = dir * halfOnVol; - const auto area = geometry.edges->GetNormal(iEdge); + const su2double* area = geometry.edges->GetNormal(iEdge); + cout << "area="<GetNormal(); // reflected normal V=U - 2U_t su2double ProjArea = 0.0; - for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim] * UnitNormal[iDim]; + const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); + su2double UnitNormal[nDim] ={0.0}; + for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; + for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim] * UnitNormal[iDim]; /*--- The mirrored half of the dual cell ---*/ + su2double areaReflected[nDim]={0.0}; for (size_t iDim = 0; iDim < nDim; iDim++) - AreaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; + areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; + + // note that for the inlet and outlet we also need to reflect. + + su2double *flux = new su2double[varEnd]; + su2double *fluxReflected = new su2double[varEnd]; - /*--- reflect velocity components ---*/ for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - Flux[iVar] = weight * (field(iPoint, iVar) + field(jPoint, iVar)); - FluxReflected[iVar] = weight * (field(iPoint, iVar) + field(jPoint, iVar)); + AD::SetPreaccIn(field(jPoint, iVar)); + flux[iVar] = weight * (field(iPoint, iVar) + field(jPoint, iVar)); + fluxReflected[iVar] = flux[iVar]; } su2double ProjFlux = 0.0; - for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += Flux[iDim + 1] * UnitNormal[iDim]; + for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; for (size_t iDim = 0; iDim < nDim; iDim++) - FluxReflected[iDim + 1] = Flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - /*--- gradient is the sum of the original and the mirrored contribution. ---*/ + AD::SetPreaccIn(field(jPoint, iVar)); for (size_t iDim = 0; iDim < nDim; ++iDim) { - cout << "old:gradient(" << iPoint << "," << iVar << "," << iDim << ") = " << gradient(iPoint, iVar, iDim) - << endl; - gradient(iPoint, iVar, iDim) += - 0.5 * (Flux[iVar] * area[iDim] + FluxReflected[iVar] * AreaReflected[iDim]); - cout << "new:gradient(" << iPoint << "," << iVar << "," << iDim << ") = " << gradient(iPoint, iVar, iDim) - << endl; + gradient(iPoint, iVar, iDim) += 0.5 * (flux[iVar] * area[iDim] + fluxReflected[iVar] * areaReflected[iDim]); } - // du/dy = 0 - gradient(iPoint, 1, 1) = 0.0; - // dv/dx = 0 - gradient(iPoint, 2, 0) = 0.0; } + + delete[] flux; + delete[] fluxReflected; } + + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) + for (size_t iDim = 0; iDim < nDim; ++iDim) AD::SetPreaccOut(gradient(iPoint, iVar, iDim)); + + AD::EndPreacc(); } END_SU2_OMP_FOR } @@ -232,6 +245,8 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double flux = field(iPoint, iVar) / volume; for (size_t iDim = 0; iDim < nDim; iDim++) gradient(iPoint, iVar, iDim) -= flux * area[iDim]; + + // note that for points on boundaries that are shared with a symmetry, we need to mirror the flux } } END_SU2_OMP_FOR From 101c10fbdc448808cdfb90a405e5d558d6e5fa7e Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 6 Jan 2024 15:56:30 +0100 Subject: [PATCH 011/194] temp saving --- Common/include/CConfig.hpp | 7 + Common/include/geometry/dual_grid/CPoint.hpp | 7 +- Common/src/CConfig.cpp | 8 + Common/src/geometry/CPhysicalGeometry.cpp | 2 + Common/src/geometry/dual_grid/CPoint.cpp | 1 + .../gradients/computeGradientsGreenGauss.hpp | 151 ++++++++++++------ 6 files changed, 122 insertions(+), 54 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index e2fdd39f0f1..640514c0067 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -6396,6 +6396,13 @@ class CConfig { */ bool GetSolid_Wall(unsigned short iMarker) const; + /*! + * \brief Determines whether a marker with index iMarker is an inlet, outlet or far-field. + * \param iMarker + * \return it marker with index iMarker is a solid boundary. + */ + bool Getinoutfar(unsigned short iMarker) const; + /*! * \brief Determines whether a marker with index iMarker is a viscous no-slip boundary. * \param iMarker diff --git a/Common/include/geometry/dual_grid/CPoint.hpp b/Common/include/geometry/dual_grid/CPoint.hpp index a6f0ac73870..55dc1d6f7a1 100644 --- a/Common/include/geometry/dual_grid/CPoint.hpp +++ b/Common/include/geometry/dual_grid/CPoint.hpp @@ -74,6 +74,7 @@ class CPoint { PhysicalBoundary; /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */ su2vector SolidBoundary; /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */ + su2vector inoutfar; su2vector ViscousBoundary; /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */ su2vector @@ -369,7 +370,7 @@ class CPoint { inline bool GetPhysicalBoundary(unsigned long iPoint) const { return PhysicalBoundary(iPoint); } /*! - * \brief Set if a point belong to the boundary. + * \brief Set if a point belong to the solid wall boundary. * \param[in] iPoint - Index of the point. * \param[in] boundary - TRUE if the point belong to the physical boundary; otherwise FALSE. */ @@ -382,6 +383,10 @@ class CPoint { */ inline bool GetSolidBoundary(unsigned long iPoint) const { return SolidBoundary(iPoint); } + // nijso: temporary + inline void Setinoutfar(unsigned long iPoint, bool boundary) { inoutfar(iPoint) = boundary; } + inline bool Getinoutfar(unsigned long iPoint) const { return inoutfar(iPoint); } + /*! * \brief Set if a point belong to the boundary. * \param[in] iPoint - Index of the point. diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 59584271ac5..01ebe366a86 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -7934,6 +7934,14 @@ bool CConfig::GetSolid_Wall(unsigned short iMarker) const { Marker_All_KindBC[iMarker] == EULER_WALL; } +// nijso: temporary +bool CConfig::Getinoutfar(unsigned short iMarker) const { + + return (Marker_All_KindBC[iMarker] == INLET_FLOW || + Marker_All_KindBC[iMarker] == OUTLET_FLOW || + Marker_All_KindBC[iMarker] == FAR_FIELD); +} + void CConfig::SetSurface_Movement(unsigned short iMarker, unsigned short kind_movement) { auto* new_surface_movement = new unsigned short[nMarker_Moving + 1]; diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index c8a37831ef6..2176d175f9b 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -3421,6 +3421,8 @@ void CPhysicalGeometry::SetBoundaries(CConfig* config) { if (config->GetSolid_Wall(iMarker)) nodes->SetSolidBoundary(Point_Surface, true); if (config->GetViscous_Wall(iMarker)) nodes->SetViscousBoundary(Point_Surface, true); + // nijso: temporary + if (config->Getinoutfar(iMarker)) nodes->Setinoutfar(Point_Surface, true); if (config->GetMarker_All_KindBC(iMarker) == PERIODIC_BOUNDARY) nodes->SetPeriodicBoundary(Point_Surface, true); } diff --git a/Common/src/geometry/dual_grid/CPoint.cpp b/Common/src/geometry/dual_grid/CPoint.cpp index e47de05486c..db81b18a365 100644 --- a/Common/src/geometry/dual_grid/CPoint.cpp +++ b/Common/src/geometry/dual_grid/CPoint.cpp @@ -88,6 +88,7 @@ void CPoint::FullAllocation(unsigned short imesh, const CConfig* config) { Domain.resize(npoint) = true; Boundary.resize(npoint) = false; SolidBoundary.resize(npoint) = false; + inoutfar.resize(npoint) = false; // nijso temporary ViscousBoundary.resize(npoint) = false; PhysicalBoundary.resize(npoint) = false; PeriodicBoundary.resize(npoint) = false; diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 1d4401b8e4a..7c6906b4648 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -27,6 +27,9 @@ * License along with SU2. If not, see . */ +#include +#include + #include "../../../Common/include/parallelization/omp_structure.hpp" #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" @@ -64,6 +67,8 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER const auto chunkSize = computeStaticChunkSize(nPointDomain, omp_get_max_threads(), OMP_MAX_CHUNK); #endif + static constexpr size_t MAXNVAR = 20; + /*--- For each (non-halo) volume integrate over its faces (edges). ---*/ SU2_OMP_FOR_DYN(chunkSize) @@ -121,29 +126,29 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER * 2. n.grad(v.t) = 0 * 3. t.grad(v.n) = 0 */ + su2double flux[MAXNVAR] = {0.0}; + su2double fluxReflected[MAXNVAR] = {0.0}; + + // what happens when we have more than 1 symmetry plane? + // store all iPoints on the symmetry to detect points that are shared by more than 1 boundary. + // std::vector symm_iPoints; for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { - SU2_OMP_FOR_STAT(32) for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - - auto nodes = geometry.nodes; - - /*--- Cannot preaccumulate if hybrid parallel due to shared reading. ---*/ - if (omp_get_num_threads() == 1) AD::StartPreacc(); - AD::SetPreaccIn(nodes->GetVolume(iPoint)); - AD::SetPreaccIn(nodes->GetPeriodicVolume(iPoint)); - - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) AD::SetPreaccIn(field(iPoint, iVar)); - /*--- Clear the gradient. --*/ - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) = 0.0; + } - /*--- Handle averaging and division by volume in one constant. ---*/ + for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { + size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); + // symm_iPoints.push_back(iPoint); + auto nodes = geometry.nodes; + + /*--- Handle averaging and division by volume in one constant. ---*/ su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint)); /*--- Add a contribution due to each neighbor. ---*/ @@ -151,12 +156,12 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { size_t iEdge = nodes->GetEdge(iPoint, iNeigh); size_t jPoint = nodes->GetPoint(iPoint, iNeigh); - su2double* icoord=nodes->GetCoord(iPoint); - su2double* jcoord=nodes->GetCoord(jPoint); - su2double Veli[nDim]={0.0}; - for (size_t iDim = 0; iDim < nDim; ++iDim) Veli[iDim] = field(iPoint,iDim+1); - su2double Velj[nDim]={0.0}; - for (size_t iDim = 0; iDim < nDim; ++iDim) Velj[iDim] = field(jPoint,iDim+1); + su2double* icoord = nodes->GetCoord(iPoint); + su2double* jcoord = nodes->GetCoord(jPoint); + su2double Veli[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; ++iDim) Veli[iDim] = field(iPoint, iDim + 1); + su2double Velj[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; ++iDim) Velj[iDim] = field(jPoint, iDim + 1); /*--- Determine if edge points inwards or outwards of iPoint. * If inwards we need to flip the area vector. ---*/ @@ -165,8 +170,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double weight = dir * halfOnVol; const su2double* area = geometry.edges->GetNormal(iEdge); - cout << "area="<GetNormal(); @@ -175,21 +178,15 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double ProjArea = 0.0; const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); - su2double UnitNormal[nDim] ={0.0}; + su2double UnitNormal[nDim] = {0.0}; for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim] * UnitNormal[iDim]; /*--- The mirrored half of the dual cell ---*/ - su2double areaReflected[nDim]={0.0}; + su2double areaReflected[nDim] = {0.0}; for (size_t iDim = 0; iDim < nDim; iDim++) areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; - // note that for the inlet and outlet we also need to reflect. - - su2double *flux = new su2double[varEnd]; - su2double *fluxReflected = new su2double[varEnd]; - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - AD::SetPreaccIn(field(jPoint, iVar)); flux[iVar] = weight * (field(iPoint, iVar) + field(jPoint, iVar)); fluxReflected[iVar] = flux[iVar]; } @@ -201,22 +198,86 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - AD::SetPreaccIn(field(jPoint, iVar)); for (size_t iDim = 0; iDim < nDim; ++iDim) { - gradient(iPoint, iVar, iDim) += 0.5 * (flux[iVar] * area[iDim] + fluxReflected[iVar] * areaReflected[iDim]); + // new reflected boundary + // gradient(iPoint, iVar, iDim) += 0.5 * (flux[iVar] * area[iDim] + fluxReflected[iVar] * + // areaReflected[iDim]); + // original + gradient(iPoint, iVar, iDim) += (flux[iVar] * area[iDim]); } } - delete[] flux; - delete[] fluxReflected; + // gradient(iPoint,0,1)=0.0; //dp/dy + // gradient(iPoint,1,1)=0.0; //du/dy + // gradient(iPoint,2,0)=0.0; //dv/dx + // gradient(iPoint,2,2)=0.0; //dv/dz + // gradient(iPoint,3,1)=0.0; //dw/dy + // /*--- For nodes shared with walls, we can simply add the mirrored contribution. The nonmirrored + // contributions is added + // * in the routine below. ---*/ + // if (nodes->GetSolidBoundary(iPoint)) { + // /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ + // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + // flux[iVar] = 2.0 * halfOnVol * field(iPoint, iVar) ; + // fluxReflected[iVar] = flux[iVar]; + // } + // /*--- project the flux ---*/ + // su2double ProjFlux = 0.0; + // for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + + // for (size_t iDim = 0; iDim < nDim; iDim++) + // fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + + // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + // for (size_t iDim = 0; iDim < nDim; ++iDim) { + // gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; + // } + // } + // } + + // /*--- check if point is on an inlet, outlet or far_field ---*/ + // if (nodes->Getinoutfar(iPoint)) { + // /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ + // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + // flux[iVar] = 2.0 * halfOnVol * field(iPoint, iVar) ; + // fluxReflected[iVar] = flux[iVar]; + // } + // /*--- project the flux ---*/ + // su2double ProjFlux = 0.0; + // for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + + // for (size_t iDim = 0; iDim < nDim; iDim++) + // fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + + // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + // for (size_t iDim = 0; iDim < nDim; ++iDim) { + // gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; + // } + // } + // } } + } - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - for (size_t iDim = 0; iDim < nDim; ++iDim) AD::SetPreaccOut(gradient(iPoint, iVar, iDim)); + } // symmetry plane + } // markers - AD::EndPreacc(); + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { + if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { + size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); + auto nodes = geometry.nodes; + if (!nodes->GetDomain(iPoint)) continue; + su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); + const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); + su2double Veli[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; ++iDim) Veli[iDim] = field(iPoint, iDim + 1); + for (size_t iVar = varBegin; iVar < varEnd; iVar++) { + su2double flux = field(iPoint, iVar) / volume; + // cout << iPoint <<", " << volume <<", " << iVar <<", "<GetNode(); - // auto nodes = geometry.nodes; - // if (!nodes->GetDomain(iPoint)) continue; - // gradient(iPoint, 1, 1) = 0.0; - // gradient(iPoint, 2, 0) = 0.0; - // } - // END_SU2_OMP_FOR - // } - // } - /*--- If no solver was provided we do not communicate ---*/ if (solver == nullptr) return; From 06f94ac4fa30700ca6fe9860b9692439a116f320 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 7 Jan 2024 23:59:53 +0100 Subject: [PATCH 012/194] add symmetry correction for inlet, outlet, and wall --- .../gradients/computeGradientsGreenGauss.hpp | 153 +++++++----------- 1 file changed, 58 insertions(+), 95 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 7c6906b4648..e9a8250ded8 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -129,35 +129,24 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double flux[MAXNVAR] = {0.0}; su2double fluxReflected[MAXNVAR] = {0.0}; - // what happens when we have more than 1 symmetry plane? - // store all iPoints on the symmetry to detect points that are shared by more than 1 boundary. - // std::vector symm_iPoints; - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { - size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - /*--- Clear the gradient. --*/ - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) = 0.0; - } - for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - // symm_iPoints.push_back(iPoint); - auto nodes = geometry.nodes; + // we need to set the gradient to zero for the entire marker to prevent double-counting + // points that are shared by other markers + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) + for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) = 0.0; - /*--- Handle averaging and division by volume in one constant. ---*/ su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint)); - - /*--- Add a contribution due to each neighbor. ---*/ - for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { size_t iEdge = nodes->GetEdge(iPoint, iNeigh); size_t jPoint = nodes->GetPoint(iPoint, iNeigh); su2double* icoord = nodes->GetCoord(iPoint); su2double* jcoord = nodes->GetCoord(jPoint); + su2double Veli[nDim] = {0.0}; for (size_t iDim = 0; iDim < nDim; ++iDim) Veli[iDim] = field(iPoint, iDim + 1); su2double Velj[nDim] = {0.0}; @@ -168,20 +157,17 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; su2double weight = dir * halfOnVol; + const auto area = geometry.edges->GetNormal(iEdge); - const su2double* area = geometry.edges->GetNormal(iEdge); - - /*--- Normal vector for this vertex (negate for outward convention). ---*/ + /*--- Normal vector for this vertex (negate for outward convention). ---*/ const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); // reflected normal V=U - 2U_t - su2double ProjArea = 0.0; - const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); su2double UnitNormal[nDim] = {0.0}; for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; + su2double ProjArea = 0.0; for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim] * UnitNormal[iDim]; - /*--- The mirrored half of the dual cell ---*/ su2double areaReflected[nDim] = {0.0}; for (size_t iDim = 0; iDim < nDim; iDim++) areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; @@ -199,87 +185,64 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { for (size_t iDim = 0; iDim < nDim; ++iDim) { - // new reflected boundary - // gradient(iPoint, iVar, iDim) += 0.5 * (flux[iVar] * area[iDim] + fluxReflected[iVar] * - // areaReflected[iDim]); - // original - gradient(iPoint, iVar, iDim) += (flux[iVar] * area[iDim]); + gradient(iPoint, iVar, iDim) += 0.5 * (flux[iVar] * area[iDim] + fluxReflected[iVar] * + areaReflected[iDim]); + } } - // gradient(iPoint,0,1)=0.0; //dp/dy - // gradient(iPoint,1,1)=0.0; //du/dy - // gradient(iPoint,2,0)=0.0; //dv/dx - // gradient(iPoint,2,2)=0.0; //dv/dz - // gradient(iPoint,3,1)=0.0; //dw/dy - // /*--- For nodes shared with walls, we can simply add the mirrored contribution. The nonmirrored + /*--- For nodes shared with walls, we can simply add the mirrored contribution. The nonmirrored // contributions is added // * in the routine below. ---*/ - // if (nodes->GetSolidBoundary(iPoint)) { - // /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ - // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // flux[iVar] = 2.0 * halfOnVol * field(iPoint, iVar) ; - // fluxReflected[iVar] = flux[iVar]; - // } - // /*--- project the flux ---*/ - // su2double ProjFlux = 0.0; - // for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - - // for (size_t iDim = 0; iDim < nDim; iDim++) - // fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; - - // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // for (size_t iDim = 0; iDim < nDim; ++iDim) { - // gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; - // } - // } - // } - - // /*--- check if point is on an inlet, outlet or far_field ---*/ - // if (nodes->Getinoutfar(iPoint)) { - // /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ - // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // flux[iVar] = 2.0 * halfOnVol * field(iPoint, iVar) ; - // fluxReflected[iVar] = flux[iVar]; - // } - // /*--- project the flux ---*/ - // su2double ProjFlux = 0.0; - // for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - - // for (size_t iDim = 0; iDim < nDim; iDim++) - // fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; - - // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // for (size_t iDim = 0; iDim < nDim; ++iDim) { - // gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; - // } - // } - // } - } - } + if (nodes->GetSolidBoundary(iPoint)) { + su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); + /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + flux[iVar] = field(iPoint, iVar) / volume; + fluxReflected[iVar] = flux[iVar]; + } + /*--- project the flux ---*/ + su2double ProjFlux = 0.0; + for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + + for (size_t iDim = 0; iDim < nDim; iDim++) + fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + for (size_t iDim = 0; iDim < nDim; ++iDim) { + gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; + } + } + } - } // symmetry plane - } // markers + /*--- check if point is shared with an inlet, outlet or far_field ---*/ + if (nodes->Getinoutfar(iPoint)) { + su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); + /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + flux[iVar] = field(iPoint, iVar) / volume; // this one is done in the routine below for the other markers + fluxReflected[iVar] = flux[iVar]; + } + /*--- project the flux ---*/ + su2double ProjFlux = 0.0; + for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + + for (size_t iDim = 0; iDim < nDim; iDim++) + fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + for (size_t iDim = 0; iDim < nDim; ++iDim) { + gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; + } + } + } - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { - if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { - for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { - size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - auto nodes = geometry.nodes; - if (!nodes->GetDomain(iPoint)) continue; - su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); - su2double Veli[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; ++iDim) Veli[iDim] = field(iPoint, iDim + 1); - for (size_t iVar = varBegin; iVar < varEnd; iVar++) { - su2double flux = field(iPoint, iVar) / volume; - // cout << iPoint <<", " << volume <<", " << iVar <<", "< Date: Mon, 8 Jan 2024 00:02:15 +0100 Subject: [PATCH 013/194] code alignment --- .../gradients/computeGradientsGreenGauss.hpp | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index e9a8250ded8..90b617d479c 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -192,50 +192,50 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } /*--- For nodes shared with walls, we can simply add the mirrored contribution. The nonmirrored - // contributions is added - // * in the routine below. ---*/ - if (nodes->GetSolidBoundary(iPoint)) { - su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - flux[iVar] = field(iPoint, iVar) / volume; - fluxReflected[iVar] = flux[iVar]; - } - /*--- project the flux ---*/ - su2double ProjFlux = 0.0; - for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + * contributions is added + * in the routine below. ---*/ + if (nodes->GetSolidBoundary(iPoint)) { + su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); + /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + flux[iVar] = field(iPoint, iVar) / volume; + fluxReflected[iVar] = flux[iVar]; + } + /*--- project the flux ---*/ + su2double ProjFlux = 0.0; + for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - for (size_t iDim = 0; iDim < nDim; iDim++) - fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + for (size_t iDim = 0; iDim < nDim; iDim++) + fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - for (size_t iDim = 0; iDim < nDim; ++iDim) { - gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; - } + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + for (size_t iDim = 0; iDim < nDim; ++iDim) { + gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; } } + } /*--- check if point is shared with an inlet, outlet or far_field ---*/ - if (nodes->Getinoutfar(iPoint)) { - su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - flux[iVar] = field(iPoint, iVar) / volume; // this one is done in the routine below for the other markers - fluxReflected[iVar] = flux[iVar]; - } - /*--- project the flux ---*/ - su2double ProjFlux = 0.0; - for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + if (nodes->Getinoutfar(iPoint)) { + su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); + /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + flux[iVar] = field(iPoint, iVar) / volume; + fluxReflected[iVar] = flux[iVar]; + } + /*--- project the flux ---*/ + su2double ProjFlux = 0.0; + for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - for (size_t iDim = 0; iDim < nDim; iDim++) - fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + for (size_t iDim = 0; iDim < nDim; iDim++) + fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - for (size_t iDim = 0; iDim < nDim; ++iDim) { - gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; - } + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + for (size_t iDim = 0; iDim < nDim; ++iDim) { + gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; } } + } } From 7387f8c22aaa1f810ce0c8c53fc94a9f830773aa Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 8 Jan 2024 23:16:26 +0100 Subject: [PATCH 014/194] corrected GG gradient computation on shared nodes --- Common/include/CConfig.hpp | 7 + Common/include/geometry/dual_grid/CPoint.hpp | 3 + Common/src/CConfig.cpp | 8 +- Common/src/geometry/CPhysicalGeometry.cpp | 8 +- Common/src/geometry/dual_grid/CPoint.cpp | 1 + .../gradients/computeGradientsGreenGauss.hpp | 244 +++++++++++++----- 6 files changed, 206 insertions(+), 65 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 640514c0067..10a714b9523 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -6403,6 +6403,13 @@ class CConfig { */ bool Getinoutfar(unsigned short iMarker) const; + /*! + * \brief Determines whether a marker with index iMarker is a symmetry. + * \param iMarker + * \return it marker with index iMarker is a solid boundary. + */ + bool GetSymmetry(unsigned short iMarker) const; + /*! * \brief Determines whether a marker with index iMarker is a viscous no-slip boundary. * \param iMarker diff --git a/Common/include/geometry/dual_grid/CPoint.hpp b/Common/include/geometry/dual_grid/CPoint.hpp index 55dc1d6f7a1..2c3d3f38a78 100644 --- a/Common/include/geometry/dual_grid/CPoint.hpp +++ b/Common/include/geometry/dual_grid/CPoint.hpp @@ -75,6 +75,7 @@ class CPoint { su2vector SolidBoundary; /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */ su2vector inoutfar; + su2vector Symmetry; su2vector ViscousBoundary; /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */ su2vector @@ -385,7 +386,9 @@ class CPoint { // nijso: temporary inline void Setinoutfar(unsigned long iPoint, bool boundary) { inoutfar(iPoint) = boundary; } + inline void SetSymmetry(unsigned long iPoint, bool boundary) { Symmetry(iPoint) = boundary; } inline bool Getinoutfar(unsigned long iPoint) const { return inoutfar(iPoint); } + inline bool GetSymmetry(unsigned long iPoint) const { return Symmetry(iPoint); } /*! * \brief Set if a point belong to the boundary. diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 01ebe366a86..36810830443 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -7936,10 +7936,10 @@ bool CConfig::GetSolid_Wall(unsigned short iMarker) const { // nijso: temporary bool CConfig::Getinoutfar(unsigned short iMarker) const { - - return (Marker_All_KindBC[iMarker] == INLET_FLOW || - Marker_All_KindBC[iMarker] == OUTLET_FLOW || - Marker_All_KindBC[iMarker] == FAR_FIELD); + return (Marker_All_KindBC[iMarker] == INLET_FLOW || Marker_All_KindBC[iMarker] == OUTLET_FLOW); +} +bool CConfig::GetSymmetry(unsigned short iMarker) const { + return (Marker_All_KindBC[iMarker] == SYMMETRY_PLANE); } void CConfig::SetSurface_Movement(unsigned short iMarker, unsigned short kind_movement) { diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 2176d175f9b..6aa120fb2c2 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -3422,7 +3422,10 @@ void CPhysicalGeometry::SetBoundaries(CConfig* config) { if (config->GetViscous_Wall(iMarker)) nodes->SetViscousBoundary(Point_Surface, true); // nijso: temporary - if (config->Getinoutfar(iMarker)) nodes->Setinoutfar(Point_Surface, true); + // cout << "nijso: setting inoutfar for ipoint "<GetMarker_All_KindBC(iMarker) << endl; if (config->Getinoutfar(iMarker)) {cout << "inoutfar + // found."<Setinoutfar(Point_Surface, true);} if (config->GetSymmetry(iMarker)) {cout << "symmetry + // found"<SetSymmetry(Point_Surface, true);} if (config->GetMarker_All_KindBC(iMarker) == PERIODIC_BOUNDARY) nodes->SetPeriodicBoundary(Point_Surface, true); } @@ -4601,6 +4604,9 @@ void CPhysicalGeometry::SetRCM_Ordering(CConfig* config) { if (config->GetSolid_Wall(iMarker)) nodes->SetSolidBoundary(InvResult[iPoint], true); if (config->GetViscous_Wall(iMarker)) nodes->SetViscousBoundary(InvResult[iPoint], true); + // nijso: temporary + if (config->Getinoutfar(iMarker)) nodes->Setinoutfar(InvResult[iPoint], true); + if (config->GetSymmetry(iMarker)) nodes->SetSymmetry(InvResult[iPoint], true); if (config->GetMarker_All_KindBC(iMarker) == PERIODIC_BOUNDARY) nodes->SetPeriodicBoundary(InvResult[iPoint], true); diff --git a/Common/src/geometry/dual_grid/CPoint.cpp b/Common/src/geometry/dual_grid/CPoint.cpp index db81b18a365..2b8a908b177 100644 --- a/Common/src/geometry/dual_grid/CPoint.cpp +++ b/Common/src/geometry/dual_grid/CPoint.cpp @@ -89,6 +89,7 @@ void CPoint::FullAllocation(unsigned short imesh, const CConfig* config) { Boundary.resize(npoint) = false; SolidBoundary.resize(npoint) = false; inoutfar.resize(npoint) = false; // nijso temporary + Symmetry.resize(npoint) = false; // nijso temporary ViscousBoundary.resize(npoint) = false; PhysicalBoundary.resize(npoint) = false; PeriodicBoundary.resize(npoint) = false; diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 90b617d479c..987041db079 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -35,6 +35,22 @@ namespace detail { +// find local vertex on a symmetry marker using global iPoint +inline su2double* getVertexNormalfromPoint(const CConfig& config, CGeometry& geometry, unsigned long iPointGlobal){ + unsigned long iPointSym=0; + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { + if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { + iPointSym = geometry.vertex[iMarker][iVertex]->GetNode(); + if (iPointSym == iPointGlobal) + return geometry.vertex[iMarker][iVertex]->GetNormal(); + } + } + } + cout << "point is not found " << endl; + exit(0); +} + /*! * \brief Compute the gradient of a field using the Green-Gauss theorem. * \ingroup FvmAlgos @@ -144,13 +160,13 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { size_t iEdge = nodes->GetEdge(iPoint, iNeigh); size_t jPoint = nodes->GetPoint(iPoint, iNeigh); - su2double* icoord = nodes->GetCoord(iPoint); - su2double* jcoord = nodes->GetCoord(jPoint); + su2double* icoord = nodes->GetCoord(iPoint); // nijso: debugging + su2double* jcoord = nodes->GetCoord(jPoint); // nijso: debugging - su2double Veli[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; ++iDim) Veli[iDim] = field(iPoint, iDim + 1); - su2double Velj[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; ++iDim) Velj[iDim] = field(jPoint, iDim + 1); + //su2double Veli[nDim] = {0.0}; + //for (size_t iDim = 0; iDim < nDim; ++iDim) Veli[iDim] = field(iPoint, iDim + 1); + //su2double Velj[nDim] = {0.0}; + //for (size_t iDim = 0; iDim < nDim; ++iDim) Velj[iDim] = field(jPoint, iDim + 1); /*--- Determine if edge points inwards or outwards of iPoint. * If inwards we need to flip the area vector. ---*/ @@ -191,53 +207,88 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } - /*--- For nodes shared with walls, we can simply add the mirrored contribution. The nonmirrored - * contributions is added - * in the routine below. ---*/ - if (nodes->GetSolidBoundary(iPoint)) { - su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - flux[iVar] = field(iPoint, iVar) / volume; - fluxReflected[iVar] = flux[iVar]; - } - /*--- project the flux ---*/ - su2double ProjFlux = 0.0; - for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - - for (size_t iDim = 0; iDim < nDim; iDim++) - fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; - - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - for (size_t iDim = 0; iDim < nDim; ++iDim) { - gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; - } - } - } - - /*--- check if point is shared with an inlet, outlet or far_field ---*/ - if (nodes->Getinoutfar(iPoint)) { - su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - flux[iVar] = field(iPoint, iVar) / volume; - fluxReflected[iVar] = flux[iVar]; - } - /*--- project the flux ---*/ - su2double ProjFlux = 0.0; - for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - - for (size_t iDim = 0; iDim < nDim; iDim++) - fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + } // loop over the edges + + // /*--- For nodes shared with walls, we can simply add the mirrored contribution. The nonmirrored + // * contributions is added + // * in the routine below. ---*/ + // if (nodes->GetSolidBoundary(iPoint)) { + // cout << "point shared by symmetry and wall" << endl; + // su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); + // const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); + // const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); + // const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); + // su2double UnitNormal[nDim] = {0.0}; + // for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; + // su2double ProjArea = 0.0; + // for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim] * UnitNormal[iDim]; + // su2double areaReflected[nDim] = {0.0}; + // for (size_t iDim = 0; iDim < nDim; iDim++) + // areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; + + // /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ + // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + // flux[iVar] = field(iPoint, iVar) / volume; + // fluxReflected[iVar] = flux[iVar]; + // } + // /*--- project the flux ---*/ + // su2double ProjFlux = 0.0; + // for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + + // for (size_t iDim = 0; iDim < nDim; iDim++) + // fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + + // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + // for (size_t iDim = 0; iDim < nDim; ++iDim) { + // gradient(iPoint, iVar, iDim) -= 0.5*fluxReflected[iVar] * areaReflected[iDim]; + // gradient(iPoint, iVar, iDim) += 0.5*flux[iVar] * area[iDim]; + // } + // } + // } + + // // // /*--- check if point is shared with an inlet, outlet or far_field ---*/ + // if (nodes->Getinoutfar(iPoint)) { + // cout << "point = " << iPoint << endl; + // su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); + // const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); + // const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); + // const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); + // su2double UnitNormal[nDim] = {0.0}; + // for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; + // su2double ProjArea = 0.0; + // for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim] * UnitNormal[iDim]; + // su2double areaReflected[nDim] = {0.0}; + // for (size_t iDim = 0; iDim < nDim; iDim++) + // areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; + + // /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ + // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + // // note that we have 2x the regular volume + // // we use 1x the regular volume in the other routine so we have + // // (1/2)*(1/Volume) * (F*a + Fr*ar) = (1/2)*(1/Volume)*(Fr*ar) + 1/volume*(F*a) - (1/2)* + // flux[iVar] = field(iPoint, iVar) / volume; + // fluxReflected[iVar] = flux[iVar]; + // } + // /*--- project the flux ---*/ + // su2double ProjFlux = 0.0; + // for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + + // for (size_t iDim = 0; iDim < nDim; iDim++) + // fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + + // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + // for (size_t iDim = 0; iDim < nDim; ++iDim) { + // cout << "before: " << iPoint << ", " << iVar << ", " << iDim << ", " << gradient(iPoint,iVar,iDim) + // << ", delta_L: " << flux[iVar] <<", "<< area[iDim] + // << ", delta_R: " << fluxReflected[iVar] <<", "<< areaReflected[iDim] + // << ", " << gradient(iPoint,iVar,iDim) - fluxReflected[iVar] * areaReflected[iDim] << endl; + // gradient(iPoint, iVar, iDim) -= 0.5*fluxReflected[iVar] * areaReflected[iDim]; + // // below we subtract 1/V, but we need only 0.5/V, so we add 0.5*V here + // gradient(iPoint, iVar, iDim) += 0.5*flux[iVar] * area[iDim]; + // } + // } + // } - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - for (size_t iDim = 0; iDim < nDim; ++iDim) { - gradient(iPoint, iVar, iDim) -= fluxReflected[iVar] * areaReflected[iDim]; - } - } - } - - } } //ivertex } //symmetry @@ -262,18 +313,89 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER if (!nodes->GetDomain(iPoint)) continue; su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); + for (size_t iVar = varBegin; iVar < varEnd; iVar++) + flux[iVar] = field(iPoint,iVar) / volume; + + // When the node is shared with a symmetry we need to mirror the contribution of + // the face that is coincident with the inlet/outlet + if (nodes->GetSymmetry(iPoint) && nodes->Getinoutfar(iPoint)) { + cout << "iPoint " + << iPoint + << " is on a symmetry plane and an inlet/outlet" + << nodes->GetSymmetry(iPoint) + << ", " + << nodes->Getinoutfar(iPoint)<< endl; + + // we have to find the edges that were missing in the symmetry computations. + // So we find the jPoints that are on the inlet plane + // so we loop over all neighbor of iPoint, find all jPoints and then check if it is on the inlet + for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { + size_t iEdge = nodes->GetEdge(iPoint, iNeigh); + size_t jPoint = nodes->GetPoint(iPoint, iNeigh); + if (nodes->Getinoutfar(jPoint)) { + cout << " jPoint " << jPoint << " is on the inlet plane" << endl; + // this edge jPoint - jPoint is the missing edge for the symmetry computations + //compute the flux on the face between iPoint and jPoint + //for (size_t iVar = varBegin; iVar < varEnd; iVar++) { + // flux[iVar] = 0.5*(field(iPoint,iVar) + field(jPoint, iVar)) / (2.0*volume); + } + if (nodes->GetSymmetry(jPoint)) { + cout << " jPoint " << jPoint << " is on the symmetry plane" << endl; + // this edge iPoint - jPoint is the missing edge for the symmetry computations + // we now need to get the normal of the symmetry plane at jpoint. + // so we loop over the markers, find all symmetry planes, check if the ipoint is on the plane + const su2double* VertexNormal = getVertexNormalfromPoint(config, geometry,jPoint); + cout << " vertex normal = " << VertexNormal[0] <<", " << VertexNormal[1] << endl; + // get the normal on the vertex + + // now reflect in the mirror + // reflected normal V=U - 2U_t + const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); + su2double UnitNormal[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = VertexNormal[iDim] / NormArea; + su2double ProjArea = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + ProjArea += area[iDim] * UnitNormal[iDim]; + su2double areaReflected[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; iDim++) + areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; + + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + flux[iVar] = 0.5 * (field(iPoint, iVar) + field(jPoint, iVar)) / (2.0*volume); + fluxReflected[iVar] = flux[iVar]; + } - for (size_t iVar = varBegin; iVar < varEnd; iVar++) { - su2double flux = field(iPoint, iVar) / volume; + su2double ProjFlux = 0.0; + for (size_t iDim = 0; iDim < nDim; iDim++) + ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - for (size_t iDim = 0; iDim < nDim; iDim++) gradient(iPoint, iVar, iDim) -= flux * area[iDim]; - } - } + for (size_t iDim = 0; iDim < nDim; iDim++) + fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + for (size_t iDim = 0; iDim < nDim; ++iDim) { + gradient(iPoint, iVar, iDim) += 0.5 * (flux[iVar] * area[iDim] + fluxReflected[iVar] * + areaReflected[iDim]); + } + } + + } // if symmetry + } //neighbors + + } else { + // if we are on a marker but not on a share point between a symmetry and an inlet/outlet + for (size_t iVar = varBegin; iVar < varEnd; iVar++) { + for (size_t iDim = 0; iDim < nDim; iDim++) { + gradient(iPoint, iVar, iDim) -= flux[iVar] * area[iDim]; + } + } // loop over variables + } // symmetry and in/out shared node + } // vertices END_SU2_OMP_FOR - } - } + } //found right marker + } // iMarkers /*--- If no solver was provided we do not communicate ---*/ @@ -293,6 +415,8 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } // namespace detail + + /*! * \brief Instantiations for 2D and 3D. * \ingroup FvmAlgos From aa4dd00b14bd504768716336ed22f3a50e6a5653 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 9 Jan 2024 10:01:17 +0100 Subject: [PATCH 015/194] GG shared nodes mirror --- .../gradients/computeGradientsGreenGauss.hpp | 108 +++++++++--------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 987041db079..106cc19f3cb 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -188,10 +188,8 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iDim = 0; iDim < nDim; iDim++) areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) flux[iVar] = weight * (field(iPoint, iVar) + field(jPoint, iVar)); - fluxReflected[iVar] = flux[iVar]; - } su2double ProjFlux = 0.0; for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; @@ -314,8 +312,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); - for (size_t iVar = varBegin; iVar < varEnd; iVar++) - flux[iVar] = field(iPoint,iVar) / volume; // When the node is shared with a symmetry we need to mirror the contribution of // the face that is coincident with the inlet/outlet @@ -330,61 +326,67 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER // we have to find the edges that were missing in the symmetry computations. // So we find the jPoints that are on the inlet plane // so we loop over all neighbor of iPoint, find all jPoints and then check if it is on the inlet + unsigned long jPoint = 0; for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { size_t iEdge = nodes->GetEdge(iPoint, iNeigh); - size_t jPoint = nodes->GetPoint(iPoint, iNeigh); + jPoint = nodes->GetPoint(iPoint, iNeigh); if (nodes->Getinoutfar(jPoint)) { cout << " jPoint " << jPoint << " is on the inlet plane" << endl; - // this edge jPoint - jPoint is the missing edge for the symmetry computations - //compute the flux on the face between iPoint and jPoint - //for (size_t iVar = varBegin; iVar < varEnd; iVar++) { - // flux[iVar] = 0.5*(field(iPoint,iVar) + field(jPoint, iVar)) / (2.0*volume); + break; } - if (nodes->GetSymmetry(jPoint)) { - cout << " jPoint " << jPoint << " is on the symmetry plane" << endl; - // this edge iPoint - jPoint is the missing edge for the symmetry computations - // we now need to get the normal of the symmetry plane at jpoint. - // so we loop over the markers, find all symmetry planes, check if the ipoint is on the plane - const su2double* VertexNormal = getVertexNormalfromPoint(config, geometry,jPoint); - cout << " vertex normal = " << VertexNormal[0] <<", " << VertexNormal[1] << endl; - // get the normal on the vertex - - // now reflect in the mirror - // reflected normal V=U - 2U_t - const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); - su2double UnitNormal[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; iDim++) - UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - su2double ProjArea = 0.0; - for (unsigned long iDim = 0; iDim < nDim; iDim++) - ProjArea += area[iDim] * UnitNormal[iDim]; - su2double areaReflected[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; iDim++) - areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; - - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - flux[iVar] = 0.5 * (field(iPoint, iVar) + field(jPoint, iVar)) / (2.0*volume); - fluxReflected[iVar] = flux[iVar]; - } - - su2double ProjFlux = 0.0; - for (size_t iDim = 0; iDim < nDim; iDim++) - ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - - for (size_t iDim = 0; iDim < nDim; iDim++) - fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; - - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - for (size_t iDim = 0; iDim < nDim; ++iDim) { - gradient(iPoint, iVar, iDim) += 0.5 * (flux[iVar] * area[iDim] + fluxReflected[iVar] * - areaReflected[iDim]); - } - } - - } // if symmetry - } //neighbors + } + // this edge jPoint - jPoint is the missing edge for the symmetry computations + //compute the flux on the face between iPoint and jPoint + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) + flux[iVar] = 0.5 * (field(iPoint, iVar) + field(jPoint, iVar)) / (2.0*volume); + + + //for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { + // size_t iEdge = nodes->GetEdge(iPoint, iNeigh); + // size_t jPoint = nodes->GetPoint(iPoint, iNeigh); + // if (nodes->GetSymmetry(jPoint)) { + //cout << " jPoint " << jPoint << " is on the symmetry plane" << endl; + // we now need the normal of the symmetry plane at iPoint + + const su2double* VertexNormal = getVertexNormalfromPoint(config, geometry,iPoint); + cout << " vertex normal = " << VertexNormal[0] <<", " << VertexNormal[1] << endl; + // get the normal on the vertex + + // now reflect in the mirror + // reflected normal V=U - 2U_t + const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); + su2double UnitNormal[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = VertexNormal[iDim] / NormArea; + + su2double ProjArea = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + ProjArea += area[iDim] * UnitNormal[iDim]; + + su2double areaReflected[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; iDim++) + areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; + + su2double ProjFlux = 0.0; + for (size_t iDim = 0; iDim < nDim; iDim++) + ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + + for (size_t iDim = 0; iDim < nDim; iDim++) + fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + for (size_t iDim = 0; iDim < nDim; ++iDim) { + gradient(iPoint, iVar, iDim) += 0.5 * (flux[iVar] * area[iDim] + fluxReflected[iVar] * + areaReflected[iDim]); + } + } + + // } // if symmetry + //} //neighbors } else { + for (size_t iVar = varBegin; iVar < varEnd; iVar++) + flux[iVar] = field(iPoint,iVar) / volume; // if we are on a marker but not on a share point between a symmetry and an inlet/outlet for (size_t iVar = varBegin; iVar < varEnd; iVar++) { for (size_t iDim = 0; iDim < nDim; iDim++) { From a3e7221710550ba8e48e359d242c8a59a6f86247 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 10 Jan 2024 08:16:39 +0100 Subject: [PATCH 016/194] GG corner gradients --- .../gradients/computeGradientsGreenGauss.hpp | 146 ++++++------------ 1 file changed, 43 insertions(+), 103 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 106cc19f3cb..e8f90d76937 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -150,6 +150,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); + cout << "iPoint = " << iPoint << endl; auto nodes = geometry.nodes; // we need to set the gradient to zero for the entire marker to prevent double-counting // points that are shared by other markers @@ -158,15 +159,18 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint)); for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { + cout << " edge = "<GetnPoint(iPoint) << endl; size_t iEdge = nodes->GetEdge(iPoint, iNeigh); + cout <<"edge " << iEdge << endl; size_t jPoint = nodes->GetPoint(iPoint, iNeigh); su2double* icoord = nodes->GetCoord(iPoint); // nijso: debugging su2double* jcoord = nodes->GetCoord(jPoint); // nijso: debugging + cout << " jPoint="<GetSolidBoundary(iPoint)) { - // cout << "point shared by symmetry and wall" << endl; - // su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - // const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); - // const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); - // const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); - // su2double UnitNormal[nDim] = {0.0}; - // for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - // su2double ProjArea = 0.0; - // for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim] * UnitNormal[iDim]; - // su2double areaReflected[nDim] = {0.0}; - // for (size_t iDim = 0; iDim < nDim; iDim++) - // areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; - - // /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ - // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // flux[iVar] = field(iPoint, iVar) / volume; - // fluxReflected[iVar] = flux[iVar]; - // } - // /*--- project the flux ---*/ - // su2double ProjFlux = 0.0; - // for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - - // for (size_t iDim = 0; iDim < nDim; iDim++) - // fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; - - // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // for (size_t iDim = 0; iDim < nDim; ++iDim) { - // gradient(iPoint, iVar, iDim) -= 0.5*fluxReflected[iVar] * areaReflected[iDim]; - // gradient(iPoint, iVar, iDim) += 0.5*flux[iVar] * area[iDim]; - // } - // } - // } - - // // // /*--- check if point is shared with an inlet, outlet or far_field ---*/ - // if (nodes->Getinoutfar(iPoint)) { - // cout << "point = " << iPoint << endl; - // su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - // const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); - // const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); - // const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); - // su2double UnitNormal[nDim] = {0.0}; - // for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - // su2double ProjArea = 0.0; - // for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim] * UnitNormal[iDim]; - // su2double areaReflected[nDim] = {0.0}; - // for (size_t iDim = 0; iDim < nDim; iDim++) - // areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; - - // /*--- First, use the values at node i only (better to use entire face but we do not have it) ---*/ - // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // // note that we have 2x the regular volume - // // we use 1x the regular volume in the other routine so we have - // // (1/2)*(1/Volume) * (F*a + Fr*ar) = (1/2)*(1/Volume)*(Fr*ar) + 1/volume*(F*a) - (1/2)* - // flux[iVar] = field(iPoint, iVar) / volume; - // fluxReflected[iVar] = flux[iVar]; - // } - // /*--- project the flux ---*/ - // su2double ProjFlux = 0.0; - // for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - - // for (size_t iDim = 0; iDim < nDim; iDim++) - // fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; - - // for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // for (size_t iDim = 0; iDim < nDim; ++iDim) { - // cout << "before: " << iPoint << ", " << iVar << ", " << iDim << ", " << gradient(iPoint,iVar,iDim) - // << ", delta_L: " << flux[iVar] <<", "<< area[iDim] - // << ", delta_R: " << fluxReflected[iVar] <<", "<< areaReflected[iDim] - // << ", " << gradient(iPoint,iVar,iDim) - fluxReflected[iVar] * areaReflected[iDim] << endl; - // gradient(iPoint, iVar, iDim) -= 0.5*fluxReflected[iVar] * areaReflected[iDim]; - // // below we subtract 1/V, but we need only 0.5/V, so we add 0.5*V here - // gradient(iPoint, iVar, iDim) += 0.5*flux[iVar] * area[iDim]; - // } - // } - // } - - } //ivertex } //symmetry } //loop over markers @@ -313,6 +239,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); + // When the node is shared with a symmetry we need to mirror the contribution of // the face that is coincident with the inlet/outlet if (nodes->GetSymmetry(iPoint) && nodes->Getinoutfar(iPoint)) { @@ -323,6 +250,8 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER << ", " << nodes->Getinoutfar(iPoint)<< endl; + cout << " face area = " << area[0] <<", " << area[1] << endl; + // we have to find the edges that were missing in the symmetry computations. // So we find the jPoints that are on the inlet plane // so we loop over all neighbor of iPoint, find all jPoints and then check if it is on the inlet @@ -335,19 +264,22 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER break; } } + + su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; + su2double weight = dir / (2.0*volume); + // this edge jPoint - jPoint is the missing edge for the symmetry computations //compute the flux on the face between iPoint and jPoint - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - flux[iVar] = 0.5 * (field(iPoint, iVar) + field(jPoint, iVar)) / (2.0*volume); - + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + // average of i and j at the midway point + flux[iVar] = weight * 0.5 * (field(iPoint, iVar) + field(jPoint, iVar)); + //flux[iVar] = field(iPoint,iVar) / volume; + fluxReflected[iVar] = flux[iVar]; + cout << "flux ("<GetnPoint(iPoint); ++iNeigh) { - // size_t iEdge = nodes->GetEdge(iPoint, iNeigh); - // size_t jPoint = nodes->GetPoint(iPoint, iNeigh); - // if (nodes->GetSymmetry(jPoint)) { - //cout << " jPoint " << jPoint << " is on the symmetry plane" << endl; - // we now need the normal of the symmetry plane at iPoint + // find the point iPoint on the symmetry plane and get the vertex normal at ipoint wrt the symmetry plane const su2double* VertexNormal = getVertexNormalfromPoint(config, geometry,iPoint); cout << " vertex normal = " << VertexNormal[0] <<", " << VertexNormal[1] << endl; // get the normal on the vertex @@ -358,6 +290,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double UnitNormal[nDim] = {0.0}; for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; + cout << " vertex unit normal = " << UnitNormal[0] <<", " << UnitNormal[1] << endl; su2double ProjArea = 0.0; for (unsigned long iDim = 0; iDim < nDim; iDim++) @@ -367,33 +300,40 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iDim = 0; iDim < nDim; iDim++) areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; + // velocity components of the flux su2double ProjFlux = 0.0; for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - - for (size_t iDim = 0; iDim < nDim; iDim++) + // velocity components of the flux + for (size_t iDim = 0; iDim < nDim; iDim++) { fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + } + + + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + cout << "fluxReflected ("< Date: Wed, 10 Jan 2024 20:44:20 +0100 Subject: [PATCH 017/194] fixes to face normal correction on symmetry --- Common/src/geometry/CPhysicalGeometry.cpp | 106 +++-- .../gradients/computeGradientsGreenGauss.hpp | 14 +- .../include/solvers/CFVMFlowSolverBase.inl | 434 +++++++++--------- SU2_CFD/src/numerics/flow/convection/fds.cpp | 2 +- SU2_CFD/src/numerics/flow/convection/roe.cpp | 3 +- 5 files changed, 282 insertions(+), 277 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 6aa120fb2c2..8b3add85c3e 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7282,60 +7282,58 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh * of the control volume, which touch the boundary. The * modification consists of removing all components of the face vector, which are normal * to the symmetry plane. ---*/ - // SU2_OMP_FOR_DYN(1) - // for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { - // if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { - // for (unsigned long iElem = 0; iElem < nElem_Bound[iMarker]; iElem++) { - - // const auto nNodes = bound[iMarker][iElem]->GetnNodes(); - // for (unsigned short iNode = 0; iNode < nNodes; iNode++) { - - // const auto iPoint = bound[iMarker][iElem]->GetNode(iNode); - // const auto iVertex = nodes->GetVertex(iPoint, iMarker); - - // const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); - // su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); - // su2double UnitNormal_Sym[MAXNDIM] = {0.0}; - - // for(unsigned short iDim = 0; iDimGetnNeighbor_Nodes(iNode); ++iNeigh){ - // su2double Product = 0.0; - // unsigned long jPoint = nodes->GetPoint(iPoint,iNeigh); - // /*---Check if neighbour point is on the same plane as the symmetry plane - // by computing the internal product and of the Normal Vertex vector and - // the vector connecting iPoint and jPoint. If the product is lower than - // estabilished tolerance (to account for Numerical errors) both points are - // in the same plane as SYMMETRY_PLANE---*/ - // su2double Tangent[MAXNDIM]={0.0}; - // for(unsigned short iDim = 0; iDimGetCoord(jPoint,iDim) - nodes->GetCoord(iPoint,iDim); - // Product += Tangent[iDim] * Normal_Sym[iDim]; - // } - - // if (abs(Product) < EPS) { - // Product = 0.0; - - // unsigned long iEdge = nodes->GetEdge(iPoint,iNeigh); - // su2double Normal[MAXNDIM] = {0.0}; - // edges->GetNormal(iEdge,Normal); - - // for(unsigned short iDim = 0; iDimSetNormal(iEdge,Normal); - // } - // } - // } - // } // loop over elements - // } // if symmetry - // } // loop over markers - // END_SU2_OMP_FOR + SU2_OMP_FOR_DYN(1) + for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { + cout << "loop over markers" << endl; + if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { + + const auto iPoint = vertex[iMarker][iVertex]->GetNode(); + + const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); + + su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); + su2double UnitNormal_Sym[MAXNDIM] = {0.0}; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormal_Sym[iDim] = Normal_Sym[iDim]/Area; + } + + for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh){ + su2double Product = 0.0; + unsigned long jPoint = nodes->GetPoint(iPoint,iNeigh); + /*---Check if neighbour point is on the same plane as the symmetry plane + by computing the internal product of the Normal Vertex vector and + the vector connecting iPoint and jPoint. If the product is lower than + estabilished tolerance (to account for Numerical errors) both points are + in the same plane as SYMMETRY_PLANE---*/ + su2double Tangent[MAXNDIM]={0.0}; + for(unsigned short iDim = 0; iDimGetCoord(jPoint,iDim) - nodes->GetCoord(iPoint,iDim); + Product += Tangent[iDim] * Normal_Sym[iDim]; + } + + if (abs(Product) < 1.0e-8) { + cout << "iPoint " << iPoint << " and jPoint " << jPoint << " are in the symmetry plane " << endl; + Product = 0.0; + + unsigned long iEdge = nodes->GetEdge(iPoint,iNeigh); + su2double Normal[MAXNDIM] = {0.0}; + edges->GetNormal(iEdge,Normal); + cout << "normal="<SetNormal(iEdge,Normal); + } // if in-plane of symmetry + } // loop over neighbors + } // loop over vertices + } // if symmetry + } // loop over markers + END_SU2_OMP_FOR } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index e8f90d76937..ad6f8ac4f6c 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -224,6 +224,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER (config.GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && (config.GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && (config.GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { + /*--- Work is shared in inner loop as two markers * may try to update the same point. ---*/ @@ -239,18 +240,9 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); - // When the node is shared with a symmetry we need to mirror the contribution of // the face that is coincident with the inlet/outlet if (nodes->GetSymmetry(iPoint) && nodes->Getinoutfar(iPoint)) { - cout << "iPoint " - << iPoint - << " is on a symmetry plane and an inlet/outlet" - << nodes->GetSymmetry(iPoint) - << ", " - << nodes->Getinoutfar(iPoint)<< endl; - - cout << " face area = " << area[0] <<", " << area[1] << endl; // we have to find the edges that were missing in the symmetry computations. // So we find the jPoints that are on the inlet plane @@ -278,7 +270,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER cout << "flux ("< |c| ---*/ + // if (abs(UnitNormal[1]) > abs(UnitNormal[2])) { + // /*--- t = bi + (c-a)j - bk ---*/ + // Tangential[0] = UnitNormal[1]; + // Tangential[1] = UnitNormal[2] - UnitNormal[0]; + // Tangential[2] = -UnitNormal[1]; + // } else { + // /*--- t = ci - cj + (b-a)k ---*/ + // Tangential[0] = UnitNormal[2]; + // Tangential[1] = -UnitNormal[2]; + // Tangential[2] = UnitNormal[1] - UnitNormal[0]; + // } + // /*--- Make it a unit vector. ---*/ + // TangentialNorm = sqrt(pow(Tangential[0], 2) + pow(Tangential[1], 2) + pow(Tangential[2], 2)); + // Tangential[0] = Tangential[0] / TangentialNorm; + // Tangential[1] = Tangential[1] / TangentialNorm; + // Tangential[2] = Tangential[2] / TangentialNorm; + // break; + // } + // } // switch + // } // if viscous + // } // if bound_is_straight + + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + // /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ + if (geometry->nodes->GetDomain(iPoint)) { + // /*-------------------------------------------------------------------------------*/ + // /*--- Step 1: For the convective fluxes, create a reflected state of the ---*/ + // /*--- Primitive variables by copying all interior values to the ---*/ + // /*--- reflected. Only the velocity is mirrored along the symmetry ---*/ + // /*--- axis. Based on the Upwind_Residual routine. ---*/ + // /*-------------------------------------------------------------------------------*/ - for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = -Normal[iDim] / Area; + // /*--- Allocate the reflected state at the symmetry boundary. ---*/ + // V_reflected = GetCharacPrimVar(val_marker, iVertex); - /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as - t*n=0 && |t|_2 = 1 ---*/ - if (viscous) { - switch (nDim) { - case 2: { - Tangential[0] = -UnitNormal[1]; - Tangential[1] = UnitNormal[0]; - break; - } - case 3: { - /*--- n = ai + bj + ck, if |b| > |c| ---*/ - if (abs(UnitNormal[1]) > abs(UnitNormal[2])) { - /*--- t = bi + (c-a)j - bk ---*/ - Tangential[0] = UnitNormal[1]; - Tangential[1] = UnitNormal[2] - UnitNormal[0]; - Tangential[2] = -UnitNormal[1]; - } else { - /*--- t = ci - cj + (b-a)k ---*/ - Tangential[0] = UnitNormal[2]; - Tangential[1] = -UnitNormal[2]; - Tangential[2] = UnitNormal[1] - UnitNormal[0]; - } - /*--- Make it a unit vector. ---*/ - TangentialNorm = sqrt(pow(Tangential[0], 2) + pow(Tangential[1], 2) + pow(Tangential[2], 2)); - Tangential[0] = Tangential[0] / TangentialNorm; - Tangential[1] = Tangential[1] / TangentialNorm; - Tangential[2] = Tangential[2] / TangentialNorm; - break; - } - } // switch - } // if viscous - } // if bound_is_straight + // /*--- Grid movement ---*/ + // if (dynamic_grid) + // conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); - iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + // /*--- Normal vector for this vertex (negate for outward convention). ---*/ + // geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ - if (geometry->nodes->GetDomain(iPoint)) { - /*-------------------------------------------------------------------------------*/ - /*--- Step 1: For the convective fluxes, create a reflected state of the ---*/ - /*--- Primitive variables by copying all interior values to the ---*/ - /*--- reflected. Only the velocity is mirrored along the symmetry ---*/ - /*--- axis. Based on the Upwind_Residual routine. ---*/ - /*-------------------------------------------------------------------------------*/ + // for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + // // set component normal to the wall to zero. + // conv_numerics->SetNormal(Normal); - /*--- Allocate the reflected state at the symmetry boundary. ---*/ - V_reflected = GetCharacPrimVar(val_marker, iVertex); + // /*--- Get current solution at this boundary node ---*/ + // V_domain = nodes->GetPrimitive(iPoint); - /*--- Grid movement ---*/ - if (dynamic_grid) - conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); + // /*--- Set the reflected state based on the boundary node. Scalars are copied and + // the velocity is mirrored along the symmetry boundary, i.e. the velocity in + // normal direction is substracted twice. ---*/ + // for (iVar = 0; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); - /*--- Normal vector for this vertex (negate for outward convention). ---*/ - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + // /*--- Compute velocity in normal direction (ProjVelocity_i=(v*n)) und substract twice from + // velocity in normal direction: v_r = v - 2 (v*n)n ---*/ + // ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); - for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - // set component normal to the wall to zero. - conv_numerics->SetNormal(Normal); + // /*--- Adjustment to v.n due to grid movement. ---*/ + // if (dynamic_grid) { + // ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); + // } - /*--- Get current solution at this boundary node ---*/ - V_domain = nodes->GetPrimitive(iPoint); + // // Note that we do not want a perfect reflection but the normal component to be set to zero. + // // so instead of u-2*v.n we can reflect only the tangential component u-1*v.n + // for (iDim = 0; iDim < nDim; iDim++) + // V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 2.0 * ProjVelocity_i * UnitNormal[iDim]; + // // V_t = b -b_n = b-(an.n).n + // // V_t = -(v-(v.n).n) - /*--- Set the reflected state based on the boundary node. Scalars are copied and - the velocity is mirrored along the symmetry boundary, i.e. the velocity in - normal direction is substracted twice. ---*/ - for (iVar = 0; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); + // /*--- Set Primitive and Secondary for numerics class. ---*/ + // conv_numerics->SetPrimitive(V_domain, V_reflected); + // conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); - /*--- Compute velocity in normal direction (ProjVelocity_i=(v*n)) und substract twice from - velocity in normal direction: v_r = v - 2 (v*n)n ---*/ - ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); + // /*--- Compute the residual using an upwind scheme. ---*/ - /*--- Adjustment to v.n due to grid movement. ---*/ - if (dynamic_grid) { - ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); - } + // auto residual = conv_numerics->ComputeResidual(config); - // Note that we do not want a perfect reflection but the normal component to be set to zero. - // so instead of u-2*v.n we reflect only the tangential component u-1*v.n - for (iDim = 0; iDim < nDim; iDim++) - V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 2.0 * ProjVelocity_i * UnitNormal[iDim]; - // V_t = b -b_n = b-(an.n).n - // V_t = -(v-(v.n).n) + // for (iVar = 0; iVar < nPrimVar; iVar++) + // cout <<"point "<GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { + const auto iPoint = vertex[iMarker][iVertex]->GetNode(); - const auto iPoint = vertex[iMarker][iVertex]->GetNode(); + const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); - const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); + su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); + su2double UnitNormal_Sym[MAXNDIM] = {0.0}; - su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); - su2double UnitNormal_Sym[MAXNDIM] = {0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; + } + for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { + su2double Product = 0.0; + unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); + /*---Check if neighbour point is on the same plane as the symmetry plane + by computing the internal product of the Normal Vertex vector and + the vector connecting iPoint and jPoint. If the product is lower than + estabilished tolerance (to account for Numerical errors) both points are + in the same plane as SYMMETRY_PLANE---*/ + su2double Tangent[MAXNDIM] = {0.0}; for (unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormal_Sym[iDim] = Normal_Sym[iDim]/Area; + Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); + Product += Tangent[iDim] * Normal_Sym[iDim]; } - for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh){ - su2double Product = 0.0; - unsigned long jPoint = nodes->GetPoint(iPoint,iNeigh); - /*---Check if neighbour point is on the same plane as the symmetry plane - by computing the internal product of the Normal Vertex vector and - the vector connecting iPoint and jPoint. If the product is lower than - estabilished tolerance (to account for Numerical errors) both points are - in the same plane as SYMMETRY_PLANE---*/ - su2double Tangent[MAXNDIM]={0.0}; - for(unsigned short iDim = 0; iDimGetCoord(jPoint,iDim) - nodes->GetCoord(iPoint,iDim); - Product += Tangent[iDim] * Normal_Sym[iDim]; - } + if (abs(Product) < EPS) { + cout << "iPoint " << iPoint << " and jPoint " << jPoint << " are in the symmetry plane " << endl; + Product = 0.0; + + unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); + su2double Normal[MAXNDIM] = {0.0}; + edges->GetNormal(iEdge, Normal); + cout << "normal=" << Normal[0] << " " << Normal[1] << endl; + for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; - if (abs(Product) < 1.0e-8) { - cout << "iPoint " << iPoint << " and jPoint " << jPoint << " are in the symmetry plane " << endl; - Product = 0.0; - - unsigned long iEdge = nodes->GetEdge(iPoint,iNeigh); - su2double Normal[MAXNDIM] = {0.0}; - edges->GetNormal(iEdge,Normal); - cout << "normal="<SetNormal(iEdge,Normal); - } // if in-plane of symmetry - } // loop over neighbors - } // loop over vertices - } // if symmetry - } // loop over markers + edges->SetNormal(iEdge, Normal); + } // if in-plane of symmetry + } // loop over neighbors + } // loop over vertices + } // if symmetry + } // loop over markers END_SU2_OMP_FOR } diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 5082fb0b0bd..92be8f401fe 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1097,294 +1097,41 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve unsigned short iDim, iVar; unsigned long iVertex, iPoint; - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool viscous = config->GetViscous(); - bool preprocessed = false; - /*--- Allocation of variables necessary for convective fluxes. ---*/ - su2double Area, ProjVelocity_i, *V_reflected, *V_domain, Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; + su2double Area, Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; - /*--- Allocation of variables necessary for viscous fluxes. ---*/ - su2double ProjGradient, ProjNormVelGrad, ProjTangVelGrad, TangentialNorm, - Tangential[MAXNDIM] = {0.0}, GradNormVel[MAXNDIM] = {0.0}, GradTangVel[MAXNDIM] = {0.0}; - /*--- Allocation of primitive gradient arrays for viscous fluxes. ---*/ - su2activematrix Grad_Reflected(nPrimVarGrad, nDim); + /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. + * The components of the residual normal to the symmetry plane are then zeroed out. + * It is also necessary to correct nomal vectors of those faces of the control volume, which + * touch the boundary. The modification consists of removing all components of the face vector, + * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ + /*--- Loop over all the vertices on this boundary marker. ---*/ SU2_OMP_FOR_DYN(OMP_MIN_SIZE) for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { - // if (!preprocessed || geometry->bound_is_straight[val_marker] != true) { - // /*----------------------------------------------------------------------------------------------*/ - // /*--- Preprocessing: ---*/ - // /*--- Compute the unit normal and (in case of viscous flow) a corresponding unit tangential ---*/ - // /*--- to that normal. On a straight(2D)/plane(3D) boundary these two vectors are constant. ---*/ - // /*--- This circumstance is checked in geometry->ComputeSurf_Straightness(...) and stored ---*/ - // /*--- such that the recomputation does not occur for each node. On true symmetry planes, the ---*/ - // /*--- normal is constant but this routine is used for Symmetry, Euler-Wall in inviscid flow ----*/ - // /*--- and Euler Wall in viscous flow as well. In the latter curvy boundaries are likely to ---*/ - // /*--- happen. In doubt, the conditional above which checks straightness can be thrown out ---*/ - // /*--- such that the recomputation is done for each node (which comes with a tiny performance ---*/ - // /*--- penalty). ---*/ - // /*----------------------------------------------------------------------------------------------*/ - - // preprocessed = true; - - // /*--- Normal vector for a random vertex (zero) on this marker (negate for outward convention). ---*/ - // geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - // for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - - // cout << "normal = " << Normal[0] << " " << Normal[1] << endl; - - // /*--- Compute unit normal, to be used for unit tangential, projected velocity and velocity - // component gradients. ---*/ - // Area = GeometryToolbox::Norm(nDim, Normal); - - // for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = -Normal[iDim] / Area; - - // /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as - // t*n=0 && |t|_2 = 1 ---*/ - // if (viscous) { - // switch (nDim) { - // case 2: { - // Tangential[0] = -UnitNormal[1]; - // Tangential[1] = UnitNormal[0]; - // break; - // } - // case 3: { - // /*--- n = ai + bj + ck, if |b| > |c| ---*/ - // if (abs(UnitNormal[1]) > abs(UnitNormal[2])) { - // /*--- t = bi + (c-a)j - bk ---*/ - // Tangential[0] = UnitNormal[1]; - // Tangential[1] = UnitNormal[2] - UnitNormal[0]; - // Tangential[2] = -UnitNormal[1]; - // } else { - // /*--- t = ci - cj + (b-a)k ---*/ - // Tangential[0] = UnitNormal[2]; - // Tangential[1] = -UnitNormal[2]; - // Tangential[2] = UnitNormal[1] - UnitNormal[0]; - // } - // /*--- Make it a unit vector. ---*/ - // TangentialNorm = sqrt(pow(Tangential[0], 2) + pow(Tangential[1], 2) + pow(Tangential[2], 2)); - // Tangential[0] = Tangential[0] / TangentialNorm; - // Tangential[1] = Tangential[1] / TangentialNorm; - // Tangential[2] = Tangential[2] / TangentialNorm; - // break; - // } - // } // switch - // } // if viscous - // } // if bound_is_straight - - iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); - - // /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ - if (geometry->nodes->GetDomain(iPoint)) { - // /*-------------------------------------------------------------------------------*/ - // /*--- Step 1: For the convective fluxes, create a reflected state of the ---*/ - // /*--- Primitive variables by copying all interior values to the ---*/ - // /*--- reflected. Only the velocity is mirrored along the symmetry ---*/ - // /*--- axis. Based on the Upwind_Residual routine. ---*/ - // /*-------------------------------------------------------------------------------*/ - - // /*--- Allocate the reflected state at the symmetry boundary. ---*/ - // V_reflected = GetCharacPrimVar(val_marker, iVertex); - - // /*--- Grid movement ---*/ - // if (dynamic_grid) - // conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); - - // /*--- Normal vector for this vertex (negate for outward convention). ---*/ - // geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - - // for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - // // set component normal to the wall to zero. - // conv_numerics->SetNormal(Normal); - - // /*--- Get current solution at this boundary node ---*/ - // V_domain = nodes->GetPrimitive(iPoint); - - // /*--- Set the reflected state based on the boundary node. Scalars are copied and - // the velocity is mirrored along the symmetry boundary, i.e. the velocity in - // normal direction is substracted twice. ---*/ - // for (iVar = 0; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); - - // /*--- Compute velocity in normal direction (ProjVelocity_i=(v*n)) und substract twice from - // velocity in normal direction: v_r = v - 2 (v*n)n ---*/ - // ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); - - // /*--- Adjustment to v.n due to grid movement. ---*/ - // if (dynamic_grid) { - // ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); - // } - - // // Note that we do not want a perfect reflection but the normal component to be set to zero. - // // so instead of u-2*v.n we can reflect only the tangential component u-1*v.n - // for (iDim = 0; iDim < nDim; iDim++) - // V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 2.0 * ProjVelocity_i * UnitNormal[iDim]; - // // V_t = b -b_n = b-(an.n).n - // // V_t = -(v-(v.n).n) - - // /*--- Set Primitive and Secondary for numerics class. ---*/ - // conv_numerics->SetPrimitive(V_domain, V_reflected); - // conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); - - // /*--- Compute the residual using an upwind scheme. ---*/ - - // auto residual = conv_numerics->ComputeResidual(config); - - // for (iVar = 0; iVar < nPrimVar; iVar++) - // cout <<"point "<GetPoint(iPoint, iNeigh); - su2double* icoord = nodes->GetCoord(iPoint); // nijso: debugging - su2double* jcoord = nodes->GetCoord(jPoint); // nijso: debugging + /*su2double* icoord = nodes->GetCoord(iPoint); // nijso: debugging */ + /*su2double* jcoord = nodes->GetCoord(jPoint); // nijso: debugging */ cout << " jPoint="<GetnPoint(iPoint); ++iNeigh) { - size_t iEdge = nodes->GetEdge(iPoint, iNeigh); jPoint = nodes->GetPoint(iPoint, iNeigh); if (nodes->Getinoutfar(jPoint)) { cout << " jPoint " << jPoint << " is on the inlet plane" << endl; @@ -265,7 +259,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { // average of i and j at the midway point flux[iVar] = weight * 0.5 * (field(iPoint, iVar) + field(jPoint, iVar)); - //flux[iVar] = field(iPoint,iVar) / volume; + /* original : flux[iVar] = field(iPoint,iVar) / volume; */ fluxReflected[iVar] = flux[iVar]; cout << "flux ("<::PushSolutionBackInTime(unsigned long TimeIter, bo template void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) { - unsigned short iDim, iVar; - unsigned long iVertex, iPoint; + unsigned short iDim; + unsigned long iVertex; /*--- Allocation of variables necessary for convective fluxes. ---*/ su2double Area, Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; @@ -1126,6 +1126,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve Normal_Product += Residual_Old[1+iDim]*UnitNormal[iDim]; } + // we do not have residual components except for the momentum su2double Residual[MAXNVAR] = {0.0}; for(iDim = 0; iDim < nDim; iDim++) Residual[1+iDim] = Normal_Product*UnitNormal[iDim]; From 8e346b0d94952bd083df6752fc4efb5cfa8890b0 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 14 Jan 2024 13:12:40 +0100 Subject: [PATCH 020/194] fig GG share nodes for 3D --- .../gradients/computeGradientsGreenGauss.hpp | 134 ++++++++++-------- 1 file changed, 71 insertions(+), 63 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 78f53bb68a3..b57e2b62c88 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -150,7 +150,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - cout << "iPoint = " << iPoint << endl; + //cout << "iPoint = " << iPoint << endl; auto nodes = geometry.nodes; // we need to set the gradient to zero for the entire marker to prevent double-counting // points that are shared by other markers @@ -159,13 +159,13 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint)); for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { - cout << " edge = "<GetnPoint(iPoint) << endl; + //cout << " edge = "<GetnPoint(iPoint) << endl; size_t iEdge = nodes->GetEdge(iPoint, iNeigh); - cout <<"edge " << iEdge << endl; + //cout <<"edge " << iEdge << endl; size_t jPoint = nodes->GetPoint(iPoint, iNeigh); /*su2double* icoord = nodes->GetCoord(iPoint); // nijso: debugging */ /*su2double* jcoord = nodes->GetCoord(jPoint); // nijso: debugging */ - cout << " jPoint="<GetCoord(iPoint)[1] << ", " << nodes->GetCoord(iPoint)[2] << endl; // we have to find the edges that were missing in the symmetry computations. // So we find the jPoints that are on the inlet plane // so we loop over all neighbor of iPoint, find all jPoints and then check if it is on the inlet unsigned long jPoint = 0; for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { jPoint = nodes->GetPoint(iPoint, iNeigh); - if (nodes->Getinoutfar(jPoint)) { - cout << " jPoint " << jPoint << " is on the inlet plane" << endl; - break; - } - } - - su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; - su2double weight = dir / (2.0*volume); - - // this edge jPoint - jPoint is the missing edge for the symmetry computations - //compute the flux on the face between iPoint and jPoint - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // average of i and j at the midway point - flux[iVar] = weight * 0.5 * (field(iPoint, iVar) + field(jPoint, iVar)); - /* original : flux[iVar] = field(iPoint,iVar) / volume; */ - fluxReflected[iVar] = flux[iVar]; - cout << "flux ("<Getinoutfar(jPoint) || nodes->GetSolidBoundary(jPoint)) { + //cout << " jPoint " << jPoint << " is on the inlet plane" << endl; + //if (nodes->GetSymmetry(jPoint)) + // cout << "jpoint is on the symmetry" << endl; + //else + // cout << "jpoint is not on the symmetry" << endl; + + //cout << "coords = " << nodes->GetCoord(jPoint)[0] << ", " <GetCoord(jPoint)[1] << ", " << nodes->GetCoord(jPoint)[2] << endl; + + + su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; + su2double weight = dir / (2.0*volume); + + // this edge jPoint - jPoint is the missing edge for the symmetry computations + //compute the flux on the face between iPoint and jPoint + for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { + // average of i and j at the midway point + flux[iVar] = weight * 0.5 * (field(iPoint, iVar) + field(jPoint, iVar)); + /* original : flux[iVar] = field(iPoint,iVar) / volume; */ + fluxReflected[iVar] = flux[iVar]; + //cout << "flux ("< Date: Mon, 15 Jan 2024 11:20:18 +0100 Subject: [PATCH 021/194] fig GG share nodes interpolation --- .../gradients/computeGradientsGreenGauss.hpp | 47 ++++--------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index b57e2b62c88..fb830aabc71 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -150,7 +150,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - //cout << "iPoint = " << iPoint << endl; auto nodes = geometry.nodes; // we need to set the gradient to zero for the entire marker to prevent double-counting // points that are shared by other markers @@ -159,13 +158,8 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint)); for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { - //cout << " edge = "<GetnPoint(iPoint) << endl; size_t iEdge = nodes->GetEdge(iPoint, iNeigh); - //cout <<"edge " << iEdge << endl; size_t jPoint = nodes->GetPoint(iPoint, iNeigh); - /*su2double* icoord = nodes->GetCoord(iPoint); // nijso: debugging */ - /*su2double* jcoord = nodes->GetCoord(jPoint); // nijso: debugging */ - //cout << " jPoint="<GetSymmetry(iPoint) && nodes->Getinoutfar(iPoint)) || - (nodes->GetSymmetry(iPoint) && nodes->GetSolidBoundary(iPoint)) ) { - //cout << "iPoint " << iPoint <<" is on the inlet and on the symmetry" << endl; - //cout << "coords = " << nodes->GetCoord(iPoint)[0] << ", " <GetCoord(iPoint)[1] << ", " << nodes->GetCoord(iPoint)[2] << endl; - // we have to find the edges that were missing in the symmetry computations. - // So we find the jPoints that are on the inlet plane - // so we loop over all neighbor of iPoint, find all jPoints and then check if it is on the inlet + if ( (nodes->GetSymmetry(iPoint) && nodes->Getinoutfar(iPoint)) || + (nodes->GetSymmetry(iPoint) && nodes->GetSolidBoundary(iPoint)) ) { + // we have to find the edges that were missing in the symmetry computations. + // So we find the jPoints that are on the inlet plane + // so we loop over all neighbor of iPoint, find all jPoints and then check if it is on the inlet unsigned long jPoint = 0; for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { jPoint = nodes->GetPoint(iPoint, iNeigh); if (nodes->Getinoutfar(jPoint) || nodes->GetSolidBoundary(jPoint)) { - //cout << " jPoint " << jPoint << " is on the inlet plane" << endl; - //if (nodes->GetSymmetry(jPoint)) - // cout << "jpoint is on the symmetry" << endl; - //else - // cout << "jpoint is not on the symmetry" << endl; - //cout << "coords = " << nodes->GetCoord(jPoint)[0] << ", " <GetCoord(jPoint)[1] << ", " << nodes->GetCoord(jPoint)[2] << endl; - - - su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; + su2double dir = 1.0; //(iPoint < jPoint) ? 1.0 : -1.0; su2double weight = dir / (2.0*volume); // this edge jPoint - jPoint is the missing edge for the symmetry computations //compute the flux on the face between iPoint and jPoint for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // average of i and j at the midway point - flux[iVar] = weight * 0.5 * (field(iPoint, iVar) + field(jPoint, iVar)); - /* original : flux[iVar] = field(iPoint,iVar) / volume; */ + // average on the face between iPoint and the midway point on the dual edge. + flux[iVar] = weight * (0.75 * field(iPoint, iVar) + 0.25 *field(jPoint, iVar)); fluxReflected[iVar] = flux[iVar]; - //cout << "flux ("< Date: Mon, 15 Jan 2024 11:28:50 +0100 Subject: [PATCH 022/194] fig GG share nodes interpolation for outlet --- Common/src/CConfig.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 36810830443..18c4685b2b9 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -7938,6 +7938,7 @@ bool CConfig::GetSolid_Wall(unsigned short iMarker) const { bool CConfig::Getinoutfar(unsigned short iMarker) const { return (Marker_All_KindBC[iMarker] == INLET_FLOW || Marker_All_KindBC[iMarker] == OUTLET_FLOW); } + bool CConfig::GetSymmetry(unsigned short iMarker) const { return (Marker_All_KindBC[iMarker] == SYMMETRY_PLANE); } From 95fb743c866edd7f421f056c1dccac7829aafb6d Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 17 Jan 2024 08:37:15 +0100 Subject: [PATCH 023/194] activate edge array --- Common/src/geometry/CPhysicalGeometry.cpp | 2 +- .../include/solvers/CFVMFlowSolverBase.hpp | 4 +- .../include/solvers/CFVMFlowSolverBase.inl | 261 ++++++++++++++++-- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 1 + 4 files changed, 244 insertions(+), 24 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index f8d6098a8f4..0a747be54e3 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7323,7 +7323,7 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; - edges->SetNormal(iEdge, Normal); + // edges->SetNormal(iEdge, Normal); } // if in-plane of symmetry } // loop over neighbors } // loop over vertices diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index 6953dd1bc59..0bebf10d5ba 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -197,11 +197,11 @@ class CFVMFlowSolverBase : public CSolver { #ifdef HAVE_OMP vector > EdgeColoring; /*!< \brief Edge colors. */ - bool ReducerStrategy = false; /*!< \brief If the reducer strategy is in use. */ + bool ReducerStrategy = true; /*!< \brief If the reducer strategy is in use. */ #else array, 1> EdgeColoring; /*--- Never use the reducer strategy if compiling for MPI-only. ---*/ - static constexpr bool ReducerStrategy = false; + static constexpr bool ReducerStrategy = true; #endif /*--- Edge fluxes, for OpenMP parallelization of difficult-to-color grids. diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 6b69a7b0918..7a92a7cecb0 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -358,12 +358,15 @@ void CFVMFlowSolverBase::HybridParallelInitialization(const CConfig& confi << " the minimum edge color group size is " << minColoredEdgeColorGroupSize << "." << endl; } } - + cout << "1. initialize reducerstrategy" << endl; if (ReducerStrategy) EdgeFluxes.Initialize(geometry.GetnEdge(), geometry.GetnEdge(), nVar, nullptr); omp_chunk_size = computeStaticChunkSize(nPoint, omp_get_max_threads(), OMP_MAX_SIZE); #else EdgeColoring[0] = DummyGridColor<>(geometry.GetnEdge()); + cout << "2. initialize reducerstrategy, nedge ="<< geometry.GetnEdge()<< ", "<::PushSolutionBackInTime(unsigned long TimeIter, bo template void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) { - unsigned short iDim; - unsigned long iVertex; + unsigned short iDim, iVar; + unsigned long iVertex, iPoint; - /*--- Allocation of variables necessary for convective fluxes. ---*/ - su2double Area, Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; + bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + bool viscous = config->GetViscous(); + bool preprocessed = false; + /*--- Allocation of variables necessary for convective fluxes. ---*/ + su2double Area, ProjVelocity_i, *V_reflected, *V_domain, Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; - /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. - * The components of the residual normal to the symmetry plane are then zeroed out. - * It is also necessary to correct nomal vectors of those faces of the control volume, which - * touch the boundary. The modification consists of removing all components of the face vector, - * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ + /*--- Allocation of variables necessary for viscous fluxes. ---*/ + su2double ProjGradient, ProjNormVelGrad, ProjTangVelGrad, TangentialNorm, + Tangential[MAXNDIM] = {0.0}, GradNormVel[MAXNDIM] = {0.0}, GradTangVel[MAXNDIM] = {0.0}; + /*--- Allocation of primitive gradient arrays for viscous fluxes. ---*/ + su2activematrix Grad_Reflected(nPrimVarGrad, nDim); /*--- Loop over all the vertices on this boundary marker. ---*/ SU2_OMP_FOR_DYN(OMP_MIN_SIZE) for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { - su2double Normal_Product = 0.0; + + + + + if (!preprocessed || geometry->bound_is_straight[val_marker] != true) { + /*----------------------------------------------------------------------------------------------*/ + /*--- Preprocessing: ---*/ + /*--- Compute the unit normal and (in case of viscous flow) a corresponding unit tangential ---*/ + /*--- to that normal. On a straight(2D)/plane(3D) boundary these two vectors are constant. ---*/ + /*--- This circumstance is checked in geometry->ComputeSurf_Straightness(...) and stored ---*/ + /*--- such that the recomputation does not occur for each node. On true symmetry planes, the ---*/ + /*--- normal is constant but this routines is used for Symmetry, Euler-Wall in inviscid flow ---*/ + /*--- and Euler Wall in viscous flow as well. In the latter curvy boundaries are likely to ---*/ + /*--- happen. In doubt, the conditional above which checks straightness can be thrown out ---*/ + /*--- such that the recomputation is done for each node (which comes with a tiny performance ---*/ + /*--- penalty). ---*/ + /*----------------------------------------------------------------------------------------------*/ + + preprocessed = true; + + /*--- Normal vector for a random vertex (zero) on this marker (negate for outward convention). ---*/ geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + + /*--- Compute unit normal, to be used for unit tangential, projected velocity and velocity + component gradients. ---*/ Area = GeometryToolbox::Norm(nDim, Normal); - unsigned long iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = -Normal[iDim] / Area; + + /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as + t*n=0 && |t|_2 = 1 ---*/ + if (viscous) { + switch (nDim) { + case 2: { + Tangential[0] = -UnitNormal[1]; + Tangential[1] = UnitNormal[0]; + break; + } + case 3: { + /*--- n = ai + bj + ck, if |b| > |c| ---*/ + if (abs(UnitNormal[1]) > abs(UnitNormal[2])) { + /*--- t = bi + (c-a)j - bk ---*/ + Tangential[0] = UnitNormal[1]; + Tangential[1] = UnitNormal[2] - UnitNormal[0]; + Tangential[2] = -UnitNormal[1]; + } else { + /*--- t = ci - cj + (b-a)k ---*/ + Tangential[0] = UnitNormal[2]; + Tangential[1] = -UnitNormal[2]; + Tangential[2] = UnitNormal[1] - UnitNormal[0]; + } + /*--- Make it a unit vector. ---*/ + TangentialNorm = sqrt(pow(Tangential[0], 2) + pow(Tangential[1], 2) + pow(Tangential[2], 2)); + Tangential[0] = Tangential[0] / TangentialNorm; + Tangential[1] = Tangential[1] / TangentialNorm; + Tangential[2] = Tangential[2] / TangentialNorm; + break; + } + } // switch + } // if viscous + } // if bound_is_straight + + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + cout << "Point = " << iPoint << endl; + /*--- loop over all neighbors ---*/ + for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { + /*--- Get the global edge id ---*/ + size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); + cout << "edge = " << iEdge << endl; + /*--- Get the flux of this edge---*/ + auto iEdgeFlux = EdgeFluxes.GetBlock(iEdge); + + cout <<" flux[0] on edge " << iEdge << " is " << iEdgeFlux[0] << endl; + //cout <<" flux[1] on edge " << iEdge << " is " << iEdgeFlux[1] << endl; + } + + /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ + if (geometry->nodes->GetDomain(iPoint)) { + /*-------------------------------------------------------------------------------*/ + /*--- Step 1: For the convective fluxes, create a reflected state of the ---*/ + /*--- Primitive variables by copying all interior values to the ---*/ + /*--- reflected. Only the velocity is mirrored along the symmetry ---*/ + /*--- axis. Based on the Upwind_Residual routine. ---*/ + /*-------------------------------------------------------------------------------*/ + + /*--- Allocate the reflected state at the symmetry boundary. ---*/ + V_reflected = GetCharacPrimVar(val_marker, iVertex); + + /*--- Grid movement ---*/ + if (dynamic_grid) + conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); + + /*--- Normal vector for this vertex (negate for outward convention). ---*/ + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + conv_numerics->SetNormal(Normal); - const su2double* Residual_Old = LinSysRes.GetBlock(iPoint); + /*--- Get current solution at this boundary node ---*/ + V_domain = nodes->GetPrimitive(iPoint); - for(iDim = 0; iDim < nDim; iDim++) { - UnitNormal[iDim] = Normal[iDim]/Area; - Normal_Product += Residual_Old[1+iDim]*UnitNormal[iDim]; + /*--- Set the reflected state based on the boundary node. Scalars are copied and + the velocity is mirrored along the symmetry boundary, i.e. the velocity in + normal direction is substracted twice. ---*/ + for (iVar = 0; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); + + /*--- Compute velocity in normal direction (ProjVelcity_i=(v*n)) und substract twice from + velocity in normal direction: v_r = v - 2 (v*n)n ---*/ + ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); + + /*--- Adjustment to v.n due to grid movement. ---*/ + if (dynamic_grid) { + ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); + } + + for (iDim = 0; iDim < nDim; iDim++) + V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 2.0 * ProjVelocity_i * UnitNormal[iDim]; + + /*--- Set Primitive and Secondary for numerics class. ---*/ + conv_numerics->SetPrimitive(V_domain, V_reflected); + conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); + + /*--- Compute the residual using an upwind scheme. ---*/ + + auto residual = conv_numerics->ComputeResidual(config); + + /*--- Update residual value ---*/ + LinSysRes.AddBlock(iPoint, residual); + + /*--- Jacobian contribution for implicit integration. ---*/ + if (implicit) { + Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); } - // we do not have residual components except for the momentum - su2double Residual[MAXNVAR] = {0.0}; - for(iDim = 0; iDim < nDim; iDim++) - Residual[1+iDim] = Normal_Product*UnitNormal[iDim]; + if (viscous) { + /*-------------------------------------------------------------------------------*/ + /*--- Step 2: The viscous fluxes of the Navier-Stokes equations depend on the ---*/ + /*--- Primitive variables and their gradients. The viscous numerics ---*/ + /*--- container is filled just as the convective numerics container, ---*/ + /*--- but the primitive gradients of the reflected state have to be ---*/ + /*--- determined additionally such that symmetry at the boundary is ---*/ + /*--- enforced. Based on the Viscous_Residual routine. ---*/ + /*-------------------------------------------------------------------------------*/ + + /*--- Set the normal vector and the coordinates. ---*/ + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); + visc_numerics->SetNormal(Normal); + + /*--- Set the primitive and Secondary variables. ---*/ + visc_numerics->SetPrimitive(V_domain, V_reflected); + visc_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); + + /*--- For viscous Fluxes also the gradients of the primitives need to be determined. + 1. The gradients of scalars are mirrored along the sym plane just as velocity for the primitives + 2. The gradients of the velocity components need more attention, i.e. the gradient of the + normal velocity in tangential direction is mirrored and the gradient of the tangential velocity in + normal direction is mirrored. ---*/ + + /*--- Get gradients of primitives of boundary cell ---*/ + for (iVar = 0; iVar < nPrimVarGrad; iVar++) + for (iDim = 0; iDim < nDim; iDim++) + Grad_Reflected[iVar][iDim] = nodes->GetGradient_Primitive(iPoint, iVar, iDim); + + /*--- Reflect the gradients for all scalars including the velocity components. + The gradients of the velocity components are set later with the + correct values: grad(V)_r = grad(V) - 2 [grad(V)*n]n, V beeing any primitive ---*/ + for (iVar = 0; iVar < nPrimVarGrad; iVar++) { + if (iVar == 0 || iVar > nDim) { // Exclude velocity component gradients - LinSysRes.SubtractBlock(iPoint, Residual); + /*--- Compute projected part of the gradient in a dot product ---*/ + ProjGradient = 0.0; + for (iDim = 0; iDim < nDim; iDim++) ProjGradient += Grad_Reflected[iVar][iDim] * UnitNormal[iDim]; + + for (iDim = 0; iDim < nDim; iDim++) + Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; + } + } + + /*--- Compute gradients of normal and tangential velocity: + grad(v*n) = grad(v_x) n_x + grad(v_y) n_y (+ grad(v_z) n_z) + grad(v*t) = grad(v_x) t_x + grad(v_y) t_y (+ grad(v_z) t_z) ---*/ + for (iVar = 0; iVar < nDim; iVar++) { // counts gradient components + GradNormVel[iVar] = 0.0; + GradTangVel[iVar] = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { // counts sum with unit normal/tangential + GradNormVel[iVar] += Grad_Reflected[iDim + 1][iVar] * UnitNormal[iDim]; + GradTangVel[iVar] += Grad_Reflected[iDim + 1][iVar] * Tangential[iDim]; + } + } + + /*--- Refelect gradients in tangential and normal direction by substracting the normal/tangential + component twice, just as done with velocity above. + grad(v*n)_r = grad(v*n) - 2 {grad([v*n])*t}t + grad(v*t)_r = grad(v*t) - 2 {grad([v*t])*n}n ---*/ + ProjNormVelGrad = 0.0; + ProjTangVelGrad = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + ProjNormVelGrad += GradNormVel[iDim] * Tangential[iDim]; // grad([v*n])*t + ProjTangVelGrad += GradTangVel[iDim] * UnitNormal[iDim]; // grad([v*t])*n + } + + for (iDim = 0; iDim < nDim; iDim++) { + GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; + GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; + } + /*--- Transfer reflected gradients back into the Cartesian Coordinate system: + grad(v_x)_r = grad(v*n)_r n_x + grad(v*t)_r t_x + grad(v_y)_r = grad(v*n)_r n_y + grad(v*t)_r t_y + ( grad(v_z)_r = grad(v*n)_r n_z + grad(v*t)_r t_z ) ---*/ + for (iVar = 0; iVar < nDim; iVar++) // loops over the velocity component gradients + for (iDim = 0; iDim < nDim; iDim++) // loops over the entries of the above + Grad_Reflected[iVar + 1][iDim] = + GradNormVel[iDim] * UnitNormal[iVar] + GradTangVel[iDim] * Tangential[iVar]; + + /*--- Set the primitive gradients of the boundary and reflected state. ---*/ + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), CMatrixView(Grad_Reflected)); + + /*--- Turbulent kinetic energy. ---*/ + if (config->GetKind_Turb_Model() == TURB_MODEL::SST) + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0)); + + /*--- Compute and update residual. Note that the viscous shear stress tensor is computed in the + following routine based upon the velocity-component gradients. ---*/ + auto residual = visc_numerics->ComputeResidual(config); + + LinSysRes.SubtractBlock(iPoint, residual); + + /*--- Jacobian contribution for implicit integration. ---*/ + if (implicit) Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); + } // if viscous + } // if GetDomain } // for iVertex END_SU2_OMP_FOR diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index d8f53845622..5765ce3bd7a 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1242,6 +1242,7 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Points in edge and normal vectors ---*/ iPoint = geometry->edges->GetNode(iEdge,0); jPoint = geometry->edges->GetNode(iEdge,1); + const su2double* normalLocal = geometry->edges->GetNormal(iEdge) ; numerics->SetNormal(geometry->edges->GetNormal(iEdge)); /*--- Grid movement ---*/ From e8434e361765483732ae8fd7b48513116394ebd6 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 31 Jan 2024 21:41:11 +0100 Subject: [PATCH 024/194] edge fluxes test --- .../include/solvers/CFVMFlowSolverBase.inl | 294 +++++++++--------- SU2_CFD/include/variables/CEulerVariable.hpp | 8 + .../include/variables/CIncEulerVariable.hpp | 8 + SU2_CFD/include/variables/CVariable.hpp | 6 + SU2_CFD/src/integration/CIntegration.cpp | 15 +- 5 files changed, 189 insertions(+), 142 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 7a92a7cecb0..7d0d778ecb6 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1108,7 +1108,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve su2double Area, ProjVelocity_i, *V_reflected, *V_domain, Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; /*--- Allocation of variables necessary for viscous fluxes. ---*/ - su2double ProjGradient, ProjNormVelGrad, ProjTangVelGrad, TangentialNorm, + su2double ProjGradient, ProjNormVelGrad, ProjTangVelGrad, TangentialNorm, ProjF_i, + F[MAXNVAR] = {0.0}, F_reflected[MAXNVAR] = {0.0}, Tangential[MAXNDIM] = {0.0}, GradNormVel[MAXNDIM] = {0.0}, GradTangVel[MAXNDIM] = {0.0}; /*--- Allocation of primitive gradient arrays for viscous fluxes. ---*/ @@ -1119,10 +1120,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve SU2_OMP_FOR_DYN(OMP_MIN_SIZE) for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { - - - - if (!preprocessed || geometry->bound_is_straight[val_marker] != true) { /*----------------------------------------------------------------------------------------------*/ /*--- Preprocessing: ---*/ @@ -1151,53 +1148,100 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as t*n=0 && |t|_2 = 1 ---*/ - if (viscous) { - switch (nDim) { - case 2: { - Tangential[0] = -UnitNormal[1]; - Tangential[1] = UnitNormal[0]; - break; - } - case 3: { - /*--- n = ai + bj + ck, if |b| > |c| ---*/ - if (abs(UnitNormal[1]) > abs(UnitNormal[2])) { - /*--- t = bi + (c-a)j - bk ---*/ - Tangential[0] = UnitNormal[1]; - Tangential[1] = UnitNormal[2] - UnitNormal[0]; - Tangential[2] = -UnitNormal[1]; - } else { - /*--- t = ci - cj + (b-a)k ---*/ - Tangential[0] = UnitNormal[2]; - Tangential[1] = -UnitNormal[2]; - Tangential[2] = UnitNormal[1] - UnitNormal[0]; - } - /*--- Make it a unit vector. ---*/ - TangentialNorm = sqrt(pow(Tangential[0], 2) + pow(Tangential[1], 2) + pow(Tangential[2], 2)); - Tangential[0] = Tangential[0] / TangentialNorm; - Tangential[1] = Tangential[1] / TangentialNorm; - Tangential[2] = Tangential[2] / TangentialNorm; - break; - } - } // switch - } // if viscous + } // if bound_is_straight iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); - cout << "Point = " << iPoint << endl; - /*--- loop over all neighbors ---*/ - for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { - /*--- Get the global edge id ---*/ - size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); - cout << "edge = " << iEdge << endl; - /*--- Get the flux of this edge---*/ - auto iEdgeFlux = EdgeFluxes.GetBlock(iEdge); - - cout <<" flux[0] on edge " << iEdge << " is " << iEdgeFlux[0] << endl; - //cout <<" flux[1] on edge " << iEdge << " is " << iEdgeFlux[1] << endl; - } + //cout << "Point = " << iPoint << endl; + const su2double* iCoord = {geometry->nodes->GetCoord(iPoint)}; + /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ if (geometry->nodes->GetDomain(iPoint)) { + su2double F_Total[MAXNVAR] = {0.0}; + su2double F_Total_reflected[MAXNVAR] = {0.0}; + + // loop over neighbors of the iPoint + unsigned long jPoint = 0; + for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { + jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); + const su2double* jCoord = {geometry->nodes->GetCoord(jPoint)}; + // cout << endl << endl; + // cout << " ipoint " + // << iPoint + // << " (" + // << iCoord[0] + // << ", " + // << iCoord[1] + // <<")" + // << endl; + // cout << " jpoint " + // << jPoint + // << " (" + // << jCoord[0] + // << ", " + // << jCoord[1] + // <<")" + // << endl; + size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); + su2double* iEdgeFlux = EdgeFluxes.GetBlock(iEdge); + + + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + /*--- Compute unit normal, to be used for unit tangential, projected velocity and velocity + component gradients. ---*/ + Area = GeometryToolbox::Norm(nDim, Normal); + + for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = -Normal[iDim] / Area; + + //cout << "normal is " << Normal[0] << ", " << Normal[1] << endl; + // Momentum flux for the edge + for (iVar = 0; iVar < nPrimVar; iVar++) + F[iVar] = iEdgeFlux[iVar]; + for (iVar = 0; iVar < nPrimVar; iVar++) + F_reflected[iVar] = iEdgeFlux[iVar]; + + // cout <<"iPoint="<edges->GetNode(iEdge,0)){ + //cout << "add" << endl; + for (iVar = 0; iVar < nPrimVar; iVar++) F_Total[iVar] += F[iVar]; + for (iVar = 0; iVar < nPrimVar; iVar++) F_Total_reflected[iVar] += F_reflected[iVar]; + // LinSysRes.AddBlock(iPoint, F_reflected); + } + else { + //cout << "subtract" << endl; + for (iVar = 0; iVar < nPrimVar; iVar++) F_Total[iVar] -= F[iVar]; + for (iVar = 0; iVar < nPrimVar; iVar++) F_Total_reflected[iVar] -= F_reflected[iVar]; + // LinSysRes.SubtractBlock(iPoint, F_reflected); + } + + } + /*-------------------------------------------------------------------------------*/ /*--- Step 1: For the convective fluxes, create a reflected state of the ---*/ /*--- Primitive variables by copying all interior values to the ---*/ @@ -1242,115 +1286,84 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); /*--- Compute the residual using an upwind scheme. ---*/ - auto residual = conv_numerics->ComputeResidual(config); - /*--- Update residual value ---*/ - LinSysRes.AddBlock(iPoint, residual); + auto residual_old = LinSysRes.GetBlock(iPoint); - /*--- Jacobian contribution for implicit integration. ---*/ - if (implicit) { - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); - } + // F_Total[0] = 0.0; + // F_Total[3] = 0.0; + // F_Total[4] = 0.0; + // F_Total_reflected[0] = 0.0; + // F_Total_reflected[3] = 0.0; + // F_Total_reflected[4] = 0.0; - if (viscous) { - /*-------------------------------------------------------------------------------*/ - /*--- Step 2: The viscous fluxes of the Navier-Stokes equations depend on the ---*/ - /*--- Primitive variables and their gradients. The viscous numerics ---*/ - /*--- container is filled just as the convective numerics container, ---*/ - /*--- but the primitive gradients of the reflected state have to be ---*/ - /*--- determined additionally such that symmetry at the boundary is ---*/ - /*--- enforced. Based on the Viscous_Residual routine. ---*/ - /*-------------------------------------------------------------------------------*/ - - /*--- Set the normal vector and the coordinates. ---*/ - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); - visc_numerics->SetNormal(Normal); - - /*--- Set the primitive and Secondary variables. ---*/ - visc_numerics->SetPrimitive(V_domain, V_reflected); - visc_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); - - /*--- For viscous Fluxes also the gradients of the primitives need to be determined. - 1. The gradients of scalars are mirrored along the sym plane just as velocity for the primitives - 2. The gradients of the velocity components need more attention, i.e. the gradient of the - normal velocity in tangential direction is mirrored and the gradient of the tangential velocity in - normal direction is mirrored. ---*/ - - /*--- Get gradients of primitives of boundary cell ---*/ - for (iVar = 0; iVar < nPrimVarGrad; iVar++) - for (iDim = 0; iDim < nDim; iDim++) - Grad_Reflected[iVar][iDim] = nodes->GetGradient_Primitive(iPoint, iVar, iDim); + //cout <<"********** iPoint="< nDim) { // Exclude velocity component gradients - /*--- Compute projected part of the gradient in a dot product ---*/ - ProjGradient = 0.0; - for (iDim = 0; iDim < nDim; iDim++) ProjGradient += Grad_Reflected[iVar][iDim] * UnitNormal[iDim]; + // multiplication by 0.5 or not?? + for (iDim = 0; iDim < nDim; iDim++) + F_Total[iDim+1] = 0.5*(F_Total[iDim+1] + F_Total_reflected[iDim+1]); - for (iDim = 0; iDim < nDim; iDim++) - Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; - } - } + // cout << residual[0] <<", "<nodes->Getinoutfar(iPoint)) { + for (iVar = 0; iVar < nPrimVar; iVar++) + F_Total[iVar] = residual_old[iVar] + residual[iVar]; + F_Total[2] = 0.0; + + LinSysRes.SetBlock(iPoint, F_Total); + su2double vel[MAXNDIM] = {0.0}; + for (iDim = 0; iDim < nDim; iDim++) + vel[iDim] = nodes->GetVelocity(iPoint,iDim); + //radial velocity to zero + //cout << "vel="<SetVelocity_Old(iPoint, vel); + nodes->Set_ResTruncError_Zero(iPoint,2); + Jacobian.DeleteValsRowi(iPoint*nVar +2); + + } - /*--- Set the primitive gradients of the boundary and reflected state. ---*/ - visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), CMatrixView(Grad_Reflected)); + else { - /*--- Turbulent kinetic energy. ---*/ - if (config->GetKind_Turb_Model() == TURB_MODEL::SST) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0), - solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint, 0)); + F_Total[2] = 0.0; - /*--- Compute and update residual. Note that the viscous shear stress tensor is computed in the - following routine based upon the velocity-component gradients. ---*/ - auto residual = visc_numerics->ComputeResidual(config); + LinSysRes.SetBlock(iPoint, F_Total); + + + su2double vel[MAXNDIM] = {0.0}; + for (iDim = 0; iDim < nDim; iDim++) + vel[iDim] = nodes->GetVelocity(iPoint,iDim); + //radial velocity to zero + //cout << "vel="<SetVelocity_Old(iPoint, vel); + nodes->Set_ResTruncError_Zero(iPoint,2); + Jacobian.DeleteValsRowi(iPoint*nVar +2); + } + + /*--- Jacobian contribution for implicit integration. ---*/ + //if (implicit) { + // Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + //} - LinSysRes.SubtractBlock(iPoint, residual); - /*--- Jacobian contribution for implicit integration. ---*/ - if (implicit) Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); - } // if viscous } // if GetDomain } // for iVertex END_SU2_OMP_FOR @@ -1661,7 +1674,10 @@ void CFVMFlowSolverBase::SumEdgeFluxes(const CGeometry* geometry) { LinSysRes.SetBlock_Zero(iPoint); + for (auto iEdge : geometry->nodes->GetEdges(iPoint)) { + const su2double* edgeflux = EdgeFluxes.GetBlock(iEdge); + //cout << "points="<edges->GetNode(iEdge,0) <<" " << geometry->edges->GetNode(iEdge,1) << endl; if (iPoint == geometry->edges->GetNode(iEdge,0)) LinSysRes.AddBlock(iPoint, EdgeFluxes.GetBlock(iEdge)); else diff --git a/SU2_CFD/include/variables/CEulerVariable.hpp b/SU2_CFD/include/variables/CEulerVariable.hpp index e9445674273..3b1c4248d64 100644 --- a/SU2_CFD/include/variables/CEulerVariable.hpp +++ b/SU2_CFD/include/variables/CEulerVariable.hpp @@ -289,6 +289,14 @@ class CEulerVariable : public CFlowVariable { for (unsigned long iDim = 0; iDim < nDim; iDim++) Res_TruncError(iPoint,iDim+1) = 0.0; } +/*! + * \brief Set the momentum part of the truncation error to zero. + * \param[in] iPoint - Point index. + */ + inline void Set_ResTruncError_Zero(unsigned long iPoint,unsigned long iVar) final { + Res_TruncError(iPoint,iVar) = 0.0; + } + /*! * \brief Specify a vector to set the velocity components of the solution. Multiplied by density for compressible cases. * \param[in] iPoint - Point index. diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index f72e2ef9c69..ac21c595df5 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -199,6 +199,14 @@ class CIncEulerVariable : public CFlowVariable { for (unsigned long iDim = 0; iDim < nDim; iDim++) Res_TruncError(iPoint,iDim+1) = 0.0; } +/*! + * \brief Set the momentum part of the truncation error to zero. + * \param[in] iPoint - Point index. + */ + inline void Set_ResTruncError_Zero(unsigned long iPoint,unsigned long iVar) final { + Res_TruncError(iPoint,iVar) = 0.0; + } + /*! * \brief Set all the primitive variables for incompressible flows. */ diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 453dca7226b..f6fd6cbb1c1 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -679,6 +679,12 @@ class CVariable { */ inline virtual void SetVel_ResTruncError_Zero(unsigned long iPoint) { } +/*! + * \brief Set the momentum part of the truncation error to zero. + * \param[in] iPoint - Point index. + */ + inline virtual void Set_ResTruncError_Zero(unsigned long iPoint,unsigned long iVar) { } + /*! * \brief Set the velocity of the truncation error to zero. * \param[in] iPoint - Point index. diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index 1ffc29364e2..fa613cfa352 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -135,9 +135,9 @@ void CIntegration::Space_Integration(CGeometry *geometry, case FAR_FIELD: solver_container[MainSolver]->BC_Far_Field(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); break; - case SYMMETRY_PLANE: - solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); - break; + //case SYMMETRY_PLANE: + // solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); + // break; } } @@ -187,6 +187,15 @@ void CIntegration::Space_Integration(CGeometry *geometry, solver_container[MainSolver]->BC_Periodic(geometry, solver_container, conv_bound_numerics, config); } + + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + KindBC = config->GetMarker_All_KindBC(iMarker); + if (KindBC == SYMMETRY_PLANE) + solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); + } + + + //AD::ResumePreaccumulation(pausePreacc); } From 44637abc71afcaa77f8d95646dc3349579258d61 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 31 Jan 2024 23:03:25 +0100 Subject: [PATCH 025/194] residual correction symmetry plane --- .../include/solvers/CFVMFlowSolverBase.hpp | 4 +- .../include/solvers/CFVMFlowSolverBase.inl | 289 +++--------------- SU2_CFD/src/numerics/flow/convection/roe.cpp | 1 + SU2_CFD/src/solvers/CIncEulerSolver.cpp | 1 - 4 files changed, 40 insertions(+), 255 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index 0bebf10d5ba..6953dd1bc59 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -197,11 +197,11 @@ class CFVMFlowSolverBase : public CSolver { #ifdef HAVE_OMP vector > EdgeColoring; /*!< \brief Edge colors. */ - bool ReducerStrategy = true; /*!< \brief If the reducer strategy is in use. */ + bool ReducerStrategy = false; /*!< \brief If the reducer strategy is in use. */ #else array, 1> EdgeColoring; /*--- Never use the reducer strategy if compiling for MPI-only. ---*/ - static constexpr bool ReducerStrategy = true; + static constexpr bool ReducerStrategy = false; #endif /*--- Edge fluxes, for OpenMP parallelization of difficult-to-color grids. diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 7d0d778ecb6..9b2c04f14f5 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -358,15 +358,12 @@ void CFVMFlowSolverBase::HybridParallelInitialization(const CConfig& confi << " the minimum edge color group size is " << minColoredEdgeColorGroupSize << "." << endl; } } - cout << "1. initialize reducerstrategy" << endl; + if (ReducerStrategy) EdgeFluxes.Initialize(geometry.GetnEdge(), geometry.GetnEdge(), nVar, nullptr); omp_chunk_size = computeStaticChunkSize(nPoint, omp_get_max_threads(), OMP_MAX_SIZE); #else EdgeColoring[0] = DummyGridColor<>(geometry.GetnEdge()); - cout << "2. initialize reducerstrategy, nedge ="<< geometry.GetnEdge()<< ", "<::PushSolutionBackInTime(unsigned long TimeIter, bo template void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) { - unsigned short iDim, iVar; - unsigned long iVertex, iPoint; - - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool viscous = config->GetViscous(); - bool preprocessed = false; + unsigned short iDim; + unsigned long iVertex; /*--- Allocation of variables necessary for convective fluxes. ---*/ - su2double Area, ProjVelocity_i, *V_reflected, *V_domain, Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; + su2double Area, Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; + - /*--- Allocation of variables necessary for viscous fluxes. ---*/ - su2double ProjGradient, ProjNormVelGrad, ProjTangVelGrad, TangentialNorm, ProjF_i, - F[MAXNVAR] = {0.0}, F_reflected[MAXNVAR] = {0.0}, - Tangential[MAXNDIM] = {0.0}, GradNormVel[MAXNDIM] = {0.0}, GradTangVel[MAXNDIM] = {0.0}; + /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. + * The components of the residual normal to the symmetry plane are then zeroed out. + * It is also necessary to correct nomal vectors of those faces of the control volume, which + * touch the boundary. The modification consists of removing all components of the face vector, + * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ - /*--- Allocation of primitive gradient arrays for viscous fluxes. ---*/ - su2activematrix Grad_Reflected(nPrimVarGrad, nDim); /*--- Loop over all the vertices on this boundary marker. ---*/ SU2_OMP_FOR_DYN(OMP_MIN_SIZE) for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { - if (!preprocessed || geometry->bound_is_straight[val_marker] != true) { - /*----------------------------------------------------------------------------------------------*/ - /*--- Preprocessing: ---*/ - /*--- Compute the unit normal and (in case of viscous flow) a corresponding unit tangential ---*/ - /*--- to that normal. On a straight(2D)/plane(3D) boundary these two vectors are constant. ---*/ - /*--- This circumstance is checked in geometry->ComputeSurf_Straightness(...) and stored ---*/ - /*--- such that the recomputation does not occur for each node. On true symmetry planes, the ---*/ - /*--- normal is constant but this routines is used for Symmetry, Euler-Wall in inviscid flow ---*/ - /*--- and Euler Wall in viscous flow as well. In the latter curvy boundaries are likely to ---*/ - /*--- happen. In doubt, the conditional above which checks straightness can be thrown out ---*/ - /*--- such that the recomputation is done for each node (which comes with a tiny performance ---*/ - /*--- penalty). ---*/ - /*----------------------------------------------------------------------------------------------*/ - - preprocessed = true; - - /*--- Normal vector for a random vertex (zero) on this marker (negate for outward convention). ---*/ + su2double Normal_Product = 0.0; geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - - /*--- Compute unit normal, to be used for unit tangential, projected velocity and velocity - component gradients. ---*/ Area = GeometryToolbox::Norm(nDim, Normal); - for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = -Normal[iDim] / Area; - - /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as - t*n=0 && |t|_2 = 1 ---*/ - - } // if bound_is_straight - - iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); - //cout << "Point = " << iPoint << endl; - const su2double* iCoord = {geometry->nodes->GetCoord(iPoint)}; - - - /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ - if (geometry->nodes->GetDomain(iPoint)) { - su2double F_Total[MAXNVAR] = {0.0}; - su2double F_Total_reflected[MAXNVAR] = {0.0}; - - // loop over neighbors of the iPoint - unsigned long jPoint = 0; - for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { - jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); - const su2double* jCoord = {geometry->nodes->GetCoord(jPoint)}; - // cout << endl << endl; - // cout << " ipoint " - // << iPoint - // << " (" - // << iCoord[0] - // << ", " - // << iCoord[1] - // <<")" - // << endl; - // cout << " jpoint " - // << jPoint - // << " (" - // << jCoord[0] - // << ", " - // << jCoord[1] - // <<")" - // << endl; - size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); - su2double* iEdgeFlux = EdgeFluxes.GetBlock(iEdge); - - - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - /*--- Compute unit normal, to be used for unit tangential, projected velocity and velocity - component gradients. ---*/ - Area = GeometryToolbox::Norm(nDim, Normal); - - for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = -Normal[iDim] / Area; - - //cout << "normal is " << Normal[0] << ", " << Normal[1] << endl; - // Momentum flux for the edge - for (iVar = 0; iVar < nPrimVar; iVar++) - F[iVar] = iEdgeFlux[iVar]; - for (iVar = 0; iVar < nPrimVar; iVar++) - F_reflected[iVar] = iEdgeFlux[iVar]; - - // cout <<"iPoint="<edges->GetNode(iEdge,0)){ - //cout << "add" << endl; - for (iVar = 0; iVar < nPrimVar; iVar++) F_Total[iVar] += F[iVar]; - for (iVar = 0; iVar < nPrimVar; iVar++) F_Total_reflected[iVar] += F_reflected[iVar]; - // LinSysRes.AddBlock(iPoint, F_reflected); - } - else { - //cout << "subtract" << endl; - for (iVar = 0; iVar < nPrimVar; iVar++) F_Total[iVar] -= F[iVar]; - for (iVar = 0; iVar < nPrimVar; iVar++) F_Total_reflected[iVar] -= F_reflected[iVar]; - // LinSysRes.SubtractBlock(iPoint, F_reflected); - } - - } - - /*-------------------------------------------------------------------------------*/ - /*--- Step 1: For the convective fluxes, create a reflected state of the ---*/ - /*--- Primitive variables by copying all interior values to the ---*/ - /*--- reflected. Only the velocity is mirrored along the symmetry ---*/ - /*--- axis. Based on the Upwind_Residual routine. ---*/ - /*-------------------------------------------------------------------------------*/ - - /*--- Allocate the reflected state at the symmetry boundary. ---*/ - V_reflected = GetCharacPrimVar(val_marker, iVertex); - - /*--- Grid movement ---*/ - if (dynamic_grid) - conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); - - /*--- Normal vector for this vertex (negate for outward convention). ---*/ - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - conv_numerics->SetNormal(Normal); - - /*--- Get current solution at this boundary node ---*/ - V_domain = nodes->GetPrimitive(iPoint); + unsigned long iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); - /*--- Set the reflected state based on the boundary node. Scalars are copied and - the velocity is mirrored along the symmetry boundary, i.e. the velocity in - normal direction is substracted twice. ---*/ - for (iVar = 0; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); + const su2double* Residual_Old = LinSysRes.GetBlock(iPoint); - /*--- Compute velocity in normal direction (ProjVelcity_i=(v*n)) und substract twice from - velocity in normal direction: v_r = v - 2 (v*n)n ---*/ - ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); - - /*--- Adjustment to v.n due to grid movement. ---*/ - if (dynamic_grid) { - ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); + for(iDim = 0; iDim < nDim; iDim++) { + UnitNormal[iDim] = Normal[iDim]/Area; + Normal_Product += Residual_Old[1 + iDim]*UnitNormal[iDim]; } - for (iDim = 0; iDim < nDim; iDim++) - V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - 2.0 * ProjVelocity_i * UnitNormal[iDim]; - - /*--- Set Primitive and Secondary for numerics class. ---*/ - conv_numerics->SetPrimitive(V_domain, V_reflected); - conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); - - /*--- Compute the residual using an upwind scheme. ---*/ - auto residual = conv_numerics->ComputeResidual(config); - - auto residual_old = LinSysRes.GetBlock(iPoint); - - // F_Total[0] = 0.0; - // F_Total[3] = 0.0; - // F_Total[4] = 0.0; - // F_Total_reflected[0] = 0.0; - // F_Total_reflected[3] = 0.0; - // F_Total_reflected[4] = 0.0; - - //cout <<"********** iPoint="<GetVelocity(iPoint, iDim); + su2double vp=0.0; + for(iDim = 0; iDim < nDim; iDim++) + vp += vel[iDim] * UnitNormal[iDim]; + su2double vt[MAXNDIM]={0.0}; + for(iDim = 0; iDim < nDim; iDim++) + vt[iDim] = vel[iDim] - vp*UnitNormal[iDim]; + // now set the normal components to zero and keep only the tangential components + // first, get the normal component of the local symmetry, which is UnitNormal + nodes->SetVelocity_Old(iPoint, vt); - // original - for (iVar = 0; iVar < nPrimVar; iVar++) - F_Total[iVar] = residual_old[iVar] + residual[iVar]; - - /*--- Update residual value ---*/ - if (geometry->nodes->Getinoutfar(iPoint)) { - for (iVar = 0; iVar < nPrimVar; iVar++) - F_Total[iVar] = residual_old[iVar] + residual[iVar]; - F_Total[2] = 0.0; - - LinSysRes.SetBlock(iPoint, F_Total); - su2double vel[MAXNDIM] = {0.0}; - for (iDim = 0; iDim < nDim; iDim++) - vel[iDim] = nodes->GetVelocity(iPoint,iDim); - //radial velocity to zero - //cout << "vel="<SetVelocity_Old(iPoint, vel); - nodes->Set_ResTruncError_Zero(iPoint,2); - Jacobian.DeleteValsRowi(iPoint*nVar +2); - - } - - else { - - F_Total[2] = 0.0; - - LinSysRes.SetBlock(iPoint, F_Total); - - - su2double vel[MAXNDIM] = {0.0}; - for (iDim = 0; iDim < nDim; iDim++) - vel[iDim] = nodes->GetVelocity(iPoint,iDim); - //radial velocity to zero - //cout << "vel="<SetVelocity_Old(iPoint, vel); - nodes->Set_ResTruncError_Zero(iPoint,2); - Jacobian.DeleteValsRowi(iPoint*nVar +2); - } - - /*--- Jacobian contribution for implicit integration. ---*/ - //if (implicit) { - // Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); - //} - - - } // if GetDomain } // for iVertex END_SU2_OMP_FOR @@ -1674,10 +1462,7 @@ void CFVMFlowSolverBase::SumEdgeFluxes(const CGeometry* geometry) { LinSysRes.SetBlock_Zero(iPoint); - for (auto iEdge : geometry->nodes->GetEdges(iPoint)) { - const su2double* edgeflux = EdgeFluxes.GetBlock(iEdge); - //cout << "points="<edges->GetNode(iEdge,0) <<" " << geometry->edges->GetNode(iEdge,1) << endl; if (iPoint == geometry->edges->GetNode(iEdge,0)) LinSysRes.AddBlock(iPoint, EdgeFluxes.GetBlock(iEdge)); else diff --git a/SU2_CFD/src/numerics/flow/convection/roe.cpp b/SU2_CFD/src/numerics/flow/convection/roe.cpp index 5b65ee8ea2c..3ea28b0f5ba 100644 --- a/SU2_CFD/src/numerics/flow/convection/roe.cpp +++ b/SU2_CFD/src/numerics/flow/convection/roe.cpp @@ -112,6 +112,7 @@ CNumerics::ResidualType<> CUpwRoeBase_Flow::ComputeResidual(const CConfig* confi /*--- Face area (norm of the normal vector) and unit normal ---*/ Area = GeometryToolbox::Norm(nDim, Normal); + for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim]/Area; diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 5765ce3bd7a..d8f53845622 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1242,7 +1242,6 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Points in edge and normal vectors ---*/ iPoint = geometry->edges->GetNode(iEdge,0); jPoint = geometry->edges->GetNode(iEdge,1); - const su2double* normalLocal = geometry->edges->GetNormal(iEdge) ; numerics->SetNormal(geometry->edges->GetNormal(iEdge)); /*--- Grid movement ---*/ From 10714185808055fe90ef6ef98cf1e35deeea668b Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 31 Jan 2024 23:24:31 +0100 Subject: [PATCH 026/194] remove unused variable --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 9b2c04f14f5..362d9dbc0a4 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1103,7 +1103,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. * The components of the residual normal to the symmetry plane are then zeroed out. - * It is also necessary to correct nomal vectors of those faces of the control volume, which + * It is also necessary to correct normal vectors of those faces of the control volume, which * touch the boundary. The modification consists of removing all components of the face vector, * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ @@ -1126,18 +1126,13 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve Normal_Product += Residual_Old[1 + iDim]*UnitNormal[iDim]; } - su2double Res_Old[MAXNVAR] = {0.0}; - Res_Old[0] = Residual_Old[0]; - Res_Old[1] = Residual_Old[1]; - Res_Old[2] = Residual_Old[2]; - su2double Residual[MAXNVAR] = {0.0}; for(iDim = 0; iDim < nDim; iDim++) Residual[1+iDim] = Normal_Product*UnitNormal[iDim]; LinSysRes.SubtractBlock(iPoint, Residual); - // also explicitly set the velocity components normal to the symmetry plane to zero. + /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. ---*/ su2double vel[MAXNDIM] = {0.0}; for(iDim = 0; iDim < nDim; iDim++) vel[iDim] = nodes->GetVelocity(iPoint, iDim); @@ -1148,12 +1143,9 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(iDim = 0; iDim < nDim; iDim++) vt[iDim] = vel[iDim] - vp*UnitNormal[iDim]; - // now set the normal components to zero and keep only the tangential components - // first, get the normal component of the local symmetry, which is UnitNormal nodes->SetVelocity_Old(iPoint, vt); - - } // for iVertex + } END_SU2_OMP_FOR } From 41b45d8657e1e16444574ceb91f50634c2a9d093 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 2 Feb 2024 10:18:49 +0100 Subject: [PATCH 027/194] finalize symmetry plane correction --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 362d9dbc0a4..adc841c2349 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1094,20 +1094,19 @@ void CFVMFlowSolverBase::PushSolutionBackInTime(unsigned long TimeIter, bo template void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); unsigned short iDim; unsigned long iVertex; /*--- Allocation of variables necessary for convective fluxes. ---*/ su2double Area, Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; - /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. * The components of the residual normal to the symmetry plane are then zeroed out. * It is also necessary to correct normal vectors of those faces of the control volume, which * touch the boundary. The modification consists of removing all components of the face vector, * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ - /*--- Loop over all the vertices on this boundary marker. ---*/ SU2_OMP_FOR_DYN(OMP_MIN_SIZE) @@ -1126,11 +1125,12 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve Normal_Product += Residual_Old[1 + iDim]*UnitNormal[iDim]; } + /*--- Keep only the tangential part of the momentum residuals ---*/ su2double Residual[MAXNVAR] = {0.0}; for(iDim = 0; iDim < nDim; iDim++) - Residual[1+iDim] = Normal_Product*UnitNormal[iDim]; + Residual[1+iDim] = Residual_Old[1+iDim] - Normal_Product*UnitNormal[iDim]; - LinSysRes.SubtractBlock(iPoint, Residual); + LinSysRes.SetBlock(iPoint, Residual); /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. ---*/ su2double vel[MAXNDIM] = {0.0}; @@ -1143,8 +1143,14 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(iDim = 0; iDim < nDim; iDim++) vt[iDim] = vel[iDim] - vp*UnitNormal[iDim]; + nodes->SetVel_ResTruncError_Zero(iPoint); + nodes->SetVelocity_Old(iPoint, vt); + if (implicit) { + for (unsigned short iVar = 1; iVar <= nDim; iVar++) + Jacobian.DeleteValsRowi(iPoint*nVar+iVar); + } } END_SU2_OMP_FOR From d81fc0e92d2def6f0cdbec8b32d3018595e9bd3e Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 4 Feb 2024 14:41:45 +0100 Subject: [PATCH 028/194] deletevalsrowi only for radial velocity --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index adc841c2349..ca52a91974b 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1127,6 +1127,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Keep only the tangential part of the momentum residuals ---*/ su2double Residual[MAXNVAR] = {0.0}; + for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) + Residual[iVar] = Residual_Old[iVar]; for(iDim = 0; iDim < nDim; iDim++) Residual[1+iDim] = Residual_Old[1+iDim] - Normal_Product*UnitNormal[iDim]; @@ -1148,8 +1150,9 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve nodes->SetVelocity_Old(iPoint, vt); if (implicit) { - for (unsigned short iVar = 1; iVar <= nDim; iVar++) - Jacobian.DeleteValsRowi(iPoint*nVar+iVar); + //for (unsigned short iVar = 1; iVar <= nDim; iVar++) + // Jacobian.DeleteValsRowi(iPoint*nVar+iVar); + Jacobian.DeleteValsRowi(iPoint*nVar+2); } } END_SU2_OMP_FOR From 4997a989bf5f841b664d1037f85b84901dffd4e6 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 4 Feb 2024 14:46:20 +0100 Subject: [PATCH 029/194] symmetry should be called before strong boundaries --- SU2_CFD/src/integration/CIntegration.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index fa613cfa352..1ffc29364e2 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -135,9 +135,9 @@ void CIntegration::Space_Integration(CGeometry *geometry, case FAR_FIELD: solver_container[MainSolver]->BC_Far_Field(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); break; - //case SYMMETRY_PLANE: - // solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); - // break; + case SYMMETRY_PLANE: + solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); + break; } } @@ -187,15 +187,6 @@ void CIntegration::Space_Integration(CGeometry *geometry, solver_container[MainSolver]->BC_Periodic(geometry, solver_container, conv_bound_numerics, config); } - - for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - KindBC = config->GetMarker_All_KindBC(iMarker); - if (KindBC == SYMMETRY_PLANE) - solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); - } - - - //AD::ResumePreaccumulation(pausePreacc); } From 9a9b02be1f034f310e3f03d4fbe29c719fb874e6 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 4 Feb 2024 22:44:00 +0100 Subject: [PATCH 030/194] activate edge correction --- Common/src/geometry/CPhysicalGeometry.cpp | 2 +- .../include/gradients/computeGradientsGreenGauss.hpp | 10 ++++++---- SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp | 1 + SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 8 ++++++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 0a747be54e3..647cf571933 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7323,7 +7323,7 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; - // edges->SetNormal(iEdge, Normal); + edges->SetNormal(iEdge, Normal); } // if in-plane of symmetry } // loop over neighbors } // loop over vertices diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index fb830aabc71..2f63d311b91 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -157,6 +157,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) = 0.0; su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint)); + for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { size_t iEdge = nodes->GetEdge(iPoint, iNeigh); size_t jPoint = nodes->GetPoint(iPoint, iNeigh); @@ -165,13 +166,14 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER * If inwards we need to flip the area vector. ---*/ su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; + su2double weight = dir * halfOnVol; const auto area = geometry.edges->GetNormal(iEdge); - /*--- Normal vector for this vertex (negate for outward convention). ---*/ + /*--- Normal vector for this vertex (negate for outward convention). ---*/ const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); - // reflected normal V=U - 2U_t + // reflected normal V = U - 2*U_t const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); su2double UnitNormal[nDim] = {0.0}; for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; @@ -247,12 +249,12 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER // this edge jPoint - jPoint is the missing edge for the symmetry computations //compute the flux on the face between iPoint and jPoint for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - // average on the face between iPoint and the midway point on the dual edge. + /*--- Average on the face between iPoint and the midway point on the dual edge. ---*/ flux[iVar] = weight * (0.75 * field(iPoint, iVar) + 0.25 *field(jPoint, iVar)); fluxReflected[iVar] = flux[iVar]; } - // find the point iPoint on the symmetry plane and get the vertex normal at ipoint wrt the symmetry plane + /*--- Get vertex normal at ipoint wrt the symmetry plane ---*/ const su2double* VertexNormal = getVertexNormalfromPoint(config, geometry,iPoint); // now reflect in the mirror diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index 6953dd1bc59..e1488797554 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -451,6 +451,7 @@ class CFVMFlowSolverBase : public CSolver { for (unsigned short iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && + (config->GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && (config->GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index ca52a91974b..60bb376eb89 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1118,6 +1118,10 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve unsigned long iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + /*--- Halo points do not need to be considered. ---*/ + + if (!geometry->nodes->GetDomain(iPoint)) continue; + const su2double* Residual_Old = LinSysRes.GetBlock(iPoint); for(iDim = 0; iDim < nDim; iDim++) { @@ -1150,8 +1154,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve nodes->SetVelocity_Old(iPoint, vt); if (implicit) { - //for (unsigned short iVar = 1; iVar <= nDim; iVar++) - // Jacobian.DeleteValsRowi(iPoint*nVar+iVar); + //for (unsigned short iDim = 0; iDim <= nDim; iDim++) + // Jacobian.DeleteValsRowi(iPoint*nVar+iDim+1); Jacobian.DeleteValsRowi(iPoint*nVar+2); } } From 95a5122ad6e715a47685fd8f5ccfb6742cad9e39 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 6 Feb 2024 06:59:20 +0100 Subject: [PATCH 031/194] new jacobian --- Common/src/geometry/CPhysicalGeometry.cpp | 4 +- .../include/solvers/CFVMFlowSolverBase.inl | 38 ++++++++++++++++--- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 647cf571933..268ac339252 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7312,18 +7312,16 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } if (abs(Product) < EPS) { - cout << "iPoint " << iPoint << " and jPoint " << jPoint << " are in the symmetry plane " << endl; Product = 0.0; unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); su2double Normal[MAXNDIM] = {0.0}; edges->GetNormal(iEdge, Normal); - cout << "normal=" << Normal[0] << " " << Normal[1] << endl; for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; - edges->SetNormal(iEdge, Normal); + edges->SetNormal(iEdge, Normal); } // if in-plane of symmetry } // loop over neighbors } // loop over vertices diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 60bb376eb89..070349c03b9 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -32,6 +32,7 @@ #include "../numerics_simd/CNumericsSIMD.hpp" #include "CFVMFlowSolverBase.hpp" + template void CFVMFlowSolverBase::AeroCoeffsArray::allocate(int size) { _size = size; @@ -1153,13 +1154,38 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve nodes->SetVelocity_Old(iPoint, vt); - if (implicit) { - //for (unsigned short iDim = 0; iDim <= nDim; iDim++) - // Jacobian.DeleteValsRowi(iPoint*nVar+iDim+1); - Jacobian.DeleteValsRowi(iPoint*nVar+2); - } + if (implicit) { + + su2double mat[MAXNVAR * MAXNVAR] = {}; + + for (unsigned short iVar = 0; iVar < nVar; iVar++) + mat[iVar * nVar + iVar] = 1; + for (unsigned short iDim = 0; iDim < nDim; iDim++) + for (unsigned short jDim = 0; jDim < nDim; jDim++) + mat[(iDim + prim_idx.Velocity()) * nVar + jDim + prim_idx.Velocity()] -= UnitNormal[iDim] * UnitNormal[jDim]; + + auto* block = Jacobian.GetBlock(iPoint, iPoint); + su2double jac[MAXNVAR * MAXNVAR], newJac[MAXNVAR * MAXNVAR]; + for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) + jac[iVar] = block[iVar]; + CBlasStructure().gemm(nVar, nVar, nVar, jac, mat, newJac, config); + for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) + block[iVar] = SU2_TYPE::GetValue(newJac[iVar]); + + for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { + unsigned long jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); + block = Jacobian.GetBlock(iPoint, jPoint); + for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) + jac[iVar] = block[iVar]; + CBlasStructure().gemm(nVar, nVar, nVar, jac, mat, newJac, config); + for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) + block[iVar] = SU2_TYPE::GetValue(newJac[iVar]); + + } + } - END_SU2_OMP_FOR +} +END_SU2_OMP_FOR } From b0d7a60655273f51acaaab24cfc2529ab7a435b2 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Fri, 9 Feb 2024 22:49:06 -0800 Subject: [PATCH 032/194] fix diagonal dominance of the Jacobian --- .../include/solvers/CFVMFlowSolverBase.inl | 142 +++++++++--------- 1 file changed, 68 insertions(+), 74 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 070349c03b9..cfb44243c58 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1096,11 +1096,7 @@ template void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) { const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - unsigned short iDim; - unsigned long iVertex; - - /*--- Allocation of variables necessary for convective fluxes. ---*/ - su2double Area, Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; + const auto iVel = prim_idx.Velocity(); /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. * The components of the residual normal to the symmetry plane are then zeroed out. @@ -1111,82 +1107,80 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Loop over all the vertices on this boundary marker. ---*/ SU2_OMP_FOR_DYN(OMP_MIN_SIZE) - for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { - - su2double Normal_Product = 0.0; - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - Area = GeometryToolbox::Norm(nDim, Normal); - - unsigned long iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + for (auto iVertex = 0ul; iVertex < geometry->nVertex[val_marker]; iVertex++) { + const auto iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); - /*--- Halo points do not need to be considered. ---*/ + /*--- Halo points do not need to be considered. ---*/ + if (!geometry->nodes->GetDomain(iPoint)) continue; - if (!geometry->nodes->GetDomain(iPoint)) continue; + su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + const su2double Area = GeometryToolbox::Norm(nDim, Normal); - const su2double* Residual_Old = LinSysRes.GetBlock(iPoint); + /*--- Keep only the tangential part of the momentum residuals. ---*/ + su2double NormalProduct = 0.0; + for(unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormal[iDim] = Normal[iDim] / Area; + NormalProduct += LinSysRes(iPoint, iVel + iDim) * UnitNormal[iDim]; + } + for(unsigned short iDim = 0; iDim < nDim; iDim++) + LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; + + /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. + * This is necessary because the modification of the residula leaves the problem + * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ + su2double vel[MAXNDIM] = {0.0}; + for(unsigned short iDim = 0; iDim < nDim; iDim++) + vel[iDim] = nodes->GetVelocity(iPoint, iDim); + + const su2double vp = GeometryToolbox::DotProduct(MAXNDIM, vel, UnitNormal); + for(unsigned short iDim = 0; iDim < nDim; iDim++) + vel[iDim] -= vp * UnitNormal[iDim]; + + nodes->SetVel_ResTruncError_Zero(iPoint); + + nodes->SetVelocity_Old(iPoint, vel); + + if (implicit) { + /*--- Modify the Jacobians according to the modification of the residual + * J_new = J * (I - n * n^T) where n = {0, nx, ny, nz, 0, ...} ---*/ + su2double mat[MAXNVAR * MAXNVAR] = {}; + + for (unsigned short iVar = 0; iVar < nVar; iVar++) + mat[iVar * nVar + iVar] = 1; + for (unsigned short iDim = 0; iDim < nDim; iDim++) + for (unsigned short jDim = 0; jDim < nDim; jDim++) + mat[(iDim + iVel) * nVar + jDim + iVel] -= UnitNormal[iDim] * UnitNormal[jDim]; + + auto ModifyJacobian = [&](const unsigned long jPoint) { + su2double jac[MAXNVAR * MAXNVAR], newJac[MAXNVAR * MAXNVAR]; + auto* block = Jacobian.GetBlock(iPoint, jPoint); + for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) jac[iVar] = block[iVar]; + + CBlasStructure().gemm(nVar, nVar, nVar, jac, mat, newJac, config); + + for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) + block[iVar] = SU2_TYPE::GetValue(newJac[iVar]); + + /*--- The modification also leaves the Jacobian ill-conditioned. Similar to setting + * the normal velocity we need to recover the diagonal dominance of the Jacobian. ---*/ + if (jPoint == iPoint) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + for (unsigned short jDim = 0; jDim < nDim; jDim++) { + const auto k = (iDim + iVel) * nVar + jDim + iVel; + block[k] += SU2_TYPE::GetValue(UnitNormal[iDim] * UnitNormal[jDim]); + } + } + } + }; + ModifyJacobian(iPoint); - for(iDim = 0; iDim < nDim; iDim++) { - UnitNormal[iDim] = Normal[iDim]/Area; - Normal_Product += Residual_Old[1 + iDim]*UnitNormal[iDim]; + for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { + ModifyJacobian(geometry->nodes->GetPoint(iPoint, iNeigh)); } - - /*--- Keep only the tangential part of the momentum residuals ---*/ - su2double Residual[MAXNVAR] = {0.0}; - for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) - Residual[iVar] = Residual_Old[iVar]; - for(iDim = 0; iDim < nDim; iDim++) - Residual[1+iDim] = Residual_Old[1+iDim] - Normal_Product*UnitNormal[iDim]; - - LinSysRes.SetBlock(iPoint, Residual); - - /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. ---*/ - su2double vel[MAXNDIM] = {0.0}; - for(iDim = 0; iDim < nDim; iDim++) - vel[iDim] = nodes->GetVelocity(iPoint, iDim); - su2double vp=0.0; - for(iDim = 0; iDim < nDim; iDim++) - vp += vel[iDim] * UnitNormal[iDim]; - su2double vt[MAXNDIM]={0.0}; - for(iDim = 0; iDim < nDim; iDim++) - vt[iDim] = vel[iDim] - vp*UnitNormal[iDim]; - - nodes->SetVel_ResTruncError_Zero(iPoint); - - nodes->SetVelocity_Old(iPoint, vt); - - if (implicit) { - - su2double mat[MAXNVAR * MAXNVAR] = {}; - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - mat[iVar * nVar + iVar] = 1; - for (unsigned short iDim = 0; iDim < nDim; iDim++) - for (unsigned short jDim = 0; jDim < nDim; jDim++) - mat[(iDim + prim_idx.Velocity()) * nVar + jDim + prim_idx.Velocity()] -= UnitNormal[iDim] * UnitNormal[jDim]; - - auto* block = Jacobian.GetBlock(iPoint, iPoint); - su2double jac[MAXNVAR * MAXNVAR], newJac[MAXNVAR * MAXNVAR]; - for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) - jac[iVar] = block[iVar]; - CBlasStructure().gemm(nVar, nVar, nVar, jac, mat, newJac, config); - for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) - block[iVar] = SU2_TYPE::GetValue(newJac[iVar]); - - for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { - unsigned long jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); - block = Jacobian.GetBlock(iPoint, jPoint); - for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) - jac[iVar] = block[iVar]; - CBlasStructure().gemm(nVar, nVar, nVar, jac, mat, newJac, config); - for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) - block[iVar] = SU2_TYPE::GetValue(newJac[iVar]); - } - } -} -END_SU2_OMP_FOR - + END_SU2_OMP_FOR } template From f7ecaebd0b561ce5ad2cb4be2296a5ef342c21cd Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 12 Feb 2024 08:31:26 +0100 Subject: [PATCH 033/194] clean up --- Common/src/CConfig.cpp | 2 +- .../gradients/computeGradientsGreenGauss.hpp | 62 +++++++++++++++---- .../include/solvers/CFVMFlowSolverBase.hpp | 2 +- 3 files changed, 52 insertions(+), 14 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index bfc9445ba7e..a9add7e8a78 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -7944,7 +7944,7 @@ bool CConfig::GetSolid_Wall(unsigned short iMarker) const { // nijso: temporary bool CConfig::Getinoutfar(unsigned short iMarker) const { - return (Marker_All_KindBC[iMarker] == INLET_FLOW || Marker_All_KindBC[iMarker] == OUTLET_FLOW); + return (Marker_All_KindBC[iMarker] == INLET_FLOW || Marker_All_KindBC[iMarker] == OUTLET_FLOW || Marker_All_KindBC[iMarker] == FAR_FIELD ); } bool CConfig::GetSymmetry(unsigned short iMarker) const { diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 2f63d311b91..cfd46bc62dc 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -77,6 +77,11 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER size_t varEnd, GradientType& gradient) { const size_t nPointDomain = geometry.GetnPointDomain(); + +cout << "Green Gauss: solver name = " << solver->GetSolverName() << endl; +cout << "number of variables = " << varEnd << endl; +cout << "commtype= = " << kindMpiComm << endl; + #ifdef HAVE_OMP constexpr size_t OMP_MAX_CHUNK = 512; @@ -175,25 +180,45 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER // reflected normal V = U - 2*U_t const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); + su2double UnitNormal[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; + for (size_t iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = VertexNormal[iDim] / NormArea; + su2double ProjArea = 0.0; - for (unsigned long iDim = 0; iDim < nDim; iDim++) ProjArea += area[iDim] * UnitNormal[iDim]; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + ProjArea += area[iDim] * UnitNormal[iDim]; + su2double areaReflected[nDim] = {0.0}; for (size_t iDim = 0; iDim < nDim; iDim++) areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; + /*--- Reflected flux for scalars is the same as original flux ---*/ for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { flux[iVar] = weight * (field(iPoint, iVar) + field(jPoint, iVar)); fluxReflected[iVar] = flux[iVar]; } - su2double ProjFlux = 0.0; - for (size_t iDim = 0; iDim < nDim; iDim++) ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - for (size_t iDim = 0; iDim < nDim; iDim++) - fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + /*--- If we are axisymmetric ---*/ + if (kindMpiComm == AUXVAR_GRADIENT) { + gradient(iPoint, 0, 0) = 0.0; + gradient(iPoint, 1, 0) = 0.0; + gradient(iPoint, 2, 0) = 0.0; + gradient(iPoint, 2, 1) = 0.0; + + } else { + su2double ProjFlux = 0.0; + for (size_t iDim = 0; iDim < nDim; iDim++) + ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + + /*--- Reflected flux for the velocities ---*/ + for (size_t iDim = 0; iDim < nDim; iDim++) + fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + } + + /*--- Loop over all variables and compute the total gradient from the flux + mirrored flux---*/ for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { for (size_t iDim = 0; iDim < nDim; ++iDim) { // factor 1/2 comes from the volume, which is twice as large due to mirroring @@ -203,6 +228,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } + } // loop over the edges } //ivertex @@ -243,7 +269,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER jPoint = nodes->GetPoint(iPoint, iNeigh); if (nodes->Getinoutfar(jPoint) || nodes->GetSolidBoundary(jPoint)) { - su2double dir = 1.0; //(iPoint < jPoint) ? 1.0 : -1.0; + su2double dir = 1.0; su2double weight = dir / (2.0*volume); // this edge jPoint - jPoint is the missing edge for the symmetry computations @@ -272,11 +298,23 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iDim = 0; iDim < nDim; iDim++) areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; - su2double ProjFlux = 0.0; - for (size_t iDim = 0; iDim < nDim; iDim++) - ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; - for (size_t iDim = 0; iDim < nDim; iDim++) { - fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + if (kindMpiComm == AUXVAR_GRADIENT) { + gradient(iPoint, 0, 0) = 0.0; + gradient(iPoint, 1, 0) = 0.0; + gradient(iPoint, 2, 0) = 0.0; + gradient(iPoint, 2, 1) = 0.0; + + } else { + + + su2double ProjFlux = 0.0; + for (size_t iDim = 0; iDim < nDim; iDim++) + ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + + /*--- Reflect the velocity components ---*/ + for (size_t iDim = 0; iDim < nDim; iDim++) { + fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + } } for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index e1488797554..a68f6ee4d3c 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -451,7 +451,7 @@ class CFVMFlowSolverBase : public CSolver { for (unsigned short iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && - (config->GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && + //(config->GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && (config->GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { From 8316f2c49c6fd532dcb24d61bcbf4ba1a3653751 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 17 Feb 2024 09:03:00 +0100 Subject: [PATCH 034/194] replace GG gradients with Tobi-Edwin method --- .../gradients/computeGradientsGreenGauss.hpp | 303 +++++++++--------- .../include/solvers/CFVMFlowSolverBase.inl | 2 +- SU2_CFD/src/integration/CIntegration.cpp | 3 +- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 2 +- SU2_CFD/src/solvers/CSolver.cpp | 2 + 5 files changed, 150 insertions(+), 162 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index cfd46bc62dc..451cd484d3a 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -81,6 +81,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER cout << "Green Gauss: solver name = " << solver->GetSolverName() << endl; cout << "number of variables = " << varEnd << endl; cout << "commtype= = " << kindMpiComm << endl; +cout << "viscous = " << config.GetViscous(); #ifdef HAVE_OMP constexpr size_t OMP_MAX_CHUNK = 512; @@ -89,6 +90,10 @@ cout << "commtype= = " << kindMpiComm << endl; #endif static constexpr size_t MAXNVAR = 20; + static constexpr size_t MAXNDIM = 3; + + /*--- Allocation of primitive gradient arrays for viscous fluxes. ---*/ + su2activematrix Grad_Reflected(varEnd, nDim); /*--- For each (non-halo) volume integrate over its faces (edges). ---*/ @@ -142,13 +147,49 @@ cout << "commtype= = " << kindMpiComm << endl; } END_SU2_OMP_FOR + su2double flux[MAXNVAR] = {0.0}; + //su2double fluxReflected[MAXNVAR] = {0.0}; + + /*--- Add edges of markers that contribute to the gradients ---*/ + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { + if ((config.GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && + (config.GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && + (config.GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && + (config.GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { + + /*--- Work is shared in inner loop as two markers + * may try to update the same point. ---*/ + + SU2_OMP_FOR_STAT(32) + for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { + size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); + auto nodes = geometry.nodes; + + /*--- Halo points do not need to be considered. ---*/ + + if (!nodes->GetDomain(iPoint)) continue; + + su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); + const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); + + for (size_t iVar = varBegin; iVar < varEnd; iVar++) + flux[iVar] = field(iPoint,iVar) / volume; + + for (size_t iVar = varBegin; iVar < varEnd; iVar++) { + for (size_t iDim = 0; iDim < nDim; iDim++) { + gradient(iPoint, iVar, iDim) -= flux[iVar] * area[iDim]; + } + } // loop over variables + } // vertices + END_SU2_OMP_FOR + } //found right marker + } // iMarkers + /* For symmetry planes, we need to impose the conditions (Blazek eq. 8.40): * 1. n.grad(phi) = 0 * 2. n.grad(v.t) = 0 * 3. t.grad(v.n) = 0 */ - su2double flux[MAXNVAR] = {0.0}; - su2double fluxReflected[MAXNVAR] = {0.0}; for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { @@ -158,188 +199,132 @@ cout << "commtype= = " << kindMpiComm << endl; auto nodes = geometry.nodes; // we need to set the gradient to zero for the entire marker to prevent double-counting // points that are shared by other markers - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) = 0.0; + //for (size_t iVar = varBegin; iVar < varEnd; ++iVar) + // for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) = 0.0; su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint)); - for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { - size_t iEdge = nodes->GetEdge(iPoint, iNeigh); - size_t jPoint = nodes->GetPoint(iPoint, iNeigh); - - /*--- Determine if edge points inwards or outwards of iPoint. - * If inwards we need to flip the area vector. ---*/ - - su2double dir = (iPoint < jPoint) ? 1.0 : -1.0; - - su2double weight = dir * halfOnVol; - const auto area = geometry.edges->GetNormal(iEdge); + /*--- Normal vector for this vertex (negate for outward convention). ---*/ + const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); - /*--- Normal vector for this vertex (negate for outward convention). ---*/ - const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); + // reflected normal V = U - 2*U_t + const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); - // reflected normal V = U - 2*U_t - const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); + su2double UnitNormal[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - su2double UnitNormal[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; iDim++) - UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - - su2double ProjArea = 0.0; - for (unsigned long iDim = 0; iDim < nDim; iDim++) - ProjArea += area[iDim] * UnitNormal[iDim]; - - su2double areaReflected[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; iDim++) - areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; - - /*--- Reflected flux for scalars is the same as original flux ---*/ - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - flux[iVar] = weight * (field(iPoint, iVar) + field(jPoint, iVar)); - fluxReflected[iVar] = flux[iVar]; + /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as + t*n=0 && |t|_2 = 1 ---*/ + su2double TangentialNorm, Tangential[MAXNDIM] = {0.0}; + switch (nDim) { + case 2: { + Tangential[0] = -UnitNormal[1]; + Tangential[1] = UnitNormal[0]; + break; } + case 3: { + /*--- n = ai + bj + ck, if |b| > |c| ---*/ + if (abs(UnitNormal[1]) > abs(UnitNormal[2])) { + /*--- t = bi + (c-a)j - bk ---*/ + Tangential[0] = UnitNormal[1]; + Tangential[1] = UnitNormal[2] - UnitNormal[0]; + Tangential[2] = -UnitNormal[1]; + } else { + /*--- t = ci - cj + (b-a)k ---*/ + Tangential[0] = UnitNormal[2]; + Tangential[1] = -UnitNormal[2]; + Tangential[2] = UnitNormal[1] - UnitNormal[0]; + } + /*--- Make it a unit vector. ---*/ + TangentialNorm = sqrt(pow(Tangential[0], 2) + pow(Tangential[1], 2) + pow(Tangential[2], 2)); + Tangential[0] = Tangential[0] / TangentialNorm; + Tangential[1] = Tangential[1] / TangentialNorm; + Tangential[2] = Tangential[2] / TangentialNorm; + break; + } + } // switch - /*--- If we are axisymmetric ---*/ - if (kindMpiComm == AUXVAR_GRADIENT) { - gradient(iPoint, 0, 0) = 0.0; - gradient(iPoint, 1, 0) = 0.0; - gradient(iPoint, 2, 0) = 0.0; - gradient(iPoint, 2, 1) = 0.0; + /*--- Get gradients of primitives of boundary cell ---*/ + for (auto iVar = varBegin; iVar < varEnd; iVar++) + for (auto iDim = 0u; iDim < nDim; iDim++) + Grad_Reflected[iVar][iDim] = gradient(iPoint, iVar, iDim); - } else { - su2double ProjFlux = 0.0; - for (size_t iDim = 0; iDim < nDim; iDim++) - ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + /*--- Reflect the gradients for all scalars including the velocity components. + The gradients of the velocity components are set later with the + correct values: grad(V)_r = grad(V) - 2 [grad(V)*n]n, V being any primitive ---*/ + for (auto iVar = varBegin; iVar < varEnd; iVar++) { + // For the auxiliary variable we do not have velocity vectors. But the gradients of the auxvars + // do not seem to be used so this has no effect on the computations. + if (iVar == 0 || iVar > nDim || kindMpiComm==12) { // Exclude velocity component gradients - /*--- Reflected flux for the velocities ---*/ - for (size_t iDim = 0; iDim < nDim; iDim++) - fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; + /*--- Compute projected part of the gradient in a dot product ---*/ + su2double ProjGradient = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) ProjGradient += Grad_Reflected[iVar][iDim] * UnitNormal[iDim]; + for (auto iDim = 0u; iDim < nDim; iDim++) + Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; } + } - /*--- Loop over all variables and compute the total gradient from the flux + mirrored flux---*/ - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - for (size_t iDim = 0; iDim < nDim; ++iDim) { - // factor 1/2 comes from the volume, which is twice as large due to mirroring - gradient(iPoint, iVar, iDim) += 0.5 * (flux[iVar] * area[iDim] + fluxReflected[iVar] * - areaReflected[iDim]); - + /*--- Compute gradients of normal and tangential velocity: + grad(v*n) = grad(v_x) n_x + grad(v_y) n_y (+ grad(v_z) n_z) + grad(v*t) = grad(v_x) t_x + grad(v_y) t_y (+ grad(v_z) t_z) ---*/ + + /*--- if we do not have auxiliary gradients ---*/ + if (kindMpiComm!=12) { + su2double GradNormVel[MAXNVAR] = {0.0}; + su2double GradTangVel[MAXNVAR] = {0.0}; + for (auto iVar = 0u; iVar < nDim; iVar++) { // counts gradient components + GradNormVel[iVar] = 0.0; + GradTangVel[iVar] = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) { // counts sum with unit normal/tangential + GradNormVel[iVar] += Grad_Reflected[iDim + 1][iVar] * UnitNormal[iDim]; + GradTangVel[iVar] += Grad_Reflected[iDim + 1][iVar] * Tangential[iDim]; } } - } // loop over the edges - - } //ivertex - } //symmetry - } //loop over markers - - - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { - if ((config.GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && - (config.GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && - (config.GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && - (config.GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { - - /*--- Work is shared in inner loop as two markers - * may try to update the same point. ---*/ - - SU2_OMP_FOR_STAT(32) - for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { - size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - auto nodes = geometry.nodes; - - /*--- Halo points do not need to be considered. ---*/ - - if (!nodes->GetDomain(iPoint)) continue; + /*--- Reflect gradients in tangential and normal direction by substracting the normal/tangential + component twice, just as done with velocity above. + grad(v*n)_r = grad(v*n) - 2 {grad([v*n])*t}t + grad(v*t)_r = grad(v*t) - 2 {grad([v*t])*n}n ---*/ + su2double ProjNormVelGrad = 0.0; + su2double ProjTangVelGrad = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) { + ProjNormVelGrad += GradNormVel[iDim] * Tangential[iDim]; // grad([v*n])*t + ProjTangVelGrad += GradTangVel[iDim] * UnitNormal[iDim]; // grad([v*t])*n + } - su2double volume = nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint); - const auto area = geometry.vertex[iMarker][iVertex]->GetNormal(); + for (auto iDim = 0u; iDim < nDim; iDim++) { + GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; + GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; + } - // When the node is shared with a symmetry we need to mirror the contribution of - // the face that is coincident with the inlet/outlet - if ( (nodes->GetSymmetry(iPoint) && nodes->Getinoutfar(iPoint)) || - (nodes->GetSymmetry(iPoint) && nodes->GetSolidBoundary(iPoint)) ) { - // we have to find the edges that were missing in the symmetry computations. - // So we find the jPoints that are on the inlet plane - // so we loop over all neighbor of iPoint, find all jPoints and then check if it is on the inlet - unsigned long jPoint = 0; - for (size_t iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { - jPoint = nodes->GetPoint(iPoint, iNeigh); - if (nodes->Getinoutfar(jPoint) || nodes->GetSolidBoundary(jPoint)) { - - su2double dir = 1.0; - su2double weight = dir / (2.0*volume); - - // this edge jPoint - jPoint is the missing edge for the symmetry computations - //compute the flux on the face between iPoint and jPoint - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - /*--- Average on the face between iPoint and the midway point on the dual edge. ---*/ - flux[iVar] = weight * (0.75 * field(iPoint, iVar) + 0.25 *field(jPoint, iVar)); - fluxReflected[iVar] = flux[iVar]; + /*--- Transfer reflected gradients back into the Cartesian Coordinate system: + grad(v_x)_r = grad(v*n)_r n_x + grad(v*t)_r t_x + grad(v_y)_r = grad(v*n)_r n_y + grad(v*t)_r t_y + ( grad(v_z)_r = grad(v*n)_r n_z + grad(v*t)_r t_z ) ---*/ + for (auto iVar = 0u; iVar < nDim; iVar++) // loops over the velocity component gradients + for (auto iDim = 0u; iDim < nDim; iDim++) { // loops over the entries of the above + Grad_Reflected[iVar + 1][iDim] = + GradNormVel[iDim] * UnitNormal[iVar] + GradTangVel[iDim] * Tangential[iVar]; + // at this point, the gradients are done. + //cout << "grad = " << Grad_Reflected[iVar + 1][iDim] << " " << gradient(iPoint,iVar+1,iDim) << endl; } + } - /*--- Get vertex normal at ipoint wrt the symmetry plane ---*/ - const su2double* VertexNormal = getVertexNormalfromPoint(config, geometry,iPoint); - - // now reflect in the mirror - // reflected normal V=U - 2U_t - const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); - su2double UnitNormal[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; iDim++) - UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - - su2double ProjArea = 0.0; - for (unsigned long iDim = 0; iDim < nDim; iDim++) - ProjArea += area[iDim] * UnitNormal[iDim]; - - su2double areaReflected[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; iDim++) - areaReflected[iDim] = area[iDim] - 2.0 * ProjArea * UnitNormal[iDim]; - - if (kindMpiComm == AUXVAR_GRADIENT) { - gradient(iPoint, 0, 0) = 0.0; - gradient(iPoint, 1, 0) = 0.0; - gradient(iPoint, 2, 0) = 0.0; - gradient(iPoint, 2, 1) = 0.0; - - } else { - - - su2double ProjFlux = 0.0; - for (size_t iDim = 0; iDim < nDim; iDim++) - ProjFlux += flux[iDim + 1] * UnitNormal[iDim]; + /*--- Update gradients with reflected gradients ---*/ + for (auto iVar = varBegin; iVar < varEnd; iVar++) + for (auto iDim = 0u; iDim < nDim; iDim++) + gradient(iPoint,iVar,iDim) = Grad_Reflected[iVar][iDim]; - /*--- Reflect the velocity components ---*/ - for (size_t iDim = 0; iDim < nDim; iDim++) { - fluxReflected[iDim + 1] = flux[iDim + 1] - 2.0 * ProjFlux * UnitNormal[iDim]; - } - } - - for (size_t iVar = varBegin; iVar < varEnd; ++iVar) { - for (size_t iDim = 0; iDim < nDim; ++iDim) { - gradient(iPoint, iVar, iDim) -= (flux[iVar] * area[iDim] + fluxReflected[iVar]*areaReflected[iDim]) ; - } - } - } - } - } else { - for (size_t iVar = varBegin; iVar < varEnd; iVar++) - flux[iVar] = field(iPoint,iVar) / volume; + } //ivertex + } //symmetry + } //loop over markers - // if we are on a marker but not on a shared point between a symmetry and an inlet/outlet - for (size_t iVar = varBegin; iVar < varEnd; iVar++) { - for (size_t iDim = 0; iDim < nDim; iDim++) { - gradient(iPoint, iVar, iDim) -= flux[iVar] * area[iDim]; - } - } // loop over variables - } - } // vertices - END_SU2_OMP_FOR - } //found right marker - } // iMarkers /*--- If no solver was provided we do not communicate ---*/ diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index cfb44243c58..657f2e05269 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1127,7 +1127,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. - * This is necessary because the modification of the residula leaves the problem + * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ su2double vel[MAXNDIM] = {0.0}; for(unsigned short iDim = 0; iDim < nDim; iDim++) diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index ca612e7d236..c7458ef32d2 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -91,7 +91,7 @@ void CIntegration::Space_Integration(CGeometry *geometry, BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { if (config->GetBoolTurbomachinery()){ - /*--- Average quantities at the inflow and outflow boundaries ---*/ + /*--- Average quantities at the inflow and outflow boundaries ---*/ solver_container[MainSolver]->TurboAverageProcess(solver_container, geometry,config,INFLOW); solver_container[MainSolver]->TurboAverageProcess(solver_container, geometry, config, OUTFLOW); } @@ -196,6 +196,7 @@ void CIntegration::Space_Integration(CGeometry *geometry, solver_container[MainSolver]->BC_Periodic(geometry, solver_container, conv_bound_numerics, config); } + //AD::ResumePreaccumulation(pausePreacc); } diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index d8f53845622..e643209012c 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1503,7 +1503,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- For viscous problems, we need an additional gradient. ---*/ if (viscous) { - + cout << "incompressible solver, auxiliary variables " << endl; AD::StartNoSharedReading(); SU2_OMP_FOR_STAT(omp_chunk_size) diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 5cd2fd93425..bed20ecdea0 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -2096,6 +2096,8 @@ void CSolver::SetAuxVar_Gradient_GG(CGeometry *geometry, const CConfig *config) const auto& solution = base_nodes->GetAuxVar(); auto& gradient = base_nodes->GetAuxVarGradient(); + cout <<"set auxiliary variables, nvar=" << base_nodes->GetnAuxVar() << endl; + computeGradientsGreenGauss(this, AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, *config, solution, 0, base_nodes->GetnAuxVar(), gradient); } From 0c21b4844e85ca69919db509919fe04a9fb6f6af Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 17 Feb 2024 09:11:11 +0100 Subject: [PATCH 035/194] small cleanup --- .../gradients/computeGradientsGreenGauss.hpp | 77 +++++++++---------- 1 file changed, 36 insertions(+), 41 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 451cd484d3a..3b3176c319f 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -148,7 +148,6 @@ cout << "viscous = " << config.GetViscous(); END_SU2_OMP_FOR su2double flux[MAXNVAR] = {0.0}; - //su2double fluxReflected[MAXNVAR] = {0.0}; /*--- Add edges of markers that contribute to the gradients ---*/ for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { @@ -257,7 +256,7 @@ cout << "viscous = " << config.GetViscous(); for (auto iVar = varBegin; iVar < varEnd; iVar++) { // For the auxiliary variable we do not have velocity vectors. But the gradients of the auxvars // do not seem to be used so this has no effect on the computations. - if (iVar == 0 || iVar > nDim || kindMpiComm==12) { // Exclude velocity component gradients + if (iVar == 0 || iVar > nDim) { // We should exclude here for instance AuxVars for axisymmetry? /*--- Compute projected part of the gradient in a dot product ---*/ su2double ProjGradient = 0.0; @@ -273,54 +272,50 @@ cout << "viscous = " << config.GetViscous(); grad(v*t) = grad(v_x) t_x + grad(v_y) t_y (+ grad(v_z) t_z) ---*/ /*--- if we do not have auxiliary gradients ---*/ - if (kindMpiComm!=12) { - su2double GradNormVel[MAXNVAR] = {0.0}; - su2double GradTangVel[MAXNVAR] = {0.0}; - for (auto iVar = 0u; iVar < nDim; iVar++) { // counts gradient components - GradNormVel[iVar] = 0.0; - GradTangVel[iVar] = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) { // counts sum with unit normal/tangential - GradNormVel[iVar] += Grad_Reflected[iDim + 1][iVar] * UnitNormal[iDim]; - GradTangVel[iVar] += Grad_Reflected[iDim + 1][iVar] * Tangential[iDim]; - } - } - - - /*--- Reflect gradients in tangential and normal direction by substracting the normal/tangential - component twice, just as done with velocity above. - grad(v*n)_r = grad(v*n) - 2 {grad([v*n])*t}t - grad(v*t)_r = grad(v*t) - 2 {grad([v*t])*n}n ---*/ - su2double ProjNormVelGrad = 0.0; - su2double ProjTangVelGrad = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) { - ProjNormVelGrad += GradNormVel[iDim] * Tangential[iDim]; // grad([v*n])*t - ProjTangVelGrad += GradTangVel[iDim] * UnitNormal[iDim]; // grad([v*t])*n + su2double GradNormVel[MAXNVAR] = {0.0}; + su2double GradTangVel[MAXNVAR] = {0.0}; + for (auto iVar = 0u; iVar < nDim; iVar++) { // counts gradient components + GradNormVel[iVar] = 0.0; + GradTangVel[iVar] = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) { // counts sum with unit normal/tangential + GradNormVel[iVar] += Grad_Reflected[iDim + 1][iVar] * UnitNormal[iDim]; + GradTangVel[iVar] += Grad_Reflected[iDim + 1][iVar] * Tangential[iDim]; } + } - for (auto iDim = 0u; iDim < nDim; iDim++) { - GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; - GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; - } + /*--- Reflect gradients in tangential and normal direction by substracting the normal/tangential + component twice, just as done with velocity above. + grad(v*n)_r = grad(v*n) - 2 {grad([v*n])*t}t + grad(v*t)_r = grad(v*t) - 2 {grad([v*t])*n}n ---*/ + su2double ProjNormVelGrad = 0.0; + su2double ProjTangVelGrad = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) { + ProjNormVelGrad += GradNormVel[iDim] * Tangential[iDim]; // grad([v*n])*t + ProjTangVelGrad += GradTangVel[iDim] * UnitNormal[iDim]; // grad([v*t])*n + } - /*--- Transfer reflected gradients back into the Cartesian Coordinate system: - grad(v_x)_r = grad(v*n)_r n_x + grad(v*t)_r t_x - grad(v_y)_r = grad(v*n)_r n_y + grad(v*t)_r t_y - ( grad(v_z)_r = grad(v*n)_r n_z + grad(v*t)_r t_z ) ---*/ - for (auto iVar = 0u; iVar < nDim; iVar++) // loops over the velocity component gradients - for (auto iDim = 0u; iDim < nDim; iDim++) { // loops over the entries of the above - Grad_Reflected[iVar + 1][iDim] = - GradNormVel[iDim] * UnitNormal[iVar] + GradTangVel[iDim] * Tangential[iVar]; - // at this point, the gradients are done. - //cout << "grad = " << Grad_Reflected[iVar + 1][iDim] << " " << gradient(iPoint,iVar+1,iDim) << endl; - } + for (auto iDim = 0u; iDim < nDim; iDim++) { + GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; + GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; } - /*--- Update gradients with reflected gradients ---*/ + /*--- Transfer reflected gradients back into the Cartesian Coordinate system: + grad(v_x)_r = grad(v*n)_r n_x + grad(v*t)_r t_x + grad(v_y)_r = grad(v*n)_r n_y + grad(v*t)_r t_y + ( grad(v_z)_r = grad(v*n)_r n_z + grad(v*t)_r t_z ) ---*/ + for (auto iVar = 0u; iVar < nDim; iVar++) // loops over the velocity component gradients + for (auto iDim = 0u; iDim < nDim; iDim++) { // loops over the entries of the above + Grad_Reflected[iVar + 1][iDim] = + GradNormVel[iDim] * UnitNormal[iVar] + GradTangVel[iDim] * Tangential[iVar]; + // at this point, the gradients are done. + //cout << "grad = " << Grad_Reflected[iVar + 1][iDim] << " " << gradient(iPoint,iVar+1,iDim) << endl; + } + + /*--- Update gradients with reflected gradients ---*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) for (auto iDim = 0u; iDim < nDim; iDim++) gradient(iPoint,iVar,iDim) = Grad_Reflected[iVar][iDim]; - } //ivertex } //symmetry } //loop over markers From 5e3b20874e2a02678209fdcbbe001e8ba1679390 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 17 Feb 2024 14:48:51 +0100 Subject: [PATCH 036/194] symmetry instead of full reflection in GG --- .../gradients/computeGradientsGreenGauss.hpp | 19 ++++++++----------- .../include/solvers/CFVMFlowSolverBase.inl | 5 +++++ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 3b3176c319f..bf11e839712 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -189,19 +189,11 @@ cout << "viscous = " << config.GetViscous(); * 2. n.grad(v.t) = 0 * 3. t.grad(v.n) = 0 */ - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - auto nodes = geometry.nodes; - // we need to set the gradient to zero for the entire marker to prevent double-counting - // points that are shared by other markers - //for (size_t iVar = varBegin; iVar < varEnd; ++iVar) - // for (size_t iDim = 0; iDim < nDim; ++iDim) gradient(iPoint, iVar, iDim) = 0.0; - - su2double halfOnVol = 0.5 / (nodes->GetVolume(iPoint) + nodes->GetPeriodicVolume(iPoint)); /*--- Normal vector for this vertex (negate for outward convention). ---*/ const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); @@ -262,8 +254,10 @@ cout << "viscous = " << config.GetViscous(); su2double ProjGradient = 0.0; for (auto iDim = 0u; iDim < nDim; iDim++) ProjGradient += Grad_Reflected[iVar][iDim] * UnitNormal[iDim]; + /*--- we do a perfect reflection here ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) - Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; + //Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; + Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 1.0 * ProjGradient * UnitNormal[iDim]; } } @@ -294,9 +288,12 @@ cout << "viscous = " << config.GetViscous(); ProjTangVelGrad += GradTangVel[iDim] * UnitNormal[iDim]; // grad([v*t])*n } + /*--- we do a perfect reflection here ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { - GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; - GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; + //GradNormVel[iDim] = GradNormVel[iDim] - 2.0 * ProjNormVelGrad * Tangential[iDim]; + //GradTangVel[iDim] = GradTangVel[iDim] - 2.0 * ProjTangVelGrad * UnitNormal[iDim]; + GradNormVel[iDim] = GradNormVel[iDim] - 1.0 * ProjNormVelGrad * Tangential[iDim]; + GradTangVel[iDim] = GradTangVel[iDim] - 1.0 * ProjTangVelGrad * UnitNormal[iDim]; } /*--- Transfer reflected gradients back into the Cartesian Coordinate system: diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 657f2e05269..a01ffd8260c 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1110,6 +1110,11 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for (auto iVertex = 0ul; iVertex < geometry->nVertex[val_marker]; iVertex++) { const auto iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + const su2double *coor = geometry->nodes->GetCoord(iPoint); + if ((coor[0]>-1) && (coor[0] < 0.0) && (coor[1] < 0.001)) + cout <nodes->GetDomain(iPoint)) continue; From 39335cb6315067747949733196106ff58b546e6c Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 4 Mar 2024 08:59:33 +0100 Subject: [PATCH 037/194] test shared symmetry --- .../include/solvers/CFVMFlowSolverBase.inl | 117 +++++++++++++++++- SU2_CFD/include/variables/CEulerVariable.hpp | 2 +- SU2_CFD/src/solvers/CEulerSolver.cpp | 8 +- 3 files changed, 118 insertions(+), 9 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index a01ffd8260c..b9d959364e2 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1104,6 +1104,25 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve * touch the boundary. The modification consists of removing all components of the face vector, * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ + // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against + static constexpr size_t MAXNSYMS = 5; + + // 2 symmetries for 1 node + bool sym2 = false; + + unsigned short Syms[MAXNSYMS] = {0}; + unsigned short nSym = 0; + for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { + if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + Syms[nSym] = iMarker; + cout << nSym<<", symmetry="<-1) && (coor[0] < 0.0) && (coor[1] < 0.001)) + // cout <nodes->GetDomain(iPoint)) continue; + /*--- Get the normal of the current symmetry ---*/ su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + const su2double Area = GeometryToolbox::Norm(nDim, Normal); + for(unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormal[iDim] = Normal[iDim] / Area; + } + + // normal of the primary symmetry plane + su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; + + + // at this point we can find out if the node is shared with another symmetry. + // step 1: do we have other symmetries? + sym2 = false; + if (nSym>1) { + //cout << "we have multiple symmetries" << endl; + // step 2: are we on a shared node? + for (auto iMarker=0;iMarkernVertex[Syms[iMarker]]; jVertex++) { + const auto jPoint = geometry->vertex[Syms[iMarker]][jVertex]->GetNode(); + if (iPoint==jPoint) { + cout << "point " + << iPoint + << ", coords " + << coor[0] + << ", " + << coor[1] + << " is shared by symmetry" + << endl; + sym2 = true; + // Does the other symmetry have a lower ID? Then that is the primary symmetry + if (Syms[iMarker]SetVelocity_Old(iPoint, vel); + nodes->SetSolution(iPoint, Solution); + nodes->SetSolution_Old(iPoint, Solution); if (implicit) { /*--- Modify the Jacobians according to the modification of the residual @@ -1184,6 +1281,18 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve ModifyJacobian(geometry->nodes->GetPoint(iPoint, iNeigh)); } } + + if (sym2==true) { + for (unsigned short iDim = 1; iDim < nDim; iDim++) { + LinSysRes(iPoint, iDim+1) = 0.0; + nodes->Set_ResTruncError_Zero(iPoint,iDim+1); + } + if (implicit) { + for (unsigned short iVar = 2; iVar <= nDim; iVar++) + Jacobian.DeleteValsRowi(iPoint*nVar+iVar); + } + } + } END_SU2_OMP_FOR } diff --git a/SU2_CFD/include/variables/CEulerVariable.hpp b/SU2_CFD/include/variables/CEulerVariable.hpp index 3b1c4248d64..6831a26135a 100644 --- a/SU2_CFD/include/variables/CEulerVariable.hpp +++ b/SU2_CFD/include/variables/CEulerVariable.hpp @@ -237,7 +237,7 @@ class CEulerVariable : public CFlowVariable { * \return Value of the velocity for the dimension iDim. */ inline su2double GetVelocity(unsigned long iPoint, unsigned long iDim) const final { - return Primitive(iPoint,iDim+indices.Velocity()); + return Primitive(iPoint, iDim+indices.Velocity()); } /*! diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 05aec1c2843..308fd48aaf8 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -9127,7 +9127,7 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC TotalAreaVelocity[iDim] += Area*Velocity[iDim]; TotalMassVelocity[iDim] += Area*(Density*TurboVelocity[0] )*Velocity[iDim]; } - + TotalFluxes[0] += Area*(Density*TurboVelocity[0]); TotalFluxes[1] += Area*(Density*TurboVelocity[0]*TurboVelocity[0] + Pressure); for (auto iDim = 2; iDim < nDim+1; iDim++) @@ -9176,7 +9176,7 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC UpdateTotalQuantities(iMarker, jSpan, iVertex); } } - } + } } // marker_flag match } // iMarkerTP match @@ -9391,7 +9391,7 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC OmegaOut[iMarkerTP - 1][iSpan] = AverageOmega[iMarker][iSpan]; NuOut[iMarkerTP - 1][iSpan] = AverageNu[iMarker][iSpan]; } - + auto TurboVel = (marker_flag == INFLOW) ? TurboVelocityIn[iMarkerTP - 1][iSpan] : TurboVelocityOut[iMarkerTP - 1][iSpan]; if (performance_average_process == MIXEDOUT) { @@ -9421,7 +9421,7 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC if(config->GetKind_Data_Giles(Marker_Tag) == RADIAL_EQUILIBRIUM){ RadialEquilibriumPressure[iMarker][nSpanWiseSections/2] = config->GetGiles_Var1(Marker_Tag)/config->GetPressure_Ref(); } - } + } for (auto iSpan= nSpanWiseSections/2; iSpan < nSpanWiseSections-1; iSpan++){ const auto Radius2 = geometry->GetTurboRadius(iMarker,iSpan+1); const auto Radius1 = geometry->GetTurboRadius(iMarker,iSpan); From eb7f2171169903a6a8124f52745f21aeae3d51c5 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 4 Mar 2024 23:40:47 +0100 Subject: [PATCH 038/194] test GG gradients for shared symmetry --- .../gradients/computeGradientsGreenGauss.hpp | 103 +++++++++++++++++- .../include/solvers/CFVMFlowSolverBase.inl | 65 ++++------- 2 files changed, 121 insertions(+), 47 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index bf11e839712..8d1351d7de6 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -91,6 +91,8 @@ cout << "viscous = " << config.GetViscous(); static constexpr size_t MAXNVAR = 20; static constexpr size_t MAXNDIM = 3; + static constexpr size_t MAXNSYMS = 5; + bool sym2 = false; /*--- Allocation of primitive gradient arrays for viscous fluxes. ---*/ su2activematrix Grad_Reflected(varEnd, nDim); @@ -189,6 +191,19 @@ cout << "viscous = " << config.GetViscous(); * 2. n.grad(v.t) = 0 * 3. t.grad(v.n) = 0 */ + + /*--- Check how many symmetry planes there are ---*/ + unsigned short Syms[MAXNSYMS] = {0}; + unsigned short nSym = 0; + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { + if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + Syms[nSym] = iMarker; + //cout << nSym<<", symmetry="<GetNode(); + + const su2double *coor = geometry.nodes->GetCoord(jPoint); + + if (iPoint==jPoint) { + // cout << "point " + // << iPoint + // << ", coords " + // << coor[0] + // << ", " + // << coor[1] + // << " is shared by symmetry" + // << endl; + sym2 = true; + // Does the other symmetry have a lower ID? Then that is the primary symmetry + if (Syms[jMarker]::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { Syms[nSym] = iMarker; - cout << nSym<<", symmetry="<::BC_Sym_Plane(CGeometry* geometry, CSolver** solve } - - /*--- Keep only the tangential part of the momentum residuals. ---*/ su2double NormalProduct = 0.0; @@ -1211,15 +1217,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ su2double vel[MAXNDIM] = {0.0}; for(unsigned short iDim = 0; iDim < nDim; iDim++) - //vel[iDim] = nodes->GetVelocity(iPoint, iDim); vel[iDim] = nodes->GetSolution(iPoint, iVel + iDim); - if (sym2 == true){ - //vel[0] is untouched - vel[1] = 0.0; - vel[2] = 0.0; - } - const su2double vp = GeometryToolbox::DotProduct(MAXNDIM, vel, UnitNormal); for(unsigned short iDim = 0; iDim < nDim; iDim++) vel[iDim] -= vp * UnitNormal[iDim]; @@ -1231,13 +1230,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iDim+1] = vel[iDim]; - if (sym2 == true){ - cout << "modify velocity" << endl; - //Solution[1+0] is untouched - Solution[1+1] = 0.0; - Solution[1+2] = 0.0; - } - nodes->SetVelocity_Old(iPoint, vel); nodes->SetSolution(iPoint, Solution); @@ -1282,17 +1274,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve } } - if (sym2==true) { - for (unsigned short iDim = 1; iDim < nDim; iDim++) { - LinSysRes(iPoint, iDim+1) = 0.0; - nodes->Set_ResTruncError_Zero(iPoint,iDim+1); - } - if (implicit) { - for (unsigned short iVar = 2; iVar <= nDim; iVar++) - Jacobian.DeleteValsRowi(iPoint*nVar+iVar); - } - } - } END_SU2_OMP_FOR } From 382e896342c93b6d4b9048f4ff6e77ee95d6d783 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 26 Mar 2024 06:17:37 +0100 Subject: [PATCH 039/194] test GG gradients with tensor implementation, not working --- .../gradients/computeGradientsGreenGauss.hpp | 430 ++++++++++++++---- .../include/solvers/CFVMFlowSolverBase.inl | 7 +- 2 files changed, 354 insertions(+), 83 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 9304f4fdd31..6100416a650 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -78,10 +78,10 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER const size_t nPointDomain = geometry.GetnPointDomain(); -cout << "Green Gauss: solver name = " << solver->GetSolverName() << endl; -cout << "number of variables = " << varEnd << endl; -cout << "commtype= = " << kindMpiComm << endl; -cout << "viscous = " << config.GetViscous(); +// cout << "Green Gauss: solver name = " << solver->GetSolverName() << endl; +// cout << "number of variables = " << varEnd << endl; +// cout << "commtype= = " << kindMpiComm << endl; +// cout << "viscous = " << config.GetViscous(); #ifdef HAVE_OMP constexpr size_t OMP_MAX_CHUNK = 512; @@ -92,11 +92,17 @@ cout << "viscous = " << config.GetViscous(); static constexpr size_t MAXNVAR = 20; static constexpr size_t MAXNDIM = 3; static constexpr size_t MAXNSYMS = 5; - bool sym2 = false; + //bool sym2 = false; /*--- Allocation of primitive gradient arrays for viscous fluxes. ---*/ su2activematrix Grad_Reflected(varEnd, nDim); + /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ + su2activematrix TensorMap(nDim,nDim); + su2activematrix TensorMapInv(nDim,nDim); + su2activematrix Gradients_Velocity(nDim,nDim); + su2activematrix Gradients_Velocity_Reflected(nDim,nDim); + /*--- For each (non-halo) volume integrate over its faces (edges). ---*/ SU2_OMP_FOR_DYN(chunkSize) @@ -222,19 +228,20 @@ cout << "viscous = " << config.GetViscous(); + // normal of the primary symmetry plane su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; // at this point we can find out if the node is shared with another symmetry. // step 1: do we have other symmetries? - sym2 = false; + //sym2 = false; if (nSym>1) { - //cout << "we have multiple symmetries" << endl; + // cout << "we have multiple symmetries" << endl; // step 2: are we on a shared node? for (auto jMarker=0;jMarkerGetCoord(iPoint); + + // if (coor[1] < 0.05) { + // cout << "unit normal = "<< UnitNormal[0] << ", " << UnitNormal[1] << ", " << UnitNormal[2] << endl; + // cout << "Tangential = " << Tangential[0] <<", "<< Tangential[1] << ", "<GetCoord(iPoint); + // if (coor[1] < 0.05) { + + // cout << "point " + // << iPoint + // << ", coords " + // << coor[0] + // << ", " + // << coor[1] + // << " is shared by symmetry" + // << endl; + // cout << "sym bc = " << iMarker << ", n=("<< UnitNormal[0]<<", " <GetCoord(iPoint); - if (coor[1] < 0.001) { - //cout << "gradient ="<< gradient(iPoint,2,0) << ", "<::BC_Sym_Plane(CGeometry* geometry, CSolver** solve // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against static constexpr size_t MAXNSYMS = 5; - // 2 symmetries for 1 node - bool sym2 = false; - unsigned short Syms[MAXNSYMS] = {0}; unsigned short nSym = 0; for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { @@ -1148,7 +1145,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve // at this point we can find out if the node is shared with another symmetry. // step 1: do we have other symmetries? - sym2 = false; if (nSym>1) { //cout << "we have multiple symmetries" << endl; // step 2: are we on a shared node? @@ -1168,7 +1164,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve // << coor[1] // << " is shared by symmetry" // << endl; - sym2 = true; // Does the other symmetry have a lower ID? Then that is the primary symmetry if (Syms[iMarker] Date: Fri, 29 Mar 2024 10:41:12 +0100 Subject: [PATCH 040/194] fix gradient conditions for symmetry plane in green-gauss --- Common/include/CConfig.hpp | 14 - Common/include/geometry/dual_grid/CPoint.hpp | 6 - Common/src/CConfig.cpp | 9 - Common/src/geometry/CPhysicalGeometry.cpp | 8 - .../gradients/computeGradientsGreenGauss.hpp | 384 +++--------------- .../include/solvers/CFVMFlowSolverBase.inl | 14 +- 6 files changed, 73 insertions(+), 362 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index bc66bc0253f..c28c3aaef54 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -6402,20 +6402,6 @@ class CConfig { */ bool GetSolid_Wall(unsigned short iMarker) const; - /*! - * \brief Determines whether a marker with index iMarker is an inlet, outlet or far-field. - * \param iMarker - * \return it marker with index iMarker is a solid boundary. - */ - bool Getinoutfar(unsigned short iMarker) const; - - /*! - * \brief Determines whether a marker with index iMarker is a symmetry. - * \param iMarker - * \return it marker with index iMarker is a solid boundary. - */ - bool GetSymmetry(unsigned short iMarker) const; - /*! * \brief Determines whether a marker with index iMarker is a viscous no-slip boundary. * \param iMarker diff --git a/Common/include/geometry/dual_grid/CPoint.hpp b/Common/include/geometry/dual_grid/CPoint.hpp index a50c2bcbc69..38895721624 100644 --- a/Common/include/geometry/dual_grid/CPoint.hpp +++ b/Common/include/geometry/dual_grid/CPoint.hpp @@ -384,12 +384,6 @@ class CPoint { */ inline bool GetSolidBoundary(unsigned long iPoint) const { return SolidBoundary(iPoint); } - // nijso: temporary - inline void Setinoutfar(unsigned long iPoint, bool boundary) { inoutfar(iPoint) = boundary; } - inline void SetSymmetry(unsigned long iPoint, bool boundary) { Symmetry(iPoint) = boundary; } - inline bool Getinoutfar(unsigned long iPoint) const { return inoutfar(iPoint); } - inline bool GetSymmetry(unsigned long iPoint) const { return Symmetry(iPoint); } - /*! * \brief Set if a point belong to the boundary. * \param[in] iPoint - Index of the point. diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 61cca4f159a..18da76556c4 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -7964,15 +7964,6 @@ bool CConfig::GetSolid_Wall(unsigned short iMarker) const { Marker_All_KindBC[iMarker] == EULER_WALL; } -// nijso: temporary -bool CConfig::Getinoutfar(unsigned short iMarker) const { - return (Marker_All_KindBC[iMarker] == INLET_FLOW || Marker_All_KindBC[iMarker] == OUTLET_FLOW || Marker_All_KindBC[iMarker] == FAR_FIELD ); -} - -bool CConfig::GetSymmetry(unsigned short iMarker) const { - return (Marker_All_KindBC[iMarker] == SYMMETRY_PLANE); -} - void CConfig::SetSurface_Movement(unsigned short iMarker, unsigned short kind_movement) { auto* new_surface_movement = new unsigned short[nMarker_Moving + 1]; diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 1d0cdd718d9..dea50612f26 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -3421,11 +3421,6 @@ void CPhysicalGeometry::SetBoundaries(CConfig* config) { if (config->GetSolid_Wall(iMarker)) nodes->SetSolidBoundary(Point_Surface, true); if (config->GetViscous_Wall(iMarker)) nodes->SetViscousBoundary(Point_Surface, true); - // nijso: temporary - // cout << "nijso: setting inoutfar for ipoint "<GetMarker_All_KindBC(iMarker) << endl; if (config->Getinoutfar(iMarker)) {cout << "inoutfar - // found."<Setinoutfar(Point_Surface, true);} if (config->GetSymmetry(iMarker)) {cout << "symmetry - // found"<SetSymmetry(Point_Surface, true);} if (config->GetMarker_All_KindBC(iMarker) == PERIODIC_BOUNDARY) nodes->SetPeriodicBoundary(Point_Surface, true); } @@ -4604,9 +4599,6 @@ void CPhysicalGeometry::SetRCM_Ordering(CConfig* config) { if (config->GetSolid_Wall(iMarker)) nodes->SetSolidBoundary(InvResult[iPoint], true); if (config->GetViscous_Wall(iMarker)) nodes->SetViscousBoundary(InvResult[iPoint], true); - // nijso: temporary - if (config->Getinoutfar(iMarker)) nodes->Setinoutfar(InvResult[iPoint], true); - if (config->GetSymmetry(iMarker)) nodes->SetSymmetry(InvResult[iPoint], true); if (config->GetMarker_All_KindBC(iMarker) == PERIODIC_BOUNDARY) nodes->SetPeriodicBoundary(InvResult[iPoint], true); diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 6100416a650..7eefdf04d0a 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -78,10 +78,11 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER const size_t nPointDomain = geometry.GetnPointDomain(); -// cout << "Green Gauss: solver name = " << solver->GetSolverName() << endl; -// cout << "number of variables = " << varEnd << endl; -// cout << "commtype= = " << kindMpiComm << endl; -// cout << "viscous = " << config.GetViscous(); + cout << "Green Gauss: solver name = " << solver->GetSolverName() << endl; + cout << "number of variables = " << varEnd << endl; + cout << "commtype= = " << kindMpiComm << endl; + cout << "viscous = " << config.GetViscous(); + bool isFlowSolver = solver->GetSolverName().find("FLOW") != string::npos; #ifdef HAVE_OMP constexpr size_t OMP_MAX_CHUNK = 512; @@ -204,11 +205,9 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { Syms[nSym] = iMarker; - //cout << nSym<<", symmetry="<GetCoord(jPoint); if (iPoint==jPoint) { - // cout << "point " - // << iPoint - // << ", coords " - // << coor[0] - // << ", " - // << coor[1] - // << " is shared by symmetry" - // << endl; - //sym2 = true; // Does the other symmetry have a lower ID? Then that is the primary symmetry if (Syms[jMarker]GetCoord(iPoint); - - // if (coor[1] < 0.05) { - // cout << "unit normal = "<< UnitNormal[0] << ", " << UnitNormal[1] << ", " << UnitNormal[2] << endl; - // cout << "Tangential = " << Tangential[0] <<", "<< Tangential[1] << ", "< nDim) { // We should exclude here for instance AuxVars for axisymmetry? + if (iVar == 0 || iVar > nDim || isFlowSolver==true) { // We should exclude here for instance AuxVars for axisymmetry? /*--- Compute projected part of the gradient in a dot product ---*/ su2double ProjGradient = 0.0; @@ -498,187 +415,16 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER // full reflection //Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; // reflect once to eliminate normal direction - Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 1.0 * ProjGradient * UnitNormal[iDim]; + Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - ProjGradient * UnitNormal[iDim]; } } - // /*--- Compute gradients of normal and tangential velocity: - // grad(v*n) = grad(v_x) n_x + grad(v_y) n_y (+ grad(v_z) n_z) - // grad(v*t) = grad(v_x) t_x + grad(v_y) t_y (+ grad(v_z) t_z) ---*/ - - // /*--- if we do not have auxiliary gradients ---*/ - // su2double GradNormVel[MAXNVAR] = {0.0}; - // su2double GradTangVel[MAXNVAR] = {0.0}; - // for (auto iVar = 0u; iVar < nDim; iVar++) { // counts gradient components - // GradNormVel[iVar] = 0.0; - // GradTangVel[iVar] = 0.0; - // for (auto iDim = 0u; iDim < nDim; iDim++) { // counts sum with unit normal/tangential - // GradNormVel[iVar] += Grad_Reflected[iDim + 1][iVar] * UnitNormal[iDim]; - // //GradTangVel[iVar] += Grad_Reflected[iDim + 1][iVar] * Tangential[iDim]; - // } - // } - - // // b = bn + bt --> bt = b - bn - // for (auto iVar = 0u; iVar < nDim; iVar++) { // counts gradient components - // for (auto iDim = 0u; iDim < nDim; iDim++) { - // Grad_ReflectedTan[iDim+1][iVar] = Grad_Reflected[iDim + 1][iVar] - GradNormVel[iVar]*UnitNormal[iDim]; - // GradTangVel[iVar] += Grad_ReflectedTan[iDim+1][iVar]*Grad_ReflectedTan[iDim+1][iVar]; - // } - // GradTangVel[iVar] = sqrt(GradTangVel[iVar]); - // } - - // // now normalize grad_reflectedTan - // for (auto iDim = 0u; iDim < nDim; iDim++) { - // for (auto iVar = 0u; iVar < nDim; iVar++) { - // Grad_ReflectedTan[iDim+1][iVar] = Grad_ReflectedTan[iDim+1][iVar]/GradTangVel[iVar]; - // } - // } - - // can we now get back to the original gradients? Simply add the components again? - - - - // backtransformation: grad(v.n)*n + grad(v.t)*t , resulting in the Jacobian matrix - // test - // su2double gradu[MAXNVAR] = {0.0}; - // su2double gradv[MAXNVAR] = {0.0}; - // su2double gradw[MAXNVAR] = {0.0}; - // //su2double gradv[MAXNVAR] = {0.0}; - // for (auto iDim = 0u; iDim < nDim; iDim++) { - // cout << "gradnormvel="<GetCoord(iPoint); - // if (coor[1] < 0.05) { - - // cout << "point " - // << iPoint - // << ", coords " - // << coor[0] - // << ", " - // << coor[1] - // << " is shared by symmetry" - // << endl; - // cout << "sym bc = " << iMarker << ", n=("<< UnitNormal[0]<<", " <::BC_Sym_Plane(CGeometry* geometry, CSolver** solve // Does the other symmetry have a lower ID? Then that is the primary symmetry if (Syms[iMarker] Date: Fri, 29 Mar 2024 22:15:52 +0100 Subject: [PATCH 041/194] remove cout statements --- .../gradients/computeGradientsGreenGauss.hpp | 9 ++++--- .../include/solvers/CFVMFlowSolverBase.inl | 24 ------------------- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 7eefdf04d0a..d2d08c87325 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -78,10 +78,10 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER const size_t nPointDomain = geometry.GetnPointDomain(); - cout << "Green Gauss: solver name = " << solver->GetSolverName() << endl; - cout << "number of variables = " << varEnd << endl; - cout << "commtype= = " << kindMpiComm << endl; - cout << "viscous = " << config.GetViscous(); +// cout << "Green Gauss: solver name = " << solver->GetSolverName() << endl; +// cout << "number of variables = " << varEnd << endl; +// cout << "commtype= = " << kindMpiComm << endl; +// cout << "viscous = " << config.GetViscous(); bool isFlowSolver = solver->GetSolverName().find("FLOW") != string::npos; #ifdef HAVE_OMP @@ -93,7 +93,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER static constexpr size_t MAXNVAR = 20; static constexpr size_t MAXNDIM = 3; static constexpr size_t MAXNSYMS = 5; - //bool sym2 = false; /*--- Allocation of primitive gradient arrays for viscous fluxes. ---*/ su2activematrix Grad_Reflected(varEnd, nDim); diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index fd26a2f12e5..6221594a411 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1110,11 +1110,9 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { Syms[nSym] = iMarker; - //cout << nSym<<", symmetry="<nodes->GetDomain(iPoint)) continue; @@ -1146,35 +1139,22 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve // at this point we can find out if the node is shared with another symmetry. // step 1: do we have other symmetries? if (nSym>1) { - //cout << "we have multiple symmetries" << endl; // step 2: are we on a shared node? for (auto iMarker=0;iMarkernVertex[Syms[iMarker]]; jVertex++) { const auto jPoint = geometry->vertex[Syms[iMarker]][jVertex]->GetNode(); if (iPoint==jPoint) { - // cout << "point " - // << iPoint - // << ", coords " - // << coor[0] - // << ", " - // << coor[1] - // << " is shared by symmetry" - // << endl; // Does the other symmetry have a lower ID? Then that is the primary symmetry if (Syms[iMarker]::BC_Sym_Plane(CGeometry* geometry, CSolver** solve su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; } - //cout << "setting shared symmetry to true, Pn="< Date: Fri, 29 Mar 2024 23:51:09 +0100 Subject: [PATCH 042/194] add comment --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 6221594a411..812fb4ecadf 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1195,9 +1195,11 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve vel[iDim] -= vp * UnitNormal[iDim]; nodes->SetVel_ResTruncError_Zero(iPoint); + su2double Solution[MAXNVAR] = {0.0}; for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution[iVar] = nodes->GetSolution(iPoint,iVar); + // overwrite solution with the new velocity for(unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iDim+1] = vel[iDim]; From 80a7b5f848df4d72a81bd8dc2249e2f752316748 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 30 Mar 2024 00:06:39 +0100 Subject: [PATCH 043/194] cleanup --- Common/include/geometry/dual_grid/CPoint.hpp | 2 -- Common/src/geometry/dual_grid/CPoint.cpp | 2 -- SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp | 4 +--- SU2_CFD/include/variables/CEulerVariable.hpp | 8 -------- SU2_CFD/include/variables/CIncEulerVariable.hpp | 8 -------- SU2_CFD/include/variables/CVariable.hpp | 6 ------ SU2_CFD/src/integration/CIntegration.cpp | 1 - SU2_CFD/src/solvers/CIncEulerSolver.cpp | 1 - SU2_CFD/src/solvers/CSolver.cpp | 2 -- 9 files changed, 1 insertion(+), 33 deletions(-) diff --git a/Common/include/geometry/dual_grid/CPoint.hpp b/Common/include/geometry/dual_grid/CPoint.hpp index 38895721624..472a119cc3a 100644 --- a/Common/include/geometry/dual_grid/CPoint.hpp +++ b/Common/include/geometry/dual_grid/CPoint.hpp @@ -74,8 +74,6 @@ class CPoint { PhysicalBoundary; /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */ su2vector SolidBoundary; /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */ - su2vector inoutfar; - su2vector Symmetry; su2vector ViscousBoundary; /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */ su2vector diff --git a/Common/src/geometry/dual_grid/CPoint.cpp b/Common/src/geometry/dual_grid/CPoint.cpp index 3e992575cea..f11b7dd8945 100644 --- a/Common/src/geometry/dual_grid/CPoint.cpp +++ b/Common/src/geometry/dual_grid/CPoint.cpp @@ -88,8 +88,6 @@ void CPoint::FullAllocation(unsigned short imesh, const CConfig* config) { Domain.resize(npoint) = true; Boundary.resize(npoint) = false; SolidBoundary.resize(npoint) = false; - inoutfar.resize(npoint) = false; // nijso temporary - Symmetry.resize(npoint) = false; // nijso temporary ViscousBoundary.resize(npoint) = false; PhysicalBoundary.resize(npoint) = false; PeriodicBoundary.resize(npoint) = false; diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index d2d08c87325..36c2fc62299 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -238,8 +238,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (auto jVertex = 0ul; jVertex < geometry.nVertex[Syms[jMarker]]; jVertex++) { const auto jPoint = geometry.vertex[Syms[jMarker]][jVertex]->GetNode(); - const su2double *coor = geometry.nodes->GetCoord(jPoint); - if (iPoint==jPoint) { // Does the other symmetry have a lower ID? Then that is the primary symmetry if (Syms[jMarker]BC_Periodic(geometry, solver_container, conv_bound_numerics, config); } - //AD::ResumePreaccumulation(pausePreacc); } diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 997829659fc..28e26839df4 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1503,7 +1503,6 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- For viscous problems, we need an additional gradient. ---*/ if (viscous) { - cout << "incompressible solver, auxiliary variables " << endl; AD::StartNoSharedReading(); SU2_OMP_FOR_STAT(omp_chunk_size) diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 20a890dfa94..03c79b46fc3 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -2095,8 +2095,6 @@ void CSolver::SetAuxVar_Gradient_GG(CGeometry *geometry, const CConfig *config) const auto& solution = base_nodes->GetAuxVar(); auto& gradient = base_nodes->GetAuxVarGradient(); - cout <<"set auxiliary variables, nvar=" << base_nodes->GetnAuxVar() << endl; - computeGradientsGreenGauss(this, AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, *config, solution, 0, base_nodes->GetnAuxVar(), gradient); } From 2a7f5dadc028fa7ef06522c852f7f63fa5d1c9b0 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 30 Mar 2024 14:45:54 +0100 Subject: [PATCH 044/194] move symplane bc to end of bc --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 2 +- SU2_CFD/src/integration/CIntegration.cpp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 812fb4ecadf..be73fd7df69 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1194,7 +1194,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(unsigned short iDim = 0; iDim < nDim; iDim++) vel[iDim] -= vp * UnitNormal[iDim]; - nodes->SetVel_ResTruncError_Zero(iPoint); su2double Solution[MAXNVAR] = {0.0}; for (unsigned short iVar = 0; iVar < nVar; iVar++) @@ -1204,6 +1203,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve Solution[iDim+1] = vel[iDim]; + nodes->SetVel_ResTruncError_Zero(iPoint); nodes->SetVelocity_Old(iPoint, vel); nodes->SetSolution(iPoint, Solution); nodes->SetSolution_Old(iPoint, Solution); diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index 7912351cce2..70bc00899c8 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -144,9 +144,9 @@ void CIntegration::Space_Integration(CGeometry *geometry, case FAR_FIELD: solver_container[MainSolver]->BC_Far_Field(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); break; - case SYMMETRY_PLANE: - solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); - break; + //case SYMMETRY_PLANE: + // solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); + // break; } } @@ -196,6 +196,14 @@ void CIntegration::Space_Integration(CGeometry *geometry, solver_container[MainSolver]->BC_Periodic(geometry, solver_container, conv_bound_numerics, config); } + /*--- Symmetry plane last because we need to mirror all other boundary conditions ---*/ + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + KindBC = config->GetMarker_All_KindBC(iMarker); + if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) + solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); + } + + //AD::ResumePreaccumulation(pausePreacc); } From 2407b19af048f72c06542d59c40833a95f50a996 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 1 Apr 2024 00:38:08 +0200 Subject: [PATCH 045/194] fix order of BC --- .../gradients/computeGradientsGreenGauss.hpp | 283 ++++++++++-------- .../include/solvers/CFVMFlowSolverBase.hpp | 3 +- .../include/solvers/CFVMFlowSolverBase.inl | 12 +- SU2_CFD/src/integration/CIntegration.cpp | 14 +- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 1 + 5 files changed, 165 insertions(+), 148 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 36c2fc62299..85558996843 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -76,13 +76,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, size_t varEnd, GradientType& gradient) { const size_t nPointDomain = geometry.GetnPointDomain(); - - -// cout << "Green Gauss: solver name = " << solver->GetSolverName() << endl; -// cout << "number of variables = " << varEnd << endl; -// cout << "commtype= = " << kindMpiComm << endl; -// cout << "viscous = " << config.GetViscous(); - bool isFlowSolver = solver->GetSolverName().find("FLOW") != string::npos; + bool isFlowSolver = solver->GetSolverName().find("FLOW") != string::npos; #ifdef HAVE_OMP constexpr size_t OMP_MAX_CHUNK = 512; @@ -99,10 +93,12 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ su2activematrix TensorMap(nDim,nDim); - su2activematrix TensorMapInv(nDim,nDim); su2activematrix Gradients_Velocity(nDim,nDim); su2activematrix Gradients_Velocity_Reflected(nDim,nDim); + su2double gradPhi[MAXNDIM] = {0.0}; + su2double gradPhiReflected[MAXNDIM] = {0.0}; + /*--- For each (non-halo) volume integrate over its faces (edges). ---*/ SU2_OMP_FOR_DYN(chunkSize) @@ -209,7 +205,9 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { + if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); @@ -223,51 +221,45 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - // normal of the primary symmetry plane - su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - - // at this point we can find out if the node is shared with another symmetry. - // step 1: do we have other symmetries? - if (nSym>1) { - // step 2: are we on a shared node? - for (auto jMarker=0;jMarkerGetNode(); - - if (iPoint==jPoint) { - // Does the other symmetry have a lower ID? Then that is the primary symmetry - if (Syms[jMarker]GetNormal(NormalPrim); - su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - for(unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - } - - // correct the current normal as n2_new = n2 - (n2.n1).n1 - su2double ProjNorm = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - // We check if the normal of the 2 planes coincide. We only update the normal if the normals of the symmetry planes are different. - if (fabs(1.0-ProjNorm)>EPS) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - // make normalized vector again - su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; + // normal of the primary symmetry plane + su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; + + // at this point we can find out if the node is shared with another symmetry. + // step 1: do we have other symmetries? + if (nSym>1) { + // step 2: are we on a shared node? + for (auto jMarker=0;jMarkerGetNode(); + if (iPoint==jPoint) { + // Does the other symmetry have a lower ID? Then that is the primary symmetry + if (Syms[jMarker]GetNormal(NormalPrim); + su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); + for(unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; + } + + // correct the current normal as n2_new = n2 - (n2.n1).n1 + su2double ProjNorm = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + // We check if the normal of the 2 planes coincide. We only update the normal if the normals of the symmetry planes are different. + if (fabs(1.0-ProjNorm)>EPS) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; + // make normalized vector again + su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; + } + } } - } } - } } - } - } - - if (isFlowSolver == true) { /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as t*n=0 && |t|_2 = 1 ---*/ @@ -280,10 +272,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (auto iDim = 0u; iDim < nDim; iDim++) { TensorMap[0][iDim] = UnitNormal[iDim]; TensorMap[1][iDim] = Tangential[iDim]; - //TensorMap[2][iDim] = Orthogonal[iDim]; - TensorMapInv[iDim][0] = UnitNormal[iDim]; - TensorMapInv[iDim][1] = Tangential[iDim]; - //TensorMapInv[iDim][2] = Orthogonal[iDim]; } break; } @@ -316,119 +304,156 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER TensorMap[0][iDim] = UnitNormal[iDim]; TensorMap[1][iDim] = Tangential[iDim]; TensorMap[2][iDim] = Orthogonal[iDim]; - TensorMapInv[iDim][0] = UnitNormal[iDim]; - TensorMapInv[iDim][1] = Tangential[iDim]; - TensorMapInv[iDim][2] = Orthogonal[iDim]; } break; } } // switch + if (isFlowSolver == true) { - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - Grad_Reflected[iVar][iDim] = gradient(iPoint, iVar, iDim); + for (auto iVar = varBegin; iVar < varEnd; iVar++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + Grad_Reflected[iVar][iDim] = gradient(iPoint, iVar, iDim); + } } - } - - /*--- Get gradients of primitives of boundary cell ---*/ - for (auto iVar = 0u; iVar < nDim; iVar++) - for (auto iDim = 0u; iDim < nDim; iDim++) - Gradients_Velocity[iVar][iDim] = gradient(iPoint, iVar+1, iDim); - - - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - Gradients_Velocity_Reflected[iDim][jDim] = 0.0; + /*--- Get gradients of primitives of boundary cell ---*/ + for (auto iVar = 0u; iVar < nDim; iVar++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + Gradients_Velocity[iVar][iDim] = gradient(iPoint, iVar+1, iDim); + Gradients_Velocity_Reflected[iVar][iDim] = 0.0; + } } - } - // Q' = L^T*Q*T - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto kDim = 0u; kDim < nDim; kDim++) { - for (auto mDim = 0u; mDim < nDim; mDim++) { - Gradients_Velocity_Reflected[iDim][jDim] += TensorMap[iDim][mDim]*TensorMap[jDim][kDim]*Gradients_Velocity[mDim][kDim]; + // Q' = L^T*Q*T + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto kDim = 0u; kDim < nDim; kDim++) { + for (auto mDim = 0u; mDim < nDim; mDim++) { + Gradients_Velocity_Reflected[iDim][jDim] += TensorMap[iDim][mDim]*TensorMap[jDim][kDim]*Gradients_Velocity[mDim][kDim]; + } } } } - } - // now also remove the gradients that are supposed to be zero - //first entry is normal direction n, with velocity V,W in the sym plane - // and velocity U in the normal direction - // we need to remove dV/dn and DW/dn = 0 - // and dU/dt and dU/ds = 0 + // now also remove the gradients that are supposed to be zero + //first entry is normal direction n, with velocity V,W in the sym plane + // and velocity U in the normal direction + // we need to remove dV/dn and DW/dn = 0 + // and dU/dt and dU/ds = 0 - // we have aligned such that U is the direction of the normal - // in 2D: dU/dy = dV/dx = 0 - // in 3D: dU/dy = dV/dx = 0 - // dU/dz = dW/dx = 0 - for (auto iDim = 1u; iDim < nDim; iDim++) { - Gradients_Velocity_Reflected[0][iDim] = 0.0; - Gradients_Velocity_Reflected[iDim][0] = 0.0; - } + // we have aligned such that U is the direction of the normal + // in 2D: dU/dy = dV/dx = 0 + // in 3D: dU/dy = dV/dx = 0 + // dU/dz = dW/dx = 0 + for (auto iDim = 1u; iDim < nDim; iDim++) { + Gradients_Velocity_Reflected[0][iDim] = 0.0; + Gradients_Velocity_Reflected[iDim][0] = 0.0; + } - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - Gradients_Velocity[iDim][jDim] = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + Gradients_Velocity[iDim][jDim] = 0.0; + } } - } - // now transform back by taking the inverse again - // T = (L^-1)*T' - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto kDim = 0u; kDim < nDim; kDim++) { - for (auto mDim = 0u; mDim < nDim; mDim++) { - Gradients_Velocity[iDim][jDim] += TensorMap[mDim][iDim]*TensorMap[kDim][jDim]*Gradients_Velocity_Reflected[mDim][kDim]; + // now transform back by taking the inverse again + // T = (L^-1)*T' + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto kDim = 0u; kDim < nDim; kDim++) { + for (auto mDim = 0u; mDim < nDim; mDim++) { + Gradients_Velocity[iDim][jDim] += TensorMap[mDim][iDim]*TensorMap[kDim][jDim]*Gradients_Velocity_Reflected[mDim][kDim]; + } } } } - } - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - Grad_Reflected[iDim+1][jDim] = Gradients_Velocity[iDim][jDim]; - } - } - } + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + Grad_Reflected[iDim+1][jDim] = Gradients_Velocity[iDim][jDim]; + } + } - /*--- Reflect the gradients for all scalars including the velocity components. - The gradients of the velocity components are set later with the - correct values: grad(V)_r = grad(V) - 2 [grad(V)*n]n, V being any primitive ---*/ - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - // For the auxiliary variable we do not have velocity vectors. But the gradients of the auxvars - // do not seem to be used so this has no effect on the computations. - if (iVar == 0 || iVar > nDim || isFlowSolver==true) { // We should exclude here for instance AuxVars for axisymmetry? + /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ + for (auto iVar = varBegin; iVar < varEnd; iVar++) { + // For the auxiliary variable we do not have velocity vectors. But the gradients of the auxvars + // do not seem to be used so this has no effect on the computations. + if (iVar == 0 || iVar > nDim) { // We should exclude here for instance AuxVars for axisymmetry? - /*--- Compute projected part of the gradient in a dot product ---*/ - su2double ProjGradient = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) ProjGradient += Grad_Reflected[iVar][iDim] * UnitNormal[iDim]; + /*--- project to symmetry aligned base ---*/ + for (auto iDim = 0u; iDim < nDim; iDim++) { + gradPhi[iDim] = gradient(iPoint, iVar, iDim); + gradPhiReflected[iDim] = 0.0; + } - for (auto iDim = 0u; iDim < nDim; iDim++) - // full reflection - //Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - 2.0 * ProjGradient * UnitNormal[iDim]; - // reflect once to eliminate normal direction - Grad_Reflected[iVar][iDim] = Grad_Reflected[iVar][iDim] - ProjGradient * UnitNormal[iDim]; - } - } + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + // map transpose T' * grad(phi) + gradPhiReflected[jDim] += TensorMap[jDim][iDim]*gradPhi[iDim]; + } + } + + for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; + + /*--- gradient in direction normal to symmetry is cancelled ---*/ + gradPhiReflected[0] = 0.0; + /*--- Now transform back ---*/ + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + gradPhi[jDim] += TensorMap[iDim][jDim]*gradPhiReflected[iDim]; + } + } + for (auto iDim = 0u; iDim < nDim; iDim++) + Grad_Reflected[iVar][iDim] = gradPhi[iDim]; + } + } - /*--- Update gradients with reflected gradients ---*/ + /*--- Update gradients with reflected gradients ---*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) for (auto iDim = 0u; iDim < nDim; iDim++) gradient(iPoint,iVar,iDim) = Grad_Reflected[iVar][iDim]; + } else { + /*--- not a flow solver ---*/ + for (size_t iVar = varBegin; iVar < varEnd; iVar++) { + /*--- project to symmetry aligned base ---*/ + for (auto iDim = 0u; iDim < nDim; iDim++) { + gradPhi[iDim] = gradient(iPoint, iVar, iDim); + gradPhiReflected[iDim] = 0.0; + } + + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + // map transpose T' * grad(phi) + gradPhiReflected[jDim] += TensorMap[jDim][iDim]*gradPhi[iDim]; + } + } + for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; - } //ivertex - } //symmetry - } //loop over markers + /*--- gradient in direction normal to symmetry is cancelled ---*/ + gradPhiReflected[0] = 0.0; + + /*--- Now transform back ---*/ + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + gradPhi[jDim] += TensorMap[iDim][jDim]*gradPhiReflected[iDim]; + } + } + + for (auto iDim = 0u; iDim < nDim; iDim++) + gradient(iPoint, iVar, iDim) = gradPhi[iDim]; + + } + } // not a flow solver + } // loop over vertices + } // symmetry + } // markers /*--- If no solver was provided we do not communicate ---*/ diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index c06ee9bf6f2..9d8f71e902b 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -451,7 +451,7 @@ class CFVMFlowSolverBase : public CSolver { for (unsigned short iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && - //(config->GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && + (config->GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && (config->GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { @@ -668,6 +668,7 @@ class CFVMFlowSolverBase : public CSolver { for (unsigned short iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && + (config->GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && (config->GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index be73fd7df69..192fd01407f 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -32,7 +32,6 @@ #include "../numerics_simd/CNumericsSIMD.hpp" #include "CFVMFlowSolverBase.hpp" - template void CFVMFlowSolverBase::AeroCoeffsArray::allocate(int size) { _size = size; @@ -1129,16 +1128,15 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve const su2double Area = GeometryToolbox::Norm(nDim, Normal); - for(unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormal[iDim] = Normal[iDim] / Area; - } + for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; + - // normal of the primary symmetry plane - su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; // at this point we can find out if the node is shared with another symmetry. // step 1: do we have other symmetries? if (nSym>1) { + // normal of the primary symmetry plane + su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; // step 2: are we on a shared node? for (auto iMarker=0;iMarker::BC_Sym_Plane(CGeometry* geometry, CSolver** solve Solution[iVar] = nodes->GetSolution(iPoint,iVar); // overwrite solution with the new velocity for(unsigned short iDim = 0; iDim < nDim; iDim++) - Solution[iDim+1] = vel[iDim]; + Solution[iVel + iDim] = vel[iDim]; nodes->SetVel_ResTruncError_Zero(iPoint); diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index 70bc00899c8..7912351cce2 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -144,9 +144,9 @@ void CIntegration::Space_Integration(CGeometry *geometry, case FAR_FIELD: solver_container[MainSolver]->BC_Far_Field(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); break; - //case SYMMETRY_PLANE: - // solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); - // break; + case SYMMETRY_PLANE: + solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); + break; } } @@ -196,14 +196,6 @@ void CIntegration::Space_Integration(CGeometry *geometry, solver_container[MainSolver]->BC_Periodic(geometry, solver_container, conv_bound_numerics, config); } - /*--- Symmetry plane last because we need to mirror all other boundary conditions ---*/ - for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - KindBC = config->GetMarker_All_KindBC(iMarker); - if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) - solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); - } - - //AD::ResumePreaccumulation(pausePreacc); } diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 28e26839df4..5b81394bd9a 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1503,6 +1503,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- For viscous problems, we need an additional gradient. ---*/ if (viscous) { + AD::StartNoSharedReading(); SU2_OMP_FOR_STAT(omp_chunk_size) From 05520c3235d7eb6761729d21b713f2713218a0dd Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 1 Apr 2024 14:22:52 +0200 Subject: [PATCH 046/194] include EULER_WALL in consideration of symmetry planes --- Common/src/geometry/CPhysicalGeometry.cpp | 3 ++- .../gradients/computeGradientsGreenGauss.hpp | 22 ++++--------------- .../include/solvers/CFVMFlowSolverBase.inl | 4 ++-- SU2_CFD/src/integration/CIntegration.cpp | 16 +++++++++----- 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index dea50612f26..0b830b50bbc 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7291,7 +7291,8 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh * to the symmetry plane. ---*/ SU2_OMP_FOR_DYN(1) for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { - if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { const auto iPoint = vertex[iMarker][iVertex]->GetNode(); diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 85558996843..a0d404bd07d 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -35,22 +35,6 @@ namespace detail { -// find local vertex on a symmetry marker using global iPoint -inline su2double* getVertexNormalfromPoint(const CConfig& config, CGeometry& geometry, unsigned long iPointGlobal){ - unsigned long iPointSym=0; - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { - if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { - for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { - iPointSym = geometry.vertex[iMarker][iVertex]->GetNode(); - if (iPointSym == iPointGlobal) - return geometry.vertex[iMarker][iVertex]->GetNormal(); - } - } - } - cout << "point is not found " << endl; - exit(0); -} - /*! * \brief Compute the gradient of a field using the Green-Gauss theorem. * \ingroup FvmAlgos @@ -158,6 +142,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER if ((config.GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && (config.GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && (config.GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && + (config.GetMarker_All_KindBC(iMarker) != EULER_WALL) && (config.GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { /*--- Work is shared in inner loop as two markers @@ -198,7 +183,8 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER unsigned short Syms[MAXNSYMS] = {0}; unsigned short nSym = 0; for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { - if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { Syms[nSym] = iMarker; nSym++; } @@ -206,7 +192,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { - if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 192fd01407f..64994843213 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1107,7 +1107,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve unsigned short Syms[MAXNSYMS] = {0}; unsigned short nSym = 0; for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { - if (config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) { + if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { Syms[nSym] = iMarker; nSym++; } @@ -1170,7 +1171,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve } } - /*--- Keep only the tangential part of the momentum residuals. ---*/ su2double NormalProduct = 0.0; diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index 7912351cce2..abd254efee9 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -103,9 +103,6 @@ void CIntegration::Space_Integration(CGeometry *geometry, for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { KindBC = config->GetMarker_All_KindBC(iMarker); switch (KindBC) { - case EULER_WALL: - solver_container[MainSolver]->BC_Euler_Wall(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); - break; case ACTDISK_INLET: solver_container[MainSolver]->BC_ActDisk_Inlet(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); break; @@ -144,9 +141,9 @@ void CIntegration::Space_Integration(CGeometry *geometry, case FAR_FIELD: solver_container[MainSolver]->BC_Far_Field(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); break; - case SYMMETRY_PLANE: - solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); - break; + //case SYMMETRY_PLANE: + // solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); + // break; } } @@ -196,6 +193,13 @@ void CIntegration::Space_Integration(CGeometry *geometry, solver_container[MainSolver]->BC_Periodic(geometry, solver_container, conv_bound_numerics, config); } + + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + if (config->GetMarker_All_KindBC(iMarker)==SYMMETRY_PLANE) + solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); + else if (config->GetMarker_All_KindBC(iMarker)==EULER_WALL) + solver_container[MainSolver]->BC_Euler_Wall(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); + } //AD::ResumePreaccumulation(pausePreacc); } From cf36935fd5b5ac8189cda203328add8a4b96c178 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 1 Apr 2024 14:27:39 +0200 Subject: [PATCH 047/194] no modified timestep at EULER_WALL --- SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index 9d8f71e902b..9a9eae08fdc 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -452,6 +452,7 @@ class CFVMFlowSolverBase : public CSolver { for (unsigned short iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && (config->GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && + (config->GetMarker_All_KindBC(iMarker) != EULER_WALL) && (config->GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { @@ -669,6 +670,7 @@ class CFVMFlowSolverBase : public CSolver { for (unsigned short iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && (config->GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && + (config->GetMarker_All_KindBC(iMarker) != EULER_WALL) && (config->GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { From 2090c7f735b833a98bebf8053b0f41dfb866f910 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 1 Apr 2024 23:08:09 +0200 Subject: [PATCH 048/194] fix getsolution to getsolution_old --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 16 +++++++--------- SU2_CFD/src/solvers/CSpeciesSolver.cpp | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 64994843213..de04b9f1040 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1132,7 +1132,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; - // at this point we can find out if the node is shared with another symmetry. // step 1: do we have other symmetries? if (nSym>1) { @@ -1181,30 +1180,29 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(unsigned short iDim = 0; iDim < nDim; iDim++) LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; + /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ su2double vel[MAXNDIM] = {0.0}; for(unsigned short iDim = 0; iDim < nDim; iDim++) - vel[iDim] = nodes->GetSolution(iPoint, iVel + iDim); + vel[iDim] = nodes->GetSolution_Old(iPoint, iVel + iDim); - const su2double vp = GeometryToolbox::DotProduct(MAXNDIM, vel, UnitNormal); + su2double vp = GeometryToolbox::DotProduct(MAXNDIM, vel, UnitNormal); for(unsigned short iDim = 0; iDim < nDim; iDim++) vel[iDim] -= vp * UnitNormal[iDim]; - su2double Solution[MAXNVAR] = {0.0}; for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution[iVar] = nodes->GetSolution(iPoint,iVar); + // overwrite solution with the new velocity for(unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iVel + iDim] = vel[iDim]; - - nodes->SetVel_ResTruncError_Zero(iPoint); - nodes->SetVelocity_Old(iPoint, vel); - nodes->SetSolution(iPoint, Solution); - nodes->SetSolution_Old(iPoint, Solution); + nodes->SetSolution_Old(iPoint, Solution); + nodes->SetSolution(iPoint, Solution); + nodes->SetVel_ResTruncError_Zero(iPoint); if (implicit) { /*--- Modify the Jacobians according to the modification of the residual diff --git a/SU2_CFD/src/solvers/CSpeciesSolver.cpp b/SU2_CFD/src/solvers/CSpeciesSolver.cpp index f5f5ed16603..3c5b1f39204 100644 --- a/SU2_CFD/src/solvers/CSpeciesSolver.cpp +++ b/SU2_CFD/src/solvers/CSpeciesSolver.cpp @@ -345,7 +345,7 @@ void CSpeciesSolver::BC_Inlet(CGeometry* geometry, CSolver** solver_container, C /*--- Identify the boundary by string name ---*/ string Marker_Tag = config->GetMarker_All_TagBound(val_marker); - + if (config->GetMarker_StrongBC(Marker_Tag)==true) { nodes->SetSolution_Old(iPoint, Inlet_SpeciesVars[val_marker][iVertex]); From e2108e7df80628400f32adb7d4b0602c2c289b66 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 1 Apr 2024 23:54:22 +0200 Subject: [PATCH 049/194] fix getsolution to getsolution_old --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index de04b9f1040..608ff4584ba 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1194,7 +1194,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve su2double Solution[MAXNVAR] = {0.0}; for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = nodes->GetSolution(iPoint,iVar); + Solution[iVar] = nodes->GetSolution_Old(iPoint,iVar); // overwrite solution with the new velocity for(unsigned short iDim = 0; iDim < nDim; iDim++) From 4c260aa2ae537561bd61554aeca20092158b9f0a Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 3 Apr 2024 23:00:30 +0200 Subject: [PATCH 050/194] move computation of base to geometry_toolbox --- Common/include/toolboxes/geometry_toolbox.hpp | 52 +++++++++++++++++++ .../gradients/computeGradientsGreenGauss.hpp | 50 ++---------------- .../include/solvers/CFVMFlowSolverBase.inl | 4 +- 3 files changed, 57 insertions(+), 49 deletions(-) diff --git a/Common/include/toolboxes/geometry_toolbox.hpp b/Common/include/toolboxes/geometry_toolbox.hpp index ce0baf55bf6..5c33251b2bd 100644 --- a/Common/include/toolboxes/geometry_toolbox.hpp +++ b/Common/include/toolboxes/geometry_toolbox.hpp @@ -216,5 +216,57 @@ inline void TangentProjection(Int nDim, const Mat& tensor, const Scalar* vector, for (Int iDim = 0; iDim < nDim; iDim++) proj[iDim] -= normalProj * vector[iDim]; } + +/*! \brief Construct a 2D or 3D base given a normal vector. + Constructs 1 (2D) or 2 (3D) additional vectors orthogonal to the normal to form a base. */ +template +inline void BaseFromNormal(Int nDim, const Scalar* UnitNormal, Matrix& TensorMap) { + /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as + t*n=0 && |t|_2 = 1 ---*/ + Scalar Tangential[3] = {0.0}; + Scalar Orthogonal[3] = {0.0}; + switch (nDim) { + case 2: { + Tangential[0] = -UnitNormal[1]; + Tangential[1] = UnitNormal[0]; + for (auto iDim = 0u; iDim < nDim; iDim++) { + TensorMap[0][iDim] = UnitNormal[iDim]; + TensorMap[1][iDim] = Tangential[iDim]; + } + break; + } + case 3: { + /*--- n = ai + bj + ck, if |b| > |c| ---*/ + if (abs(UnitNormal[1]) > abs(UnitNormal[2])) { + /*--- t = bi + (c-a)j - bk ---*/ + Tangential[0] = UnitNormal[1]; + Tangential[1] = UnitNormal[2] - UnitNormal[0]; + Tangential[2] = -UnitNormal[1]; + } else { + /*--- t = ci - cj + (b-a)k ---*/ + Tangential[0] = UnitNormal[2]; + Tangential[1] = -UnitNormal[2]; + Tangential[2] = UnitNormal[1] - UnitNormal[0]; + } + /*--- Make it a unit vector. ---*/ + Scalar TangentialNorm = Norm(3, Tangential); + Tangential[0] = Tangential[0] / TangentialNorm; + Tangential[1] = Tangential[1] / TangentialNorm; + Tangential[2] = Tangential[2] / TangentialNorm; + + /*--- Compute 3rd direction of the base using cross product ---*/ + CrossProduct(UnitNormal, Tangential, Orthogonal); + + // now we construct the tensor mapping T, note that its inverse is the transpose of T + for (auto iDim = 0u; iDim < nDim; iDim++) { + TensorMap[0][iDim] = UnitNormal[iDim]; + TensorMap[1][iDim] = Tangential[iDim]; + TensorMap[2][iDim] = Orthogonal[iDim]; + } + break; + } + } // switch +} + /// @} } // namespace GeometryToolbox diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index a0d404bd07d..2b073906cd7 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -247,53 +247,9 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } - /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as - t*n=0 && |t|_2 = 1 ---*/ - su2double TangentialNorm, Tangential[MAXNDIM] = {0.0}; - su2double Orthogonal[MAXNDIM] = {0.0}; - switch (nDim) { - case 2: { - Tangential[0] = -UnitNormal[1]; - Tangential[1] = UnitNormal[0]; - for (auto iDim = 0u; iDim < nDim; iDim++) { - TensorMap[0][iDim] = UnitNormal[iDim]; - TensorMap[1][iDim] = Tangential[iDim]; - } - break; - } - case 3: { - /*--- n = ai + bj + ck, if |b| > |c| ---*/ - if (abs(UnitNormal[1]) > abs(UnitNormal[2])) { - /*--- t = bi + (c-a)j - bk ---*/ - Tangential[0] = UnitNormal[1]; - Tangential[1] = UnitNormal[2] - UnitNormal[0]; - Tangential[2] = -UnitNormal[1]; - } else { - /*--- t = ci - cj + (b-a)k ---*/ - Tangential[0] = UnitNormal[2]; - Tangential[1] = -UnitNormal[2]; - Tangential[2] = UnitNormal[1] - UnitNormal[0]; - } - /*--- Make it a unit vector. ---*/ - TangentialNorm = sqrt(pow(Tangential[0], 2) + pow(Tangential[1], 2) + pow(Tangential[2], 2)); - Tangential[0] = Tangential[0] / TangentialNorm; - Tangential[1] = Tangential[1] / TangentialNorm; - Tangential[2] = Tangential[2] / TangentialNorm; - - /*--- Compute 3rd direction of the base using cross product ---*/ - Orthogonal[0] = UnitNormal[1]*Tangential[2] - UnitNormal[2]*Tangential[1]; - Orthogonal[1] = UnitNormal[2]*Tangential[0] - UnitNormal[0]*Tangential[2]; - Orthogonal[2] = UnitNormal[0]*Tangential[1] - UnitNormal[1]*Tangential[0]; - - // now we construct the tensor mapping T, note that its inverse is the transpose of T - for (auto iDim = 0u; iDim < nDim; iDim++) { - TensorMap[0][iDim] = UnitNormal[iDim]; - TensorMap[1][iDim] = Tangential[iDim]; - TensorMap[2][iDim] = Orthogonal[iDim]; - } - break; - } - } // switch + + GeometryToolbox::BaseFromNormal(nDim,UnitNormal,TensorMap); + if (isFlowSolver == true) { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 608ff4584ba..f34bba7ade0 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1131,7 +1131,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; - // at this point we can find out if the node is shared with another symmetry. // step 1: do we have other symmetries? if (nSym>1) { @@ -1201,7 +1200,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve Solution[iVel + iDim] = vel[iDim]; nodes->SetSolution_Old(iPoint, Solution); - nodes->SetSolution(iPoint, Solution); + // not necessary? + //nodes->SetSolution(iPoint, Solution); nodes->SetVel_ResTruncError_Zero(iPoint); if (implicit) { From 228823de3841b138ed98d10c1943a1d428c75c01 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 4 Apr 2024 23:21:35 +0200 Subject: [PATCH 051/194] make green-gauss gradient computations for symmetry planes more compact --- .../gradients/computeGradientsGreenGauss.hpp | 57 +++---------------- 1 file changed, 9 insertions(+), 48 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 2b073906cd7..1ac2e186a96 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -61,6 +61,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER size_t varEnd, GradientType& gradient) { const size_t nPointDomain = geometry.GetnPointDomain(); bool isFlowSolver = solver->GetSolverName().find("FLOW") != string::npos; + //const auto iVel = prim_idx.Velocity(); #ifdef HAVE_OMP constexpr size_t OMP_MAX_CHUNK = 512; @@ -262,7 +263,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER /*--- Get gradients of primitives of boundary cell ---*/ for (auto iVar = 0u; iVar < nDim; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { - Gradients_Velocity[iVar][iDim] = gradient(iPoint, iVar+1, iDim); + Gradients_Velocity[iVar][iDim] = Grad_Reflected[1 + iVar][iDim]; Gradients_Velocity_Reflected[iVar][iDim] = 0.0; } } @@ -278,7 +279,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } - // now also remove the gradients that are supposed to be zero //first entry is normal direction n, with velocity V,W in the sym plane // and velocity U in the normal direction @@ -314,7 +314,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { - Grad_Reflected[iDim+1][jDim] = Gradients_Velocity[iDim][jDim]; + gradient(iPoint,iDim+1,iDim) = Gradients_Velocity[iDim][jDim]; } } @@ -322,25 +322,24 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (auto iVar = varBegin; iVar < varEnd; iVar++) { // For the auxiliary variable we do not have velocity vectors. But the gradients of the auxvars // do not seem to be used so this has no effect on the computations. - if (iVar == 0 || iVar > nDim) { // We should exclude here for instance AuxVars for axisymmetry? + if ((isFlowSolver==true && (iVar == 0 || iVar > nDim)) || (isFlowSolver == false) ) { /*--- project to symmetry aligned base ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { - gradPhi[iDim] = gradient(iPoint, iVar, iDim); + gradPhi[iDim] = 0.0; gradPhiReflected[iDim] = 0.0; } for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto iDim = 0u; iDim < nDim; iDim++) { // map transpose T' * grad(phi) - gradPhiReflected[jDim] += TensorMap[jDim][iDim]*gradPhi[iDim]; + gradPhiReflected[jDim] += TensorMap[jDim][iDim]*Grad_Reflected[iVar][iDim]; } } - for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; - /*--- gradient in direction normal to symmetry is cancelled ---*/ gradPhiReflected[0] = 0.0; + /*--- Now transform back ---*/ for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto iDim = 0u; iDim < nDim; iDim++) { @@ -349,50 +348,12 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } for (auto iDim = 0u; iDim < nDim; iDim++) - Grad_Reflected[iVar][iDim] = gradPhi[iDim]; + gradient(iPoint,iVar,iDim) = gradPhi[iDim]; } } + } - /*--- Update gradients with reflected gradients ---*/ - for (auto iVar = varBegin; iVar < varEnd; iVar++) - for (auto iDim = 0u; iDim < nDim; iDim++) - gradient(iPoint,iVar,iDim) = Grad_Reflected[iVar][iDim]; - - } else { - /*--- not a flow solver ---*/ - for (size_t iVar = varBegin; iVar < varEnd; iVar++) { - /*--- project to symmetry aligned base ---*/ - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradPhi[iDim] = gradient(iPoint, iVar, iDim); - gradPhiReflected[iDim] = 0.0; - } - - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - // map transpose T' * grad(phi) - gradPhiReflected[jDim] += TensorMap[jDim][iDim]*gradPhi[iDim]; - } - } - - for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; - - /*--- gradient in direction normal to symmetry is cancelled ---*/ - gradPhiReflected[0] = 0.0; - - /*--- Now transform back ---*/ - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradPhi[jDim] += TensorMap[iDim][jDim]*gradPhiReflected[iDim]; - } - } - - for (auto iDim = 0u; iDim < nDim; iDim++) - gradient(iPoint, iVar, iDim) = gradPhi[iDim]; - - } - - } // not a flow solver } // loop over vertices } // symmetry } // markers From 101319144c41a587c216db303d2d463c2d7088ce Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 5 Apr 2024 00:01:08 +0200 Subject: [PATCH 052/194] make green-gauss gradient computations for symmetry planes more compact --- .../gradients/computeGradientsGreenGauss.hpp | 22 ++++++------------- .../include/solvers/CFVMFlowSolverBase.inl | 2 +- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 1ac2e186a96..428ed3c7854 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -71,10 +71,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER static constexpr size_t MAXNVAR = 20; static constexpr size_t MAXNDIM = 3; - static constexpr size_t MAXNSYMS = 5; - - /*--- Allocation of primitive gradient arrays for viscous fluxes. ---*/ - su2activematrix Grad_Reflected(varEnd, nDim); + static constexpr size_t MAXNSYMS = 100; /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ su2activematrix TensorMap(nDim,nDim); @@ -254,16 +251,10 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER if (isFlowSolver == true) { - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - Grad_Reflected[iVar][iDim] = gradient(iPoint, iVar, iDim); - } - } - - /*--- Get gradients of primitives of boundary cell ---*/ + /*--- Get local copy of velocity gradients ---*/ for (auto iVar = 0u; iVar < nDim; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { - Gradients_Velocity[iVar][iDim] = Grad_Reflected[1 + iVar][iDim]; + Gradients_Velocity[iVar][iDim] = gradient(iPoint, 1 + iVar, iDim); Gradients_Velocity_Reflected[iVar][iDim] = 0.0; } } @@ -279,7 +270,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } - // now also remove the gradients that are supposed to be zero + // now also remove the gradients that are zero in the symmetry aligned 'reflected' base //first entry is normal direction n, with velocity V,W in the sym plane // and velocity U in the normal direction // we need to remove dV/dn and DW/dn = 0 @@ -294,13 +285,14 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER Gradients_Velocity_Reflected[iDim][0] = 0.0; } + // clean velocity gradients for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { Gradients_Velocity[iDim][jDim] = 0.0; } } - // now transform back by taking the inverse again + // now transform back the corrected velocity gradients by taking the inverse again // T = (L^-1)*T' for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { @@ -333,7 +325,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto iDim = 0u; iDim < nDim; iDim++) { // map transpose T' * grad(phi) - gradPhiReflected[jDim] += TensorMap[jDim][iDim]*Grad_Reflected[iVar][iDim]; + gradPhiReflected[jDim] += TensorMap[jDim][iDim]*gradient(iPoint,iVar,iDim); } } diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index f34bba7ade0..7439dc4dc11 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1102,7 +1102,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against - static constexpr size_t MAXNSYMS = 5; + static constexpr size_t MAXNSYMS = 100; unsigned short Syms[MAXNSYMS] = {0}; unsigned short nSym = 0; From 960dc1f86807a6dbbd85283b8de5ee5eaee9a263 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 9 Apr 2024 23:19:14 +0200 Subject: [PATCH 053/194] modify restruncerror --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 13 ++++++++++++- SU2_CFD/include/variables/CVariable.hpp | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 7439dc4dc11..3490c2549e4 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1134,6 +1134,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve // at this point we can find out if the node is shared with another symmetry. // step 1: do we have other symmetries? if (nSym>1) { + cout << "more than one symmetry!!!" << endl; // normal of the primary symmetry plane su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; // step 2: are we on a shared node? @@ -1202,7 +1203,17 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve nodes->SetSolution_Old(iPoint, Solution); // not necessary? //nodes->SetSolution(iPoint, Solution); - nodes->SetVel_ResTruncError_Zero(iPoint); + + NormalProduct = 0.0; + su2double* Res_TruncError = nodes->GetResTruncError(iPoint); + for(unsigned short iDim = 0; iDim < nDim; iDim++) { + NormalProduct += Res_TruncError[iVel + iDim] * UnitNormal[iDim]; + } + + for(unsigned short iDim = 0; iDim < nDim; iDim++) + Res_TruncError[iVel + iDim] -= NormalProduct * UnitNormal[iDim]; + + nodes->SetResTruncError(iPoint, Res_TruncError); if (implicit) { /*--- Modify the Jacobians according to the modification of the residual diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 358824ae8d7..920f5680915 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -702,6 +702,16 @@ class CVariable { val_trunc_error[iVar] = Res_TruncError(iPoint, iVar); } + /*! + * \brief Set the truncation error. + * \param[in] iPoint - Point index. + * \param[in] val_trunc_error - Pointer to the truncation error. + */ + inline void SetResTruncError(unsigned long iPoint, su2double *val_trunc_error) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Res_TruncError(iPoint, iVar) = val_trunc_error[iVar]; + } + /*! * \brief Set the gradient of the solution. * \param[in] iPoint - Point index. From 8d45f6c0bfca630e7fb0a44a43dc074c064a1cda Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 10 Apr 2024 00:03:12 +0200 Subject: [PATCH 054/194] modify normals in multigrid --- Common/include/geometry/CGeometry.hpp | 2 +- .../include/geometry/CMultiGridGeometry.hpp | 2 +- Common/src/geometry/CGeometry.cpp | 2 +- Common/src/geometry/CMultiGridGeometry.cpp | 56 ++++++++++++++++++- .../src/grid_movement/CVolumetricMovement.cpp | 2 +- SU2_CFD/src/drivers/CDriver.cpp | 6 +- 6 files changed, 62 insertions(+), 8 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index 15a726cabec..ec9a4b1d07d 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -938,7 +938,7 @@ class CGeometry { * \param[in] fine_grid - Geometrical definition of the problem. * \param[in] action - Allocate or not the new elements. */ - inline virtual void SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) {} + inline virtual void SetBoundControlVolume(const CConfig* config, const CGeometry* fine_grid, unsigned short action) {} /*! * \brief A virtual member. diff --git a/Common/include/geometry/CMultiGridGeometry.hpp b/Common/include/geometry/CMultiGridGeometry.hpp index 6669db4b019..057dd073cbe 100644 --- a/Common/include/geometry/CMultiGridGeometry.hpp +++ b/Common/include/geometry/CMultiGridGeometry.hpp @@ -150,7 +150,7 @@ class CMultiGridGeometry final : public CGeometry { * \param[in] fine_grid - Geometrical definition of the problem. * \param[in] action - Allocate or not the new elements. */ - void SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) override; + void SetBoundControlVolume(const CConfig* config, const CGeometry* fine_grid, unsigned short action) override; /*! * \brief Set a representative coordinates of the agglomerated control volume. diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index e1f199999f9..d3a4309054d 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2338,7 +2338,7 @@ void CGeometry::UpdateGeometry(CGeometry** geometry_container, CConfig* config) /*--- Update the control volume structures ---*/ geometry_container[iMesh]->SetControlVolume(geometry_container[iMesh - 1], UPDATE); - geometry_container[iMesh]->SetBoundControlVolume(geometry_container[iMesh - 1], UPDATE); + geometry_container[iMesh]->SetBoundControlVolume(config, geometry_container[iMesh - 1], UPDATE); geometry_container[iMesh]->SetCoord(geometry_container[iMesh - 1]); } diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 3e2b26c0198..03a3d45fd4f 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -900,7 +900,8 @@ void CMultiGridGeometry::SetControlVolume(const CGeometry* fine_grid, unsigned s END_SU2_OMP_SAFE_GLOBAL_ACCESS } -void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) { +void CMultiGridGeometry::SetBoundControlVolume(const CConfig* config, const CGeometry* fine_grid, + unsigned short action) { BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { unsigned long iCoarsePoint, iFinePoint, FineVertex, iVertex; unsigned short iMarker, iChildren, iDim; @@ -938,6 +939,59 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig } } END_SU2_OMP_SAFE_GLOBAL_ACCESS + + /*--- For symmetry planes: Blazek chapter 8.6: + * It is also necessary to correct the normal vectors of those faces + * of the control volume, which touch the boundary. The + * modification consists of removing all components of the face vector, which are normal + * to the symmetry plane. ---*/ + SU2_OMP_FOR_DYN(1) + for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { + if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { + const auto iPoint = vertex[iMarker][iVertex]->GetNode(); + + const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); + + su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); + su2double UnitNormal_Sym[MAXNDIM] = {0.0}; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; + } + + for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { + su2double Product = 0.0; + unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); + /*---Check if neighbour point is on the same plane as the symmetry plane + by computing the internal product of the Normal Vertex vector and + the vector connecting iPoint and jPoint. If the product is lower than + estabilished tolerance (to account for Numerical errors) both points are + in the same plane as SYMMETRY_PLANE---*/ + su2double Tangent[MAXNDIM] = {0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); + Product += Tangent[iDim] * Normal_Sym[iDim]; + } + + if (abs(Product) < EPS) { + Product = 0.0; + + unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); + su2double Normal[MAXNDIM] = {0.0}; + edges->GetNormal(iEdge, Normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; + + edges->SetNormal(iEdge, Normal); + } // if in-plane of symmetry + } // loop over neighbors + } // loop over vertices + } // if symmetry + } // loop over markers + END_SU2_OMP_FOR } void CMultiGridGeometry::SetCoord(const CGeometry* fine_grid) { diff --git a/Common/src/grid_movement/CVolumetricMovement.cpp b/Common/src/grid_movement/CVolumetricMovement.cpp index 5b09a9cdd71..f82c71b2972 100644 --- a/Common/src/grid_movement/CVolumetricMovement.cpp +++ b/Common/src/grid_movement/CVolumetricMovement.cpp @@ -98,7 +98,7 @@ void CVolumetricMovement::UpdateMultiGrid(CGeometry** geometry, CConfig* config) for (iMGlevel = 1; iMGlevel <= nMGlevel; iMGlevel++) { iMGfine = iMGlevel - 1; geometry[iMGlevel]->SetControlVolume(geometry[iMGfine], UPDATE); - geometry[iMGlevel]->SetBoundControlVolume(geometry[iMGfine], UPDATE); + geometry[iMGlevel]->SetBoundControlVolume(config, geometry[iMGfine], UPDATE); geometry[iMGlevel]->SetCoord(geometry[iMGfine]); if (config->GetGrid_Movement()) geometry[iMGlevel]->SetRestricted_GridVelocity(geometry[iMGfine]); } diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 7160cc93e6f..a1c9c098a24 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -844,7 +844,7 @@ void CDriver::InitializeGeometryFVM(CConfig *config, CGeometry **&geometry) { /*--- Create the control volume structures ---*/ geometry[iMGlevel]->SetControlVolume(geometry[iMGlevel-1], ALLOCATE); - geometry[iMGlevel]->SetBoundControlVolume(geometry[iMGlevel-1], ALLOCATE); + geometry[iMGlevel]->SetBoundControlVolume(config, geometry[iMGlevel-1], ALLOCATE); geometry[iMGlevel]->SetCoord(geometry[iMGlevel-1]); /*--- Find closest neighbor to a surface point ---*/ @@ -2511,7 +2511,7 @@ void CDriver::InitializeInterface(CConfig **config, CSolver***** solver, CGeomet const auto fluidZone = heat_target? donor : target; - if (config[fluidZone]->GetEnergy_Equation() || (config[fluidZone]->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE) + if (config[fluidZone]->GetEnergy_Equation() || (config[fluidZone]->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE) || (config[fluidZone]->GetKind_FluidModel() == ENUM_FLUIDMODEL::FLUID_FLAMELET)) interface_type = heat_target? CONJUGATE_HEAT_FS : CONJUGATE_HEAT_SF; else if (config[fluidZone]->GetWeakly_Coupled_Heat()) @@ -2691,7 +2691,7 @@ void CDriver::PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry, } } - for (iZone = 0; iZone < nZone-1; iZone++) { + for (iZone = 0; iZone < nZone-1; iZone++) { geometry[nZone-1][INST_0][MESH_0]->SetAvgTurboGeoValues(config[iZone],geometry[iZone][INST_0][MESH_0], iZone); } From 3666bcf3c15e2c7fb3d36bd8a72d12463a7fbf2b Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 10 Apr 2024 00:05:51 +0200 Subject: [PATCH 055/194] modify normals in multigrid - commented --- Common/src/geometry/CMultiGridGeometry.cpp | 92 +++++++++++----------- 1 file changed, 45 insertions(+), 47 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 03a3d45fd4f..91b4ae20927 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -945,53 +945,51 @@ void CMultiGridGeometry::SetBoundControlVolume(const CConfig* config, const CGeo * of the control volume, which touch the boundary. The * modification consists of removing all components of the face vector, which are normal * to the symmetry plane. ---*/ - SU2_OMP_FOR_DYN(1) - for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { - const auto iPoint = vertex[iMarker][iVertex]->GetNode(); - - const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); - - su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); - su2double UnitNormal_Sym[MAXNDIM] = {0.0}; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; - } - - for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { - su2double Product = 0.0; - unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); - /*---Check if neighbour point is on the same plane as the symmetry plane - by computing the internal product of the Normal Vertex vector and - the vector connecting iPoint and jPoint. If the product is lower than - estabilished tolerance (to account for Numerical errors) both points are - in the same plane as SYMMETRY_PLANE---*/ - su2double Tangent[MAXNDIM] = {0.0}; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); - Product += Tangent[iDim] * Normal_Sym[iDim]; - } - - if (abs(Product) < EPS) { - Product = 0.0; - - unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); - su2double Normal[MAXNDIM] = {0.0}; - edges->GetNormal(iEdge, Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; - - edges->SetNormal(iEdge, Normal); - } // if in-plane of symmetry - } // loop over neighbors - } // loop over vertices - } // if symmetry - } // loop over markers - END_SU2_OMP_FOR + // for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { + // if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + // (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + // for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { + // const auto iPoint = vertex[iMarker][iVertex]->GetNode(); + + // const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); + + // su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); + // su2double UnitNormal_Sym[MAXNDIM] = {0.0}; + + // for (unsigned short iDim = 0; iDim < nDim; iDim++) { + // UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; + // } + + // for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { + // su2double Product = 0.0; + // unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); + // /*---Check if neighbour point is on the same plane as the symmetry plane + // by computing the internal product of the Normal Vertex vector and + // the vector connecting iPoint and jPoint. If the product is lower than + // estabilished tolerance (to account for Numerical errors) both points are + // in the same plane as SYMMETRY_PLANE---*/ + // su2double Tangent[MAXNDIM] = {0.0}; + // for (unsigned short iDim = 0; iDim < nDim; iDim++) { + // Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); + // Product += Tangent[iDim] * Normal_Sym[iDim]; + // } + + // if (abs(Product) < EPS) { + // Product = 0.0; + + // unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); + // su2double Normal[MAXNDIM] = {0.0}; + // edges->GetNormal(iEdge, Normal); + // for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; + + // for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; + + // edges->SetNormal(iEdge, Normal); + // } // if in-plane of symmetry + // } // loop over neighbors + // } // loop over vertices + // } // if symmetry + // } // loop over markers } void CMultiGridGeometry::SetCoord(const CGeometry* fine_grid) { From 805ba34261d82a151be302b9a309a11d99378d3b Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 17 Apr 2024 21:40:05 +0200 Subject: [PATCH 056/194] small fix --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 3490c2549e4..de06c1f85ac 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1046,7 +1046,7 @@ void CFVMFlowSolverBase::PushSolutionBackInTime(unsigned long TimeIter, bo CSolver*** solver_container, CGeometry** geometry, CConfig* config) { /*--- Push back the initial condition to previous solution containers - for a 1st-order restart or when simply intitializing to freestream. ---*/ + for a 1st-order restart or when simply initializing to freestream. ---*/ for (unsigned short iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { solver_container[iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); @@ -1072,7 +1072,6 @@ void CFVMFlowSolverBase::PushSolutionBackInTime(unsigned long TimeIter, bo /*--- Load an additional restart file for a 2nd-order restart. ---*/ solver_container[MESH_0][FLOW_SOL]->LoadRestart(geometry, solver_container, config, TimeIter-1, true); - /*--- Load an additional restart file for the turbulence model. ---*/ if (rans) solver_container[MESH_0][TURB_SOL]->LoadRestart(geometry, solver_container, config, TimeIter-1, false); From 64fd52a4defd4026cc5345a53a6f14bee6195129 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 20 Apr 2024 17:13:06 +0200 Subject: [PATCH 057/194] uncomment again --- Common/src/geometry/CMultiGridGeometry.cpp | 90 +++++++++---------- .../include/solvers/CFVMFlowSolverBase.inl | 1 - SU2_CFD/src/integration/CIntegration.cpp | 3 - 3 files changed, 45 insertions(+), 49 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 91b4ae20927..0cd20d8e961 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -945,51 +945,51 @@ void CMultiGridGeometry::SetBoundControlVolume(const CConfig* config, const CGeo * of the control volume, which touch the boundary. The * modification consists of removing all components of the face vector, which are normal * to the symmetry plane. ---*/ - // for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { - // if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - // (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - // for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { - // const auto iPoint = vertex[iMarker][iVertex]->GetNode(); - - // const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); - - // su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); - // su2double UnitNormal_Sym[MAXNDIM] = {0.0}; - - // for (unsigned short iDim = 0; iDim < nDim; iDim++) { - // UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; - // } - - // for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { - // su2double Product = 0.0; - // unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); - // /*---Check if neighbour point is on the same plane as the symmetry plane - // by computing the internal product of the Normal Vertex vector and - // the vector connecting iPoint and jPoint. If the product is lower than - // estabilished tolerance (to account for Numerical errors) both points are - // in the same plane as SYMMETRY_PLANE---*/ - // su2double Tangent[MAXNDIM] = {0.0}; - // for (unsigned short iDim = 0; iDim < nDim; iDim++) { - // Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); - // Product += Tangent[iDim] * Normal_Sym[iDim]; - // } - - // if (abs(Product) < EPS) { - // Product = 0.0; - - // unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); - // su2double Normal[MAXNDIM] = {0.0}; - // edges->GetNormal(iEdge, Normal); - // for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; - - // for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; - - // edges->SetNormal(iEdge, Normal); - // } // if in-plane of symmetry - // } // loop over neighbors - // } // loop over vertices - // } // if symmetry - // } // loop over markers + for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { + if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { + const auto iPoint = vertex[iMarker][iVertex]->GetNode(); + + const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); + + su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); + su2double UnitNormal_Sym[MAXNDIM] = {0.0}; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; + } + + for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { + su2double Product = 0.0; + unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); + /*---Check if neighbour point is on the same plane as the symmetry plane + by computing the internal product of the Normal Vertex vector and + the vector connecting iPoint and jPoint. If the product is lower than + estabilished tolerance (to account for Numerical errors) both points are + in the same plane as SYMMETRY_PLANE---*/ + su2double Tangent[MAXNDIM] = {0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); + Product += Tangent[iDim] * Normal_Sym[iDim]; + } + + if (abs(Product) < EPS) { + Product = 0.0; + + unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); + su2double Normal[MAXNDIM] = {0.0}; + edges->GetNormal(iEdge, Normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; + + edges->SetNormal(iEdge, Normal); + } // if in-plane of symmetry + } // loop over neighbors + } // loop over vertices + } // if symmetry + } // loop over markers } void CMultiGridGeometry::SetCoord(const CGeometry* fine_grid) { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index de06c1f85ac..a5d45b6fee1 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1133,7 +1133,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve // at this point we can find out if the node is shared with another symmetry. // step 1: do we have other symmetries? if (nSym>1) { - cout << "more than one symmetry!!!" << endl; // normal of the primary symmetry plane su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; // step 2: are we on a shared node? diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index abd254efee9..8299990c129 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -141,9 +141,6 @@ void CIntegration::Space_Integration(CGeometry *geometry, case FAR_FIELD: solver_container[MainSolver]->BC_Far_Field(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); break; - //case SYMMETRY_PLANE: - // solver_container[MainSolver]->BC_Sym_Plane(geometry, solver_container, conv_bound_numerics, visc_bound_numerics, config, iMarker); - // break; } } From 48e77c52671abb7b248e191c524f3ce17c7f0112 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 21 Apr 2024 13:06:47 +0200 Subject: [PATCH 058/194] fix GG, fix multigrid --- Common/src/geometry/CMultiGridGeometry.cpp | 11 +++++++--- .../gradients/computeGradientsGreenGauss.hpp | 20 +++++++++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 0cd20d8e961..646ae1283d7 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -118,7 +118,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE); } - /*--- If there are more than 2 markers, the aglomeration will be discarted ---*/ + /*--- If there are more than 2 markers, the aglomeration will be discarded ---*/ if (counter > 2) agglomerate_seed = false; @@ -501,7 +501,7 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark const CConfig* config) const { bool agglomerate_CV = false; - /*--- Basic condition, the point has not being previously agglomerated, it belongs to the domain, + /*--- Basic condition, the point has not been previously agglomerated, it belongs to the domain, and has passed some basic geometrical checks. ---*/ if ((!fine_grid->nodes->GetAgglomerate(CVPoint)) && (fine_grid->nodes->GetDomain(CVPoint)) && @@ -551,10 +551,15 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark } - /*--- If the element belongs to the domain, it is allways aglomerated. ---*/ + /*--- If the element belongs to the domain, it is always aglomerated. ---*/ else { agglomerate_CV = true; + // actually, for symmetry (and possibly other cells) we only agglomerate cells that are on the marker + // at this point, the seed was on the boundary and the CV was not. so we check if the seed is a symmetry + if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) { + agglomerate_CV = false; + } } } diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 428ed3c7854..2b07eb7038a 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -61,7 +61,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER size_t varEnd, GradientType& gradient) { const size_t nPointDomain = geometry.GetnPointDomain(); bool isFlowSolver = solver->GetSolverName().find("FLOW") != string::npos; - //const auto iVel = prim_idx.Velocity(); #ifdef HAVE_OMP constexpr size_t OMP_MAX_CHUNK = 512; @@ -73,6 +72,9 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER static constexpr size_t MAXNDIM = 3; static constexpr size_t MAXNSYMS = 100; + /*--- Allocation of primitive gradient arrays for viscous fluxes. ---*/ + //su2activematrix Grad_Reflected(varEnd, nDim); + /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ su2activematrix TensorMap(nDim,nDim); su2activematrix Gradients_Velocity(nDim,nDim); @@ -251,7 +253,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER if (isFlowSolver == true) { - /*--- Get local copy of velocity gradients ---*/ + /*--- Get gradients of primitives of boundary cell ---*/ for (auto iVar = 0u; iVar < nDim; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { Gradients_Velocity[iVar][iDim] = gradient(iPoint, 1 + iVar, iDim); @@ -306,19 +308,24 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { - gradient(iPoint,iDim+1,iDim) = Gradients_Velocity[iDim][jDim]; + gradient(iPoint,iDim+1,jDim) = Gradients_Velocity[iDim][jDim]; } } + } /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) { // For the auxiliary variable we do not have velocity vectors. But the gradients of the auxvars // do not seem to be used so this has no effect on the computations. - if ((isFlowSolver==true && (iVar == 0 || iVar > nDim)) || (isFlowSolver == false) ) { + if ( + (isFlowSolver==false) || + ((isFlowSolver==true) && (iVar == 0 || iVar > nDim)) + ) + { /*--- project to symmetry aligned base ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { - gradPhi[iDim] = 0.0; + gradPhi[iDim] = gradient(iPoint, iVar, iDim); gradPhiReflected[iDim] = 0.0; } @@ -329,6 +336,8 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } + for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; + /*--- gradient in direction normal to symmetry is cancelled ---*/ gradPhiReflected[0] = 0.0; @@ -344,7 +353,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } - } } // loop over vertices } // symmetry From a3c03bbace289d94e26d14fa00eb040d74003aef Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 21 Apr 2024 23:21:59 +0200 Subject: [PATCH 059/194] formatting... --- Common/src/geometry/CMultiGridGeometry.cpp | 1 - .../gradients/computeGradientsGreenGauss.hpp | 57 ++++++++----------- .../include/solvers/CFVMFlowSolverBase.inl | 25 ++++---- 3 files changed, 35 insertions(+), 48 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 646ae1283d7..331bf95150e 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -151,7 +151,6 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto CVPoint : Suitable_Indirect_Neighbors) { /*--- The new point can be agglomerated ---*/ - if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) { /*--- We set the value of the parent ---*/ diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 2b07eb7038a..72e563585e7 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -72,9 +72,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER static constexpr size_t MAXNDIM = 3; static constexpr size_t MAXNSYMS = 100; - /*--- Allocation of primitive gradient arrays for viscous fluxes. ---*/ - //su2activematrix Grad_Reflected(varEnd, nDim); - /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ su2activematrix TensorMap(nDim,nDim); su2activematrix Gradients_Velocity(nDim,nDim); @@ -193,7 +190,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - + SU2_OMP_FOR_STAT(32) for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); @@ -207,36 +204,37 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - // normal of the primary symmetry plane + /*--- Normal of the primary symmetry plane ---*/ su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - // at this point we can find out if the node is shared with another symmetry. - // step 1: do we have other symmetries? + /*--- At this point we can find out if the node is shared with another symmetry. + * Step 1: do we have other symmetries? ---*/ if (nSym>1) { - // step 2: are we on a shared node? + /*--- Step 2: are we on a shared node? ---*/ for (auto jMarker=0;jMarkerGetNode(); if (iPoint==jPoint) { - // Does the other symmetry have a lower ID? Then that is the primary symmetry + /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ if (Syms[jMarker]GetNormal(NormalPrim); su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); for(unsigned short iDim = 0; iDim < nDim; iDim++) { UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; } - // correct the current normal as n2_new = n2 - (n2.n1).n1 + /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ su2double ProjNorm = 0.0; for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - // We check if the normal of the 2 planes coincide. We only update the normal if the normals of the symmetry planes are different. + /*--- We check if the normal of the 2 planes coincide. + * We only update the normal if the normals of the symmetry planes are different. ---*/ if (fabs(1.0-ProjNorm)>EPS) { for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - // make normalized vector again + /* Make normalized vector ---*/ su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; } @@ -247,10 +245,9 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } - + /*--- Compute a new base for TensorMap aligned with the unit normal ---*/ GeometryToolbox::BaseFromNormal(nDim,UnitNormal,TensorMap); - if (isFlowSolver == true) { /*--- Get gradients of primitives of boundary cell ---*/ @@ -261,7 +258,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } - // Q' = L^T*Q*T + /*--- Q' = L^T*Q*T ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto kDim = 0u; kDim < nDim; kDim++) { @@ -272,30 +269,23 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } - // now also remove the gradients that are zero in the symmetry aligned 'reflected' base - //first entry is normal direction n, with velocity V,W in the sym plane - // and velocity U in the normal direction - // we need to remove dV/dn and DW/dn = 0 - // and dU/dt and dU/ds = 0 - - // we have aligned such that U is the direction of the normal - // in 2D: dU/dy = dV/dx = 0 - // in 3D: dU/dy = dV/dx = 0 - // dU/dz = dW/dx = 0 + /*--- we have aligned such that U is the direction of the normal + * in 2D: dU/dy = dV/dx = 0 + * in 3D: dU/dy = dV/dx = 0 + * dU/dz = dW/dx = 0 ---*/ for (auto iDim = 1u; iDim < nDim; iDim++) { Gradients_Velocity_Reflected[0][iDim] = 0.0; Gradients_Velocity_Reflected[iDim][0] = 0.0; } - // clean velocity gradients for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { Gradients_Velocity[iDim][jDim] = 0.0; } } - // now transform back the corrected velocity gradients by taking the inverse again - // T = (L^-1)*T' + /*--- now transform back the corrected velocity gradients by taking the inverse again + * T = (L^-1)*T' ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto kDim = 0u; kDim < nDim; kDim++) { @@ -315,8 +305,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) { - // For the auxiliary variable we do not have velocity vectors. But the gradients of the auxvars - // do not seem to be used so this has no effect on the computations. if ( (isFlowSolver==false) || ((isFlowSolver==true) && (iVar == 0 || iVar > nDim)) @@ -331,7 +319,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto iDim = 0u; iDim < nDim; iDim++) { - // map transpose T' * grad(phi) + /*--- map transpose T' * grad(phi) ---*/ gradPhiReflected[jDim] += TensorMap[jDim][iDim]*gradient(iPoint,iVar,iDim); } } @@ -355,6 +343,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } // loop over vertices + END_SU2_OMP_FOR } // symmetry } // markers diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index a5d45b6fee1..ddbc7154606 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1130,34 +1130,35 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; - // at this point we can find out if the node is shared with another symmetry. - // step 1: do we have other symmetries? + /*--- At this point we find out if the node is shared with another symmetry. ---*/ + /*--- Step 1: do we have other symmetries? ---*/ if (nSym>1) { - // normal of the primary symmetry plane + /*--- Normal of the primary symmetry plane ---*/ su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - // step 2: are we on a shared node? + /*--- Step 2: are we on a shared node? ---*/ for (auto iMarker=0;iMarkernVertex[Syms[iMarker]]; jVertex++) { const auto jPoint = geometry->vertex[Syms[iMarker]][jVertex]->GetNode(); if (iPoint==jPoint) { - // Does the other symmetry have a lower ID? Then that is the primary symmetry + /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ if (Syms[iMarker]vertex[Syms[iMarker]][jVertex]->GetNormal(NormalPrim); su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); for(unsigned short iDim = 0; iDim < nDim; iDim++) { UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; } - // correct the current normal as n2_new = n2 - (n2.n1).n1 + /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ su2double ProjNorm = 0.0; for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - // We check if the normal of the 2 planes coincide. We only update the normal if the normals of the symmetry planes are different. + /*--- We check if the normal of the 2 planes coincide. + * We only update the normal if the normals of the symmetry planes are different. ---*/ if (fabs(1.0-ProjNorm)>EPS) { for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - // make normalized vector again + /*--- Make normalized vector ---*/ su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; } @@ -1178,7 +1179,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(unsigned short iDim = 0; iDim < nDim; iDim++) LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; - /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ @@ -1194,7 +1194,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution[iVar] = nodes->GetSolution_Old(iPoint,iVar); - // overwrite solution with the new velocity for(unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iVel + iDim] = vel[iDim]; From c24fd6e5802dbe9becfcec30a0b1465dc1eadecb Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 21 Apr 2024 23:49:54 +0200 Subject: [PATCH 060/194] boilerplate - create only one copy of normal edge correction --- Common/include/geometry/CGeometry.hpp | 7 ++- Common/src/geometry/CGeometry.cpp | 57 +++++++++++++++++++++- Common/src/geometry/CMultiGridGeometry.cpp | 52 +------------------- Common/src/geometry/CPhysicalGeometry.cpp | 54 +------------------- 4 files changed, 66 insertions(+), 104 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index ec9a4b1d07d..0ba3dbf688e 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -1005,6 +1005,11 @@ class CGeometry { */ su2double GetSurfaceArea(const CConfig* config, unsigned short val_marker) const; + /*! + * \brief Correct edge normals for symmetry planes. + */ + void SetBoundControlVolumeSym(const CConfig* config); + /*! * \brief Check if a boundary is straight(2D) / plane(3D) for EULER_WALL and SYMMETRY_PLANE * only and store the information in bound_is_straight. For all other boundary types @@ -1012,7 +1017,7 @@ class CGeometry { * \param[in] config - Definition of the particular problem. * \param[in] print_on_screen - Boolean whether to print result on screen. */ - void ComputeSurf_Straightness(CConfig* config, bool print_on_screen); + void ComputeSurf_Straightness(const CConfig* config, bool print_on_screen); /*! * \brief Find and store all vertices on a sharp corner in the geometry. diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index d3a4309054d..2eac6697c85 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2457,7 +2457,62 @@ su2double CGeometry::GetSurfaceArea(const CConfig* config, unsigned short val_ma return 0.0; } -void CGeometry::ComputeSurf_Straightness(CConfig* config, bool print_on_screen) { +void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { + /*--- For symmetry planes: Blazek chapter 8.6: + * It is also necessary to correct the normal vectors of those faces + * of the control volume, which touch the boundary. + * The modification consists of removing all components of the face vector, + * which are normal to the symmetry plane. ---*/ + SU2_OMP_FOR_DYN(1) + for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { + if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { + const auto iPoint = vertex[iMarker][iVertex]->GetNode(); + + const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); + + su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); + su2double UnitNormal_Sym[MAXNDIM] = {0.0}; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; + } + + for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { + su2double Product = 0.0; + unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); + /*---Check if neighbour point is on the same plane as the symmetry plane + by computing the internal product of the Normal Vertex vector and + the vector connecting iPoint and jPoint. If the product is lower than + estabilished tolerance (to account for Numerical errors) both points are + in the same plane as SYMMETRY_PLANE---*/ + su2double Tangent[MAXNDIM] = {0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); + Product += Tangent[iDim] * Normal_Sym[iDim]; + } + + if (abs(Product) < EPS) { + Product = 0.0; + + unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); + su2double Normal[MAXNDIM] = {0.0}; + edges->GetNormal(iEdge, Normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; + + edges->SetNormal(iEdge, Normal); + } // if in-plane of symmetry + } // loop over neighbors + } // loop over vertices + } // if symmetry + } // loop over markers + END_SU2_OMP_FOR +} + +void CGeometry::ComputeSurf_Straightness(const CConfig* config, bool print_on_screen) { bool RefUnitNormal_defined; unsigned short iDim, iMarker, iMarker_Global, nMarker_Global = config->GetnMarker_CfgFile(); unsigned long iVertex; diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 331bf95150e..eeab1180f1d 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -944,56 +944,8 @@ void CMultiGridGeometry::SetBoundControlVolume(const CConfig* config, const CGeo } END_SU2_OMP_SAFE_GLOBAL_ACCESS - /*--- For symmetry planes: Blazek chapter 8.6: - * It is also necessary to correct the normal vectors of those faces - * of the control volume, which touch the boundary. The - * modification consists of removing all components of the face vector, which are normal - * to the symmetry plane. ---*/ - for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { - const auto iPoint = vertex[iMarker][iVertex]->GetNode(); - - const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); - - su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); - su2double UnitNormal_Sym[MAXNDIM] = {0.0}; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; - } - - for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { - su2double Product = 0.0; - unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); - /*---Check if neighbour point is on the same plane as the symmetry plane - by computing the internal product of the Normal Vertex vector and - the vector connecting iPoint and jPoint. If the product is lower than - estabilished tolerance (to account for Numerical errors) both points are - in the same plane as SYMMETRY_PLANE---*/ - su2double Tangent[MAXNDIM] = {0.0}; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); - Product += Tangent[iDim] * Normal_Sym[iDim]; - } - - if (abs(Product) < EPS) { - Product = 0.0; - - unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); - su2double Normal[MAXNDIM] = {0.0}; - edges->GetNormal(iEdge, Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; - - edges->SetNormal(iEdge, Normal); - } // if in-plane of symmetry - } // loop over neighbors - } // loop over vertices - } // if symmetry - } // loop over markers + /*--- Correct normals on symmetry plane ---*/ + SetBoundControlVolumeSym(config); } void CMultiGridGeometry::SetCoord(const CGeometry* fine_grid) { diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 0b830b50bbc..5fa08f6c457 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7284,58 +7284,8 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } END_SU2_OMP_FOR - /*--- For symmetry planes: Blazek chapter 8.6: - * It is also necessary to correct the normal vectors of those faces - * of the control volume, which touch the boundary. The - * modification consists of removing all components of the face vector, which are normal - * to the symmetry plane. ---*/ - SU2_OMP_FOR_DYN(1) - for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { - const auto iPoint = vertex[iMarker][iVertex]->GetNode(); - - const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); - - su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); - su2double UnitNormal_Sym[MAXNDIM] = {0.0}; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; - } - - for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { - su2double Product = 0.0; - unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); - /*---Check if neighbour point is on the same plane as the symmetry plane - by computing the internal product of the Normal Vertex vector and - the vector connecting iPoint and jPoint. If the product is lower than - estabilished tolerance (to account for Numerical errors) both points are - in the same plane as SYMMETRY_PLANE---*/ - su2double Tangent[MAXNDIM] = {0.0}; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); - Product += Tangent[iDim] * Normal_Sym[iDim]; - } - - if (abs(Product) < EPS) { - Product = 0.0; - - unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); - su2double Normal[MAXNDIM] = {0.0}; - edges->GetNormal(iEdge, Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; - - edges->SetNormal(iEdge, Normal); - } // if in-plane of symmetry - } // loop over neighbors - } // loop over vertices - } // if symmetry - } // loop over markers - END_SU2_OMP_FOR + /*--- Correct normals on symmetry plane ---*/ + SetBoundControlVolumeSym(config); } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { From 1bcf772b74b29f90d68b5d718e688ed9c98e74a2 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 23 Apr 2024 00:24:41 +0200 Subject: [PATCH 061/194] rerun conv_numerics->ComputeResiduals, also modify multigrid, and do not correct normals for nodes that are shared by other markers --- .../include/geometry/CMultiGridGeometry.hpp | 3 +- Common/src/geometry/CGeometry.cpp | 99 +++++++++++++ Common/src/geometry/CMultiGridGeometry.cpp | 127 ++++++++++++++-- .../include/solvers/CFVMFlowSolverBase.inl | 137 ++++++++++-------- 4 files changed, 299 insertions(+), 67 deletions(-) diff --git a/Common/include/geometry/CMultiGridGeometry.hpp b/Common/include/geometry/CMultiGridGeometry.hpp index 057dd073cbe..ce65ed46d69 100644 --- a/Common/include/geometry/CMultiGridGeometry.hpp +++ b/Common/include/geometry/CMultiGridGeometry.hpp @@ -40,12 +40,13 @@ class CMultiGridGeometry final : public CGeometry { /*! * \brief Determine if a CVPoint van be agglomerated, if it have the same marker point as the seed. * \param[in] CVPoint - Control volume to be agglomerated. + * \param[in] iPoint - Master point. * \param[in] marker_seed - Marker of the seed. * \param[in] fine_grid - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. * \return TRUE or FALSE depending if the control volume can be agglomerated. */ - bool SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, const CGeometry* fine_grid, + bool SetBoundAgglomeration(unsigned long CVPoint, unsigned long iPoint, short marker_seed, const CGeometry* fine_grid, const CConfig* config) const; /*! diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index 2eac6697c85..e7ed4a12f46 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2458,6 +2458,19 @@ su2double CGeometry::GetSurfaceArea(const CConfig* config, unsigned short val_ma } void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { + // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against + static constexpr size_t MAXNSYMS = 100; + + unsigned short Syms[MAXNSYMS] = {0}; + unsigned short nSym = 0; + for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { + if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + Syms[nSym] = iMarker; + nSym++; + } + } + /*--- For symmetry planes: Blazek chapter 8.6: * It is also necessary to correct the normal vectors of those faces * of the control volume, which touch the boundary. @@ -2470,6 +2483,23 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { const auto iPoint = vertex[iMarker][iVertex]->GetNode(); + // first check if the iPoint is shared with another marker + // loop over all markers + bool sharedPoint = false; + for (size_t jMarker = 0; jMarker < nMarker; jMarker++) { + // loop over all vertices on the marker + for (size_t jVertex = 0; jVertex < GetnVertex(jMarker); jVertex++) { + // get the jPoint of the vertex + size_t jPoint = vertex[jMarker][jVertex]->GetNode(); + if (iPoint == jPoint) { + cout << "iPoint" << iPoint << " is shared with marker " << iMarker << " " << jMarker << endl; + sharedPoint = true; + } + } + } + + if (sharedPoint == true) continue; + const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); @@ -2510,6 +2540,75 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { } // if symmetry } // loop over markers END_SU2_OMP_FOR + + // // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize + // against + // static constexpr size_t MAXNSYMS = 100; + + // unsigned short Syms[MAXNSYMS] = {0}; + // unsigned short nSym = 0; + // for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { + // if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + // (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + // Syms[nSym] = iMarker; + // nSym++; + // } + // } + + // for (size_t val_marker = 0; val_marker < nMarker; ++val_marker) { + // for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { + // const auto iPoint = vertex[val_marker][iVertex]->GetNode(); + + // /*--- Halo points do not need to be considered. ---*/ + // if (!nodes->GetDomain(iPoint)) continue; + + // /*--- Get the normal of the current symmetry ---*/ + // su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; + // vertex[val_marker][iVertex]->GetNormal(Normal); + + // const su2double Area = GeometryToolbox::Norm(nDim, Normal); + + // for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; + // if (nSym>1) { + // /*--- Normal of the primary symmetry plane ---*/ + // su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; + // /*--- Step 2: are we on a shared node? ---*/ + // for (auto iMarker=0;iMarkerGetNode(); + // if (iPoint==jPoint) { + // /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ + // if (Syms[iMarker]GetNormal(NormalPrim); + // su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); + // for(unsigned short iDim = 0; iDim < nDim; iDim++) { + // UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; + // } + // /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ + // su2double ProjNorm = 0.0; + // for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + // /*--- We check if the normal of the 2 planes coincide. + // * We only update the normal if the normals of the symmetry planes are different. ---*/ + // if (fabs(1.0-ProjNorm)>EPS) { + // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; + // /*--- Make normalized vector ---*/ + // su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); + // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; + // //edges->SetNormal(iEdge, Normal); + + // } // EPS + // } //syms + // } // ipoint==jpoint + // } //vertex + // }//val_marker + // } //imarker + // } //nsyms>1 + // } + // } } void CGeometry::ComputeSurf_Straightness(const CConfig* config, bool print_on_screen) { diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index eeab1180f1d..d97bd55f80a 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -67,6 +67,8 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un unsigned long Index_CoarseCV = 0; + su2double cx = 0.0, cy = 0.0, cz = 0.0; + /*--- The first step is the boundary agglomeration. ---*/ for (auto iMarker = 0u; iMarker < fine_grid->GetnMarker(); iMarker++) { @@ -77,10 +79,22 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un belongs to this physical domain, and it meets the geometrical criteria, the agglomeration is studied. ---*/ + cx = fine_grid->nodes->GetCoord(iPoint)[0]; + cy = fine_grid->nodes->GetCoord(iPoint)[1]; + cz = fine_grid->nodes->GetCoord(iPoint)[2]; + if ((iPoint == 6129) || (iPoint == 6971)) { + cout << iMarker << ", interior point " << iPoint << " , " << cx << " , " << cy << " , " << cz << " " + << GeometricalCheck(iPoint, fine_grid, config) << endl; + cout << fine_grid->nodes->GetAgglomerate(iPoint) << endl; + cout << fine_grid->nodes->GetDomain(iPoint) << endl; + } + if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint)) && (GeometricalCheck(iPoint, fine_grid, config))) { unsigned short nChildren = 1; - + if ((iPoint == 6129) || (iPoint == 6971)) { + cout << "point " << iPoint << " is set as a parent CV" << endl; + } /*--- We set an index for the parent control volume, this also marks it as agglomerated. ---*/ @@ -104,6 +118,9 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un } } + if ((iPoint == 6129) || iPoint == 6971) { + cout << "ipoint " << iPoint << " found, counter=" << counter << endl; + } /*--- To aglomerate a vertex it must have only one physical bc!! This can be improved. If there is only a marker, it is a good candidate for agglomeration ---*/ @@ -116,6 +133,13 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un if (counter == 2) { agglomerate_seed = (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) || (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE); + + if ((config->GetMarker_All_KindBC(copy_marker[0]) == SYMMETRY_PLANE) && + (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) { + cout << "possible agglomeration of symmetry plane" << endl; + agglomerate_seed = true; + cout << "point " << iPoint << " , " << cx << " , " << cy << " " << cz << endl; + } } /*--- If there are more than 2 markers, the aglomeration will be discarded ---*/ @@ -129,9 +153,15 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto CVPoint : fine_grid->nodes->GetPoints(iPoint)) { /*--- The new point can be agglomerated ---*/ - - if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) { + if ((iPoint == 6129) || iPoint == 6971) { + cout << "loop over cvpoints, ipoint=" << iPoint << " " << CVPoint << endl; + } + if (SetBoundAgglomeration(CVPoint, iPoint, marker_seed, fine_grid, config)) { /*--- We set the value of the parent ---*/ + if ((iPoint == 6129) || iPoint == 6971) { + cout << "agglomerated, ipoint " << iPoint << " found, counter=" << counter << endl; + cout << "cv=" << CVPoint << " " << Index_CoarseCV << endl; + } fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV); @@ -151,7 +181,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto CVPoint : Suitable_Indirect_Neighbors) { /*--- The new point can be agglomerated ---*/ - if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) { + if (SetBoundAgglomeration(CVPoint, iPoint, marker_seed, fine_grid, config)) { /*--- We set the value of the parent ---*/ fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV); @@ -184,8 +214,8 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto iMarker = 0u; iMarker < fine_grid->GetnMarker(); iMarker++) { for (auto iVertex = 0ul; iVertex < fine_grid->GetnVertex(iMarker); iVertex++) { const auto iPoint = fine_grid->vertex[iMarker][iVertex]->GetNode(); - if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint))) { + cout << "leftover nodes:" << iPoint << " " << Index_CoarseCV << endl; fine_grid->nodes->SetParent_CV(iPoint, Index_CoarseCV); nodes->SetChildren_CV(Index_CoarseCV, 0, iPoint); nodes->SetnChildren_CV(Index_CoarseCV, 1); @@ -310,6 +340,8 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto iPoint = 0ul; iPoint < fine_grid->GetnPoint(); iPoint++) { if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint))) { + cout << "convert coarse points leftover nodes:" << iPoint << endl; + fine_grid->nodes->SetParent_CV(iPoint, Index_CoarseCV); if (fine_grid->nodes->GetAgglomerate_Indirect(iPoint)) nodes->SetAgglomerate_Indirect(Index_CoarseCV, true); nodes->SetChildren_CV(Index_CoarseCV, 0, iPoint); @@ -329,6 +361,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto iCoarsePoint = 0ul; iCoarsePoint < nPointDomain; iCoarsePoint++) { if (nodes->GetnPoint(iCoarsePoint) == 1) { /*--- Find the neighbor of the isolated point. This neighbor is the right control volume ---*/ + cout << "detect isolated points:" << iCoarsePoint << endl; const auto iCoarsePoint_Complete = nodes->GetPoint(iCoarsePoint, 0); @@ -353,6 +386,26 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un } } + // ************************************************************************* + // if (iPoint==6971) { + cout << "parent = " << fine_grid->nodes->GetParent_CV(6971) << endl; + // const auto iCoarsePoint_Complete = nodes->GetPoint(6971, 0); + auto nChildren = nodes->GetnChildren_CV(6971); + cout << "nr of children=" << nChildren << endl; + for (auto iChildren = 0u; iChildren < nodes->GetnChildren_CV(6971); iChildren++) { + cout << "child=" << nodes->GetChildren_CV(6971, iChildren) << endl; + ; + } + + cout << "parent = " << fine_grid->nodes->GetParent_CV(6129) << endl; + // const auto iCoarsePoint_Complete = nodes->GetPoint(6971, 0); + nChildren = nodes->GetnChildren_CV(6129); + cout << "nr of children=" << nChildren << endl; + for (auto iChildren = 0u; iChildren < nodes->GetnChildren_CV(6129); iChildren++) { + cout << "child=" << nodes->GetChildren_CV(6129, iChildren) << endl; + ; + } + /*--- Reset the neighbor information. ---*/ nodes->ResetPoints(); @@ -496,8 +549,8 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un edgeColorGroupSize = config->GetEdgeColoringGroupSize(); } -bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, const CGeometry* fine_grid, - const CConfig* config) const { +bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, unsigned long iPoint, short marker_seed, + const CGeometry* fine_grid, const CConfig* config) const { bool agglomerate_CV = false; /*--- Basic condition, the point has not been previously agglomerated, it belongs to the domain, @@ -519,6 +572,28 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark } } + int counter2 = 0; + unsigned short copy_marker2[3] = {}; + for (auto jMarker = 0u; jMarker < fine_grid->GetnMarker() && counter < 3; jMarker++) { + if (fine_grid->nodes->GetVertex(iPoint, jMarker) != -1) { + copy_marker2[counter] = jMarker; + counter2++; + } + } + + if ((counter == 2) && (counter2 == 2)) { + su2double cx = fine_grid->nodes->GetCoord(iPoint)[0]; + su2double cy = fine_grid->nodes->GetCoord(iPoint)[1]; + su2double cz = fine_grid->nodes->GetCoord(iPoint)[2]; + cout << "2-2, iPoint = " << iPoint << " " << cx << " " << cy << " " << cz << endl; + cx = fine_grid->nodes->GetCoord(CVPoint)[0]; + cy = fine_grid->nodes->GetCoord(CVPoint)[1]; + cz = fine_grid->nodes->GetCoord(CVPoint)[2]; + cout << "2-2, CVPoint = " << CVPoint << " " << cx << " " << cy << " " << cz << endl; + } + // if the master node is on the edge of 2 symmetries (counter=2) + // and the control node is not on the edge of 2 symmetries, then do not agglomerate + /*--- The basic condition is that the aglomerated vertex must have the same physical marker, but eventually a send-receive condition ---*/ @@ -532,20 +607,49 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark /*--- If there is only one marker, but the marker is the SEND_RECEIVE ---*/ if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) agglomerate_CV = true; + + if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE)) { + if (counter2 == 2) { + cout << "counter = 1, counter2=2, mismatch for " << iPoint << " " << CVPoint << endl; + agglomerate_CV = false; + } else + agglomerate_CV = true; + } } /*--- If there are two markers in the vertex that is going to be aglomerated ---*/ if (counter == 2) { /*--- First we verify that the seed is a physical boundary ---*/ + // cout << "counter=2, point " << CVPoint << " , " << fine_grid->nodes->GetCoord(CVPoint)[0] << " , " + // <nodes->GetCoord(CVPoint)[1] << endl; if (config->GetMarker_All_KindBC(marker_seed) != SEND_RECEIVE) { - /*--- Then we check that one of the marker is equal to the seed marker, and the other is send/receive ---*/ + /*--- Then we check that one of the markers is equal to the seed marker, and the other is send/receive ---*/ if (((copy_marker[0] == marker_seed) && (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE)) || - ((config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) && (copy_marker[1] == marker_seed))) + ((config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) && (copy_marker[1] == marker_seed))) { agglomerate_CV = true; + } + } + + if (counter2 == 2) { + cout << "agglomeration 2-2 match for " << iPoint << " " << CVPoint << endl; + agglomerate_CV = true; + } else { + // cout << "no agglomeration 2-1 mismatch" << endl; + agglomerate_CV = false; } + // // both markers are symmetry + // if (((copy_marker[0] == marker_seed) && (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) || + // ((config->GetMarker_All_KindBC(copy_marker[0]) == SYMMETRY_PLANE) && (copy_marker[1] == marker_seed))) { + + // agglomerate_CV = true; + // cout << "both are symmetry, aggl = true" << iPoint << " " << CVPoint << endl; + // cout << "counter=2, sym, point " << CVPoint << " , " << fine_grid->nodes->GetCoord(CVPoint)[0] << " + // , " <nodes->GetCoord(CVPoint)[1] << endl; + + // } } } @@ -554,10 +658,15 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark else { agglomerate_CV = true; + // cout << "on interior, point " << CVPoint << " , " << fine_grid->nodes->GetCoord(CVPoint)[0] << " , " + // <nodes->GetCoord(CVPoint)[1] << endl; + // actually, for symmetry (and possibly other cells) we only agglomerate cells that are on the marker // at this point, the seed was on the boundary and the CV was not. so we check if the seed is a symmetry if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) { agglomerate_CV = false; + // cout << "on interior, CV=symmetry, point " << CVPoint << " , " << fine_grid->nodes->GetCoord(CVPoint)[0] << " + // , " <nodes->GetCoord(CVPoint)[1] << endl; } } } diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index ddbc7154606..9de96360e06 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1169,37 +1169,60 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve } } - /*--- Keep only the tangential part of the momentum residuals. ---*/ - su2double NormalProduct = 0.0; - - for(unsigned short iDim = 0; iDim < nDim; iDim++) { - NormalProduct += LinSysRes(iPoint, iVel + iDim) * UnitNormal[iDim]; - } - - for(unsigned short iDim = 0; iDim < nDim; iDim++) - LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ - su2double vel[MAXNDIM] = {0.0}; + su2double V_reflected[MAXNDIM] = {0.0}; + for(unsigned short iDim = 0; iDim < nDim; iDim++) - vel[iDim] = nodes->GetSolution_Old(iPoint, iVel + iDim); + V_reflected[iDim] = nodes->GetVelocity(iPoint, iDim); + + su2double vp = GeometryToolbox::DotProduct(MAXNDIM, V_reflected, UnitNormal); - su2double vp = GeometryToolbox::DotProduct(MAXNDIM, vel, UnitNormal); for(unsigned short iDim = 0; iDim < nDim; iDim++) - vel[iDim] -= vp * UnitNormal[iDim]; + V_reflected[iDim] -= vp * UnitNormal[iDim]; su2double Solution[MAXNVAR] = {0.0}; - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = nodes->GetSolution_Old(iPoint,iVar); + for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) + Solution[iVar] = nodes->GetPrimitive(iPoint, iVar); + + for(unsigned short iDim = 0; iDim < nDim; iDim++) + Solution[iVel + iDim] = V_reflected[iDim]; + + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Normal[iDim] = -Normal[iDim]; + conv_numerics->SetNormal(Normal); + /*--- Get current solution at this boundary node ---*/ + su2double* V_domain = nodes->GetPrimitive(iPoint); + + /*--- Set Primitive and Secondary for numerics class. ---*/ + conv_numerics->SetPrimitive(V_domain, V_reflected); + conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); + auto residual = conv_numerics->ComputeResidual(config); + + for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) + if ((iVar=iVel+nDim) + LinSysRes(iPoint,iVar)= residual[iVar]; + + /*--- Jacobian contribution for implicit integration. ---*/ + if (implicit) + Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + + /*--- Keep only the tangential part of the momentum residuals. ---*/ + su2double NormalProduct = 0.0; for(unsigned short iDim = 0; iDim < nDim; iDim++) - Solution[iVel + iDim] = vel[iDim]; + NormalProduct += LinSysRes(iPoint, iVel + iDim) * UnitNormal[iDim]; + for(unsigned short iDim = 0; iDim < nDim; iDim++) + LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; + + nodes->SetSolution_Old(iPoint, Solution); + + // not necessary? + //nodes->SetSolution(iPoint, Solution); - nodes->SetSolution_Old(iPoint, Solution); - // not necessary? - //nodes->SetSolution(iPoint, Solution); NormalProduct = 0.0; su2double* Res_TruncError = nodes->GetResTruncError(iPoint); @@ -1212,44 +1235,44 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve nodes->SetResTruncError(iPoint, Res_TruncError); - if (implicit) { - /*--- Modify the Jacobians according to the modification of the residual - * J_new = J * (I - n * n^T) where n = {0, nx, ny, nz, 0, ...} ---*/ - su2double mat[MAXNVAR * MAXNVAR] = {}; - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - mat[iVar * nVar + iVar] = 1; - for (unsigned short iDim = 0; iDim < nDim; iDim++) - for (unsigned short jDim = 0; jDim < nDim; jDim++) - mat[(iDim + iVel) * nVar + jDim + iVel] -= UnitNormal[iDim] * UnitNormal[jDim]; - - auto ModifyJacobian = [&](const unsigned long jPoint) { - su2double jac[MAXNVAR * MAXNVAR], newJac[MAXNVAR * MAXNVAR]; - auto* block = Jacobian.GetBlock(iPoint, jPoint); - for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) jac[iVar] = block[iVar]; - - CBlasStructure().gemm(nVar, nVar, nVar, jac, mat, newJac, config); - - for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) - block[iVar] = SU2_TYPE::GetValue(newJac[iVar]); - - /*--- The modification also leaves the Jacobian ill-conditioned. Similar to setting - * the normal velocity we need to recover the diagonal dominance of the Jacobian. ---*/ - if (jPoint == iPoint) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - for (unsigned short jDim = 0; jDim < nDim; jDim++) { - const auto k = (iDim + iVel) * nVar + jDim + iVel; - block[k] += SU2_TYPE::GetValue(UnitNormal[iDim] * UnitNormal[jDim]); - } - } - } - }; - ModifyJacobian(iPoint); - - for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { - ModifyJacobian(geometry->nodes->GetPoint(iPoint, iNeigh)); - } - } + // if (implicit) { + // /*--- Modify the Jacobians according to the modification of the residual + // * J_new = J * (I - n * n^T) where n = {0, nx, ny, nz, 0, ...} ---*/ + // su2double mat[MAXNVAR * MAXNVAR] = {}; + + // for (unsigned short iVar = 0; iVar < nVar; iVar++) + // mat[iVar * nVar + iVar] = 1; + // for (unsigned short iDim = 0; iDim < nDim; iDim++) + // for (unsigned short jDim = 0; jDim < nDim; jDim++) + // mat[(iDim + iVel) * nVar + jDim + iVel] -= UnitNormal[iDim] * UnitNormal[jDim]; + + // auto ModifyJacobian = [&](const unsigned long jPoint) { + // su2double jac[MAXNVAR * MAXNVAR], newJac[MAXNVAR * MAXNVAR]; + // auto* block = Jacobian.GetBlock(iPoint, jPoint); + // for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) jac[iVar] = block[iVar]; + + // CBlasStructure().gemm(nVar, nVar, nVar, jac, mat, newJac, config); + + // for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) + // block[iVar] = SU2_TYPE::GetValue(newJac[iVar]); + + // /*--- The modification also leaves the Jacobian ill-conditioned. Similar to setting + // * the normal velocity we need to recover the diagonal dominance of the Jacobian. ---*/ + // if (jPoint == iPoint) { + // for (unsigned short iDim = 0; iDim < nDim; iDim++) { + // for (unsigned short jDim = 0; jDim < nDim; jDim++) { + // const auto k = (iDim + iVel) * nVar + jDim + iVel; + // block[k] += SU2_TYPE::GetValue(UnitNormal[iDim] * UnitNormal[jDim]); + // } + // } + // } + // }; + // ModifyJacobian(iPoint); + + // for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { + // ModifyJacobian(geometry->nodes->GetPoint(iPoint, iNeigh)); + // } + // } } END_SU2_OMP_FOR From c517767666460621161684320fe16d69437cd240 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 23 Apr 2024 22:14:17 +0200 Subject: [PATCH 062/194] minus sign --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 4 +++- SU2_CFD/include/variables/CEulerVariable.hpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 9de96360e06..60234d15c38 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1203,9 +1203,11 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); auto residual = conv_numerics->ComputeResidual(config); + + for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) if ((iVar=iVel+nDim) - LinSysRes(iPoint,iVar)= residual[iVar]; + LinSysRes(iPoint,iVar)+= residual[iVar]; /*--- Jacobian contribution for implicit integration. ---*/ if (implicit) diff --git a/SU2_CFD/include/variables/CEulerVariable.hpp b/SU2_CFD/include/variables/CEulerVariable.hpp index afeca44937a..4dc91781c4b 100644 --- a/SU2_CFD/include/variables/CEulerVariable.hpp +++ b/SU2_CFD/include/variables/CEulerVariable.hpp @@ -256,7 +256,7 @@ class CEulerVariable : public CFlowVariable { inline su2double GetProjVel(unsigned long iPoint, const su2double *val_vector) const final { su2double ProjVel = 0.0; for (unsigned long iDim = 0; iDim < nDim; iDim++) - ProjVel += Primitive(iPoint,iDim+indices.Velocity())*val_vector[iDim]; + ProjVel += Primitive(iPoint, iDim+indices.Velocity())*val_vector[iDim]; return ProjVel; } From 3ef46eb62446b552df897a5b81928db6c864374a Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 24 Apr 2024 08:30:54 +0200 Subject: [PATCH 063/194] small fix --- .../include/solvers/CFVMFlowSolverBase.inl | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 60234d15c38..0c0343c87d6 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1102,6 +1102,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against static constexpr size_t MAXNSYMS = 100; + su2double Area, ProjVelocity_i, *V_reflected, *V_domain, Vel[MAXNDIM],Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; unsigned short Syms[MAXNSYMS] = {0}; unsigned short nSym = 0; @@ -1173,39 +1174,38 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ - su2double V_reflected[MAXNDIM] = {0.0}; - for(unsigned short iDim = 0; iDim < nDim; iDim++) - V_reflected[iDim] = nodes->GetVelocity(iPoint, iDim); + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Normal[iDim] = -Normal[iDim]; + conv_numerics->SetNormal(Normal); - su2double vp = GeometryToolbox::DotProduct(MAXNDIM, V_reflected, UnitNormal); - for(unsigned short iDim = 0; iDim < nDim; iDim++) - V_reflected[iDim] -= vp * UnitNormal[iDim]; - su2double Solution[MAXNVAR] = {0.0}; + /*--- Get current solution at this boundary node ---*/ + V_reflected = GetCharacPrimVar(val_marker, iVertex); + for (auto iVar = 0u; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); - for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) - Solution[iVar] = nodes->GetPrimitive(iPoint, iVar); + ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); + + for (auto iDim = 0u; iDim < nDim; iDim++) + V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - ProjVelocity_i * UnitNormal[iDim]; + +// ***************************** + V_reflected[2] = 0.0; - for(unsigned short iDim = 0; iDim < nDim; iDim++) - Solution[iVel + iDim] = V_reflected[iDim]; - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Normal[iDim] = -Normal[iDim]; - conv_numerics->SetNormal(Normal); /*--- Get current solution at this boundary node ---*/ su2double* V_domain = nodes->GetPrimitive(iPoint); - /*--- Set Primitive and Secondary for numerics class. ---*/ conv_numerics->SetPrimitive(V_domain, V_reflected); conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); + auto residual = conv_numerics->ComputeResidual(config); - for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) + for (unsigned short iVar = 0; iVar < nVar; iVar++) if ((iVar=iVel+nDim) LinSysRes(iPoint,iVar)+= residual[iVar]; @@ -1220,7 +1220,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(unsigned short iDim = 0; iDim < nDim; iDim++) LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; - nodes->SetSolution_Old(iPoint, Solution); + //nodes->SetSolution_Old(iPoint, V_reflected); + nodes->SetSolution(iPoint, V_reflected); // not necessary? //nodes->SetSolution(iPoint, Solution); From 61e8ce44d3beb496b08cf8e3fd947f8cc4f428d1 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 24 Apr 2024 11:28:48 +0200 Subject: [PATCH 064/194] check nodes shared by markers --- Common/src/geometry/CGeometry.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index e7ed4a12f46..e4c48f6cb7f 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2483,10 +2483,13 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { const auto iPoint = vertex[iMarker][iVertex]->GetNode(); - // first check if the iPoint is shared with another marker + // first check if the iPoint is shared with another marker + // nijso:we still include shared with another symmetry????? // loop over all markers bool sharedPoint = false; for (size_t jMarker = 0; jMarker < nMarker; jMarker++) { + + if (jMarker == iMarker) continue; // loop over all vertices on the marker for (size_t jVertex = 0; jVertex < GetnVertex(jMarker); jVertex++) { // get the jPoint of the vertex @@ -2541,19 +2544,7 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { } // loop over markers END_SU2_OMP_FOR - // // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize - // against - // static constexpr size_t MAXNSYMS = 100; - - // unsigned short Syms[MAXNSYMS] = {0}; - // unsigned short nSym = 0; - // for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { - // if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - // (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - // Syms[nSym] = iMarker; - // nSym++; - // } - // } + // for (size_t val_marker = 0; val_marker < nMarker; ++val_marker) { // for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { From 625d2739b3f10fdbd28f1ccadf2c512fe7994efb Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 24 Apr 2024 14:23:20 +0200 Subject: [PATCH 065/194] fix error for compressible --- Common/src/geometry/CGeometry.cpp | 20 ++++++-- .../include/solvers/CFVMFlowSolverBase.inl | 48 +++++++++++-------- 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index e4c48f6cb7f..9f42ab791a6 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2483,13 +2483,11 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { const auto iPoint = vertex[iMarker][iVertex]->GetNode(); - // first check if the iPoint is shared with another marker - // nijso:we still include shared with another symmetry????? + // first check if the iPoint is shared with another marker // loop over all markers bool sharedPoint = false; for (size_t jMarker = 0; jMarker < nMarker; jMarker++) { - - if (jMarker == iMarker) continue; + if (iMarker==jMarker) continue; // loop over all vertices on the marker for (size_t jVertex = 0; jVertex < GetnVertex(jMarker); jVertex++) { // get the jPoint of the vertex @@ -2544,7 +2542,19 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { } // loop over markers END_SU2_OMP_FOR - + // // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize + // against + // static constexpr size_t MAXNSYMS = 100; + + // unsigned short Syms[MAXNSYMS] = {0}; + // unsigned short nSym = 0; + // for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { + // if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + // (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + // Syms[nSym] = iMarker; + // nSym++; + // } + // } // for (size_t val_marker = 0; val_marker < nMarker; ++val_marker) { // for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 0c0343c87d6..25a4d5af65f 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1102,7 +1102,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against static constexpr size_t MAXNSYMS = 100; - su2double Area, ProjVelocity_i, *V_reflected, *V_domain, Vel[MAXNDIM],Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; unsigned short Syms[MAXNSYMS] = {0}; unsigned short nSym = 0; @@ -1174,37 +1173,48 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ + su2double V_reflected[MAXNDIM] = {0.0}; - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Normal[iDim] = -Normal[iDim]; - conv_numerics->SetNormal(Normal); + for(unsigned short iDim = 0; iDim < nDim; iDim++) + V_reflected[iDim] = nodes->GetVelocity(iPoint, iDim); + su2double vp = GeometryToolbox::DotProduct(MAXNDIM, V_reflected, UnitNormal); + for(unsigned short iDim = 0; iDim < nDim; iDim++) + V_reflected[iDim] -= vp * UnitNormal[iDim]; - /*--- Get current solution at this boundary node ---*/ - V_reflected = GetCharacPrimVar(val_marker, iVertex); - for (auto iVar = 0u; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); + su2double Solution[MAXNVAR] = {0.0}; + + for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) + Solution[iVar] = nodes->GetPrimitive(iPoint, iVar); + + for(unsigned short iDim = 0; iDim < nDim; iDim++) + Solution[iVel + iDim] = V_reflected[iDim]; - ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); - for (auto iDim = 0u; iDim < nDim; iDim++) - V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - ProjVelocity_i * UnitNormal[iDim]; -// ***************************** - V_reflected[2] = 0.0; + // **************************************************** +// su2double* V_reflected = GetCharacPrimVar(val_marker, iVertex); +// - for (auto iVar = 0u; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); +// ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); +// for (auto iDim = 0u; iDim < nDim; iDim++) +// - V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - ProjVelocity_i * UnitNormal[iDim]; + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Normal[iDim] = -Normal[iDim]; + conv_numerics->SetNormal(Normal); /*--- Get current solution at this boundary node ---*/ su2double* V_domain = nodes->GetPrimitive(iPoint); + /*--- Set Primitive and Secondary for numerics class. ---*/ - conv_numerics->SetPrimitive(V_domain, V_reflected); + //conv_numerics->SetPrimitive(V_domain, V_reflected); + conv_numerics->SetPrimitive(V_domain, Solution); conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); - auto residual = conv_numerics->ComputeResidual(config); - - + //for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) for (unsigned short iVar = 0; iVar < nVar; iVar++) if ((iVar=iVel+nDim) LinSysRes(iPoint,iVar)+= residual[iVar]; @@ -1220,8 +1230,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(unsigned short iDim = 0; iDim < nDim; iDim++) LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; - //nodes->SetSolution_Old(iPoint, V_reflected); - nodes->SetSolution(iPoint, V_reflected); + nodes->SetSolution_Old(iPoint, Solution); + //nodes->SetSolution(iPoint, Solution); // not necessary? //nodes->SetSolution(iPoint, Solution); From 833100cf1602e7b3a16e62dd1d432478ab1ac82a Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 24 Apr 2024 21:53:38 +0200 Subject: [PATCH 066/194] fix error for compressible --- Common/src/geometry/CGeometry.cpp | 1 + .../include/solvers/CFVMFlowSolverBase.inl | 76 ++++++------------- 2 files changed, 23 insertions(+), 54 deletions(-) diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index 9f42ab791a6..3f68643d3e6 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2482,6 +2482,7 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { const auto iPoint = vertex[iMarker][iVertex]->GetNode(); + if (!nodes->GetDomain(iPoint)) continue; // first check if the iPoint is shared with another marker // loop over all markers diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 25a4d5af65f..91f82d89878 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1173,33 +1173,36 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ - su2double V_reflected[MAXNDIM] = {0.0}; + su2double Vel_reflected[MAXNDIM] = {0.0}; for(unsigned short iDim = 0; iDim < nDim; iDim++) - V_reflected[iDim] = nodes->GetVelocity(iPoint, iDim); + Vel_reflected[iDim] = nodes->GetSolution(iPoint, 1+iDim); - su2double vp = GeometryToolbox::DotProduct(MAXNDIM, V_reflected, UnitNormal); + su2double vp = GeometryToolbox::DotProduct(MAXNDIM, Vel_reflected, UnitNormal); for(unsigned short iDim = 0; iDim < nDim; iDim++) - V_reflected[iDim] -= vp * UnitNormal[iDim]; + Vel_reflected[iDim] -= vp * UnitNormal[iDim]; + su2double Solution[MAXNVAR] = {0.0}; for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) - Solution[iVar] = nodes->GetPrimitive(iPoint, iVar); + Solution[iVar] = nodes->GetSolution(iPoint, iVar); for(unsigned short iDim = 0; iDim < nDim; iDim++) - Solution[iVel + iDim] = V_reflected[iDim]; + Solution[iVel + iDim] = Vel_reflected[iDim]; // **************************************************** -// su2double* V_reflected = GetCharacPrimVar(val_marker, iVertex); -// - for (auto iVar = 0u; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); -// ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); -// for (auto iDim = 0u; iDim < nDim; iDim++) -// - V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - ProjVelocity_i * UnitNormal[iDim]; + + su2double* V_reflected = GetCharacPrimVar(val_marker, iVertex); + for (auto iVar = 0u; iVar < nPrimVar; iVar++) + V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); + su2double ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) + V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - ProjVelocity_i * UnitNormal[iDim]; geometry->vertex[val_marker][iVertex]->GetNormal(Normal); for (unsigned short iDim = 0; iDim < nDim; iDim++) @@ -1209,8 +1212,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve su2double* V_domain = nodes->GetPrimitive(iPoint); /*--- Set Primitive and Secondary for numerics class. ---*/ - //conv_numerics->SetPrimitive(V_domain, V_reflected); - conv_numerics->SetPrimitive(V_domain, Solution); + conv_numerics->SetPrimitive(V_domain, V_reflected); + //conv_numerics->SetPrimitive(V_domain, Solution); conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); auto residual = conv_numerics->ComputeResidual(config); @@ -1231,10 +1234,12 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; nodes->SetSolution_Old(iPoint, Solution); - //nodes->SetSolution(iPoint, Solution); + nodes->SetSolution(iPoint, Solution); + + + + - // not necessary? - //nodes->SetSolution(iPoint, Solution); NormalProduct = 0.0; @@ -1248,44 +1253,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve nodes->SetResTruncError(iPoint, Res_TruncError); - // if (implicit) { - // /*--- Modify the Jacobians according to the modification of the residual - // * J_new = J * (I - n * n^T) where n = {0, nx, ny, nz, 0, ...} ---*/ - // su2double mat[MAXNVAR * MAXNVAR] = {}; - - // for (unsigned short iVar = 0; iVar < nVar; iVar++) - // mat[iVar * nVar + iVar] = 1; - // for (unsigned short iDim = 0; iDim < nDim; iDim++) - // for (unsigned short jDim = 0; jDim < nDim; jDim++) - // mat[(iDim + iVel) * nVar + jDim + iVel] -= UnitNormal[iDim] * UnitNormal[jDim]; - - // auto ModifyJacobian = [&](const unsigned long jPoint) { - // su2double jac[MAXNVAR * MAXNVAR], newJac[MAXNVAR * MAXNVAR]; - // auto* block = Jacobian.GetBlock(iPoint, jPoint); - // for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) jac[iVar] = block[iVar]; - - // CBlasStructure().gemm(nVar, nVar, nVar, jac, mat, newJac, config); - - // for (unsigned short iVar = 0; iVar < nVar * nVar; iVar++) - // block[iVar] = SU2_TYPE::GetValue(newJac[iVar]); - - // /*--- The modification also leaves the Jacobian ill-conditioned. Similar to setting - // * the normal velocity we need to recover the diagonal dominance of the Jacobian. ---*/ - // if (jPoint == iPoint) { - // for (unsigned short iDim = 0; iDim < nDim; iDim++) { - // for (unsigned short jDim = 0; jDim < nDim; jDim++) { - // const auto k = (iDim + iVel) * nVar + jDim + iVel; - // block[k] += SU2_TYPE::GetValue(UnitNormal[iDim] * UnitNormal[jDim]); - // } - // } - // } - // }; - // ModifyJacobian(iPoint); - - // for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { - // ModifyJacobian(geometry->nodes->GetPoint(iPoint, iNeigh)); - // } - // } + } END_SU2_OMP_FOR From ef214f1771507aa00e5aff680e828df69bf16b8a Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 24 Apr 2024 22:37:01 +0200 Subject: [PATCH 067/194] fix error for compressible --- .../include/solvers/CFVMFlowSolverBase.inl | 58 ++++++++----------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 91f82d89878..3e4c07cadfa 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1170,57 +1170,33 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve } - /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. - * This is necessary because the modification of the residual leaves the problem - * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ - su2double Vel_reflected[MAXNDIM] = {0.0}; - - for(unsigned short iDim = 0; iDim < nDim; iDim++) - Vel_reflected[iDim] = nodes->GetSolution(iPoint, 1+iDim); - - su2double vp = GeometryToolbox::DotProduct(MAXNDIM, Vel_reflected, UnitNormal); - - for(unsigned short iDim = 0; iDim < nDim; iDim++) - Vel_reflected[iDim] -= vp * UnitNormal[iDim]; - - - su2double Solution[MAXNVAR] = {0.0}; - - for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) - Solution[iVar] = nodes->GetSolution(iPoint, iVar); - - for(unsigned short iDim = 0; iDim < nDim; iDim++) - Solution[iVel + iDim] = Vel_reflected[iDim]; - - - - - // **************************************************** su2double* V_reflected = GetCharacPrimVar(val_marker, iVertex); + for (auto iVar = 0u; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); + su2double ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) - V_reflected[iDim + 1] = nodes->GetVelocity(iPoint, iDim) - ProjVelocity_i * UnitNormal[iDim]; + V_reflected[iDim + iVel] = nodes->GetVelocity(iPoint, iDim) - ProjVelocity_i * UnitNormal[iDim]; geometry->vertex[val_marker][iVertex]->GetNormal(Normal); for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; conv_numerics->SetNormal(Normal); + /*--- Get current solution at this boundary node ---*/ su2double* V_domain = nodes->GetPrimitive(iPoint); /*--- Set Primitive and Secondary for numerics class. ---*/ conv_numerics->SetPrimitive(V_domain, V_reflected); - //conv_numerics->SetPrimitive(V_domain, Solution); conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); auto residual = conv_numerics->ComputeResidual(config); - //for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) - for (unsigned short iVar = 0; iVar < nVar; iVar++) - if ((iVar=iVel+nDim) - LinSysRes(iPoint,iVar)+= residual[iVar]; + //for (unsigned short iVar = 0; iVar < nVar; iVar++) + // if ((iVar=iVel+nDim) + // LinSysRes(iPoint,iVar)+= residual[iVar]; /*--- Jacobian contribution for implicit integration. ---*/ if (implicit) @@ -1233,13 +1209,27 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(unsigned short iDim = 0; iDim < nDim; iDim++) LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; - nodes->SetSolution_Old(iPoint, Solution); - nodes->SetSolution(iPoint, Solution); + /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. + * This is necessary because the modification of the residual leaves the problem + * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ + su2double Vel_reflected[MAXNDIM] = {0.0}; + + for(unsigned short iDim = 0; iDim < nDim; iDim++) + Vel_reflected[iDim] = nodes->GetSolution(iPoint, iVel+iDim); + + su2double vp = GeometryToolbox::DotProduct(MAXNDIM, Vel_reflected, UnitNormal); + for(unsigned short iDim = 0; iDim < nDim; iDim++) + Vel_reflected[iDim] -= vp * UnitNormal[iDim]; + su2double* Solution = nodes->GetSolution(iPoint); + for(unsigned short iDim = 0; iDim < nDim; iDim++) + Solution[iVel + iDim] = Vel_reflected[iDim]; + nodes->SetSolution_Old(iPoint, Solution); + nodes->SetSolution(iPoint, Solution); NormalProduct = 0.0; From 0bdbd2203df3b9f05bc56f2a22112e27ef6c5bbe Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 24 Apr 2024 22:45:22 +0200 Subject: [PATCH 068/194] formatting --- .../include/solvers/CFVMFlowSolverBase.inl | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 3e4c07cadfa..e62d6990687 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1170,16 +1170,15 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve } + su2double* V_reflected = GetCharacPrimVar(val_marker, iVertex); - su2double* V_reflected = GetCharacPrimVar(val_marker, iVertex); + for (auto iVar = 0u; iVar < nPrimVar; iVar++) + V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); - for (auto iVar = 0u; iVar < nPrimVar; iVar++) - V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); + su2double ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); - su2double ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); - - for (auto iDim = 0u; iDim < nDim; iDim++) - V_reflected[iDim + iVel] = nodes->GetVelocity(iPoint, iDim) - ProjVelocity_i * UnitNormal[iDim]; + for (auto iDim = 0u; iDim < nDim; iDim++) + V_reflected[iDim + iVel] = nodes->GetVelocity(iPoint, iDim) - ProjVelocity_i * UnitNormal[iDim]; geometry->vertex[val_marker][iVertex]->GetNormal(Normal); for (unsigned short iDim = 0; iDim < nDim; iDim++) @@ -1194,10 +1193,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); auto residual = conv_numerics->ComputeResidual(config); - //for (unsigned short iVar = 0; iVar < nVar; iVar++) - // if ((iVar=iVel+nDim) - // LinSysRes(iPoint,iVar)+= residual[iVar]; - /*--- Jacobian contribution for implicit integration. ---*/ if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); @@ -1209,8 +1204,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(unsigned short iDim = 0; iDim < nDim; iDim++) LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; - - /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ @@ -1225,13 +1218,13 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve su2double* Solution = nodes->GetSolution(iPoint); - for(unsigned short iDim = 0; iDim < nDim; iDim++) + for(unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iVel + iDim] = Vel_reflected[iDim]; nodes->SetSolution_Old(iPoint, Solution); nodes->SetSolution(iPoint, Solution); - + /*--- Correction for multigrid ---*/ NormalProduct = 0.0; su2double* Res_TruncError = nodes->GetResTruncError(iPoint); for(unsigned short iDim = 0; iDim < nDim; iDim++) { @@ -1244,7 +1237,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve nodes->SetResTruncError(iPoint, Res_TruncError); - } END_SU2_OMP_FOR } From c294bfc18aa9542eb00bded563d8301491f2d8be Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 25 Apr 2024 23:23:26 +0200 Subject: [PATCH 069/194] switch to solution_old --- Common/src/geometry/CGeometry.cpp | 41 +++++++++---------- Common/src/geometry/CMultiGridGeometry.cpp | 15 ++++++- Common/src/geometry/CPhysicalGeometry.cpp | 2 +- .../include/solvers/CFVMFlowSolverBase.inl | 30 +++++++++++++- 4 files changed, 62 insertions(+), 26 deletions(-) diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index 3f68643d3e6..973d77675d1 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2466,6 +2466,7 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + cout << "marker " << iMarker << " is a symmetry or euler" << endl; Syms[nSym] = iMarker; nSym++; } @@ -2477,9 +2478,10 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { * The modification consists of removing all components of the face vector, * which are normal to the symmetry plane. ---*/ SU2_OMP_FOR_DYN(1) - for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + /*--- First we loop over all symmetry+euler markers and we check for shared nodes ---*/ + for (unsigned short iSym = 0; iSym < nSym; iSym++) { + unsigned short iMarker = Syms[iSym]; + for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { const auto iPoint = vertex[iMarker][iVertex]->GetNode(); if (!nodes->GetDomain(iPoint)) continue; @@ -2487,14 +2489,22 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { // first check if the iPoint is shared with another marker // loop over all markers bool sharedPoint = false; - for (size_t jMarker = 0; jMarker < nMarker; jMarker++) { - if (iMarker==jMarker) continue; + + for (unsigned short jMarker = 0; jMarker < nMarker; jMarker++) { + // we only check for collisions with markers other than symmetry + if ( + (iMarker==jMarker) || + ( + (config->GetMarker_All_KindBC(jMarker) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(jMarker) == EULER_WALL) + ) + ) continue; // loop over all vertices on the marker - for (size_t jVertex = 0; jVertex < GetnVertex(jMarker); jVertex++) { + for (unsigned long jVertex = 0; jVertex < GetnVertex(jMarker); jVertex++) { // get the jPoint of the vertex - size_t jPoint = vertex[jMarker][jVertex]->GetNode(); + const auto jPoint = vertex[jMarker][jVertex]->GetNode(); + if (!nodes->GetDomain(jPoint)) continue; if (iPoint == jPoint) { - cout << "iPoint" << iPoint << " is shared with marker " << iMarker << " " << jMarker << endl; sharedPoint = true; } } @@ -2539,23 +2549,12 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { } // if in-plane of symmetry } // loop over neighbors } // loop over vertices - } // if symmetry } // loop over markers END_SU2_OMP_FOR - // // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize + // Use the first (lowest ID) in the symlist as the basis to orthogonalize // against - // static constexpr size_t MAXNSYMS = 100; - - // unsigned short Syms[MAXNSYMS] = {0}; - // unsigned short nSym = 0; - // for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { - // if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - // (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - // Syms[nSym] = iMarker; - // nSym++; - // } - // } + // for (size_t val_marker = 0; val_marker < nMarker; ++val_marker) { // for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index d97bd55f80a..d36cc30797e 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -125,8 +125,14 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un This can be improved. If there is only a marker, it is a good candidate for agglomeration ---*/ - if (counter == 1) agglomerate_seed = true; + if (counter == 1) { + + agglomerate_seed = true; + if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) + agglomerate_seed=false; + + } /*--- If there are two markers, we will aglomerate if any of the markers is SEND_RECEIVE ---*/ @@ -137,7 +143,12 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un if ((config->GetMarker_All_KindBC(copy_marker[0]) == SYMMETRY_PLANE) && (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) { cout << "possible agglomeration of symmetry plane" << endl; - agglomerate_seed = true; + + //agglomerate_seed = true; + // do not agglomerate when one of the markers is symmetry + agglomerate_seed = false; + + cout << "point " << iPoint << " , " << cx << " , " << cy << " " << cz << endl; } } diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 5fa08f6c457..6a5cd4d30e0 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -9561,7 +9561,7 @@ su2double CPhysicalGeometry::Compute_Length(su2double* Plane_P0, su2double* Plan su2double DeltaZ, DeltaX; /*--- Not that in a symmetry plane configuration there is an extra edge that connects - the two extremes, and we really don't now the curve orientation. We will evaluate + the two extremes, and we really don't know the curve orientation. We will evaluate both distance and picked the smallest one ---*/ Length_Value = 0.0; diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index e62d6990687..9db356b4c94 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1072,6 +1072,7 @@ void CFVMFlowSolverBase::PushSolutionBackInTime(unsigned long TimeIter, bo /*--- Load an additional restart file for a 2nd-order restart. ---*/ solver_container[MESH_0][FLOW_SOL]->LoadRestart(geometry, solver_container, config, TimeIter-1, true); + /*--- Load an additional restart file for the turbulence model. ---*/ if (rans) solver_container[MESH_0][TURB_SOL]->LoadRestart(geometry, solver_container, config, TimeIter-1, false); @@ -1209,19 +1210,44 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ su2double Vel_reflected[MAXNDIM] = {0.0}; + // use solution_old because it contains the update of the wall boundary for(unsigned short iDim = 0; iDim < nDim; iDim++) - Vel_reflected[iDim] = nodes->GetSolution(iPoint, iVel+iDim); + Vel_reflected[iDim] = nodes->GetSolution_Old(iPoint, iVel+iDim); su2double vp = GeometryToolbox::DotProduct(MAXNDIM, Vel_reflected, UnitNormal); for(unsigned short iDim = 0; iDim < nDim; iDim++) Vel_reflected[iDim] -= vp * UnitNormal[iDim]; - su2double* Solution = nodes->GetSolution(iPoint); + su2double* Solution = nodes->GetSolution_Old(iPoint); for(unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iVel + iDim] = Vel_reflected[iDim]; + // loop over other markers and check if we have a collision + // for (unsigned short jMarker = 0; jMarker < nMarker; jMarker++) { + // // check if it is in the syms list + // bool isSym=false; + // for (auto iSyms=0;iSymsnVertex[jMarker]; jVertex++) { + // const auto jPoint = geometry->vertex[jMarker][jVertex]->GetNode(); + // if (iPoint==jPoint) { + // cout << "point " << jPoint <<" is on marker " << jMarker << endl; + // cout << "solution is" << endl; + // for (auto iVar = 0u; iVar < nVar; iVar++) + // cout << iVar << " " << Solution[iVar] << endl; + // } + // } + // } + // } + + // this causes an issue on the wall nodes->SetSolution_Old(iPoint, Solution); + nodes->SetSolution(iPoint, Solution); /*--- Correction for multigrid ---*/ From 2bc215ff1dbc6e243a3d467b1547c9be5da874c7 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 26 Apr 2024 11:14:52 +0200 Subject: [PATCH 070/194] cleanup --- Common/src/geometry/CMultiGridGeometry.cpp | 44 +++---------------- .../include/solvers/CFVMFlowSolverBase.inl | 28 +----------- 2 files changed, 8 insertions(+), 64 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index d36cc30797e..d3756ee5125 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -82,19 +82,12 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un cx = fine_grid->nodes->GetCoord(iPoint)[0]; cy = fine_grid->nodes->GetCoord(iPoint)[1]; cz = fine_grid->nodes->GetCoord(iPoint)[2]; - if ((iPoint == 6129) || (iPoint == 6971)) { - cout << iMarker << ", interior point " << iPoint << " , " << cx << " , " << cy << " , " << cz << " " - << GeometricalCheck(iPoint, fine_grid, config) << endl; - cout << fine_grid->nodes->GetAgglomerate(iPoint) << endl; - cout << fine_grid->nodes->GetDomain(iPoint) << endl; - } + if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint)) && (GeometricalCheck(iPoint, fine_grid, config))) { unsigned short nChildren = 1; - if ((iPoint == 6129) || (iPoint == 6971)) { - cout << "point " << iPoint << " is set as a parent CV" << endl; - } + /*--- We set an index for the parent control volume, this also marks it as agglomerated. ---*/ @@ -118,9 +111,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un } } - if ((iPoint == 6129) || iPoint == 6971) { - cout << "ipoint " << iPoint << " found, counter=" << counter << endl; - } + /*--- To aglomerate a vertex it must have only one physical bc!! This can be improved. If there is only a marker, it is a good candidate for agglomeration ---*/ @@ -164,15 +155,10 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto CVPoint : fine_grid->nodes->GetPoints(iPoint)) { /*--- The new point can be agglomerated ---*/ - if ((iPoint == 6129) || iPoint == 6971) { - cout << "loop over cvpoints, ipoint=" << iPoint << " " << CVPoint << endl; - } + if (SetBoundAgglomeration(CVPoint, iPoint, marker_seed, fine_grid, config)) { /*--- We set the value of the parent ---*/ - if ((iPoint == 6129) || iPoint == 6971) { - cout << "agglomerated, ipoint " << iPoint << " found, counter=" << counter << endl; - cout << "cv=" << CVPoint << " " << Index_CoarseCV << endl; - } + fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV); @@ -397,25 +383,9 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un } } - // ************************************************************************* - // if (iPoint==6971) { - cout << "parent = " << fine_grid->nodes->GetParent_CV(6971) << endl; - // const auto iCoarsePoint_Complete = nodes->GetPoint(6971, 0); - auto nChildren = nodes->GetnChildren_CV(6971); - cout << "nr of children=" << nChildren << endl; - for (auto iChildren = 0u; iChildren < nodes->GetnChildren_CV(6971); iChildren++) { - cout << "child=" << nodes->GetChildren_CV(6971, iChildren) << endl; - ; - } - cout << "parent = " << fine_grid->nodes->GetParent_CV(6129) << endl; - // const auto iCoarsePoint_Complete = nodes->GetPoint(6971, 0); - nChildren = nodes->GetnChildren_CV(6129); - cout << "nr of children=" << nChildren << endl; - for (auto iChildren = 0u; iChildren < nodes->GetnChildren_CV(6129); iChildren++) { - cout << "child=" << nodes->GetChildren_CV(6129, iChildren) << endl; - ; - } + + /*--- Reset the neighbor information. ---*/ diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 9db356b4c94..342faf27108 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1223,40 +1223,14 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iVel + iDim] = Vel_reflected[iDim]; - // loop over other markers and check if we have a collision - // for (unsigned short jMarker = 0; jMarker < nMarker; jMarker++) { - // // check if it is in the syms list - // bool isSym=false; - // for (auto iSyms=0;iSymsnVertex[jMarker]; jVertex++) { - // const auto jPoint = geometry->vertex[jMarker][jVertex]->GetNode(); - // if (iPoint==jPoint) { - // cout << "point " << jPoint <<" is on marker " << jMarker << endl; - // cout << "solution is" << endl; - // for (auto iVar = 0u; iVar < nVar; iVar++) - // cout << iVar << " " << Solution[iVar] << endl; - // } - // } - // } - // } - // this causes an issue on the wall nodes->SetSolution_Old(iPoint, Solution); - nodes->SetSolution(iPoint, Solution); - /*--- Correction for multigrid ---*/ NormalProduct = 0.0; su2double* Res_TruncError = nodes->GetResTruncError(iPoint); - for(unsigned short iDim = 0; iDim < nDim; iDim++) { + for(unsigned short iDim = 0; iDim < nDim; iDim++) NormalProduct += Res_TruncError[iVel + iDim] * UnitNormal[iDim]; - } - for(unsigned short iDim = 0; iDim < nDim; iDim++) Res_TruncError[iVel + iDim] -= NormalProduct * UnitNormal[iDim]; From 752adfdbb87d89d8f63dc11a7e2807eafaf149fc Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 26 Apr 2024 11:19:05 +0200 Subject: [PATCH 071/194] precommit alignment --- Common/src/geometry/CGeometry.cpp | 109 ++++++++++----------- Common/src/geometry/CMultiGridGeometry.cpp | 12 +-- 2 files changed, 56 insertions(+), 65 deletions(-) diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index 973d77675d1..e508234a331 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2482,79 +2482,74 @@ void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { for (unsigned short iSym = 0; iSym < nSym; iSym++) { unsigned short iMarker = Syms[iSym]; - for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { - const auto iPoint = vertex[iMarker][iVertex]->GetNode(); - if (!nodes->GetDomain(iPoint)) continue; - - // first check if the iPoint is shared with another marker - // loop over all markers - bool sharedPoint = false; - - for (unsigned short jMarker = 0; jMarker < nMarker; jMarker++) { - // we only check for collisions with markers other than symmetry - if ( - (iMarker==jMarker) || - ( - (config->GetMarker_All_KindBC(jMarker) == SYMMETRY_PLANE) || - (config->GetMarker_All_KindBC(jMarker) == EULER_WALL) - ) - ) continue; - // loop over all vertices on the marker - for (unsigned long jVertex = 0; jVertex < GetnVertex(jMarker); jVertex++) { - // get the jPoint of the vertex - const auto jPoint = vertex[jMarker][jVertex]->GetNode(); - if (!nodes->GetDomain(jPoint)) continue; - if (iPoint == jPoint) { - sharedPoint = true; - } + for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { + const auto iPoint = vertex[iMarker][iVertex]->GetNode(); + if (!nodes->GetDomain(iPoint)) continue; + + // first check if the iPoint is shared with another marker + // loop over all markers + bool sharedPoint = false; + + for (unsigned short jMarker = 0; jMarker < nMarker; jMarker++) { + // we only check for collisions with markers other than symmetry + if ((iMarker == jMarker) || ((config->GetMarker_All_KindBC(jMarker) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(jMarker) == EULER_WALL))) + continue; + // loop over all vertices on the marker + for (unsigned long jVertex = 0; jVertex < GetnVertex(jMarker); jVertex++) { + // get the jPoint of the vertex + const auto jPoint = vertex[jMarker][jVertex]->GetNode(); + if (!nodes->GetDomain(jPoint)) continue; + if (iPoint == jPoint) { + sharedPoint = true; } } + } - if (sharedPoint == true) continue; + if (sharedPoint == true) continue; - const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); + const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); - su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); - su2double UnitNormal_Sym[MAXNDIM] = {0.0}; + su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); + su2double UnitNormal_Sym[MAXNDIM] = {0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; + } + + for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { + su2double Product = 0.0; + unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); + /*---Check if neighbour point is on the same plane as the symmetry plane + by computing the internal product of the Normal Vertex vector and + the vector connecting iPoint and jPoint. If the product is lower than + estabilished tolerance (to account for Numerical errors) both points are + in the same plane as SYMMETRY_PLANE---*/ + su2double Tangent[MAXNDIM] = {0.0}; for (unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; + Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); + Product += Tangent[iDim] * Normal_Sym[iDim]; } - for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { - su2double Product = 0.0; - unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); - /*---Check if neighbour point is on the same plane as the symmetry plane - by computing the internal product of the Normal Vertex vector and - the vector connecting iPoint and jPoint. If the product is lower than - estabilished tolerance (to account for Numerical errors) both points are - in the same plane as SYMMETRY_PLANE---*/ - su2double Tangent[MAXNDIM] = {0.0}; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); - Product += Tangent[iDim] * Normal_Sym[iDim]; - } - - if (abs(Product) < EPS) { - Product = 0.0; + if (abs(Product) < EPS) { + Product = 0.0; - unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); - su2double Normal[MAXNDIM] = {0.0}; - edges->GetNormal(iEdge, Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; + unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); + su2double Normal[MAXNDIM] = {0.0}; + edges->GetNormal(iEdge, Normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; - for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; + for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; - edges->SetNormal(iEdge, Normal); - } // if in-plane of symmetry - } // loop over neighbors - } // loop over vertices - } // loop over markers + edges->SetNormal(iEdge, Normal); + } // if in-plane of symmetry + } // loop over neighbors + } // loop over vertices + } // loop over markers END_SU2_OMP_FOR // Use the first (lowest ID) in the symlist as the basis to orthogonalize // against - // for (size_t val_marker = 0; val_marker < nMarker; ++val_marker) { // for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index d36cc30797e..b6a3b7909de 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -126,12 +126,9 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un candidate for agglomeration ---*/ if (counter == 1) { - - agglomerate_seed = true; - - if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) - agglomerate_seed=false; + agglomerate_seed = true; + if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) agglomerate_seed = false; } /*--- If there are two markers, we will aglomerate if any of the markers is SEND_RECEIVE ---*/ @@ -144,11 +141,10 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) { cout << "possible agglomeration of symmetry plane" << endl; - //agglomerate_seed = true; - // do not agglomerate when one of the markers is symmetry + // agglomerate_seed = true; + // do not agglomerate when one of the markers is symmetry agglomerate_seed = false; - cout << "point " << iPoint << " , " << cx << " , " << cy << " " << cz << endl; } } From bb1df12412e9482460e771b073dce25aa97c3b20 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 26 Apr 2024 16:55:40 +0200 Subject: [PATCH 072/194] cleanup --- .../include/geometry/CMultiGridGeometry.hpp | 3 +- Common/src/geometry/CMultiGridGeometry.cpp | 111 ++++-------------- Common/src/geometry/CPhysicalGeometry.cpp | 2 +- .../include/solvers/CFVMFlowSolverBase.inl | 18 +-- 4 files changed, 27 insertions(+), 107 deletions(-) diff --git a/Common/include/geometry/CMultiGridGeometry.hpp b/Common/include/geometry/CMultiGridGeometry.hpp index ce65ed46d69..057dd073cbe 100644 --- a/Common/include/geometry/CMultiGridGeometry.hpp +++ b/Common/include/geometry/CMultiGridGeometry.hpp @@ -40,13 +40,12 @@ class CMultiGridGeometry final : public CGeometry { /*! * \brief Determine if a CVPoint van be agglomerated, if it have the same marker point as the seed. * \param[in] CVPoint - Control volume to be agglomerated. - * \param[in] iPoint - Master point. * \param[in] marker_seed - Marker of the seed. * \param[in] fine_grid - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. * \return TRUE or FALSE depending if the control volume can be agglomerated. */ - bool SetBoundAgglomeration(unsigned long CVPoint, unsigned long iPoint, short marker_seed, const CGeometry* fine_grid, + bool SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, const CGeometry* fine_grid, const CConfig* config) const; /*! diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index d3756ee5125..2a39ac26281 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -67,8 +67,6 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un unsigned long Index_CoarseCV = 0; - su2double cx = 0.0, cy = 0.0, cz = 0.0; - /*--- The first step is the boundary agglomeration. ---*/ for (auto iMarker = 0u; iMarker < fine_grid->GetnMarker(); iMarker++) { @@ -79,15 +77,10 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un belongs to this physical domain, and it meets the geometrical criteria, the agglomeration is studied. ---*/ - cx = fine_grid->nodes->GetCoord(iPoint)[0]; - cy = fine_grid->nodes->GetCoord(iPoint)[1]; - cz = fine_grid->nodes->GetCoord(iPoint)[2]; - - if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint)) && (GeometricalCheck(iPoint, fine_grid, config))) { unsigned short nChildren = 1; - + /*--- We set an index for the parent control volume, this also marks it as agglomerated. ---*/ @@ -111,7 +104,6 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un } } - /*--- To aglomerate a vertex it must have only one physical bc!! This can be improved. If there is only a marker, it is a good candidate for agglomeration ---*/ @@ -120,8 +112,9 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un agglomerate_seed = true; - if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) - agglomerate_seed=false; + //if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) + // //agglomerate_seed=true; + // agglomerate_seed=false; } /*--- If there are two markers, we will aglomerate if any of the @@ -131,17 +124,10 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un agglomerate_seed = (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) || (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE); - if ((config->GetMarker_All_KindBC(copy_marker[0]) == SYMMETRY_PLANE) && - (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) { - cout << "possible agglomeration of symmetry plane" << endl; - - //agglomerate_seed = true; - // do not agglomerate when one of the markers is symmetry - agglomerate_seed = false; - - - cout << "point " << iPoint << " , " << cx << " , " << cy << " " << cz << endl; - } + //if ((config->GetMarker_All_KindBC(copy_marker[0]) == SYMMETRY_PLANE) && + // (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) { + // agglomerate_seed = false; + //} } /*--- If there are more than 2 markers, the aglomeration will be discarded ---*/ @@ -156,10 +142,9 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto CVPoint : fine_grid->nodes->GetPoints(iPoint)) { /*--- The new point can be agglomerated ---*/ - if (SetBoundAgglomeration(CVPoint, iPoint, marker_seed, fine_grid, config)) { + if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) { /*--- We set the value of the parent ---*/ - fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV); /*--- We set the value of the child ---*/ @@ -178,7 +163,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto CVPoint : Suitable_Indirect_Neighbors) { /*--- The new point can be agglomerated ---*/ - if (SetBoundAgglomeration(CVPoint, iPoint, marker_seed, fine_grid, config)) { + if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) { /*--- We set the value of the parent ---*/ fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV); @@ -212,7 +197,6 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto iVertex = 0ul; iVertex < fine_grid->GetnVertex(iMarker); iVertex++) { const auto iPoint = fine_grid->vertex[iMarker][iVertex]->GetNode(); if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint))) { - cout << "leftover nodes:" << iPoint << " " << Index_CoarseCV << endl; fine_grid->nodes->SetParent_CV(iPoint, Index_CoarseCV); nodes->SetChildren_CV(Index_CoarseCV, 0, iPoint); nodes->SetnChildren_CV(Index_CoarseCV, 1); @@ -246,7 +230,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un const auto iPoint = MGQueue_InnerCV.NextCV(); iteration++; - /*--- If the element has not being previously agglomerated, belongs to the physical domain, + /*--- If the element has not been previously agglomerated, belongs to the physical domain, and satisfies several geometrical criteria then the seed CV is accepted for agglomeration. ---*/ if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint)) && @@ -337,8 +321,6 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto iPoint = 0ul; iPoint < fine_grid->GetnPoint(); iPoint++) { if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint))) { - cout << "convert coarse points leftover nodes:" << iPoint << endl; - fine_grid->nodes->SetParent_CV(iPoint, Index_CoarseCV); if (fine_grid->nodes->GetAgglomerate_Indirect(iPoint)) nodes->SetAgglomerate_Indirect(Index_CoarseCV, true); nodes->SetChildren_CV(Index_CoarseCV, 0, iPoint); @@ -358,7 +340,6 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto iCoarsePoint = 0ul; iCoarsePoint < nPointDomain; iCoarsePoint++) { if (nodes->GetnPoint(iCoarsePoint) == 1) { /*--- Find the neighbor of the isolated point. This neighbor is the right control volume ---*/ - cout << "detect isolated points:" << iCoarsePoint << endl; const auto iCoarsePoint_Complete = nodes->GetPoint(iCoarsePoint, 0); @@ -384,9 +365,6 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un } - - - /*--- Reset the neighbor information. ---*/ nodes->ResetPoints(); @@ -471,7 +449,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un /*--- Be careful, it is possible that a node changes the agglomeration configuration, the priority is always when receiving the information. ---*/ - + // nijso: Possible problem here? Some internal nodes get agglomerated with symmetry nodes when using mpi fine_grid->nodes->SetParent_CV(iPoint_Fine, iPoint_Coarse); nodes->SetChildren_CV(iPoint_Coarse, nChildren_MPI[iPoint_Coarse], iPoint_Fine); nChildren_MPI[iPoint_Coarse]++; @@ -530,7 +508,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un edgeColorGroupSize = config->GetEdgeColoringGroupSize(); } -bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, unsigned long iPoint, short marker_seed, +bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, const CGeometry* fine_grid, const CConfig* config) const { bool agglomerate_CV = false; @@ -544,6 +522,7 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, unsigned l if (fine_grid->nodes->GetBoundary(CVPoint)) { /*--- Identify the markers of the vertex that we want to agglomerate ---*/ + // count number of markers on the agglomeration candidate int counter = 0; unsigned short copy_marker[3] = {}; for (auto jMarker = 0u; jMarker < fine_grid->GetnMarker() && counter < 3; jMarker++) { @@ -553,25 +532,6 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, unsigned l } } - int counter2 = 0; - unsigned short copy_marker2[3] = {}; - for (auto jMarker = 0u; jMarker < fine_grid->GetnMarker() && counter < 3; jMarker++) { - if (fine_grid->nodes->GetVertex(iPoint, jMarker) != -1) { - copy_marker2[counter] = jMarker; - counter2++; - } - } - - if ((counter == 2) && (counter2 == 2)) { - su2double cx = fine_grid->nodes->GetCoord(iPoint)[0]; - su2double cy = fine_grid->nodes->GetCoord(iPoint)[1]; - su2double cz = fine_grid->nodes->GetCoord(iPoint)[2]; - cout << "2-2, iPoint = " << iPoint << " " << cx << " " << cy << " " << cz << endl; - cx = fine_grid->nodes->GetCoord(CVPoint)[0]; - cy = fine_grid->nodes->GetCoord(CVPoint)[1]; - cz = fine_grid->nodes->GetCoord(CVPoint)[2]; - cout << "2-2, CVPoint = " << CVPoint << " " << cx << " " << cy << " " << cz << endl; - } // if the master node is on the edge of 2 symmetries (counter=2) // and the control node is not on the edge of 2 symmetries, then do not agglomerate @@ -581,29 +541,22 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, unsigned l /*--- Only one marker in the vertex that is going to be aglomerated ---*/ if (counter == 1) { - /*--- We agglomerate if there is only a marker and is the same marker as the seed marker ---*/ - + /*--- We agglomerate if there is only one marker and it is the same marker as the seed marker ---*/ + // note that this should be the same marker id, not just the same marker type if (copy_marker[0] == marker_seed) agglomerate_CV = true; /*--- If there is only one marker, but the marker is the SEND_RECEIVE ---*/ if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) agglomerate_CV = true; - if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE)) { - if (counter2 == 2) { - cout << "counter = 1, counter2=2, mismatch for " << iPoint << " " << CVPoint << endl; - agglomerate_CV = false; - } else - agglomerate_CV = true; - } + //if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE)) + // agglomerate_CV = true; } /*--- If there are two markers in the vertex that is going to be aglomerated ---*/ if (counter == 2) { /*--- First we verify that the seed is a physical boundary ---*/ - // cout << "counter=2, point " << CVPoint << " , " << fine_grid->nodes->GetCoord(CVPoint)[0] << " , " - // <nodes->GetCoord(CVPoint)[1] << endl; if (config->GetMarker_All_KindBC(marker_seed) != SEND_RECEIVE) { /*--- Then we check that one of the markers is equal to the seed marker, and the other is send/receive ---*/ @@ -613,43 +566,19 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, unsigned l agglomerate_CV = true; } } - - if (counter2 == 2) { - cout << "agglomeration 2-2 match for " << iPoint << " " << CVPoint << endl; - agglomerate_CV = true; - } else { - // cout << "no agglomeration 2-1 mismatch" << endl; - agglomerate_CV = false; - } - // // both markers are symmetry - // if (((copy_marker[0] == marker_seed) && (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) || - // ((config->GetMarker_All_KindBC(copy_marker[0]) == SYMMETRY_PLANE) && (copy_marker[1] == marker_seed))) { - - // agglomerate_CV = true; - // cout << "both are symmetry, aggl = true" << iPoint << " " << CVPoint << endl; - // cout << "counter=2, sym, point " << CVPoint << " , " << fine_grid->nodes->GetCoord(CVPoint)[0] << " - // , " <nodes->GetCoord(CVPoint)[1] << endl; - - // } } - } - /*--- If the element belongs to the domain, it is always aglomerated. ---*/ - else { agglomerate_CV = true; - // cout << "on interior, point " << CVPoint << " , " << fine_grid->nodes->GetCoord(CVPoint)[0] << " , " - // <nodes->GetCoord(CVPoint)[1] << endl; // actually, for symmetry (and possibly other cells) we only agglomerate cells that are on the marker // at this point, the seed was on the boundary and the CV was not. so we check if the seed is a symmetry if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) { agglomerate_CV = false; - // cout << "on interior, CV=symmetry, point " << CVPoint << " , " << fine_grid->nodes->GetCoord(CVPoint)[0] << " - // , " <nodes->GetCoord(CVPoint)[1] << endl; } } + } return agglomerate_CV; @@ -1035,7 +964,7 @@ void CMultiGridGeometry::SetBoundControlVolume(const CConfig* config, const CGeo END_SU2_OMP_SAFE_GLOBAL_ACCESS /*--- Correct normals on symmetry plane ---*/ - SetBoundControlVolumeSym(config); + //SetBoundControlVolumeSym(config); } void CMultiGridGeometry::SetCoord(const CGeometry* fine_grid) { diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 6a5cd4d30e0..d998060e39e 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7285,7 +7285,7 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh END_SU2_OMP_FOR /*--- Correct normals on symmetry plane ---*/ - SetBoundControlVolumeSym(config); + //SetBoundControlVolumeSym(config); } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 342faf27108..8677173bec6 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1208,23 +1208,15 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ - su2double Vel_reflected[MAXNDIM] = {0.0}; - // use solution_old because it contains the update of the wall boundary + su2double* solutionOld = nodes->GetSolution_Old(iPoint); + su2double vp = 0.0; for(unsigned short iDim = 0; iDim < nDim; iDim++) - Vel_reflected[iDim] = nodes->GetSolution_Old(iPoint, iVel+iDim); - - su2double vp = GeometryToolbox::DotProduct(MAXNDIM, Vel_reflected, UnitNormal); - for(unsigned short iDim = 0; iDim < nDim; iDim++) - Vel_reflected[iDim] -= vp * UnitNormal[iDim]; - - su2double* Solution = nodes->GetSolution_Old(iPoint); - + vp += solutionOld[iVel+iDim] * UnitNormal[iDim]; for(unsigned short iDim = 0; iDim < nDim; iDim++) - Solution[iVel + iDim] = Vel_reflected[iDim]; + solutionOld[iVel + iDim] -= vp * UnitNormal[iDim]; - // this causes an issue on the wall - nodes->SetSolution_Old(iPoint, Solution); + nodes->SetSolution_Old(iPoint, solutionOld); /*--- Correction for multigrid ---*/ NormalProduct = 0.0; From 8324dc7431451da3fbbbb37497d14983b4883341 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 26 Apr 2024 17:18:06 +0200 Subject: [PATCH 073/194] cleanup --- Common/include/geometry/CGeometry.hpp | 5 - Common/src/geometry/CGeometry.cpp | 150 --------------------- Common/src/geometry/CMultiGridGeometry.cpp | 33 ++--- Common/src/geometry/CPhysicalGeometry.cpp | 3 - 4 files changed, 12 insertions(+), 179 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index 0ba3dbf688e..be9d403902c 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -1005,11 +1005,6 @@ class CGeometry { */ su2double GetSurfaceArea(const CConfig* config, unsigned short val_marker) const; - /*! - * \brief Correct edge normals for symmetry planes. - */ - void SetBoundControlVolumeSym(const CConfig* config); - /*! * \brief Check if a boundary is straight(2D) / plane(3D) for EULER_WALL and SYMMETRY_PLANE * only and store the information in bound_is_straight. For all other boundary types diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index e508234a331..aed63ec1066 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2457,156 +2457,6 @@ su2double CGeometry::GetSurfaceArea(const CConfig* config, unsigned short val_ma return 0.0; } -void CGeometry::SetBoundControlVolumeSym(const CConfig* config) { - // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against - static constexpr size_t MAXNSYMS = 100; - - unsigned short Syms[MAXNSYMS] = {0}; - unsigned short nSym = 0; - for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { - if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - cout << "marker " << iMarker << " is a symmetry or euler" << endl; - Syms[nSym] = iMarker; - nSym++; - } - } - - /*--- For symmetry planes: Blazek chapter 8.6: - * It is also necessary to correct the normal vectors of those faces - * of the control volume, which touch the boundary. - * The modification consists of removing all components of the face vector, - * which are normal to the symmetry plane. ---*/ - SU2_OMP_FOR_DYN(1) - /*--- First we loop over all symmetry+euler markers and we check for shared nodes ---*/ - for (unsigned short iSym = 0; iSym < nSym; iSym++) { - unsigned short iMarker = Syms[iSym]; - - for (unsigned long iVertex = 0; iVertex < GetnVertex(iMarker); iVertex++) { - const auto iPoint = vertex[iMarker][iVertex]->GetNode(); - if (!nodes->GetDomain(iPoint)) continue; - - // first check if the iPoint is shared with another marker - // loop over all markers - bool sharedPoint = false; - - for (unsigned short jMarker = 0; jMarker < nMarker; jMarker++) { - // we only check for collisions with markers other than symmetry - if ((iMarker == jMarker) || ((config->GetMarker_All_KindBC(jMarker) == SYMMETRY_PLANE) || - (config->GetMarker_All_KindBC(jMarker) == EULER_WALL))) - continue; - // loop over all vertices on the marker - for (unsigned long jVertex = 0; jVertex < GetnVertex(jMarker); jVertex++) { - // get the jPoint of the vertex - const auto jPoint = vertex[jMarker][jVertex]->GetNode(); - if (!nodes->GetDomain(jPoint)) continue; - if (iPoint == jPoint) { - sharedPoint = true; - } - } - } - - if (sharedPoint == true) continue; - - const auto Normal_Sym = vertex[iMarker][iVertex]->GetNormal(); - - su2double Area = GeometryToolbox::Norm(nDim, Normal_Sym); - su2double UnitNormal_Sym[MAXNDIM] = {0.0}; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormal_Sym[iDim] = Normal_Sym[iDim] / Area; - } - - for (unsigned short iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); ++iNeigh) { - su2double Product = 0.0; - unsigned long jPoint = nodes->GetPoint(iPoint, iNeigh); - /*---Check if neighbour point is on the same plane as the symmetry plane - by computing the internal product of the Normal Vertex vector and - the vector connecting iPoint and jPoint. If the product is lower than - estabilished tolerance (to account for Numerical errors) both points are - in the same plane as SYMMETRY_PLANE---*/ - su2double Tangent[MAXNDIM] = {0.0}; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Tangent[iDim] = nodes->GetCoord(jPoint, iDim) - nodes->GetCoord(iPoint, iDim); - Product += Tangent[iDim] * Normal_Sym[iDim]; - } - - if (abs(Product) < EPS) { - Product = 0.0; - - unsigned long iEdge = nodes->GetEdge(iPoint, iNeigh); - su2double Normal[MAXNDIM] = {0.0}; - edges->GetNormal(iEdge, Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) Product += Normal[iDim] * UnitNormal_Sym[iDim]; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] -= Product * UnitNormal_Sym[iDim]; - - edges->SetNormal(iEdge, Normal); - } // if in-plane of symmetry - } // loop over neighbors - } // loop over vertices - } // loop over markers - END_SU2_OMP_FOR - - // Use the first (lowest ID) in the symlist as the basis to orthogonalize - // against - - // for (size_t val_marker = 0; val_marker < nMarker; ++val_marker) { - // for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { - // const auto iPoint = vertex[val_marker][iVertex]->GetNode(); - - // /*--- Halo points do not need to be considered. ---*/ - // if (!nodes->GetDomain(iPoint)) continue; - - // /*--- Get the normal of the current symmetry ---*/ - // su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; - // vertex[val_marker][iVertex]->GetNormal(Normal); - - // const su2double Area = GeometryToolbox::Norm(nDim, Normal); - - // for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; - // if (nSym>1) { - // /*--- Normal of the primary symmetry plane ---*/ - // su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - // /*--- Step 2: are we on a shared node? ---*/ - // for (auto iMarker=0;iMarkerGetNode(); - // if (iPoint==jPoint) { - // /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ - // if (Syms[iMarker]GetNormal(NormalPrim); - // su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - // for(unsigned short iDim = 0; iDim < nDim; iDim++) { - // UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - // } - // /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ - // su2double ProjNorm = 0.0; - // for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - // /*--- We check if the normal of the 2 planes coincide. - // * We only update the normal if the normals of the symmetry planes are different. ---*/ - // if (fabs(1.0-ProjNorm)>EPS) { - // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - // /*--- Make normalized vector ---*/ - // su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); - // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; - // //edges->SetNormal(iEdge, Normal); - - // } // EPS - // } //syms - // } // ipoint==jpoint - // } //vertex - // }//val_marker - // } //imarker - // } //nsyms>1 - // } - // } -} - void CGeometry::ComputeSurf_Straightness(const CConfig* config, bool print_on_screen) { bool RefUnitNormal_defined; unsigned short iDim, iMarker, iMarker_Global, nMarker_Global = config->GetnMarker_CfgFile(); diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 41fcd4ee799..f1d46f0e610 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -111,10 +111,8 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un if (counter == 1) { agglomerate_seed = true; - //if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) - // agglomerate_seed=true; - - if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) agglomerate_seed = false; + // if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) + // agglomerate_seed=true; } /*--- If there are two markers, we will aglomerate if any of the markers is SEND_RECEIVE ---*/ @@ -123,11 +121,10 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un agglomerate_seed = (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) || (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE); - //if ((config->GetMarker_All_KindBC(copy_marker[0]) == SYMMETRY_PLANE) && - // (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) { - // agglomerate_seed = false; - //} - + // if ((config->GetMarker_All_KindBC(copy_marker[0]) == SYMMETRY_PLANE) && + // (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) { + // agglomerate_seed = false; + // } } /*--- If there are more than 2 markers, the aglomeration will be discarded ---*/ @@ -163,6 +160,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto CVPoint : Suitable_Indirect_Neighbors) { /*--- The new point can be agglomerated ---*/ + if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) { /*--- We set the value of the parent ---*/ @@ -196,6 +194,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un for (auto iMarker = 0u; iMarker < fine_grid->GetnMarker(); iMarker++) { for (auto iVertex = 0ul; iVertex < fine_grid->GetnVertex(iMarker); iVertex++) { const auto iPoint = fine_grid->vertex[iMarker][iVertex]->GetNode(); + if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint))) { fine_grid->nodes->SetParent_CV(iPoint, Index_CoarseCV); nodes->SetChildren_CV(Index_CoarseCV, 0, iPoint); @@ -364,7 +363,6 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un } } - /*--- Reset the neighbor information. ---*/ nodes->ResetPoints(); @@ -508,8 +506,8 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un edgeColorGroupSize = config->GetEdgeColoringGroupSize(); } -bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, - const CGeometry* fine_grid, const CConfig* config) const { +bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, const CGeometry* fine_grid, + const CConfig* config) const { bool agglomerate_CV = false; /*--- Basic condition, the point has not been previously agglomerated, it belongs to the domain, @@ -532,9 +530,6 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark } } - // if the master node is on the edge of 2 symmetries (counter=2) - // and the control node is not on the edge of 2 symmetries, then do not agglomerate - /*--- The basic condition is that the aglomerated vertex must have the same physical marker, but eventually a send-receive condition ---*/ @@ -549,8 +544,8 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) agglomerate_CV = true; - //if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE)) - // agglomerate_CV = true; + // if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE)) + // agglomerate_CV = true; } /*--- If there are two markers in the vertex that is going to be aglomerated ---*/ @@ -578,7 +573,6 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark agglomerate_CV = false; } } - } return agglomerate_CV; @@ -962,9 +956,6 @@ void CMultiGridGeometry::SetBoundControlVolume(const CConfig* config, const CGeo } } END_SU2_OMP_SAFE_GLOBAL_ACCESS - - /*--- Correct normals on symmetry plane ---*/ - //SetBoundControlVolumeSym(config); } void CMultiGridGeometry::SetCoord(const CGeometry* fine_grid) { diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index d998060e39e..de57eaa30df 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7283,9 +7283,6 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } } END_SU2_OMP_FOR - - /*--- Correct normals on symmetry plane ---*/ - //SetBoundControlVolumeSym(config); } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { From 2db7de2f7de8fc4f8e33f765a44c035b94c7cbdf Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 27 Apr 2024 00:41:18 +0200 Subject: [PATCH 074/194] fix mg for 2d meshes with mpi --- Common/src/geometry/CMultiGridGeometry.cpp | 25 ++++++++++++------- .../include/solvers/CFVMFlowSolverBase.inl | 3 ++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index f1d46f0e610..a3d039a1b8e 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -114,17 +114,19 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un // if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) // agglomerate_seed=true; } - /*--- If there are two markers, we will aglomerate if any of the + /*--- If there are two markers, we will agglomerate if any of the markers is SEND_RECEIVE ---*/ if (counter == 2) { agglomerate_seed = (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) || (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE); - // if ((config->GetMarker_All_KindBC(copy_marker[0]) == SYMMETRY_PLANE) && - // (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) { - // agglomerate_seed = false; - // } + // if one of them is a symmetry, then do not agglomerate + // if ((config->GetMarker_All_KindBC(copy_marker[0]) == SYMMETRY_PLANE) || + // (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) { + // cout <<"we do not agglomerate because we have counter=2 and one of them is a symmetry" << endl; + // agglomerate_seed = false; + //} } /*--- If there are more than 2 markers, the aglomeration will be discarded ---*/ @@ -542,10 +544,15 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark /*--- If there is only one marker, but the marker is the SEND_RECEIVE ---*/ - if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) agglomerate_CV = true; + if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) { + agglomerate_CV = true; + } - // if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE)) - // agglomerate_CV = true; + if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE)) { + if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) { + agglomerate_CV = false; + } + } } /*--- If there are two markers in the vertex that is going to be aglomerated ---*/ @@ -563,7 +570,7 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark } } } - /*--- If the element belongs to the domain, it is always aglomerated. ---*/ + /*--- If the element belongs to the domain, it is always agglomerated. ---*/ else { agglomerate_CV = true; diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 8677173bec6..ef3a8a37084 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1143,6 +1143,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Loop over all points on the other symmetry and check if current iPoint is on the symmetry ---*/ for (auto jVertex = 0ul; jVertex < geometry->nVertex[Syms[iMarker]]; jVertex++) { const auto jPoint = geometry->vertex[Syms[iMarker]][jVertex]->GetNode(); + if (!geometry->nodes->GetDomain(jPoint)) continue; if (iPoint==jPoint) { /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ if (Syms[iMarker]::BC_Sym_Plane(CGeometry* geometry, CSolver** solve su2double* V_reflected = GetCharacPrimVar(val_marker, iVertex); - for (auto iVar = 0u; iVar < nPrimVar; iVar++) + for (auto iVar = 0u; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); su2double ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); From bde93f380c637e23855ced829479474ede7678b1 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 28 Apr 2024 09:30:05 +0200 Subject: [PATCH 075/194] remove dependency of config in functions --- Common/include/geometry/CGeometry.hpp | 2 +- Common/include/geometry/CMultiGridGeometry.hpp | 2 +- Common/src/geometry/CGeometry.cpp | 2 +- Common/src/geometry/CMultiGridGeometry.cpp | 3 +-- Common/src/grid_movement/CVolumetricMovement.cpp | 2 +- SU2_CFD/src/drivers/CDriver.cpp | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index be9d403902c..1896e90a7e9 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -938,7 +938,7 @@ class CGeometry { * \param[in] fine_grid - Geometrical definition of the problem. * \param[in] action - Allocate or not the new elements. */ - inline virtual void SetBoundControlVolume(const CConfig* config, const CGeometry* fine_grid, unsigned short action) {} + inline virtual void SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) {} /*! * \brief A virtual member. diff --git a/Common/include/geometry/CMultiGridGeometry.hpp b/Common/include/geometry/CMultiGridGeometry.hpp index 057dd073cbe..6669db4b019 100644 --- a/Common/include/geometry/CMultiGridGeometry.hpp +++ b/Common/include/geometry/CMultiGridGeometry.hpp @@ -150,7 +150,7 @@ class CMultiGridGeometry final : public CGeometry { * \param[in] fine_grid - Geometrical definition of the problem. * \param[in] action - Allocate or not the new elements. */ - void SetBoundControlVolume(const CConfig* config, const CGeometry* fine_grid, unsigned short action) override; + void SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) override; /*! * \brief Set a representative coordinates of the agglomerated control volume. diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index aed63ec1066..bd4a2836e66 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2338,7 +2338,7 @@ void CGeometry::UpdateGeometry(CGeometry** geometry_container, CConfig* config) /*--- Update the control volume structures ---*/ geometry_container[iMesh]->SetControlVolume(geometry_container[iMesh - 1], UPDATE); - geometry_container[iMesh]->SetBoundControlVolume(config, geometry_container[iMesh - 1], UPDATE); + geometry_container[iMesh]->SetBoundControlVolume(geometry_container[iMesh - 1], UPDATE); geometry_container[iMesh]->SetCoord(geometry_container[iMesh - 1]); } diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index a3d039a1b8e..006db759225 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -924,8 +924,7 @@ void CMultiGridGeometry::SetControlVolume(const CGeometry* fine_grid, unsigned s END_SU2_OMP_SAFE_GLOBAL_ACCESS } -void CMultiGridGeometry::SetBoundControlVolume(const CConfig* config, const CGeometry* fine_grid, - unsigned short action) { +void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) { BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { unsigned long iCoarsePoint, iFinePoint, FineVertex, iVertex; unsigned short iMarker, iChildren, iDim; diff --git a/Common/src/grid_movement/CVolumetricMovement.cpp b/Common/src/grid_movement/CVolumetricMovement.cpp index f82c71b2972..5b09a9cdd71 100644 --- a/Common/src/grid_movement/CVolumetricMovement.cpp +++ b/Common/src/grid_movement/CVolumetricMovement.cpp @@ -98,7 +98,7 @@ void CVolumetricMovement::UpdateMultiGrid(CGeometry** geometry, CConfig* config) for (iMGlevel = 1; iMGlevel <= nMGlevel; iMGlevel++) { iMGfine = iMGlevel - 1; geometry[iMGlevel]->SetControlVolume(geometry[iMGfine], UPDATE); - geometry[iMGlevel]->SetBoundControlVolume(config, geometry[iMGfine], UPDATE); + geometry[iMGlevel]->SetBoundControlVolume(geometry[iMGfine], UPDATE); geometry[iMGlevel]->SetCoord(geometry[iMGfine]); if (config->GetGrid_Movement()) geometry[iMGlevel]->SetRestricted_GridVelocity(geometry[iMGfine]); } diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index a1c9c098a24..34d79d95fed 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -844,7 +844,7 @@ void CDriver::InitializeGeometryFVM(CConfig *config, CGeometry **&geometry) { /*--- Create the control volume structures ---*/ geometry[iMGlevel]->SetControlVolume(geometry[iMGlevel-1], ALLOCATE); - geometry[iMGlevel]->SetBoundControlVolume(config, geometry[iMGlevel-1], ALLOCATE); + geometry[iMGlevel]->SetBoundControlVolume(geometry[iMGlevel-1], ALLOCATE); geometry[iMGlevel]->SetCoord(geometry[iMGlevel-1]); /*--- Find closest neighbor to a surface point ---*/ From d3be71c3ca4d139ae5669cf5cf591977f7e518df Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 28 Apr 2024 09:33:45 +0200 Subject: [PATCH 076/194] move gradient update for symmetry to toolbox template --- Common/include/toolboxes/geometry_toolbox.hpp | 110 ++++++++++++++++++ .../gradients/computeGradientsGreenGauss.hpp | 18 +++ 2 files changed, 128 insertions(+) diff --git a/Common/include/toolboxes/geometry_toolbox.hpp b/Common/include/toolboxes/geometry_toolbox.hpp index 5c33251b2bd..6d7fb064a84 100644 --- a/Common/include/toolboxes/geometry_toolbox.hpp +++ b/Common/include/toolboxes/geometry_toolbox.hpp @@ -28,6 +28,9 @@ #include +// for su2activematrix +#include "../containers/C2DContainer.hpp" + namespace GeometryToolbox { /// \addtogroup GeometryToolbox /// @{ @@ -217,6 +220,113 @@ inline void TangentProjection(Int nDim, const Mat& tensor, const Scalar* vector, for (Int iDim = 0; iDim < nDim; iDim++) proj[iDim] -= normalProj * vector[iDim]; } +/*! \brief Reflect a gradient using a tensor mapping. Used for symmetry reflection. */ +template +// inline void ReflectGradient(Int nVar, Int nDim, Int iPoint, Bool isFlowSolver, GradientType& gradient, Matrix& +// TensorMap) { +inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isFlowSolver, Matrix& TensorMap, + Matrix& Gradients_iPoint) { + su2activematrix Gradients_Velocity(nDim, nDim); + su2activematrix Gradients_Velocity_Reflected(nDim, nDim); + static constexpr size_t MAXNDIM = 3; + su2double gradPhi[MAXNDIM] = {0.0}; + su2double gradPhiReflected[MAXNDIM] = {0.0}; + + if (isFlowSolver == true) { + /*--- Get gradients of primitives of boundary cell ---*/ + for (auto iVar = 0u; iVar < nDim; iVar++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + // Gradients_Velocity[iVar][iDim] = gradient(iPoint, 1 + iVar, iDim); + Gradients_Velocity[iVar][iDim] = Gradients_iPoint[1 + iVar][iDim]; + Gradients_Velocity_Reflected[iVar][iDim] = 0.0; + } + } + + /*--- Q' = L^T*Q*T ---*/ + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto kDim = 0u; kDim < nDim; kDim++) { + for (auto mDim = 0u; mDim < nDim; mDim++) { + Gradients_Velocity_Reflected[iDim][jDim] += + TensorMap[iDim][mDim] * TensorMap[jDim][kDim] * Gradients_Velocity[mDim][kDim]; + } + } + } + } + + /*--- we have aligned such that U is the direction of the normal + * in 2D: dU/dy = dV/dx = 0 + * in 3D: dU/dy = dV/dx = 0 + * dU/dz = dW/dx = 0 ---*/ + for (auto iDim = 1u; iDim < nDim; iDim++) { + Gradients_Velocity_Reflected[0][iDim] = 0.0; + Gradients_Velocity_Reflected[iDim][0] = 0.0; + } + + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + Gradients_Velocity[iDim][jDim] = 0.0; + } + } + + /*--- now transform back the corrected velocity gradients by taking the inverse again + * T = (L^-1)*T' ---*/ + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto kDim = 0u; kDim < nDim; kDim++) { + for (auto mDim = 0u; mDim < nDim; mDim++) { + Gradients_Velocity[iDim][jDim] += + TensorMap[mDim][iDim] * TensorMap[kDim][jDim] * Gradients_Velocity_Reflected[mDim][kDim]; + } + } + } + } + + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + // gradient(iPoint,iDim+1,jDim) = Gradients_Velocity[iDim][jDim]; + Gradients_iPoint[iDim + 1][jDim] = Gradients_Velocity[iDim][jDim]; + } + } + } + + /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ + for (auto iVar = varBegin; iVar < varEnd; iVar++) { + if ((isFlowSolver == false) || ((isFlowSolver == true) && (iVar == 0 || iVar > nDim))) { + /*--- project to symmetry aligned base ---*/ + for (auto iDim = 0u; iDim < nDim; iDim++) { + // gradPhi[iDim] = gradient(iPoint, iVar, iDim); + gradPhi[iDim] = Gradients_iPoint[iVar][iDim]; + gradPhiReflected[iDim] = 0.0; + } + + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + /*--- map transpose T' * grad(phi) ---*/ + // gradPhiReflected[jDim] += TensorMap[jDim][iDim]*gradient(iPoint,iVar,iDim); + gradPhiReflected[jDim] += TensorMap[jDim][iDim] * Gradients_iPoint[iVar][iDim]; + } + } + + for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; + + /*--- gradient in direction normal to symmetry is cancelled ---*/ + gradPhiReflected[0] = 0.0; + + /*--- Now transform back ---*/ + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + gradPhi[jDim] += TensorMap[iDim][jDim] * gradPhiReflected[iDim]; + } + } + + for (auto iDim = 0u; iDim < nDim; iDim++) + // gradient(iPoint,iVar,iDim) = gradPhi[iDim]; + Gradients_iPoint[iVar][iDim] = gradPhi[iDim]; + } + } +} + /*! \brief Construct a 2D or 3D base given a normal vector. Constructs 1 (2D) or 2 (3D) additional vectors orthogonal to the normal to form a base. */ template diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 72e563585e7..1fe0859f62e 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -248,6 +248,24 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER /*--- Compute a new base for TensorMap aligned with the unit normal ---*/ GeometryToolbox::BaseFromNormal(nDim,UnitNormal,TensorMap); + // su2activematrix Gradients_iPoint(varEnd-varBegin,nDim); + + // for (auto iVar = varBegin; iVar < varEnd; iVar++) { + // for (auto iDim = 0u; iDim < nDim; iDim++) { + // Gradients_iPoint[iVar][iDim] = gradient(iPoint, iVar, iDim); + // } + // } + + // GeometryToolbox::ReflectGradient(nDim, varBegin,varEnd, isFlowSolver, TensorMap, Gradients_iPoint); + + // for (auto iVar = varBegin; iVar < varEnd; iVar++) { + // for (auto iDim = 0u; iDim < nDim; iDim++) { + // gradient(iPoint, iVar, iDim) = Gradients_iPoint[iVar][iDim]; + // } + // } + + + if (isFlowSolver == true) { /*--- Get gradients of primitives of boundary cell ---*/ From 2f593644a835335c796691e3c4e1503c7a42e72e Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 28 Apr 2024 10:23:03 +0200 Subject: [PATCH 077/194] move around stuff --- .../include/solvers/CFVMFlowSolverBase.inl | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index ef3a8a37084..f16574ea5ea 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1195,18 +1195,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); auto residual = conv_numerics->ComputeResidual(config); - /*--- Jacobian contribution for implicit integration. ---*/ - if (implicit) - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); - - /*--- Keep only the tangential part of the momentum residuals. ---*/ - su2double NormalProduct = 0.0; - for(unsigned short iDim = 0; iDim < nDim; iDim++) - NormalProduct += LinSysRes(iPoint, iVel + iDim) * UnitNormal[iDim]; - for(unsigned short iDim = 0; iDim < nDim; iDim++) - LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; - - /*--- Also explicitly set the velocity components normal to the symmetry plane to zero. + /*--- Explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ @@ -1219,6 +1208,17 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve nodes->SetSolution_Old(iPoint, solutionOld); + /*--- Keep only the tangential part of the momentum residuals. ---*/ + su2double NormalProduct = 0.0; + for(unsigned short iDim = 0; iDim < nDim; iDim++) + NormalProduct += LinSysRes(iPoint, iVel + iDim) * UnitNormal[iDim]; + for(unsigned short iDim = 0; iDim < nDim; iDim++) + LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; + + /*--- Jacobian contribution for implicit integration. ---*/ + if (implicit) + Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + /*--- Correction for multigrid ---*/ NormalProduct = 0.0; su2double* Res_TruncError = nodes->GetResTruncError(iPoint); @@ -1229,7 +1229,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve nodes->SetResTruncError(iPoint, Res_TruncError); - } END_SU2_OMP_FOR } From ce4d0f3b370333d135acf562974095837fd68183 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 28 Apr 2024 12:37:01 +0200 Subject: [PATCH 078/194] move gradient correction to geometry_toolbox --- Common/include/toolboxes/geometry_toolbox.hpp | 2 - .../gradients/computeGradientsGreenGauss.hpp | 110 ++---------------- .../include/solvers/CFVMFlowSolverBase.inl | 7 +- 3 files changed, 12 insertions(+), 107 deletions(-) diff --git a/Common/include/toolboxes/geometry_toolbox.hpp b/Common/include/toolboxes/geometry_toolbox.hpp index 6d7fb064a84..b13fae9de2d 100644 --- a/Common/include/toolboxes/geometry_toolbox.hpp +++ b/Common/include/toolboxes/geometry_toolbox.hpp @@ -222,8 +222,6 @@ inline void TangentProjection(Int nDim, const Mat& tensor, const Scalar* vector, /*! \brief Reflect a gradient using a tensor mapping. Used for symmetry reflection. */ template -// inline void ReflectGradient(Int nVar, Int nDim, Int iPoint, Bool isFlowSolver, GradientType& gradient, Matrix& -// TensorMap) { inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isFlowSolver, Matrix& TensorMap, Matrix& Gradients_iPoint) { su2activematrix Gradients_Velocity(nDim, nDim); diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 1fe0859f62e..5743426d18b 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -248,118 +248,22 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER /*--- Compute a new base for TensorMap aligned with the unit normal ---*/ GeometryToolbox::BaseFromNormal(nDim,UnitNormal,TensorMap); - // su2activematrix Gradients_iPoint(varEnd-varBegin,nDim); + su2activematrix Gradients_iPoint(varEnd-varBegin,nDim); - // for (auto iVar = varBegin; iVar < varEnd; iVar++) { - // for (auto iDim = 0u; iDim < nDim; iDim++) { - // Gradients_iPoint[iVar][iDim] = gradient(iPoint, iVar, iDim); - // } - // } - - // GeometryToolbox::ReflectGradient(nDim, varBegin,varEnd, isFlowSolver, TensorMap, Gradients_iPoint); - - // for (auto iVar = varBegin; iVar < varEnd; iVar++) { - // for (auto iDim = 0u; iDim < nDim; iDim++) { - // gradient(iPoint, iVar, iDim) = Gradients_iPoint[iVar][iDim]; - // } - // } - - - - if (isFlowSolver == true) { - - /*--- Get gradients of primitives of boundary cell ---*/ - for (auto iVar = 0u; iVar < nDim; iVar++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - Gradients_Velocity[iVar][iDim] = gradient(iPoint, 1 + iVar, iDim); - Gradients_Velocity_Reflected[iVar][iDim] = 0.0; - } - } - - /*--- Q' = L^T*Q*T ---*/ + for (auto iVar = varBegin; iVar < varEnd; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto kDim = 0u; kDim < nDim; kDim++) { - for (auto mDim = 0u; mDim < nDim; mDim++) { - Gradients_Velocity_Reflected[iDim][jDim] += TensorMap[iDim][mDim]*TensorMap[jDim][kDim]*Gradients_Velocity[mDim][kDim]; - } - } - } + Gradients_iPoint[iVar][iDim] = gradient(iPoint, iVar, iDim); } + } - /*--- we have aligned such that U is the direction of the normal - * in 2D: dU/dy = dV/dx = 0 - * in 3D: dU/dy = dV/dx = 0 - * dU/dz = dW/dx = 0 ---*/ - for (auto iDim = 1u; iDim < nDim; iDim++) { - Gradients_Velocity_Reflected[0][iDim] = 0.0; - Gradients_Velocity_Reflected[iDim][0] = 0.0; - } + GeometryToolbox::ReflectGradient(nDim, varBegin,varEnd, isFlowSolver, TensorMap, Gradients_iPoint); + for (auto iVar = varBegin; iVar < varEnd; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - Gradients_Velocity[iDim][jDim] = 0.0; - } - } - - /*--- now transform back the corrected velocity gradients by taking the inverse again - * T = (L^-1)*T' ---*/ - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto kDim = 0u; kDim < nDim; kDim++) { - for (auto mDim = 0u; mDim < nDim; mDim++) { - Gradients_Velocity[iDim][jDim] += TensorMap[mDim][iDim]*TensorMap[kDim][jDim]*Gradients_Velocity_Reflected[mDim][kDim]; - } - } - } - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - gradient(iPoint,iDim+1,jDim) = Gradients_Velocity[iDim][jDim]; - } + gradient(iPoint, iVar, iDim) = Gradients_iPoint[iVar][iDim]; } } - /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - if ( - (isFlowSolver==false) || - ((isFlowSolver==true) && (iVar == 0 || iVar > nDim)) - ) - { - - /*--- project to symmetry aligned base ---*/ - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradPhi[iDim] = gradient(iPoint, iVar, iDim); - gradPhiReflected[iDim] = 0.0; - } - - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - /*--- map transpose T' * grad(phi) ---*/ - gradPhiReflected[jDim] += TensorMap[jDim][iDim]*gradient(iPoint,iVar,iDim); - } - } - - for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; - - /*--- gradient in direction normal to symmetry is cancelled ---*/ - gradPhiReflected[0] = 0.0; - - /*--- Now transform back ---*/ - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradPhi[jDim] += TensorMap[iDim][jDim]*gradPhiReflected[iDim]; - } - } - - for (auto iDim = 0u; iDim < nDim; iDim++) - gradient(iPoint,iVar,iDim) = gradPhi[iDim]; - - } - } - } // loop over vertices END_SU2_OMP_FOR } // symmetry diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index f16574ea5ea..1c231ed5443 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1215,9 +1215,12 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for(unsigned short iDim = 0; iDim < nDim; iDim++) LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; - /*--- Jacobian contribution for implicit integration. ---*/ - if (implicit) + /*--- Jacobian contribution for implicit integration. ---*/ + if (implicit) { + Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + /*--- Add Jacobian again for more diagonal dominance. ---*/ Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + } /*--- Correction for multigrid ---*/ NormalProduct = 0.0; From 5c05ad27b76a2fd196b4dfa30922eb12bf4e799f Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 28 Apr 2024 13:21:56 +0200 Subject: [PATCH 079/194] remove commented code --- Common/include/toolboxes/geometry_toolbox.hpp | 13 +++++-------- .../gradients/computeGradientsGreenGauss.hpp | 12 ++++-------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Common/include/toolboxes/geometry_toolbox.hpp b/Common/include/toolboxes/geometry_toolbox.hpp index b13fae9de2d..d3fa919a821 100644 --- a/Common/include/toolboxes/geometry_toolbox.hpp +++ b/Common/include/toolboxes/geometry_toolbox.hpp @@ -224,9 +224,10 @@ inline void TangentProjection(Int nDim, const Mat& tensor, const Scalar* vector, template inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isFlowSolver, Matrix& TensorMap, Matrix& Gradients_iPoint) { + static constexpr size_t MAXNDIM = 3; + su2activematrix Gradients_Velocity(nDim, nDim); su2activematrix Gradients_Velocity_Reflected(nDim, nDim); - static constexpr size_t MAXNDIM = 3; su2double gradPhi[MAXNDIM] = {0.0}; su2double gradPhiReflected[MAXNDIM] = {0.0}; @@ -234,7 +235,7 @@ inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isF /*--- Get gradients of primitives of boundary cell ---*/ for (auto iVar = 0u; iVar < nDim; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { - // Gradients_Velocity[iVar][iDim] = gradient(iPoint, 1 + iVar, iDim); + // todo: 1 ->idx.velocity Gradients_Velocity[iVar][iDim] = Gradients_iPoint[1 + iVar][iDim]; Gradients_Velocity_Reflected[iVar][iDim] = 0.0; } @@ -282,7 +283,7 @@ inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isF for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { - // gradient(iPoint,iDim+1,jDim) = Gradients_Velocity[iDim][jDim]; + // todo: 1->idx.velocity Gradients_iPoint[iDim + 1][jDim] = Gradients_Velocity[iDim][jDim]; } } @@ -293,7 +294,6 @@ inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isF if ((isFlowSolver == false) || ((isFlowSolver == true) && (iVar == 0 || iVar > nDim))) { /*--- project to symmetry aligned base ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { - // gradPhi[iDim] = gradient(iPoint, iVar, iDim); gradPhi[iDim] = Gradients_iPoint[iVar][iDim]; gradPhiReflected[iDim] = 0.0; } @@ -301,7 +301,6 @@ inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isF for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto iDim = 0u; iDim < nDim; iDim++) { /*--- map transpose T' * grad(phi) ---*/ - // gradPhiReflected[jDim] += TensorMap[jDim][iDim]*gradient(iPoint,iVar,iDim); gradPhiReflected[jDim] += TensorMap[jDim][iDim] * Gradients_iPoint[iVar][iDim]; } } @@ -318,9 +317,7 @@ inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isF } } - for (auto iDim = 0u; iDim < nDim; iDim++) - // gradient(iPoint,iVar,iDim) = gradPhi[iDim]; - Gradients_iPoint[iVar][iDim] = gradPhi[iDim]; + for (auto iDim = 0u; iDim < nDim; iDim++) Gradients_iPoint[iVar][iDim] = gradPhi[iDim]; } } } diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 5743426d18b..56262e8fc64 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -72,14 +72,6 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER static constexpr size_t MAXNDIM = 3; static constexpr size_t MAXNSYMS = 100; - /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ - su2activematrix TensorMap(nDim,nDim); - su2activematrix Gradients_Velocity(nDim,nDim); - su2activematrix Gradients_Velocity_Reflected(nDim,nDim); - - su2double gradPhi[MAXNDIM] = {0.0}; - su2double gradPhiReflected[MAXNDIM] = {0.0}; - /*--- For each (non-halo) volume integrate over its faces (edges). ---*/ SU2_OMP_FOR_DYN(chunkSize) @@ -245,6 +237,10 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } + + /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ + su2activematrix TensorMap(nDim,nDim); + /*--- Compute a new base for TensorMap aligned with the unit normal ---*/ GeometryToolbox::BaseFromNormal(nDim,UnitNormal,TensorMap); From 8666f0c2e5748dd0f052829685abd3cb21d2ad0d Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 28 Apr 2024 23:03:47 +0200 Subject: [PATCH 080/194] Euler walls can never be agglomerated --- Common/src/geometry/CMultiGridGeometry.cpp | 22 +++++++++++----------- Common/src/geometry/CPhysicalGeometry.cpp | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 006db759225..cd459faaf8d 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -111,8 +111,8 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un if (counter == 1) { agglomerate_seed = true; - // if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) - // agglomerate_seed=true; + /*--- Euler walls can be curved and agglomerating them leads to difficulties ---*/ + if (config->GetMarker_All_KindBC(marker_seed) == EULER_WALL) agglomerate_seed = false; } /*--- If there are two markers, we will agglomerate if any of the markers is SEND_RECEIVE ---*/ @@ -121,12 +121,11 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un agglomerate_seed = (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) || (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE); - // if one of them is a symmetry, then do not agglomerate - // if ((config->GetMarker_All_KindBC(copy_marker[0]) == SYMMETRY_PLANE) || - // (config->GetMarker_All_KindBC(copy_marker[1]) == SYMMETRY_PLANE)) { - // cout <<"we do not agglomerate because we have counter=2 and one of them is a symmetry" << endl; - // agglomerate_seed = false; - //} + /* --- Euler walls can also not be agglomerated when the point has 2 markers ---*/ + if ((config->GetMarker_All_KindBC(copy_marker[0]) == EULER_WALL) || + (config->GetMarker_All_KindBC(copy_marker[1]) == EULER_WALL)) { + agglomerate_seed = false; + } } /*--- If there are more than 2 markers, the aglomeration will be discarded ---*/ @@ -449,7 +448,6 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un /*--- Be careful, it is possible that a node changes the agglomeration configuration, the priority is always when receiving the information. ---*/ - // nijso: Possible problem here? Some internal nodes get agglomerated with symmetry nodes when using mpi fine_grid->nodes->SetParent_CV(iPoint_Fine, iPoint_Coarse); nodes->SetChildren_CV(iPoint_Coarse, nChildren_MPI[iPoint_Coarse], iPoint_Fine); nChildren_MPI[iPoint_Coarse]++; @@ -548,7 +546,8 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark agglomerate_CV = true; } - if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE)) { + if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(marker_seed) == EULER_WALL)) { if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) { agglomerate_CV = false; } @@ -576,7 +575,8 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark // actually, for symmetry (and possibly other cells) we only agglomerate cells that are on the marker // at this point, the seed was on the boundary and the CV was not. so we check if the seed is a symmetry - if (config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) { + if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(marker_seed) == EULER_WALL)) { agglomerate_CV = false; } } diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index de57eaa30df..0d06dac6eec 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -4124,7 +4124,7 @@ void CPhysicalGeometry::Check_IntElem_Orientation(const CConfig* config) { if (tria_flip + quad_flip + tet_flip + hexa_flip + pyram_flip + prism_flip + quad_error + pyram_error + prism_error + hexa_error == 0) { - cout << "All volume elements are correctly orientend." << endl; + cout << "All volume elements are correctly oriented." << endl; } } } @@ -4260,7 +4260,7 @@ void CPhysicalGeometry::Check_BoundElem_Orientation(const CConfig* config) { } if (line_flip + tria_flip + quad_flip + quad_error == 0) { - cout << "All surface elements are correctly orientend." << endl; + cout << "All surface elements are correctly oriented." << endl; } } } From 707e80da7ae6daeeadbfa5c2fd3c2a7772f4611b Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 3 May 2024 23:15:35 +0200 Subject: [PATCH 081/194] point to fix_symmetry workflow --- .github/workflows/regression.yml | 2 +- TestCases/euler/naca0012/inv_NACA0012_Roe.cfg | 6 ++-- .../navierstokes/cylinder/lam_cylinder.cfg | 2 +- .../navierstokes/flatplate/lam_flatplate.cfg | 4 +-- TestCases/serial_regression.py | 32 +++++++++---------- TestCases/tutorials.py | 30 ++++++++--------- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index c001fedf53f..b9c45897ab9 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -173,7 +173,7 @@ jobs: uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103 with: # -t -c - args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t fix_symmetry -c fix_symmetry -s ${{matrix.testscript}} - name: Cleanup uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103 with: diff --git a/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg b/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg index 6215d0870ae..ca0ca64d502 100644 --- a/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg +++ b/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg @@ -41,7 +41,7 @@ MARKER_MONITORING= ( airfoil ) % ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 4.0 +CFL_NUMBER= 1.0 CFL_ADAPT= NO CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) @@ -57,8 +57,8 @@ MGCYCLE= W_CYCLE MG_PRE_SMOOTH= ( 1, 2, 2, 2 ) MG_POST_SMOOTH= ( 1, 1, 1, 1 ) MG_CORRECTION_SMOOTH= ( 1, 1, 1, 1 ) -MG_DAMP_RESTRICTION= 1.0 -MG_DAMP_PROLONGATION= 1.0 +MG_DAMP_RESTRICTION= 0.75 +MG_DAMP_PROLONGATION= 0.75 % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % diff --git a/TestCases/navierstokes/cylinder/lam_cylinder.cfg b/TestCases/navierstokes/cylinder/lam_cylinder.cfg index 8c0efd53259..eb03eb6c121 100644 --- a/TestCases/navierstokes/cylinder/lam_cylinder.cfg +++ b/TestCases/navierstokes/cylinder/lam_cylinder.cfg @@ -42,7 +42,7 @@ MARKER_MONITORING= ( cylinder ) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 4.0 +CFL_NUMBER= 500.0 CFL_ADAPT= NO CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) diff --git a/TestCases/navierstokes/flatplate/lam_flatplate.cfg b/TestCases/navierstokes/flatplate/lam_flatplate.cfg index 34f572d5598..70f595eca06 100644 --- a/TestCases/navierstokes/flatplate/lam_flatplate.cfg +++ b/TestCases/navierstokes/flatplate/lam_flatplate.cfg @@ -63,8 +63,8 @@ MGCYCLE= V_CYCLE MG_PRE_SMOOTH= ( 1, 1, 1, 2 ) MG_POST_SMOOTH= ( 0, 1, 1, 0 ) MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) -MG_DAMP_RESTRICTION= 0.75 -MG_DAMP_PROLONGATION= 0.75 +MG_DAMP_RESTRICTION= 0.7 +MG_DAMP_PROLONGATION= 0.7 % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index dab5dd1256f..338b3447e9d 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -61,7 +61,7 @@ def main(): invwedge.cfg_dir = "nonequilibrium/invwedge" invwedge.cfg_file = "invwedge_ausm.cfg" invwedge.test_iter = 10 - invwedge.test_vals = [-1.046323, -1.571086, -18.301251, -18.628639, -18.574676, 2.271778, 1.875687, 5.315769, 0.870008] + invwedge.test_vals = [-1.074519, -1.599282, -18.299959, -18.627370, -18.573382, 2.241084, 1.866240, 5.285351, 0.842916] invwedge.test_vals_aarch64 = [-1.046323, -1.571086, -18.301361, -18.628744, -18.574788, 2.271778, 1.875687, 5.315769, 0.870008] test_list.append(invwedge) @@ -70,7 +70,7 @@ def main(): visc_cone.cfg_dir = "nonequilibrium/visc_wedge" visc_cone.cfg_file = "axi_visccone.cfg" visc_cone.test_iter = 10 - visc_cone.test_vals = [-5.215236, -5.739371, -20.556662, -20.517023, -20.436970, 1.262783, -3.205463, -0.015695, 0.093205, 32656.000000] + visc_cone.test_vals = [-5.215236, -5.739371, -20.560910, -20.517094, -20.406632, 1.262780, -3.205483, -0.015695, 0.093205, 32655.000000] visc_cone.test_vals_aarch64 = [-5.215229, -5.739368, -20.556662, -20.517022, -20.437459, 1.262784, -3.205455, -0.015696, 0.093207, 32656.000000] test_list.append(visc_cone) @@ -90,7 +90,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 10 - channel.test_vals = [-2.475872, 3.046370, -0.203974, 0.036018] + channel.test_vals = [-2.427098, 3.088105, 0.331946, -0.044759] test_list.append(channel) # NACA0012 @@ -98,7 +98,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-4.023999, -3.515034, 0.339426, 0.022217] + naca0012.test_vals = [-3.930109, -3.424824, -0.063246, -0.094245] test_list.append(naca0012) # Supersonic wedge @@ -106,7 +106,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-0.942862, 4.784581, -0.208106, 0.036665] + wedge.test_vals = [-1.002840, 4.720744, -0.082079, 0.014516] test_list.append(wedge) # ONERA M6 Wing @@ -133,7 +133,7 @@ def main(): polar_naca0012.polar = True polar_naca0012.test_iter = 10 polar_naca0012.test_vals = [-1.243326, 4.224483, 0.016432, 0.016145] - polar_naca0012.test_vals_aarch64 = [-1.811046, 3.612379, 0.012330, 0.009194] + polar_naca0012.test_vals_aarch64 = [-1.169556, 4.301216, -0.785046, -0.140490] polar_naca0012.command = TestCase.Command(exec = "compute_polar.py", param = "-n 1 -i 11") # flaky test on arm64 polar_naca0012.enabled_on_cpu_arch = ["x86_64"] @@ -144,7 +144,7 @@ def main(): bluntbody.cfg_dir = "euler/bluntbody" bluntbody.cfg_file = "blunt.cfg" bluntbody.test_iter = 20 - bluntbody.test_vals = [0.540009, 6.916653, -0.000000, 1.868975] + bluntbody.test_vals = [0.581950, 6.955500, -0.000000, 1.757414] test_list.append(bluntbody) ########################## @@ -239,7 +239,7 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-4.157358, -6.736289, -0.176258, 0.057431] + turb_flatplate.test_vals = [-4.156817, -6.736063, -0.176192, 0.057478] test_list.append(turb_flatplate) # FLAT PLATE, WALL FUNCTIONS, COMPRESSIBLE SST @@ -247,7 +247,7 @@ def main(): turb_wallfunction_flatplate_sst.cfg_dir = "wallfunctions/flatplate/compressible_SST" turb_wallfunction_flatplate_sst.cfg_file = "turb_SST_flatplate.cfg" turb_wallfunction_flatplate_sst.test_iter = 10 - turb_wallfunction_flatplate_sst.test_vals = [-4.181412, -1.864638, -1.966031, 1.259921, -1.487159, 1.544166, 10.000000, -2.130777, 0.073950, 0.002971] + turb_wallfunction_flatplate_sst.test_vals = [-4.182760, -1.884285, -1.946696, 1.257252, -1.251977, 1.537975, 10.000000, -2.066493, 0.074431, 0.002935] test_list.append(turb_wallfunction_flatplate_sst) # FLAT PLATE, WALL FUNCTIONS, COMPRESSIBLE SA @@ -255,7 +255,7 @@ def main(): turb_wallfunction_flatplate_sa.cfg_dir = "wallfunctions/flatplate/compressible_SA" turb_wallfunction_flatplate_sa.cfg_file = "turb_SA_flatplate.cfg" turb_wallfunction_flatplate_sa.test_iter = 10 - turb_wallfunction_flatplate_sa.test_vals = [-4.435719, -2.044696, -2.114266, 0.980115, -5.393813, 10.000000, -1.589802, 0.069744, 0.002686] + turb_wallfunction_flatplate_sa.test_vals = [-4.361852, -1.994458, -2.149183, 1.075806, -5.387005, 10.000000, -1.759813, 0.069046, 0.002643] test_list.append(turb_wallfunction_flatplate_sa) # ONERA M6 Wing @@ -263,7 +263,7 @@ def main(): turb_oneram6.cfg_dir = "rans/oneram6" turb_oneram6.cfg_file = "turb_ONERAM6.cfg" turb_oneram6.test_iter = 10 - turb_oneram6.test_vals = [-2.388841, -6.689427, 0.230321, 0.157640, -32539.000000] + turb_oneram6.test_vals = [-2.392611, -6.689654, 0.230566, 0.158760, -33786.000000] turb_oneram6.timeout = 3200 test_list.append(turb_oneram6) @@ -368,7 +368,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-4.858287, -3.810487, 0.491850, 0.007002] + inc_euler_naca0012.test_vals = [-4.560214, -3.573893, 0.482483, -0.165393] test_list.append(inc_euler_naca0012) # C-D nozzle with pressure inlet and mass flow outlet @@ -419,7 +419,7 @@ def main(): inc_lam_bend.cfg_dir = "incomp_navierstokes/bend" inc_lam_bend.cfg_file = "lam_bend.cfg" inc_lam_bend.test_iter = 10 - inc_lam_bend.test_vals = [-3.455147, -3.082194, -0.018579, 1.169947] + inc_lam_bend.test_vals = [-3.480202, -3.250417, -0.017527, 1.008144] test_list.append(inc_lam_bend) ############################ @@ -454,7 +454,7 @@ def main(): inc_turb_wallfunction_flatplate_sst.cfg_dir = "wallfunctions/flatplate/incompressible_SST" inc_turb_wallfunction_flatplate_sst.cfg_file = "turb_SST_flatplate.cfg" inc_turb_wallfunction_flatplate_sst.test_iter = 10 - inc_turb_wallfunction_flatplate_sst.test_vals = [-6.560775, -5.700721, -6.304284, -4.230488, -7.179831, -1.956057, 10.000000, -2.918240, 0.000887, 0.003680, 0.518450] + inc_turb_wallfunction_flatplate_sst.test_vals = [-6.455603, -5.693013, -6.560772, -4.218571, -7.009774, -1.955796, 10.000000, -3.027629, 0.001076, 0.003642, 0.634400] test_list.append(inc_turb_wallfunction_flatplate_sst) # FLAT PLATE, WALL FUNCTIONS, INCOMPRESSIBLE SA @@ -462,7 +462,7 @@ def main(): inc_turb_wallfunction_flatplate_sa.cfg_dir = "wallfunctions/flatplate/incompressible_SA" inc_turb_wallfunction_flatplate_sa.cfg_file = "turb_SA_flatplate.cfg" inc_turb_wallfunction_flatplate_sa.test_iter = 10 - inc_turb_wallfunction_flatplate_sa.test_vals = [-6.561303, -5.718581, -6.306403, -4.230225, -9.586904, 10.000000, -2.927392, 0.000858, 0.003792] + inc_turb_wallfunction_flatplate_sa.test_vals = [-6.469107, -5.710429, -6.540591, -4.219577, -9.586948, 10.000000, -3.045446, 0.000993, 0.003756] test_list.append(inc_turb_wallfunction_flatplate_sa) #################### @@ -555,7 +555,7 @@ def main(): schubauer_klebanoff_transition.cfg_dir = "transition/Schubauer_Klebanoff" schubauer_klebanoff_transition.cfg_file = "transitional_BC_model_ConfigFile.cfg" schubauer_klebanoff_transition.test_iter = 10 - schubauer_klebanoff_transition.test_vals = [-8.029786, -13.240213, 0.000053, 0.007986] + schubauer_klebanoff_transition.test_vals = [-8.002250, -13.240235, 0.000056, 0.007985] test_list.append(schubauer_klebanoff_transition) ##################################### diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index f63fb81c990..f3335173fa6 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -71,7 +71,7 @@ def main(): sp_pinArray_2d_mf_hf.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" sp_pinArray_2d_mf_hf.cfg_file = "sp_pinArray_2d_mf_hf.cfg" sp_pinArray_2d_mf_hf.test_iter = 25 - sp_pinArray_2d_mf_hf.test_vals = [-4.625757, 1.445108, -0.750969, 241.762883] + sp_pinArray_2d_mf_hf.test_vals = [-4.504174, 1.569752, -0.747804, 241.767008] test_list.append(sp_pinArray_2d_mf_hf) # 2D pin case pressure drop periodic with heatflux BC and temperature periodicity @@ -79,7 +79,7 @@ def main(): sp_pinArray_2d_dp_hf_tp.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" sp_pinArray_2d_dp_hf_tp.cfg_file = "sp_pinArray_2d_dp_hf_tp.cfg" sp_pinArray_2d_dp_hf_tp.test_iter = 25 - sp_pinArray_2d_dp_hf_tp.test_vals = [-4.666547, 1.396426, -0.709267, 208.023676] + sp_pinArray_2d_dp_hf_tp.test_vals = [-4.528950, 1.539981, -0.706095, 208.023676] test_list.append(sp_pinArray_2d_dp_hf_tp) ### Species Transport @@ -89,7 +89,7 @@ def main(): species3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" species3_primitiveVenturi.cfg_file = "species3_primitiveVenturi.cfg" species3_primitiveVenturi.test_iter = 50 - species3_primitiveVenturi.test_vals = [-6.082040, -5.293756, -5.131970, -5.933415, -1.606563, -6.274241, -6.408477, 5.000000, -0.811535, 5.000000, -2.344697, 5.000000, -0.388358, 1.647440, 0.499101, 0.600978, 0.547361] + species3_primitiveVenturi.test_vals = [-5.980474, -5.337634, -5.274813, -6.037197, -1.812747, -6.418509, -6.557506, 5.000000, -0.826786, 5.000000, -2.181601, 5.000000, -0.490381, 1.652855, 0.500725, 0.597239, 0.554891] test_list.append(species3_primitiveVenturi) # 3 species (2 eq) primitive venturi mixing @@ -97,8 +97,8 @@ def main(): DAspecies3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" DAspecies3_primitiveVenturi.cfg_file = "DAspecies3_primitiveVenturi.cfg" DAspecies3_primitiveVenturi.test_iter = 50 - DAspecies3_primitiveVenturi.test_vals = [-8.443103, -7.715615, -7.706589, -7.428740, -12.067471, -12.205189, -11.368995] - DAspecies3_primitiveVenturi.test_vals_aarch64 = [-8.443103, -7.715615, -7.706589, -7.428740, -12.067471, -12.205189, -11.368995] + DAspecies3_primitiveVenturi.test_vals = [-8.001028, -7.654107, -7.446051, -7.341816, -11.903671, -10.939999, -10.166007] + DAspecies3_primitiveVenturi.test_vals_aarch64 = [-8.001028, -7.654107, -7.446051, -7.341816, -11.903671, -10.939999, -10.166007] DAspecies3_primitiveVenturi.command = TestCase.Command("mpirun -n 2", "SU2_CFD_AD") test_list.append(DAspecies3_primitiveVenturi) @@ -127,7 +127,7 @@ def main(): premixed_hydrogen.cfg_dir = "../Tutorials/incompressible_flow/Inc_Combustion/1__premixed_hydrogen" premixed_hydrogen.cfg_file = "H2_burner.cfg" premixed_hydrogen.test_iter = 10 - premixed_hydrogen.test_vals = [-9.905856, -10.449512, -11.035999, -4.331440, -11.882740] + premixed_hydrogen.test_vals = [-9.845322, -10.354388, -11.027983, -4.321538, -11.867730] test_list.append(premixed_hydrogen) ### Compressible Flow @@ -137,7 +137,7 @@ def main(): tutorial_inv_bump.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Bump" tutorial_inv_bump.cfg_file = "inv_channel.cfg" tutorial_inv_bump.test_iter = 0 - tutorial_inv_bump.test_vals = [-1.437425, 4.075857, 0.005439, 0.012998] + tutorial_inv_bump.test_vals = [-1.437425, 4.075857, 0.042960, 0.087660] test_list.append(tutorial_inv_bump) # Inviscid Wedge @@ -145,7 +145,7 @@ def main(): tutorial_inv_wedge.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Wedge" tutorial_inv_wedge.cfg_file = "inv_wedge_HLLC.cfg" tutorial_inv_wedge.test_iter = 0 - tutorial_inv_wedge.test_vals = [-0.481460, 5.253008, -0.291747, 0.052515] + tutorial_inv_wedge.test_vals = [-0.481460, 5.253008, -0.286364, 0.051477] tutorial_inv_wedge.no_restart = True test_list.append(tutorial_inv_wedge) @@ -154,7 +154,7 @@ def main(): tutorial_inv_onera.cfg_dir = "../Tutorials/compressible_flow/Inviscid_ONERAM6" tutorial_inv_onera.cfg_file = "inv_ONERAM6.cfg" tutorial_inv_onera.test_iter = 0 - tutorial_inv_onera.test_vals = [-5.204928, -4.597762, 0.247451, 0.085770] + tutorial_inv_onera.test_vals = [-5.204928, -4.597762, 0.259973, 0.082368] tutorial_inv_onera.no_restart = True test_list.append(tutorial_inv_onera) @@ -199,7 +199,7 @@ def main(): tutorial_trans_flatplate_T3A.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A" tutorial_trans_flatplate_T3A.cfg_file = "transitional_LM_model_ConfigFile.cfg" tutorial_trans_flatplate_T3A.test_iter = 20 - tutorial_trans_flatplate_T3A.test_vals = [-5.837186, -2.092246, -3.982633, -0.302219, -1.921235, 1.667190, -3.496277, 0.391605] + tutorial_trans_flatplate_T3A.test_vals = [-5.837190, -2.092245, -3.983710, -0.302215, -1.929882, 1.677075, -3.496279, 0.391606] tutorial_trans_flatplate_T3A.test_vals_aarch64 = [-5.837191, -2.092246, -3.982640, -0.302224, -1.922554, 1.667190, -3.496277, 0.391605] tutorial_trans_flatplate_T3A.no_restart = True test_list.append(tutorial_trans_flatplate_T3A) @@ -209,7 +209,7 @@ def main(): tutorial_trans_flatplate_T3Am.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A-" tutorial_trans_flatplate_T3Am.cfg_file = "transitional_LM_model_ConfigFile.cfg" tutorial_trans_flatplate_T3Am.test_iter = 20 - tutorial_trans_flatplate_T3Am.test_vals = [-6.063600, -1.945057, -3.946760, -0.549063, -3.863792, 2.664453, -2.517606, 1.112979] + tutorial_trans_flatplate_T3Am.test_vals = [-6.063083, -1.945092, -3.946928, -0.548659, -3.863795, 2.664463, -2.517595, 1.112979 tutorial_trans_flatplate_T3Am.test_vals_aarch64 = [-6.063598, -1.945057, -3.946744, -0.549062, -3.863792, 2.664453, -2.517606, 1.112979] tutorial_trans_flatplate_T3Am.no_restart = True test_list.append(tutorial_trans_flatplate_T3Am) @@ -237,7 +237,7 @@ def main(): tutorial_turb_oneram6.cfg_dir = "../Tutorials/compressible_flow/Turbulent_ONERAM6" tutorial_turb_oneram6.cfg_file = "turb_ONERAM6.cfg" tutorial_turb_oneram6.test_iter = 0 - tutorial_turb_oneram6.test_vals = [-4.564441, -11.524476, 0.327954, 0.097349] + tutorial_turb_oneram6.test_vals = [-4.564441, -11.529247, 0.327435, 0.097253] test_list.append(tutorial_turb_oneram6) # NICD Nozzle @@ -245,7 +245,7 @@ def main(): tutorial_nicfd_nozzle.cfg_dir = "../Tutorials/compressible_flow/NICFD_nozzle" tutorial_nicfd_nozzle.cfg_file = "NICFD_nozzle.cfg" tutorial_nicfd_nozzle.test_iter = 20 - tutorial_nicfd_nozzle.test_vals = [-2.187397, -2.338457, 3.617301, 0.000000, 0.000000] + tutorial_nicfd_nozzle.test_vals = [-2.063934, -2.344744, 3.596583, 0.000000, 0.000000] tutorial_nicfd_nozzle.no_restart = True test_list.append(tutorial_nicfd_nozzle) @@ -275,7 +275,7 @@ def main(): tutorial_design_inv_naca0012.cfg_dir = "../Tutorials/design/Inviscid_2D_Unconstrained_NACA0012" tutorial_design_inv_naca0012.cfg_file = "inv_NACA0012_basic.cfg" tutorial_design_inv_naca0012.test_iter = 0 - tutorial_design_inv_naca0012.test_vals = [-3.585391, -2.989014, 0.135070, 0.208565] + tutorial_design_inv_naca0012.test_vals = [-3.585391, -2.989014, 0.131159, 0.206017] tutorial_design_inv_naca0012.no_restart = True test_list.append(tutorial_design_inv_naca0012) @@ -293,7 +293,7 @@ def main(): tutorial_design_multiobj.cfg_dir = "../Tutorials/design/Multi_Objective_Shape_Design" tutorial_design_multiobj.cfg_file = "inv_wedge_ROE_multiobj_combo.cfg" tutorial_design_multiobj.test_iter = 0 - tutorial_design_multiobj.test_vals = [2.657333, -3.020635, 324840.000000, 0.000000] #last 4 columns + tutorial_design_multiobj.test_vals = [2.657333, -3.020635, 370220.000000, 0.000000] tutorial_design_multiobj.no_restart = True test_list.append(tutorial_design_multiobj) From 99e60e22be37806db7a3709496645e7967508ce1 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 4 May 2024 12:36:33 +0200 Subject: [PATCH 082/194] fix regressions for vandv --- TestCases/vandv.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/TestCases/vandv.py b/TestCases/vandv.py index 16ea373e8c1..3f80cd88fc8 100644 --- a/TestCases/vandv.py +++ b/TestCases/vandv.py @@ -54,8 +54,8 @@ def main(): flatplate_sst1994m.cfg_dir = "vandv/rans/flatplate" flatplate_sst1994m.cfg_file = "turb_flatplate_sst.cfg" flatplate_sst1994m.test_iter = 5 - flatplate_sst1994m.test_vals = [-13.023358, -9.956752, -11.099910, -7.933220, -10.206577, -5.132343, 0.002808] - flatplate_sst1994m.test_vals_aarch64 = [-13.022835, -9.956652, -11.102384, -7.928197, -10.206580, -5.132317, 0.002808] + flatplate_sst1994m.test_vals = [-13.028095, -11.271115, -11.532461, -8.387610, -11.417974, -5.116988, 0.002808] + flatplate_sst1994m.test_vals_aarch64 = [-13.028095, -11.271115, -11.532461, -8.387610, -11.417974, -5.116988, 0.002808] test_list.append(flatplate_sst1994m) # bump in channel - sst-v1994m @@ -63,8 +63,8 @@ def main(): bump_sst1994m.cfg_dir = "vandv/rans/bump_in_channel" bump_sst1994m.cfg_file = "turb_bump_sst.cfg" bump_sst1994m.test_iter = 5 - bump_sst1994m.test_vals = [-12.986182, -10.719941, -10.556276, -7.606531, -10.774915, -5.605156, 0.004972] - bump_sst1994m.test_vals_aarch64 = [-13.039365, -10.729085, -10.609923, -7.682911, -10.774915, -5.605087, 0.004972] + bump_sst1994m.test_vals = [-13.034665, -10.510699, -10.627802, -7.661320, -10.680337, -5.749566, 0.004972] + bump_sst1994m.test_vals_aarch64 = [-13.034665, -10.510699, -10.627802, -7.661320, -10.680337, -5.749566, 0.004972] test_list.append(bump_sst1994m) # SWBLI SA @@ -72,8 +72,8 @@ def main(): swbli_sa.cfg_dir = "vandv/rans/swbli" swbli_sa.cfg_file = "config_sa.cfg" swbli_sa.test_iter = 5 - swbli_sa.test_vals = [-11.530796, -10.915564, -12.034495, -10.538719, -15.922522, 0.002233, -3.359164, 1.340100] - swbli_sa.test_vals_aarch64 = [-11.530796, -10.915564, -12.034495, -10.538719, -15.922522, 0.002233, -3.359164, 1.340100] + swbli_sa.test_vals = [-11.564511, -10.836187, -11.792765, -10.383947, -15.718717, 0.002212, -2.993991, 1.340100] + swbli_sa.test_vals_aarch64 = [-11.564511, -10.836187, -11.792765, -10.383947, -15.718717, 0.002212, -2.993991, 1.340100] test_list.append(swbli_sa) @@ -82,7 +82,7 @@ def main(): swbli_sst.cfg_dir = "vandv/rans/swbli" swbli_sst.cfg_file = "config_sst.cfg" swbli_sst.test_iter = 5 - swbli_sst.test_vals = [-11.527743, -11.150388, -11.944923, -10.750834, -11.116769, -4.030059, 0.002339, -2.730391, -4.067274, 1.276300] + swbli_sst.test_vals = [-11.528112, -10.961624, -11.903226, -10.630539, -11.117619, -4.573066, 0.002318, -2.905628, -4.037947, 1.340100] test_list.append(swbli_sst) ########################## @@ -94,8 +94,8 @@ def main(): sandiajet_sst.cfg_dir = "vandv/species_transport/sandia_jet" sandiajet_sst.cfg_file = "validation.cfg" sandiajet_sst.test_iter = 5 - sandiajet_sst.test_vals = [-16.249917, -13.835991, -14.303372, -13.276035, -10.074262, -14.027223, 5, -1.672359, 5, -4.938477, 5, -3.462217, 2.5859e-04, 2.8215e-32, 4.5010e-68, 2.5859e-04, 4.0474e+03, 3.9468e+03, 4.9170e+01, 5.1441e+01] - sandiajet_sst.test_vals_aarch64 = [-16.249289, -13.833785, -14.303058, -13.276559, -10.267928, -14.027240, 5, -1.676412, 5, -4.815216, 5, -3.462247, 0.000259, 0, 0, 0.000259, 4047.4, 3946.8, 49.17, 51.441] + sandiajet_sst.test_vals = [-17.069026, -13.156800, -15.290567, -11.689831, -9.349978, -14.907311, 5.000000, -2.738947, 5.000000, -4.813747, 5.000000, -3.981740, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] + sandiajet_sst.test_vals_aarch64 = [-17.069026, -13.156800, -15.290567, -11.689831, -9.349978, -14.907311, 5.000000, -2.738947, 5.000000, -4.813747, 5.000000, -3.981740, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] test_list.append(sandiajet_sst) ################# From f7ea1c4e29bebb67b6055dc08fc47fa735b0bf8c Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 4 May 2024 12:37:31 +0200 Subject: [PATCH 083/194] fix partial regressions for tutorials --- TestCases/tutorials.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index f3335173fa6..b6884aa9470 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -209,7 +209,7 @@ def main(): tutorial_trans_flatplate_T3Am.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A-" tutorial_trans_flatplate_T3Am.cfg_file = "transitional_LM_model_ConfigFile.cfg" tutorial_trans_flatplate_T3Am.test_iter = 20 - tutorial_trans_flatplate_T3Am.test_vals = [-6.063083, -1.945092, -3.946928, -0.548659, -3.863795, 2.664463, -2.517595, 1.112979 + tutorial_trans_flatplate_T3Am.test_vals = [-6.063083, -1.945092, -3.946928, -0.548659, -3.863795, 2.664463, -2.517595, 1.112979] tutorial_trans_flatplate_T3Am.test_vals_aarch64 = [-6.063598, -1.945057, -3.946744, -0.549062, -3.863792, 2.664453, -2.517606, 1.112979] tutorial_trans_flatplate_T3Am.no_restart = True test_list.append(tutorial_trans_flatplate_T3Am) From 7d3b28953ab7da71b7d0a4ca1cefe8b10a04d4c6 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 4 May 2024 16:40:45 +0200 Subject: [PATCH 084/194] fix partial regressions --- TestCases/fixed_cl/naca0012/inv_NACA0012.cfg | 12 +++--- .../incomp_euler/naca0012/incomp_NACA0012.cfg | 2 +- TestCases/serial_regression.py | 38 +++++++++---------- TestCases/tutorials.py | 2 +- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/TestCases/fixed_cl/naca0012/inv_NACA0012.cfg b/TestCases/fixed_cl/naca0012/inv_NACA0012.cfg index 5842e3848dc..a66afe95074 100644 --- a/TestCases/fixed_cl/naca0012/inv_NACA0012.cfg +++ b/TestCases/fixed_cl/naca0012/inv_NACA0012.cfg @@ -55,7 +55,7 @@ MARKER_DESIGNING = ( airfoil ) % NUM_METHOD_GRAD= GREEN_GAUSS OBJECTIVE_FUNCTION= DRAG -CFL_NUMBER= 5.0 +CFL_NUMBER=1000 ITER= 1000 % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% @@ -115,15 +115,15 @@ CONV_CAUCHY_EPS= 1E-6 MESH_FILENAME= mesh_NACA0012_inv.su2 MESH_FORMAT= SU2 MESH_OUT_FILENAME= mesh_out.su2 -SOLUTION_FILENAME= solution_flow.dat -SOLUTION_ADJ_FILENAME= solution_adj.dat +SOLUTION_FILENAME= solution_flow +SOLUTION_ADJ_FILENAME= solution_adj TABULAR_FORMAT= CSV CONV_FILENAME= history -RESTART_FILENAME= restart_flow.dat -RESTART_ADJ_FILENAME= restart_adj.dat +RESTART_FILENAME= restart_flow +RESTART_ADJ_FILENAME= restart_adj VOLUME_FILENAME= flow VOLUME_ADJ_FILENAME= adjoint -GRAD_OBJFUNC_FILENAME= of_grad.dat +GRAD_OBJFUNC_FILENAME= of_grad SURFACE_FILENAME= surface_flow SURFACE_ADJ_FILENAME= surface_adjoint OUTPUT_WRT_FREQ= 250 diff --git a/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg b/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg index 3b7da053aef..456ca08e23e 100644 --- a/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg +++ b/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg @@ -43,7 +43,7 @@ MARKER_MONITORING= ( airfoil ) % ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% % NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 3.0 +CFL_NUMBER= 100.0 CFL_ADAPT= NO CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 338b3447e9d..5cc5716c1c1 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -90,7 +90,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 10 - channel.test_vals = [-2.427098, 3.088105, 0.331946, -0.044759] + channel.test_vals = [-2.559747, 2.953478, -0.072659, 0.021260] test_list.append(channel) # NACA0012 @@ -98,7 +98,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-3.930109, -3.424824, -0.063246, -0.094245] + naca0012.test_vals = [-3.839778, -3.314410, 0.101982, 0.086755] test_list.append(naca0012) # Supersonic wedge @@ -106,7 +106,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-1.002840, 4.720744, -0.082079, 0.014516] + wedge.test_vals = [-0.878239, 4.855758, -0.217331, 0.038329] test_list.append(wedge) # ONERA M6 Wing @@ -114,7 +114,7 @@ def main(): oneram6.cfg_dir = "euler/oneram6" oneram6.cfg_file = "inv_ONERAM6.cfg" oneram6.test_iter = 10 - oneram6.test_vals = [-9.279396, -8.697739, 0.281703, 0.011821] + oneram6.test_vals = [-10.253956, -9.716810, 0.280800, 0.008623] oneram6.timeout = 9600 test_list.append(oneram6) @@ -132,8 +132,8 @@ def main(): polar_naca0012.cfg_file = "inv_NACA0012.cfg" polar_naca0012.polar = True polar_naca0012.test_iter = 10 - polar_naca0012.test_vals = [-1.243326, 4.224483, 0.016432, 0.016145] - polar_naca0012.test_vals_aarch64 = [-1.169556, 4.301216, -0.785046, -0.140490] + polar_naca0012.test_vals = [-1.063447, 4.401847, 0.000291, 0.031696] + polar_naca0012.test_vals_aarch64 = [-1.063447, 4.401847, 0.000291, 0.031696] polar_naca0012.command = TestCase.Command(exec = "compute_polar.py", param = "-n 1 -i 11") # flaky test on arm64 polar_naca0012.enabled_on_cpu_arch = ["x86_64"] @@ -163,7 +163,7 @@ def main(): flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" flatplate.test_iter = 100 - flatplate.test_vals = [-9.856258, -4.371983, 0.001112, 0.036277, 2.361500, -2.325300, -2.279500, -2.279500] + flatplate.test_vals = [-9.196938, -3.712725, 0.001112, 0.036276, 2.361500, -2.325300, -2.277100, -2.277100] test_list.append(flatplate) # Laminar cylinder (steady) @@ -171,7 +171,7 @@ def main(): cylinder.cfg_dir = "navierstokes/cylinder" cylinder.cfg_file = "lam_cylinder.cfg" cylinder.test_iter = 25 - cylinder.test_vals = [-6.765430, -1.297426, 0.019508, 0.310015, 0.123250] + cylinder.test_vals = [-8.363068, -2.882163, -0.017777, 1.607222, -0.010064] test_list.append(cylinder) # Laminar cylinder (low Mach correction) @@ -376,7 +376,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-5.971283, -4.911145, -0.000201, 0.121631] + inc_nozzle.test_vals = [-5.273920, -4.365578, -0.000035, 0.130649] test_list.append(inc_nozzle) ############################# @@ -591,7 +591,7 @@ def main(): contadj_wedge.cfg_dir = "cont_adj_euler/wedge" contadj_wedge.cfg_file = "inv_wedge_ROE.cfg" contadj_wedge.test_iter = 10 - contadj_wedge.test_vals = [2.872691, -2.755572, 853000.000000, 0.000000] + contadj_wedge.test_vals = [2.872447, -2.755769, 1011900.000000, 0.000000] test_list.append(contadj_wedge) # Inviscid fixed CL NACA0012 @@ -599,7 +599,7 @@ def main(): contadj_fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" contadj_fixedCL_naca0012.cfg_file = "inv_NACA0012_ContAdj.cfg" contadj_fixedCL_naca0012.test_iter = 100 - contadj_fixedCL_naca0012.test_vals = [0.293213, -5.201710, 0.360590, -0.000022] + contadj_fixedCL_naca0012.test_vals = [0.756719, -4.770533, -0.509920, -0.000016] test_list.append(contadj_fixedCL_naca0012) ################################### @@ -722,7 +722,7 @@ def main(): harmonic_balance.cfg_dir = "harmonic_balance" harmonic_balance.cfg_file = "HB.cfg" harmonic_balance.test_iter = 25 - harmonic_balance.test_vals = [-1.589739, 0.790169, 0.937053, 3.922579] + harmonic_balance.test_vals = [-1.567440, 0.815498, 0.928381, 3.947221] test_list.append(harmonic_balance) # Turbulent pitching NACA 64a010 airfoil @@ -742,7 +742,7 @@ def main(): rot_naca0012.cfg_dir = "rotating/naca0012" rot_naca0012.cfg_file = "rot_NACA0012.cfg" rot_naca0012.test_iter = 25 - rot_naca0012.test_vals = [-2.688979, 2.857521, -0.079219, 0.002135] + rot_naca0012.test_vals = [-2.286632, 2.541708, -0.054757, 0.241346] test_list.append(rot_naca0012) # Lid-driven cavity @@ -779,7 +779,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977520, 3.481804, -0.012277, -0.007309] + sine_gust.test_vals = [-1.977477, 3.481821, -0.017967, -0.008371] sine_gust.unsteady = True test_list.append(sine_gust) @@ -788,7 +788,7 @@ def main(): aeroelastic.cfg_dir = "aeroelastic" aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" aeroelastic.test_iter = 2 - aeroelastic.test_vals = [0.074836, 0.033102, -0.001650, -0.000127] + aeroelastic.test_vals = [0.074349, 0.027575, -0.001579, -0.000160] aeroelastic.unsteady = True test_list.append(aeroelastic) @@ -797,7 +797,7 @@ def main(): ddes_flatplate.cfg_dir = "ddes/flatplate" ddes_flatplate.cfg_file = "ddes_flatplate.cfg" ddes_flatplate.test_iter = 10 - ddes_flatplate.test_vals = [-2.714757, -5.882779, -0.215005, 0.023783, -618.130000] + ddes_flatplate.test_vals = [-2.714788, -5.882720, -0.215049, 0.023758, -617.450000] ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) @@ -815,7 +815,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform.cfg" unst_deforming_naca0012.test_iter = 5 - unst_deforming_naca0012.test_vals = [-3.665129, -3.793590, -3.716505, -3.148308] + unst_deforming_naca0012.test_vals = [-3.668036, -3.810252, -3.725464, -3.153093] unst_deforming_naca0012.unsteady = True test_list.append(unst_deforming_naca0012) @@ -836,7 +836,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 20 - edge_VW.test_vals = [-0.711552, 5.490479, -0.000975, 0.000000] + edge_VW.test_vals = [-0.840739, 5.361270, -0.001139, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR @@ -844,7 +844,7 @@ def main(): edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" edge_PPR.test_iter = 20 - edge_PPR.test_vals = [-1.670439, 4.522842, 0.001027, 0.000000] + edge_PPR.test_vals = [-1.651538, 4.537499, 0.001027, 0.000000] test_list.append(edge_PPR) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index b6884aa9470..5540ddb25e6 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -116,7 +116,7 @@ def main(): sudo_tutorial.cfg_dir = "../Tutorials/incompressible_flow/Inc_Turbulent_Bend_Wallfunctions" sudo_tutorial.cfg_file = "sudo.cfg" sudo_tutorial.test_iter = 10 - sudo_tutorial.test_vals = [-13.618610, -12.647974, -12.296537, -11.658760, -13.136523, -9.550829, 15.000000, -2.369703] + sudo_tutorial.test_vals = [-14.450816, -13.243177, -14.303635, -12.402343, -14.057378, -10.875628, 15.000000, -2.423966] sudo_tutorial.command = TestCase.Command("mpirun -n 2", "SU2_CFD") test_list.append(sudo_tutorial) From 13a79b5aea6280a601dacf22cbc16de58941e6c8 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 4 May 2024 19:53:26 +0200 Subject: [PATCH 085/194] fix tutorial regression --- TestCases/tutorials.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 5540ddb25e6..f655e6925d4 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -137,7 +137,7 @@ def main(): tutorial_inv_bump.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Bump" tutorial_inv_bump.cfg_file = "inv_channel.cfg" tutorial_inv_bump.test_iter = 0 - tutorial_inv_bump.test_vals = [-1.437425, 4.075857, 0.042960, 0.087660] + tutorial_inv_bump.test_vals = [-1.437425, 4.075857, -0.004083, 0.067355] test_list.append(tutorial_inv_bump) # Inviscid Wedge @@ -145,7 +145,7 @@ def main(): tutorial_inv_wedge.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Wedge" tutorial_inv_wedge.cfg_file = "inv_wedge_HLLC.cfg" tutorial_inv_wedge.test_iter = 0 - tutorial_inv_wedge.test_vals = [-0.481460, 5.253008, -0.286364, 0.051477] + tutorial_inv_wedge.test_vals = [-0.481460, 5.253008, -0.322609, 0.056823] tutorial_inv_wedge.no_restart = True test_list.append(tutorial_inv_wedge) @@ -154,7 +154,7 @@ def main(): tutorial_inv_onera.cfg_dir = "../Tutorials/compressible_flow/Inviscid_ONERAM6" tutorial_inv_onera.cfg_file = "inv_ONERAM6.cfg" tutorial_inv_onera.test_iter = 0 - tutorial_inv_onera.test_vals = [-5.204928, -4.597762, 0.259973, 0.082368] + tutorial_inv_onera.test_vals = [-5.204928, -4.597762, 0.255459, 0.112835] tutorial_inv_onera.no_restart = True test_list.append(tutorial_inv_onera) @@ -275,7 +275,7 @@ def main(): tutorial_design_inv_naca0012.cfg_dir = "../Tutorials/design/Inviscid_2D_Unconstrained_NACA0012" tutorial_design_inv_naca0012.cfg_file = "inv_NACA0012_basic.cfg" tutorial_design_inv_naca0012.test_iter = 0 - tutorial_design_inv_naca0012.test_vals = [-3.585391, -2.989014, 0.131159, 0.206017] + tutorial_design_inv_naca0012.test_vals = [-3.585391, -2.989014, 0.132704, 0.204686] tutorial_design_inv_naca0012.no_restart = True test_list.append(tutorial_design_inv_naca0012) From 6163c81622a1932840f7655a30e60718efac6948 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 6 May 2024 00:12:18 +0200 Subject: [PATCH 086/194] add symmetry routine to WLS --- Common/include/toolboxes/geometry_toolbox.hpp | 153 -------------- .../gradients/computeGradientsGreenGauss.hpp | 5 +- .../computeGradientsLeastSquares.hpp | 109 ++++++++++ .../gradients/computeGradientsSymmetry.hpp | 199 ++++++++++++++++++ .../incomp_navierstokes/sphere/sphere.cfg | 92 ++++++++ TestCases/parallel_regression.py | 72 ++++--- 6 files changed, 443 insertions(+), 187 deletions(-) create mode 100644 SU2_CFD/include/gradients/computeGradientsSymmetry.hpp create mode 100644 TestCases/incomp_navierstokes/sphere/sphere.cfg diff --git a/Common/include/toolboxes/geometry_toolbox.hpp b/Common/include/toolboxes/geometry_toolbox.hpp index d3fa919a821..2f9c01c2a86 100644 --- a/Common/include/toolboxes/geometry_toolbox.hpp +++ b/Common/include/toolboxes/geometry_toolbox.hpp @@ -220,158 +220,5 @@ inline void TangentProjection(Int nDim, const Mat& tensor, const Scalar* vector, for (Int iDim = 0; iDim < nDim; iDim++) proj[iDim] -= normalProj * vector[iDim]; } -/*! \brief Reflect a gradient using a tensor mapping. Used for symmetry reflection. */ -template -inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isFlowSolver, Matrix& TensorMap, - Matrix& Gradients_iPoint) { - static constexpr size_t MAXNDIM = 3; - - su2activematrix Gradients_Velocity(nDim, nDim); - su2activematrix Gradients_Velocity_Reflected(nDim, nDim); - su2double gradPhi[MAXNDIM] = {0.0}; - su2double gradPhiReflected[MAXNDIM] = {0.0}; - - if (isFlowSolver == true) { - /*--- Get gradients of primitives of boundary cell ---*/ - for (auto iVar = 0u; iVar < nDim; iVar++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - // todo: 1 ->idx.velocity - Gradients_Velocity[iVar][iDim] = Gradients_iPoint[1 + iVar][iDim]; - Gradients_Velocity_Reflected[iVar][iDim] = 0.0; - } - } - - /*--- Q' = L^T*Q*T ---*/ - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto kDim = 0u; kDim < nDim; kDim++) { - for (auto mDim = 0u; mDim < nDim; mDim++) { - Gradients_Velocity_Reflected[iDim][jDim] += - TensorMap[iDim][mDim] * TensorMap[jDim][kDim] * Gradients_Velocity[mDim][kDim]; - } - } - } - } - - /*--- we have aligned such that U is the direction of the normal - * in 2D: dU/dy = dV/dx = 0 - * in 3D: dU/dy = dV/dx = 0 - * dU/dz = dW/dx = 0 ---*/ - for (auto iDim = 1u; iDim < nDim; iDim++) { - Gradients_Velocity_Reflected[0][iDim] = 0.0; - Gradients_Velocity_Reflected[iDim][0] = 0.0; - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - Gradients_Velocity[iDim][jDim] = 0.0; - } - } - - /*--- now transform back the corrected velocity gradients by taking the inverse again - * T = (L^-1)*T' ---*/ - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto kDim = 0u; kDim < nDim; kDim++) { - for (auto mDim = 0u; mDim < nDim; mDim++) { - Gradients_Velocity[iDim][jDim] += - TensorMap[mDim][iDim] * TensorMap[kDim][jDim] * Gradients_Velocity_Reflected[mDim][kDim]; - } - } - } - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - // todo: 1->idx.velocity - Gradients_iPoint[iDim + 1][jDim] = Gradients_Velocity[iDim][jDim]; - } - } - } - - /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - if ((isFlowSolver == false) || ((isFlowSolver == true) && (iVar == 0 || iVar > nDim))) { - /*--- project to symmetry aligned base ---*/ - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradPhi[iDim] = Gradients_iPoint[iVar][iDim]; - gradPhiReflected[iDim] = 0.0; - } - - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - /*--- map transpose T' * grad(phi) ---*/ - gradPhiReflected[jDim] += TensorMap[jDim][iDim] * Gradients_iPoint[iVar][iDim]; - } - } - - for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; - - /*--- gradient in direction normal to symmetry is cancelled ---*/ - gradPhiReflected[0] = 0.0; - - /*--- Now transform back ---*/ - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradPhi[jDim] += TensorMap[iDim][jDim] * gradPhiReflected[iDim]; - } - } - - for (auto iDim = 0u; iDim < nDim; iDim++) Gradients_iPoint[iVar][iDim] = gradPhi[iDim]; - } - } -} - -/*! \brief Construct a 2D or 3D base given a normal vector. - Constructs 1 (2D) or 2 (3D) additional vectors orthogonal to the normal to form a base. */ -template -inline void BaseFromNormal(Int nDim, const Scalar* UnitNormal, Matrix& TensorMap) { - /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as - t*n=0 && |t|_2 = 1 ---*/ - Scalar Tangential[3] = {0.0}; - Scalar Orthogonal[3] = {0.0}; - switch (nDim) { - case 2: { - Tangential[0] = -UnitNormal[1]; - Tangential[1] = UnitNormal[0]; - for (auto iDim = 0u; iDim < nDim; iDim++) { - TensorMap[0][iDim] = UnitNormal[iDim]; - TensorMap[1][iDim] = Tangential[iDim]; - } - break; - } - case 3: { - /*--- n = ai + bj + ck, if |b| > |c| ---*/ - if (abs(UnitNormal[1]) > abs(UnitNormal[2])) { - /*--- t = bi + (c-a)j - bk ---*/ - Tangential[0] = UnitNormal[1]; - Tangential[1] = UnitNormal[2] - UnitNormal[0]; - Tangential[2] = -UnitNormal[1]; - } else { - /*--- t = ci - cj + (b-a)k ---*/ - Tangential[0] = UnitNormal[2]; - Tangential[1] = -UnitNormal[2]; - Tangential[2] = UnitNormal[1] - UnitNormal[0]; - } - /*--- Make it a unit vector. ---*/ - Scalar TangentialNorm = Norm(3, Tangential); - Tangential[0] = Tangential[0] / TangentialNorm; - Tangential[1] = Tangential[1] / TangentialNorm; - Tangential[2] = Tangential[2] / TangentialNorm; - - /*--- Compute 3rd direction of the base using cross product ---*/ - CrossProduct(UnitNormal, Tangential, Orthogonal); - - // now we construct the tensor mapping T, note that its inverse is the transpose of T - for (auto iDim = 0u; iDim < nDim; iDim++) { - TensorMap[0][iDim] = UnitNormal[iDim]; - TensorMap[1][iDim] = Tangential[iDim]; - TensorMap[2][iDim] = Orthogonal[iDim]; - } - break; - } - } // switch -} - /// @} } // namespace GeometryToolbox diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 56262e8fc64..9a35a57c378 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -32,6 +32,7 @@ #include "../../../Common/include/parallelization/omp_structure.hpp" #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" +#include "computeGradientsSymmetry.hpp" namespace detail { @@ -242,7 +243,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER su2activematrix TensorMap(nDim,nDim); /*--- Compute a new base for TensorMap aligned with the unit normal ---*/ - GeometryToolbox::BaseFromNormal(nDim,UnitNormal,TensorMap); + BaseFromNormal(nDim,UnitNormal,TensorMap); su2activematrix Gradients_iPoint(varEnd-varBegin,nDim); @@ -252,7 +253,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } } - GeometryToolbox::ReflectGradient(nDim, varBegin,varEnd, isFlowSolver, TensorMap, Gradients_iPoint); + ReflectGradient(nDim, varBegin,varEnd, isFlowSolver, TensorMap, Gradients_iPoint); for (auto iVar = varBegin; iVar < varEnd; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { diff --git a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp index 29daee7f06e..31461ab38a7 100644 --- a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp +++ b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp @@ -28,6 +28,7 @@ #include "../../../Common/include/parallelization/omp_structure.hpp" #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" +#include "computeGradientsSymmetry.hpp" namespace detail { @@ -192,6 +193,7 @@ void computeGradientsLeastSquares(CSolver* solver, RMatrixType& Rmatrix) { const bool periodic = (solver != nullptr) && (config.GetnMarker_Periodic() > 0); + bool isFlowSolver = solver->GetSolverName().find("FLOW") != string::npos; const size_t nPointDomain = geometry.GetnPointDomain(); @@ -202,6 +204,9 @@ void computeGradientsLeastSquares(CSolver* solver, omp_get_max_threads(), OMP_MAX_CHUNK); #endif + static constexpr size_t MAXNDIM = 3; + static constexpr size_t MAXNSYMS = 100; + /*--- First loop over non-halo points of the grid. ---*/ SU2_OMP_FOR_DYN(chunkSize) @@ -312,6 +317,110 @@ void computeGradientsLeastSquares(CSolver* solver, END_SU2_OMP_FOR } + + /* For symmetry planes, we need to impose the conditions (Blazek eq. 8.40): + * 1. n.grad(phi) = 0 + * 2. n.grad(v.t) = 0 + * 3. t.grad(v.n) = 0 + */ + + /*--- Check how many symmetry planes there are ---*/ + unsigned short Syms[MAXNSYMS] = {0}; + unsigned short nSym = 0; + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { + if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + Syms[nSym] = iMarker; + nSym++; + } + } + + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { + + if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + SU2_OMP_FOR_STAT(32) + for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { + + size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); + + /*--- Normal vector for this vertex (negate for outward convention). ---*/ + const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); + + const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); + + su2double UnitNormal[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = VertexNormal[iDim] / NormArea; + + /*--- Normal of the primary symmetry plane ---*/ + su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; + + /*--- At this point we can find out if the node is shared with another symmetry. + * Step 1: do we have other symmetries? ---*/ + if (nSym>1) { + /*--- Step 2: are we on a shared node? ---*/ + for (auto jMarker=0;jMarkerGetNode(); + if (iPoint==jPoint) { + /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ + if (Syms[jMarker]GetNormal(NormalPrim); + su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); + for(unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; + } + + /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ + su2double ProjNorm = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + /*--- We check if the normal of the 2 planes coincide. + * We only update the normal if the normals of the symmetry planes are different. ---*/ + if (fabs(1.0-ProjNorm)>EPS) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; + /* Make normalized vector ---*/ + su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; + } + } + } + } + } + } + } + + + /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ + su2activematrix TensorMap(nDim,nDim); + + /*--- Compute a new base for TensorMap aligned with the unit normal ---*/ + BaseFromNormal(nDim,UnitNormal,TensorMap); + + su2activematrix Gradients_iPoint(varEnd-varBegin,nDim); + + for (auto iVar = varBegin; iVar < varEnd; iVar++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + Gradients_iPoint[iVar][iDim] = gradient(iPoint, iVar, iDim); + } + } + + ReflectGradient(nDim, varBegin,varEnd, isFlowSolver, TensorMap, Gradients_iPoint); + + for (auto iVar = varBegin; iVar < varEnd; iVar++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + gradient(iPoint, iVar, iDim) = Gradients_iPoint[iVar][iDim]; + } + } + + } // loop over vertices + END_SU2_OMP_FOR + } // symmetry + } // markers + /*--- If no solver was provided we do not communicate ---*/ if (solver != nullptr) diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp new file mode 100644 index 00000000000..87c96770423 --- /dev/null +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -0,0 +1,199 @@ +/*! + * \file computeGradientsSymmetry.hpp + * \brief Implements the symmetry boundary conditions for the gradient computations. + * \author N. Beishuizen + * \version 8.0.1 "Harrier" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2024, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include +#include + +#include "../../../Common/include/parallelization/omp_structure.hpp" +#include "../../../Common/include/toolboxes/geometry_toolbox.hpp" + + +/*! + * \brief Reflect a gradient using a tensor mapping. Used for symmetry reflection. + * \ingroup FvmAlgos + * \param[in] nDim - number of dimensions, 2 or 3. + * \param[in] varBegin - start of the variables. + * \param[in] varEnd - end of the variables. + * \param[in] isFlowSolver - are we using the flow solver. + * \param[in] TensorMAp - the tensor map to map to rotated base. + * \param[out] Gradients_iPoint - the gradient for the point. + */ + + +template +inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isFlowSolver, Matrix& TensorMap, + Matrix& Gradients_iPoint) { + static constexpr size_t MAXNDIM = 3; + + su2activematrix Gradients_Velocity(nDim, nDim); + su2activematrix Gradients_Velocity_Reflected(nDim, nDim); + su2double gradPhi[MAXNDIM] = {0.0}; + su2double gradPhiReflected[MAXNDIM] = {0.0}; + + if (isFlowSolver == true) { + /*--- Get gradients of primitives of boundary cell ---*/ + for (auto iVar = 0u; iVar < nDim; iVar++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + // todo: 1 ->idx.velocity + Gradients_Velocity[iVar][iDim] = Gradients_iPoint[1 + iVar][iDim]; + Gradients_Velocity_Reflected[iVar][iDim] = 0.0; + } + } + + /*--- Q' = L^T*Q*T ---*/ + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto kDim = 0u; kDim < nDim; kDim++) { + for (auto mDim = 0u; mDim < nDim; mDim++) { + Gradients_Velocity_Reflected[iDim][jDim] += + TensorMap[iDim][mDim] * TensorMap[jDim][kDim] * Gradients_Velocity[mDim][kDim]; + } + } + } + } + + /*--- we have aligned such that U is the direction of the normal + * in 2D: dU/dy = dV/dx = 0 + * in 3D: dU/dy = dV/dx = 0 + * dU/dz = dW/dx = 0 ---*/ + for (auto iDim = 1u; iDim < nDim; iDim++) { + Gradients_Velocity_Reflected[0][iDim] = 0.0; + Gradients_Velocity_Reflected[iDim][0] = 0.0; + } + + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + Gradients_Velocity[iDim][jDim] = 0.0; + } + } + + /*--- now transform back the corrected velocity gradients by taking the inverse again + * T = (L^-1)*T' ---*/ + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto kDim = 0u; kDim < nDim; kDim++) { + for (auto mDim = 0u; mDim < nDim; mDim++) { + Gradients_Velocity[iDim][jDim] += + TensorMap[mDim][iDim] * TensorMap[kDim][jDim] * Gradients_Velocity_Reflected[mDim][kDim]; + } + } + } + } + + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + // todo: 1->idx.velocity + Gradients_iPoint[iDim + 1][jDim] = Gradients_Velocity[iDim][jDim]; + } + } + } + + /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ + for (auto iVar = varBegin; iVar < varEnd; iVar++) { + if ((isFlowSolver == false) || ((isFlowSolver == true) && (iVar == 0 || iVar > nDim))) { + /*--- project to symmetry aligned base ---*/ + for (auto iDim = 0u; iDim < nDim; iDim++) { + gradPhi[iDim] = Gradients_iPoint[iVar][iDim]; + gradPhiReflected[iDim] = 0.0; + } + + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + /*--- map transpose T' * grad(phi) ---*/ + gradPhiReflected[jDim] += TensorMap[jDim][iDim] * Gradients_iPoint[iVar][iDim]; + } + } + + for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; + + /*--- gradient in direction normal to symmetry is cancelled ---*/ + gradPhiReflected[0] = 0.0; + + /*--- Now transform back ---*/ + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + gradPhi[jDim] += TensorMap[iDim][jDim] * gradPhiReflected[iDim]; + } + } + + for (auto iDim = 0u; iDim < nDim; iDim++) Gradients_iPoint[iVar][iDim] = gradPhi[iDim]; + } + } +} + +/*! \brief Construct a 2D or 3D base given a normal vector. + Constructs 1 (2D) or 2 (3D) additional vectors orthogonal to the normal to form a base. */ +template +inline void BaseFromNormal(Int nDim, const Scalar* UnitNormal, Matrix& TensorMap) { + /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as + t*n=0 && |t|_2 = 1 ---*/ + Scalar Tangential[3] = {0.0}; + Scalar Orthogonal[3] = {0.0}; + switch (nDim) { + case 2: { + Tangential[0] = -UnitNormal[1]; + Tangential[1] = UnitNormal[0]; + for (auto iDim = 0u; iDim < nDim; iDim++) { + TensorMap[0][iDim] = UnitNormal[iDim]; + TensorMap[1][iDim] = Tangential[iDim]; + } + break; + } + case 3: { + /*--- n = ai + bj + ck, if |b| > |c| ---*/ + if (abs(UnitNormal[1]) > abs(UnitNormal[2])) { + /*--- t = bi + (c-a)j - bk ---*/ + Tangential[0] = UnitNormal[1]; + Tangential[1] = UnitNormal[2] - UnitNormal[0]; + Tangential[2] = -UnitNormal[1]; + } else { + /*--- t = ci - cj + (b-a)k ---*/ + Tangential[0] = UnitNormal[2]; + Tangential[1] = -UnitNormal[2]; + Tangential[2] = UnitNormal[1] - UnitNormal[0]; + } + /*--- Make it a unit vector. ---*/ + Scalar TangentialNorm = GeometryToolbox::Norm(3, Tangential); + Tangential[0] = Tangential[0] / TangentialNorm; + Tangential[1] = Tangential[1] / TangentialNorm; + Tangential[2] = Tangential[2] / TangentialNorm; + + /*--- Compute 3rd direction of the base using cross product ---*/ + GeometryToolbox::CrossProduct(UnitNormal, Tangential, Orthogonal); + + // now we construct the tensor mapping T, note that its inverse is the transpose of T + for (auto iDim = 0u; iDim < nDim; iDim++) { + TensorMap[0][iDim] = UnitNormal[iDim]; + TensorMap[1][iDim] = Tangential[iDim]; + TensorMap[2][iDim] = Orthogonal[iDim]; + } + break; + } + } // switch +} diff --git a/TestCases/incomp_navierstokes/sphere/sphere.cfg b/TestCases/incomp_navierstokes/sphere/sphere.cfg new file mode 100644 index 00000000000..d526c68e9e1 --- /dev/null +++ b/TestCases/incomp_navierstokes/sphere/sphere.cfg @@ -0,0 +1,92 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: laminar flow around a sphere % +% Author: Nijso Beishuizen % +% Institution: Technische Universiteit Eindhoven % +% Date: 2024.05.05 % +% File Version 8.0.1 "Harrier" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= INC_NAVIER_STOKES +KIND_TURB_MODEL= NONE +MATH_PROBLEM= DIRECT +RESTART_SOL= YES +INC_NONDIM= DIMENSIONAL + +% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% +% Re = rho*V*D/mu = 0.01*20*1.0/0.01 = 20 +INC_DENSITY_INIT= 0.01 +INC_VELOCITY_INIT= ( 20., 0.0, 0.0 ) + +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +VISCOSITY_MODEL= CONSTANT_VISCOSITY +MU_CONSTANT= 0.01 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +REF_LENGTH= 1.0 +REF_AREA= 1.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_HEATFLUX= ( wall, 0.0 ) +MARKER_SYM= ( symmetry_left, symmetry_right ) +MARKER_FAR= ( farfield ) +MARKER_PLOTTING= ( wall ) +MARKER_MONITORING= ( wall ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 5.0 +CFL_ADAPT= NO +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +ITER=1000 +VENKAT_LIMITER_COEFF= 0.01 + +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-05 +LINEAR_SOLVER_ITER= 5 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +MGLEVEL= 0 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +CONV_NUM_METHOD_FLOW= FDS +MUSCL_FLOW= NO +SLOPE_LIMITER_FLOW= NONE +JST_SENSOR_COEFF= ( 0.5, 0.04 ) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_RESIDUAL_MINVAL= -10 +CONV_STARTITER= 10 +CONV_CAUCHY_ELEMS= 100 +CONV_CAUCHY_EPS= 1E-6 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +MESH_FILENAME= sphere_2syms.su2 +MESH_FORMAT= SU2 +SOLUTION_FILENAME= solution_flow.dat +TABULAR_FORMAT= CSV +CONV_FILENAME= history +RESTART_FILENAME= restart_flow.dat +VOLUME_FILENAME= flow +SURFACE_FILENAME= surface_flow +OUTPUT_WRT_FREQ= 100 +WRT_VOLUME_OVERWRITE= YES +SCREEN_OUTPUT= ( INNER_ITER, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_VELOCITY-Z, LIFT, DRAG ) +VOLUME_OUTPUT= ( SOLUTION,PRIMITIVE,RESIDUAL,MULTIGRID, RANK ) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index b891e7d9a84..971707d2795 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -112,8 +112,8 @@ def main(): invwedge_a.cfg_dir = "nonequilibrium/invwedge" invwedge_a.cfg_file = "invwedge_ausm.cfg" invwedge_a.test_iter = 10 - invwedge_a.test_vals = [-1.042842, -1.567605, -18.301264, -18.628631, -18.574668, 2.275192, 1.879772, 5.319421, 0.873699] - invwedge_a.test_vals_aarch64 = [-1.042842, -1.567605, -18.301374, -18.628734, -18.574780, 2.275192, 1.879772, 5.319421, 0.873699] + invwedge_a.test_vals = [-1.070904, -1.595667, -18.299980, -18.627372, -18.573382, 2.244654, 1.871030, 5.289134, 0.846502] + invwedge_a.test_vals_aarch64 = [-1.070904, -1.595667, -18.299980, -18.627372, -18.573382, 2.244654, 1.871030, 5.289134, 0.846502] test_list.append(invwedge_a) # Inviscid single wedge, ausm+-up2, implicit @@ -121,8 +121,8 @@ def main(): invwedge_ap2.cfg_dir = "nonequilibrium/invwedge" invwedge_ap2.cfg_file = "invwedge_ausmplusup2.cfg" invwedge_ap2.test_iter = 10 - invwedge_ap2.test_vals = [-0.952589, -1.477352, -16.736014, -17.064021, -17.009120, 2.387086, 1.287286, 5.403046, 0.956402] - invwedge_ap2.test_vals_aarch64 = [-0.952589, -1.477352, -16.736014, -17.064021, -17.009120, 2.387086, 1.287286, 5.403046, 0.956402] + invwedge_ap2.test_vals = [-0.982059, -1.506822, -16.735977, -17.063993, -17.009083, 2.354326, 1.482256, 5.373931, 0.927155] + invwedge_ap2.test_vals_aarch64 = [-0.982059, -1.506822, -16.735977, -17.063993, -17.009083, 2.354326, 1.482256, 5.373931, 0.927155] test_list.append(invwedge_ap2) # Inviscid single wedge, msw, implicit @@ -130,8 +130,8 @@ def main(): invwedge_msw.cfg_dir = "nonequilibrium/invwedge" invwedge_msw.cfg_file = "invwedge_msw.cfg" invwedge_msw.test_iter = 10 - invwedge_msw.test_vals = [-1.165957, -1.690720, -18.298756, -18.626164, -18.572159, 2.151638, 1.721236, 5.193813, 0.751584] - invwedge_msw.test_vals_aarch64 = [-1.165957, -1.690720, -18.301301, -18.628685, -18.574704, 2.151638, 1.721236, 5.193813, 0.751584] + invwedge_msw.test_vals = [-1.224649, -1.749412, -18.299151, -18.626550, -18.572552, 2.094106, 1.635779, 5.131012, 0.692821] + invwedge_msw.test_vals_aarch64 = [-1.224649, -1.749412, -18.299151, -18.626550, -18.572552, 2.094106, 1.635779, 5.131012, 0.692821] test_list.append(invwedge_msw) # Inviscid single wedge, roe, implicit @@ -139,8 +139,8 @@ def main(): invwedge_roe.cfg_dir = "nonequilibrium/invwedge" invwedge_roe.cfg_file = "invwedge_roe.cfg" invwedge_roe.test_iter = 10 - invwedge_roe.test_vals = [-1.038582, -1.563344, -18.300307, -18.627706, -18.573706, 2.278987, 1.861307, 5.323753, 0.874900] - invwedge_roe.test_vals_aarch64 = [-1.038582, -1.563344, -18.299879, -18.627263, -18.573276, 2.278987, 1.861307, 5.323753, 0.874900] + invwedge_roe.test_vals = [-1.069128, -1.593891, -17.208222, -17.537969, -17.481352, 2.249020, 1.852904, 5.287143, 0.879852] + invwedge_roe.test_vals_aarch64 = [-1.069128, -1.593891, -17.208222, -17.537969, -17.481352, 2.249020, 1.852904, 5.287143, 0.879852] test_list.append(invwedge_roe) # Inviscid single wedge, lax, implicit @@ -148,8 +148,8 @@ def main(): invwedge_lax.cfg_dir = "nonequilibrium/invwedge" invwedge_lax.cfg_file = "invwedge_lax.cfg" invwedge_lax.test_iter = 10 - invwedge_lax.test_vals = [-1.075662, -1.600425, -32.000000, -32.000000, -24.972431, 2.252952, 1.725158, 5.282140, 0.848823] - invwedge_lax.test_vals_aarch64 = [-1.075662, -1.600425, -32.000000, -32.000000, -24.972431, 2.252952, 1.725158, 5.282140, 0.848823] + invwedge_lax.test_vals = [-0.877280, -1.402043, -32.000000, -32.000000, -24.952631, 2.451869, 1.857084, 5.486158, 1.051580] + invwedge_lax.test_vals_aarch64 = [-0.877280, -1.402043, -32.000000, -32.000000, -24.952631, 2.451869, 1.857084, 5.486158, 1.051580] test_list.append(invwedge_lax) # Inviscid single wedge, implicit, AUSM+M scheme @@ -157,8 +157,8 @@ def main(): invwedge_ausm_m.cfg_dir = "nonequilibrium/invwedge" invwedge_ausm_m.cfg_file = "invwedge_am.cfg" invwedge_ausm_m.test_iter = 10 - invwedge_ausm_m.test_vals = [-1.055083, -1.579845, -16.739725, -17.063618, -17.012831, 2.265430, 1.797602, 5.302740, 0.856548] - invwedge_ausm_m.test_vals_aarch64 = [-1.055079, -1.579842, -16.739725, -17.063618, -17.012831, 2.265433, 1.797600, 5.302743, 0.856551] + invwedge_ausm_m.test_vals = [-1.171654, -1.696417, -16.739585, -17.063491, -17.012691, 2.125633, 1.966511, 5.184281, 0.749068] + invwedge_ausm_m.test_vals_aarch64 = [-1.171654, -1.696417, -16.739585, -17.063491, -17.012691, 2.125633, 1.966511, 5.184281, 0.749068] test_list.append(invwedge_ausm_m) # Inviscid single wedge, implicit, NEMO supersonic inlet @@ -166,8 +166,8 @@ def main(): invwedge_ss_inlet.cfg_dir = "nonequilibrium/invwedge" invwedge_ss_inlet.cfg_file = "invwedge_ss_inlet.cfg" invwedge_ss_inlet.test_iter = 10 - invwedge_ss_inlet.test_vals = [-1.042718, -1.567481, -18.250175, -18.579516, -18.523248, 2.275305, 1.880068, 5.319548, 0.873821] - invwedge_ss_inlet.test_vals_aarch64 = [-1.042718, -1.567481, -18.250175, -18.579516, -18.523248, 2.275305, 1.880068, 5.319548, 0.873821] + invwedge_ss_inlet.test_vals = [-1.069892, -1.594654, -18.250175, -18.579516, -18.523248, 2.245827, 1.871123, 5.290054, 0.847476] + invwedge_ss_inlet.test_vals_aarch64 = [-1.069892, -1.594654, -18.250175, -18.579516, -18.523248, 2.245827, 1.871123, 5.290054, 0.847476] test_list.append(invwedge_ss_inlet) # Viscous single cone - axisymmetric @@ -175,8 +175,8 @@ def main(): visc_cone.cfg_dir = "nonequilibrium/visc_wedge" visc_cone.cfg_file = "axi_visccone.cfg" visc_cone.test_iter = 10 - visc_cone.test_vals = [-5.222212, -5.746462, -20.559802, -20.510196, -20.439814, 1.255865, -3.208363, -0.016006, 0.093455, 32633.000000] - visc_cone.test_vals_aarch64 = [-5.222267, -5.746522, -20.559799, -20.510195, -20.440311, 1.255761, -3.208360, -0.016014, 0.093462, 32634.000000] + visc_cone.test_vals = [-5.222267, -5.746523, -20.560279, -20.510152, -20.409102, 1.255758, -3.208380, -0.016014, 0.093462, 32633.000000] + visc_cone.test_vals_aarch64 = [-5.222267, -5.746523, -20.560279, -20.510152, -20.409102, 1.255758, -3.208380, -0.016014, 0.093462, 32633.000000] test_list.append(visc_cone) # Viscous single wedge with Mutation++ @@ -192,7 +192,7 @@ def main(): super_cat.cfg_dir = "nonequilibrium/visc_wedge" super_cat.cfg_file = "super_cat.cfg" super_cat.test_iter = 10 - super_cat.test_vals = [-5.232590, -5.757884, -20.641547, -20.640244, -20.539243, 1.246889, -3.205235, -0.028406, 0.250857, 32459.000000] + super_cat.test_vals = [-5.232586, -5.757880, -20.641415, -20.640623, -20.541670, 1.246867, -3.205252, -0.028406, 0.250849, 32457.000000] test_list.append(super_cat) # Viscous single wedge - partially catalytic walls @@ -200,7 +200,7 @@ def main(): partial_cat.cfg_dir = "nonequilibrium/visc_wedge" partial_cat.cfg_file = "partial_cat.cfg" partial_cat.test_iter = 10 - partial_cat.test_vals = [-5.210300, -5.735063, -20.880374, -20.825890, -23.475263, 1.806281, -2.813924, -0.078469, 0.496017, 29021.000000] + partial_cat.test_vals = [-5.210300, -5.735063, -20.880453, -20.825975, -23.475263, 1.806201, -2.813952, -0.078465, 0.495977, 29026.000000] test_list.append(partial_cat) # Viscous cylinder, ionization, Gupta-Yos @@ -220,7 +220,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 20 - channel.test_vals = [-2.647975, 2.818090, 0.022280, 0.004644] + channel.test_vals = [-2.741010, 2.728838, 0.037995, 0.007932] test_list.append(channel) # NACA0012 @@ -228,7 +228,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-4.014140, -3.537888, 0.333403, 0.021227] + naca0012.test_vals = [-3.839374, -3.307884, 0.094017, 0.085982] test_list.append(naca0012) # Supersonic wedge @@ -236,7 +236,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-0.944740, 4.782451, -0.208522, 0.036742] + wedge.test_vals = [-0.878443, 4.857425, -0.218783, 0.038583] test_list.append(wedge) # ONERA M6 Wing @@ -244,7 +244,7 @@ def main(): oneram6.cfg_dir = "euler/oneram6" oneram6.cfg_file = "inv_ONERAM6.cfg" oneram6.test_iter = 10 - oneram6.test_vals = [-9.277150, -8.694005, 0.281703, 0.011821] + oneram6.test_vals = [-10.256914, -9.720987, 0.280800, 0.008623] oneram6.timeout = 3200 test_list.append(oneram6) @@ -253,7 +253,7 @@ def main(): fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" fixedCL_naca0012.cfg_file = "inv_NACA0012.cfg" fixedCL_naca0012.test_iter = 10 - fixedCL_naca0012.test_vals = [-7.379831, -1.886302, 0.300000, 0.019471] + fixedCL_naca0012.test_vals = [-3.848065, 1.685467, 0.301124, 0.019487] test_list.append(fixedCL_naca0012) # Polar sweep of the inviscid NACA0012 @@ -262,8 +262,8 @@ def main(): polar_naca0012.cfg_file = "inv_NACA0012.cfg" polar_naca0012.polar = True polar_naca0012.test_iter = 10 - polar_naca0012.test_vals = [-1.217981, 4.256386, 0.009084, 0.016823] - polar_naca0012.test_vals_aarch64 = [-1.718925, 3.711429, 0.009217, 0.007784] + polar_naca0012.test_vals = [-1.083394, 4.386134, 0.001588, 0.033513] + polar_naca0012.test_vals_aarch64 = [-1.083394, 4.386134, 0.001588, 0.033513] polar_naca0012.command = TestCase.Command(exec = "compute_polar.py", param = "-i 11") # flaky test on arm64 polar_naca0012.enabled_on_cpu_arch = ["x86_64"] @@ -274,7 +274,7 @@ def main(): bluntbody.cfg_dir = "euler/bluntbody" bluntbody.cfg_file = "blunt.cfg" bluntbody.test_iter = 20 - bluntbody.test_vals = [0.540009, 6.916653, 0.000000, 1.868976] + bluntbody.test_vals = [0.581950, 6.955500, 0.000000, 1.757414] test_list.append(bluntbody) # Equivalent area NACA64-206 @@ -282,7 +282,7 @@ def main(): ea_naca64206.cfg_dir = "optimization_euler/equivalentarea_naca64206" ea_naca64206.cfg_file = "NACA64206.cfg" ea_naca64206.test_iter = 10 - ea_naca64206.test_vals = [-1.076215, -0.391987, -0.000701, 67775.000000] + ea_naca64206.test_vals = [-1.114938, -0.436978, -0.002475, 67775.000000] test_list.append(ea_naca64206) # SUPERSONIC FLOW PAST A RAMP IN A CHANNEL @@ -303,7 +303,7 @@ def main(): flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" flatplate.test_iter = 100 - flatplate.test_vals = [-9.336395, -3.849426, 0.001112, 0.036276, 2.361500, -2.325300, -2.279700, -2.279700] + flatplate.test_vals = [-8.865290, -3.372402, 0.001112, 0.036276, 2.361500, -2.325300, -2.278600, -2.278600] test_list.append(flatplate) # Custom objective function @@ -311,7 +311,7 @@ def main(): flatplate_udobj.cfg_dir = "user_defined_functions" flatplate_udobj.cfg_file = "lam_flatplate.cfg" flatplate_udobj.test_iter = 20 - flatplate_udobj.test_vals = [-6.653802, -1.181430, -0.794887, 0.000611, -0.000369, 0.000736, -0.001104, 596.690000, 299.800000, 296.890000, 21.492000, 0.563990, 37.148000, 2.278700] + flatplate_udobj.test_vals = [-6.558447, -1.084109, -1.056374, 0.000656, -0.000765, 0.000425, -0.001190, 597.070000, 300.170000, 296.900000, 23.149000, 0.474530, 37.289000, 2.320400] test_list.append(flatplate_udobj) # Laminar cylinder (steady) @@ -319,7 +319,7 @@ def main(): cylinder.cfg_dir = "navierstokes/cylinder" cylinder.cfg_file = "lam_cylinder.cfg" cylinder.test_iter = 25 - cylinder.test_vals = [-6.754517, -1.286785, -0.213640, 0.706519, 0.158870] + cylinder.test_vals = [-8.421986, -2.931138, -0.003382, 1.607685, -0.009905] test_list.append(cylinder) # Laminar cylinder (low Mach correction) @@ -381,7 +381,7 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-4.147727, -6.728308, -0.176232, 0.057717] + turb_flatplate.test_vals = [-4.147644, -6.728397, -0.176245, 0.057709] test_list.append(turb_flatplate) # Flat plate (compressible) with species inlet @@ -389,7 +389,7 @@ def main(): turb_flatplate_species.cfg_dir = "rans/flatplate" turb_flatplate_species.cfg_file = "turb_SA_flatplate_species.cfg" turb_flatplate_species.test_iter = 20 - turb_flatplate_species.test_vals = [-4.147727, -0.634899, -1.770894, 1.334987, -3.250340, 9.000000, -6.700853, 5.000000, -6.991055, 10.000000, -6.033829, 0.996033, 0.996033] + turb_flatplate_species.test_vals = [-4.147644, -0.634804, -1.769053, 1.335081, -3.250274, 9.000000, -6.693588, 5.000000, -6.991149, 10.000000, -6.032957, 0.996034, 0.996034] test_list.append(turb_flatplate_species) # ONERA M6 Wing @@ -565,6 +565,14 @@ def main(): inc_lam_cylinder.test_vals = [-4.004072, -3.194881, -0.076553, 7.780048] test_list.append(inc_lam_cylinder) + # Laminar sphere with restart + inc_lam_sphere = TestCase('inc_lam_sphere') + inc_lam_sphere.cfg_dir = "incomp_navierstokes/sphere" + inc_lam_sphere.cfg_file = "sphere.cfg" + inc_lam_sphere.test_iter = 5 + inc_lam_sphere.test_vals = [-4.004072, -3.194881, -0.076553, 7.780048] + test_list.append(inc_lam_sphere) + # Buoyancy-driven cavity inc_buoyancy = TestCase('inc_buoyancy') inc_buoyancy.cfg_dir = "incomp_navierstokes/buoyancy_cavity" From e5174aedb88fc955fa16e0a181ca43e999213615 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 6 May 2024 19:50:33 +0200 Subject: [PATCH 087/194] add grid movement back into symplane --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 1c231ed5443..df959eb8338 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1174,11 +1174,20 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve su2double* V_reflected = GetCharacPrimVar(val_marker, iVertex); + /*--- Grid movement ---*/ + if (dynamic_grid) + conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); + for (auto iVar = 0u; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); su2double ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); + + /*--- Adjustment to v.n due to grid movement. ---*/ + if (dynamic_grid) { + ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) V_reflected[iDim + iVel] = nodes->GetVelocity(iPoint, iDim) - ProjVelocity_i * UnitNormal[iDim]; From ff79f706d1e8593ddf73aecc635b828efd43d9ab Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 6 May 2024 23:41:02 +0200 Subject: [PATCH 088/194] fix braces --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index df959eb8338..2eddc2f4497 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1185,7 +1185,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Adjustment to v.n due to grid movement. ---*/ - if (dynamic_grid) { + if (dynamic_grid) ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); for (auto iDim = 0u; iDim < nDim; iDim++) From 15761eab97af4c138af77191d2d0ceaa5725e130 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 7 May 2024 07:47:54 +0200 Subject: [PATCH 089/194] cleanup geometry_toolbox --- Common/include/toolboxes/geometry_toolbox.hpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Common/include/toolboxes/geometry_toolbox.hpp b/Common/include/toolboxes/geometry_toolbox.hpp index 2f9c01c2a86..ce0baf55bf6 100644 --- a/Common/include/toolboxes/geometry_toolbox.hpp +++ b/Common/include/toolboxes/geometry_toolbox.hpp @@ -28,9 +28,6 @@ #include -// for su2activematrix -#include "../containers/C2DContainer.hpp" - namespace GeometryToolbox { /// \addtogroup GeometryToolbox /// @{ @@ -219,6 +216,5 @@ inline void TangentProjection(Int nDim, const Mat& tensor, const Scalar* vector, for (Int iDim = 0; iDim < nDim; iDim++) proj[iDim] -= normalProj * vector[iDim]; } - /// @} } // namespace GeometryToolbox From a2f5c423bfaad20aa8a4bdc7a3d3b499a4db2fb3 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 7 May 2024 21:47:47 +0200 Subject: [PATCH 090/194] fix tutorials --- TestCases/tutorials.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index f655e6925d4..0f1a303eafc 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -89,7 +89,7 @@ def main(): species3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" species3_primitiveVenturi.cfg_file = "species3_primitiveVenturi.cfg" species3_primitiveVenturi.test_iter = 50 - species3_primitiveVenturi.test_vals = [-5.980474, -5.337634, -5.274813, -6.037197, -1.812747, -6.418509, -6.557506, 5.000000, -0.826786, 5.000000, -2.181601, 5.000000, -0.490381, 1.652855, 0.500725, 0.597239, 0.554891] + species3_primitiveVenturi.test_vals = [-5.913968, -5.289629, -5.242978, -6.004174, -1.801167, -6.357795, -6.503730, 5.000000, -0.865450, 5.000000, -2.224839, 5.000000, -0.537583, 1.652289, 0.500844, 0.596928, 0.554518] test_list.append(species3_primitiveVenturi) # 3 species (2 eq) primitive venturi mixing @@ -97,8 +97,8 @@ def main(): DAspecies3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" DAspecies3_primitiveVenturi.cfg_file = "DAspecies3_primitiveVenturi.cfg" DAspecies3_primitiveVenturi.test_iter = 50 - DAspecies3_primitiveVenturi.test_vals = [-8.001028, -7.654107, -7.446051, -7.341816, -11.903671, -10.939999, -10.166007] - DAspecies3_primitiveVenturi.test_vals_aarch64 = [-8.001028, -7.654107, -7.446051, -7.341816, -11.903671, -10.939999, -10.166007] + DAspecies3_primitiveVenturi.test_vals = [-7.865411, -7.548131, -7.347978, -7.217536, -11.822422, -10.968444, -10.193225] + DAspecies3_primitiveVenturi.test_vals_aarch64 = [-7.865411, -7.548131, -7.347978, -7.217536, -11.822422, -10.968444, -10.193225] DAspecies3_primitiveVenturi.command = TestCase.Command("mpirun -n 2", "SU2_CFD_AD") test_list.append(DAspecies3_primitiveVenturi) @@ -127,7 +127,7 @@ def main(): premixed_hydrogen.cfg_dir = "../Tutorials/incompressible_flow/Inc_Combustion/1__premixed_hydrogen" premixed_hydrogen.cfg_file = "H2_burner.cfg" premixed_hydrogen.test_iter = 10 - premixed_hydrogen.test_vals = [-9.845322, -10.354388, -11.027983, -4.321538, -11.867730] + premixed_hydrogen.test_vals = [-9.867500, -10.384793, -11.046230, -4.332015, -11.884493] test_list.append(premixed_hydrogen) ### Compressible Flow @@ -145,7 +145,7 @@ def main(): tutorial_inv_wedge.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Wedge" tutorial_inv_wedge.cfg_file = "inv_wedge_HLLC.cfg" tutorial_inv_wedge.test_iter = 0 - tutorial_inv_wedge.test_vals = [-0.481460, 5.253008, -0.322609, 0.056823] + tutorial_inv_wedge.test_vals = [-0.481460, 5.253008, -0.293451, 0.051695] tutorial_inv_wedge.no_restart = True test_list.append(tutorial_inv_wedge) @@ -172,7 +172,7 @@ def main(): tutorial_lam_flatplate.cfg_dir = "../Tutorials/compressible_flow/Laminar_Flat_Plate" tutorial_lam_flatplate.cfg_file = "lam_flatplate.cfg" tutorial_lam_flatplate.test_iter = 0 - tutorial_lam_flatplate.test_vals = [-2.821818, 2.657591, -0.400044, 0.029413] #last 4 columns + tutorial_lam_flatplate.test_vals = [-2.821818, 2.657591, -0.400044, 0.029365] #last 4 columns tutorial_lam_flatplate.no_restart = True test_list.append(tutorial_lam_flatplate) @@ -181,7 +181,7 @@ def main(): tutorial_turb_flatplate.cfg_dir = "../Tutorials/compressible_flow/Turbulent_Flat_Plate" tutorial_turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" tutorial_turb_flatplate.test_iter = 0 - tutorial_turb_flatplate.test_vals = [-2.258584, -4.901015, -0.429375, 0.201236] + tutorial_turb_flatplate.test_vals = [-2.258584, -4.901015, -0.429373, 0.201034] tutorial_turb_flatplate.no_restart = True test_list.append(tutorial_turb_flatplate) @@ -199,8 +199,8 @@ def main(): tutorial_trans_flatplate_T3A.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A" tutorial_trans_flatplate_T3A.cfg_file = "transitional_LM_model_ConfigFile.cfg" tutorial_trans_flatplate_T3A.test_iter = 20 - tutorial_trans_flatplate_T3A.test_vals = [-5.837190, -2.092245, -3.983710, -0.302215, -1.929882, 1.677075, -3.496279, 0.391606] - tutorial_trans_flatplate_T3A.test_vals_aarch64 = [-5.837191, -2.092246, -3.982640, -0.302224, -1.922554, 1.667190, -3.496277, 0.391605] + tutorial_trans_flatplate_T3A.test_vals = [-5.837368, -2.092246, -3.984172, -0.302357, -1.928108, 1.667157, -3.496279, 0.391610] + tutorial_trans_flatplate_T3A.test_vals_aarch64 = [-5.837368, -2.092246, -3.984172, -0.302357, -1.928108, 1.667157, -3.496279, 0.391610] tutorial_trans_flatplate_T3A.no_restart = True test_list.append(tutorial_trans_flatplate_T3A) @@ -209,8 +209,8 @@ def main(): tutorial_trans_flatplate_T3Am.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A-" tutorial_trans_flatplate_T3Am.cfg_file = "transitional_LM_model_ConfigFile.cfg" tutorial_trans_flatplate_T3Am.test_iter = 20 - tutorial_trans_flatplate_T3Am.test_vals = [-6.063083, -1.945092, -3.946928, -0.548659, -3.863795, 2.664463, -2.517595, 1.112979] - tutorial_trans_flatplate_T3Am.test_vals_aarch64 = [-6.063598, -1.945057, -3.946744, -0.549062, -3.863792, 2.664453, -2.517606, 1.112979] + tutorial_trans_flatplate_T3Am.test_vals = [-6.063726, -1.945088, -3.946923, -0.549166, -3.863794, 2.664439, -2.517601, 1.112978] + tutorial_trans_flatplate_T3Am.test_vals_aarch64 = [-6.063726, -1.945088, -3.946923, -0.549166, -3.863794, 2.664439, -2.517601, 1.112978] tutorial_trans_flatplate_T3Am.no_restart = True test_list.append(tutorial_trans_flatplate_T3Am) From d5bc57a4c22d934564f140ece8ae7cede6d6afbd Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 8 May 2024 00:14:14 +0200 Subject: [PATCH 091/194] fix regressions --- TestCases/euler/naca0012/inv_NACA0012_Roe.cfg | 4 +- TestCases/hybrid_regression.py | 70 ++++++++--------- TestCases/hybrid_regression_AD.py | 14 ++-- TestCases/parallel_regression.py | 78 +++++++++---------- 4 files changed, 83 insertions(+), 83 deletions(-) diff --git a/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg b/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg index ca0ca64d502..3fbc79377bb 100644 --- a/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg +++ b/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg @@ -41,11 +41,11 @@ MARKER_MONITORING= ( airfoil ) % ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 1.0 +CFL_NUMBER= 20.0 CFL_ADAPT= NO CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) -ITER= 110 +ITER= 1000 LINEAR_SOLVER= BCGSTAB LINEAR_SOLVER_ERROR= 1E-6 LINEAR_SOLVER_ITER= 5 diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 8745a96f610..c218179d8bb 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -51,7 +51,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 20 - channel.test_vals = [-2.667328, 2.797437, 0.018714, 0.006906] + channel.test_vals = [-2.771553, 2.690545, 0.059193, 0.006637] test_list.append(channel) # NACA0012 @@ -59,7 +59,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-4.023999, -3.515034, 0.339426, 0.022217] + naca0012.test_vals = [-3.843223, -3.318001, 0.101992, 0.089762] test_list.append(naca0012) # Supersonic wedge @@ -67,7 +67,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-0.942862, 4.784581, -0.208106, 0.036665] + wedge.test_vals = [-0.970990, 4.753109, -0.212841, 0.037538] test_list.append(wedge) # ONERA M6 Wing @@ -75,7 +75,7 @@ def main(): oneram6.cfg_dir = "euler/oneram6" oneram6.cfg_file = "inv_ONERAM6.cfg" oneram6.test_iter = 10 - oneram6.test_vals = [0.281703, 0.011821] + oneram6.test_vals = [0.280800, 0.008623] test_list.append(oneram6) # Fixed CL NACA0012 @@ -91,7 +91,7 @@ def main(): bluntbody.cfg_dir = "euler/bluntbody" bluntbody.cfg_file = "blunt.cfg" bluntbody.test_iter = 20 - bluntbody.test_vals = [0.540010, 6.916656, 0.000027, 1.869004] + bluntbody.test_vals = [0.581952, 6.955503, 0.000020, 1.757430] test_list.append(bluntbody) ########################## @@ -112,7 +112,7 @@ def main(): cylinder.cfg_dir = "navierstokes/cylinder" cylinder.cfg_file = "lam_cylinder.cfg" cylinder.test_iter = 25 - cylinder.test_vals = [-6.765429, -1.297425, 0.019571, 0.310233, 0.123270] + cylinder.test_vals = [-8.265865, -2.783635, -0.019914, 1.614879, -0.010191] cylinder.test_vals_aarch64 = [-6.765429, -1.297425, 0.019571, 0.310231, 0.123270] test_list.append(cylinder) @@ -185,7 +185,7 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-4.157358, -6.736289, -0.176258, 0.057431] + turb_flatplate.test_vals = [-4.156816, -6.736063, -0.176192, 0.057478] test_list.append(turb_flatplate) # ONERA M6 Wing @@ -193,7 +193,7 @@ def main(): turb_oneram6.cfg_dir = "rans/oneram6" turb_oneram6.cfg_file = "turb_ONERAM6.cfg" turb_oneram6.test_iter = 10 - turb_oneram6.test_vals = [-2.388836, -6.689426, 0.230320, 0.157640, -32539.000000] + turb_oneram6.test_vals = [-2.392607, -6.689653, 0.230565, 0.158760, -33786.000000] test_list.append(turb_oneram6) # NACA0012 (SA, FUN3D finest grid results: CL=1.0983, CD=0.01242) @@ -255,7 +255,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-12.060634, -6.992273, -8.808757, -4.097753, -2019.800000] + axi_rans_air_nozzle_restart.test_vals = [-12.152920, -6.612685, -9.255147, -4.541279, -2019.700000] test_list.append(axi_rans_air_nozzle_restart) ################################# @@ -329,7 +329,7 @@ def main(): harmonic_balance.cfg_dir = "harmonic_balance" harmonic_balance.cfg_file = "HB.cfg" harmonic_balance.test_iter = 25 - harmonic_balance.test_vals = [-1.589740, 0.790168, 0.937052, 3.922578] + harmonic_balance.test_vals = [-1.567527, 0.815337, 0.928321, 3.947117] test_list.append(harmonic_balance) # Turbulent pitching NACA 64a010 airfoil @@ -349,7 +349,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-4.858287, -3.810487, 0.491850, 0.007002] + inc_euler_naca0012.test_vals = [-6.827464, -5.980287, 0.531769, 0.008475] test_list.append(inc_euler_naca0012) # C-D nozzle with pressure inlet and mass flow outlet @@ -395,7 +395,7 @@ def main(): inc_lam_bend.cfg_dir = "incomp_navierstokes/bend" inc_lam_bend.cfg_file = "lam_bend.cfg" inc_lam_bend.test_iter = 10 - inc_lam_bend.test_vals = [-3.437996, -3.086189, -0.015600, 1.142212] + inc_lam_bend.test_vals = [-3.465319, -3.233960, -0.015705, 0.991726] inc_lam_bend.test_vals_aarch64 = [-3.437996, -3.086188, -0.015600, 1.142213] test_list.append(inc_lam_bend) @@ -424,7 +424,7 @@ def main(): inc_weakly_coupled.cfg_dir = "disc_adj_heat" inc_weakly_coupled.cfg_file = "primal.cfg" inc_weakly_coupled.test_iter = 10 - inc_weakly_coupled.test_vals = [-16.498562, -15.335587, -15.570565, -12.867787, -18.185331, -13.071436, 5.545800] + inc_weakly_coupled.test_vals = [-10.178878, -9.034942, -9.789683, -10.295431, -14.202552, -1.024140, 5.547700] test_list.append(inc_weakly_coupled) ###################################### @@ -467,7 +467,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977520, 3.481804, -0.012402, -0.007454] + sine_gust.test_vals = [-1.977477, 3.481821, -0.017533, -0.008638] sine_gust.unsteady = True test_list.append(sine_gust) @@ -476,7 +476,7 @@ def main(): cosine_gust.cfg_dir = "gust" cosine_gust.cfg_file = "cosine_gust_zdir.cfg" cosine_gust.test_iter = 79 - cosine_gust.test_vals = [-2.418813, 0.004650, -0.001878, -0.000637, -0.000271] + cosine_gust.test_vals = [-2.418803, 0.003346, -0.001497, 0.000675, -0.000557] cosine_gust.unsteady = True cosine_gust.enabled_with_tsan = False test_list.append(cosine_gust) @@ -486,7 +486,7 @@ def main(): gust_mesh_defo.cfg_dir = "gust" gust_mesh_defo.cfg_file = "gust_with_mesh_deformation.cfg" gust_mesh_defo.test_iter = 6 - gust_mesh_defo.test_vals = [-1.844778, 0.000846, -0.000408] + gust_mesh_defo.test_vals = [-1.844763, 0.003570, 0.000026] gust_mesh_defo.unsteady = True gust_mesh_defo.enabled_with_tsan = False test_list.append(gust_mesh_defo) @@ -496,8 +496,8 @@ def main(): aeroelastic.cfg_dir = "aeroelastic" aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" aeroelastic.test_iter = 2 - aeroelastic.test_vals = [0.074432, 0.033108, -0.001650, -0.000127] - aeroelastic.test_vals_aarch64 = [0.074836, 0.033102, -0.001650, -0.000127] + aeroelastic.test_vals = [0.074170, 0.027590, -0.001579, -0.000160] + aeroelastic.test_vals_aarch64 = [0.074170, 0.027590, -0.001579, -0.000160] aeroelastic.unsteady = True aeroelastic.enabled_on_cpu_arch = ["x86_64"] # Requires AVX-capable architecture aeroelastic.enabled_with_tsan = False @@ -508,7 +508,7 @@ def main(): ddes_flatplate.cfg_dir = "ddes/flatplate" ddes_flatplate.cfg_file = "ddes_flatplate.cfg" ddes_flatplate.test_iter = 10 - ddes_flatplate.test_vals = [-2.714757, -5.882779, -0.215005, 0.023783, -618.130000] + ddes_flatplate.test_vals = [-2.714788, -5.882720, -0.215049, 0.023758, -617.440000] ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) @@ -526,7 +526,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform.cfg" unst_deforming_naca0012.test_iter = 5 - unst_deforming_naca0012.test_vals = [-3.665126, -3.793497, -3.716496, -3.148290] + unst_deforming_naca0012.test_vals = [-3.668047, -3.810208, -3.725488, -3.153095] unst_deforming_naca0012.unsteady = True unst_deforming_naca0012.enabled_with_tsan = False test_list.append(unst_deforming_naca0012) @@ -540,7 +540,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 100 - edge_VW.test_vals = [-5.040246, 1.124521, -0.000009, 0.000000] + edge_VW.test_vals = [-7.414583, -1.184125, -0.000009, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR @@ -548,8 +548,8 @@ def main(): edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" edge_PPR.test_iter = 100 - edge_PPR.test_vals = [-5.401604, 0.738202, -0.000035, 0.000000] - edge_PPR.test_vals_aarch64 = [-5.401642, 0.738164, -0.000035, 0.000000] + edge_PPR.test_vals = [-8.573595, -2.391849, -0.000034, 0.000000] + edge_PPR.test_vals_aarch64 = [-8.573595, -2.391849, -0.000034, 0.000000] test_list.append(edge_PPR) ###################################### @@ -591,7 +591,7 @@ def main(): uniform_flow.cfg_dir = "sliding_interface/uniform_flow" uniform_flow.cfg_file = "uniform_NN.cfg" uniform_flow.test_iter = 5 - uniform_flow.test_vals = [5.000000, 0.000000, -0.188748, -10.631533] + uniform_flow.test_vals = [5.000000, 0.000000, -0.194599, -10.631539] uniform_flow.unsteady = True uniform_flow.multizone = True test_list.append(uniform_flow) @@ -601,7 +601,7 @@ def main(): channel_2D.cfg_dir = "sliding_interface/channel_2D" channel_2D.cfg_file = "channel_2D_WA.cfg" channel_2D.test_iter = 2 - channel_2D.test_vals = [2.000000, 0.000000, 0.397975, 0.352765, 0.405420] + channel_2D.test_vals = [2.000000, 0.000000, 0.399764, 0.352564, 0.404770] channel_2D.unsteady = True channel_2D.multizone = True test_list.append(channel_2D) @@ -611,8 +611,8 @@ def main(): channel_3D.cfg_dir = "sliding_interface/channel_3D" channel_3D.cfg_file = "channel_3D_WA.cfg" channel_3D.test_iter = 2 - channel_3D.test_vals = [2.000000, 0.000000, 0.620170, 0.505179, 0.415317] - channel_3D.test_vals_aarch64 = [2.000000, 0.000000, 0.620189, 0.505311, 0.415246] + channel_3D.test_vals = [2.000000, 0.000000, 0.620558, 0.504323, 0.412729] + channel_3D.test_vals_aarch64 = [2.000000, 0.000000, 0.620558, 0.504323, 0.412729] channel_3D.unsteady = True channel_3D.multizone = True channel_3D.enabled_with_tsan = False @@ -623,7 +623,7 @@ def main(): pipe.cfg_dir = "sliding_interface/pipe" pipe.cfg_file = "pipe_NN.cfg" pipe.test_iter = 2 - pipe.test_vals = [0.150024, 0.491949, 0.677759, 0.963991, 1.006947] + pipe.test_vals = [0.120770, 0.484697, 0.675943, 0.987258, 1.008392] pipe.unsteady = True pipe.multizone = True test_list.append(pipe) @@ -633,7 +633,7 @@ def main(): rotating_cylinders.cfg_dir = "sliding_interface/rotating_cylinders" rotating_cylinders.cfg_file = "rot_cylinders_WA.cfg" rotating_cylinders.test_iter = 3 - rotating_cylinders.test_vals = [3.000000, 0.000000, 0.777568, 1.134807, 1.224137] + rotating_cylinders.test_vals = [3.000000, 0.000000, 0.718429, 1.111401, 1.155959] rotating_cylinders.unsteady = True rotating_cylinders.multizone = True test_list.append(rotating_cylinders) @@ -643,7 +643,7 @@ def main(): supersonic_vortex_shedding.cfg_dir = "sliding_interface/supersonic_vortex_shedding" supersonic_vortex_shedding.cfg_file = "sup_vor_shed_WA.cfg" supersonic_vortex_shedding.test_iter = 5 - supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.214344, 1.663912] + supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.208203, 1.034371] supersonic_vortex_shedding.unsteady = True supersonic_vortex_shedding.multizone = True test_list.append(supersonic_vortex_shedding) @@ -694,7 +694,7 @@ def main(): fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" fsi2d.cfg_file = "configFSI.cfg" fsi2d.test_iter = 4 - fsi2d.test_vals = [4.000000, 0.000000, -3.743227, -4.133479] + fsi2d.test_vals = [4.000000, 0.000000, -3.729707, -4.151494] fsi2d.multizone= True fsi2d.unsteady = True fsi2d.enabled_with_tsan = False @@ -715,8 +715,8 @@ def main(): dyn_fsi.cfg_dir = "fea_fsi/dyn_fsi" dyn_fsi.cfg_file = "config.cfg" dyn_fsi.test_iter = 4 - dyn_fsi.test_vals = [-4.355806, -4.060582, 0.000000, 103.000000] - dyn_fsi.test_vals_aarch64 = [-4.355806, -4.060582, 0.000000, 103.000000] + dyn_fsi.test_vals = [-4.332167, -4.057742, 0.000000, 102.000000] + dyn_fsi.test_vals_aarch64 = [-4.332167, -4.057742, 0.000000, 102.000000] dyn_fsi.multizone = True dyn_fsi.unsteady = True test_list.append(dyn_fsi) @@ -726,8 +726,8 @@ def main(): stat_fsi_restart.cfg_dir = "fea_fsi/stat_fsi" stat_fsi_restart.cfg_file = "config_restart.cfg" stat_fsi_restart.test_iter = 1 - stat_fsi_restart.test_vals = [-3.474078, -4.242240, 0.000000, 36.000000] - stat_fsi_restart.test_vals_aarch64 = [-3.474081, -4.242372, 0.000000, 37.000000] + stat_fsi_restart.test_vals = [-3.442878, -4.228058, 0.000000, 37.000000] + stat_fsi_restart.test_vals_aarch64 = [-3.442878, -4.228058, 0.000000, 37.000000] stat_fsi_restart.multizone = True test_list.append(stat_fsi_restart) diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index 5bf0befa263..4f61f064af6 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -50,7 +50,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.561506, -8.926634, -0.000000, 0.005587] + discadj_naca0012.test_vals = [-3.563782, -8.924462, -0.000000, 0.005520] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) @@ -58,7 +58,7 @@ def main(): discadj_cylinder3D.cfg_dir = "disc_adj_euler/cylinder3D" discadj_cylinder3D.cfg_file = "inv_cylinder3D.cfg" discadj_cylinder3D.test_iter = 5 - discadj_cylinder3D.test_vals = [-3.730673, -3.832084, -0.000000, 0.000000] + discadj_cylinder3D.test_vals = [-3.811884, -3.768379, -0.000000, 0.000000] test_list.append(discadj_cylinder3D) # Arina nozzle 2D @@ -66,7 +66,7 @@ def main(): discadj_arina2k.cfg_dir = "disc_adj_euler/arina2k" discadj_arina2k.cfg_file = "Arina2KRS.cfg" discadj_arina2k.test_iter = 20 - discadj_arina2k.test_vals = [-3.087876, -3.481506, 0.068878, 0.000000] + discadj_arina2k.test_vals = [-3.242104, -3.481387, 0.056340, 0.000000] test_list.append(discadj_arina2k) #################################### @@ -98,7 +98,7 @@ def main(): discadj_incomp_NACA0012.cfg_dir = "disc_adj_incomp_euler/naca0012" discadj_incomp_NACA0012.cfg_file = "incomp_NACA0012_disc.cfg" discadj_incomp_NACA0012.test_iter = 20 - discadj_incomp_NACA0012.test_vals = [20.000000, -4.092007, -2.652751, 0.000000] + discadj_incomp_NACA0012.test_vals = [20.000000, -4.084634, -2.650488, 0.000000] test_list.append(discadj_incomp_NACA0012) ##################################### @@ -185,7 +185,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.219713, -1.645717, -0.007513, 0.000013] + discadj_pitchingNACA0012.test_vals = [-1.218226, -1.645219, -0.007565, 0.000013] discadj_pitchingNACA0012.unsteady = True discadj_pitchingNACA0012.enabled_with_tsan = False test_list.append(discadj_pitchingNACA0012) @@ -253,8 +253,8 @@ def main(): pywrapper_CFD_AD_MeshDisp.cfg_dir = "py_wrapper/disc_adj_flow/mesh_disp_sens" pywrapper_CFD_AD_MeshDisp.cfg_file = "configAD_flow.cfg" pywrapper_CFD_AD_MeshDisp.test_iter = 1000 - pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.521422, 1.372295, 0.000000] #last 4 columns - pywrapper_CFD_AD_MeshDisp.test_vals_aarch64 = [30.000000, -2.516536, 1.386443, 0.000000] + pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.499079, 1.440068, 0.000000] #last 4 columns + pywrapper_CFD_AD_MeshDisp.test_vals_aarch64 = [30.000000, -2.499079, 1.440068, 0.000000] pywrapper_CFD_AD_MeshDisp.command = TestCase.Command(exec = "python", param = "run_adjoint.py --parallel -f") pywrapper_CFD_AD_MeshDisp.timeout = 1600 pywrapper_CFD_AD_MeshDisp.tol = 1e-2 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 971707d2795..937b3c74583 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -594,7 +594,7 @@ def main(): inc_lam_bend.cfg_dir = "incomp_navierstokes/bend" inc_lam_bend.cfg_file = "lam_bend.cfg" inc_lam_bend.test_iter = 10 - inc_lam_bend.test_vals = [-3.447746, -3.085237, -0.020816, 1.147373] + inc_lam_bend.test_vals = [-3.472790, -3.244232, -0.018861, 1.002345] test_list.append(inc_lam_bend) # 3D laminar channnel with 1 cell in flow direction, streamwise periodic @@ -610,7 +610,7 @@ def main(): inc_heatTransfer_BC.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" inc_heatTransfer_BC.cfg_file = "BC_HeatTransfer.cfg" inc_heatTransfer_BC.test_iter = 50 - inc_heatTransfer_BC.test_vals = [-8.242651, -7.341179, -7.407346, -0.152603, -1667.300000] + inc_heatTransfer_BC.test_vals = [-8.183146, -7.600022, -8.052449, -0.092131, -1671.400000] test_list.append(inc_heatTransfer_BC) ############################ @@ -761,7 +761,7 @@ def main(): schubauer_klebanoff_transition.cfg_dir = "transition/Schubauer_Klebanoff" schubauer_klebanoff_transition.cfg_file = "transitional_BC_model_ConfigFile.cfg" schubauer_klebanoff_transition.test_iter = 10 - schubauer_klebanoff_transition.test_vals = [-7.994740, -13.240225, 0.000046, 0.007987] + schubauer_klebanoff_transition.test_vals = [-7.925066, -13.240352, 0.000049, 0.007982] test_list.append(schubauer_klebanoff_transition) ##################################### @@ -789,7 +789,7 @@ def main(): contadj_wedge.cfg_dir = "cont_adj_euler/wedge" contadj_wedge.cfg_file = "inv_wedge_ROE.cfg" contadj_wedge.test_iter = 10 - contadj_wedge.test_vals = [2.872691, -2.755572, 853010.000000, -0.000000] + contadj_wedge.test_vals = [2.872064, -2.756210, 1010800.000000, 0.000000] test_list.append(contadj_wedge) # Inviscid fixed CL NACA0012 @@ -797,7 +797,7 @@ def main(): contadj_fixed_CL_naca0012.cfg_dir = "fixed_cl/naca0012" contadj_fixed_CL_naca0012.cfg_file = "inv_NACA0012_ContAdj.cfg" contadj_fixed_CL_naca0012.test_iter = 100 - contadj_fixed_CL_naca0012.test_vals = [0.275856, -5.200511, 0.342710, 0.000105] + contadj_fixed_CL_naca0012.test_vals = [0.748138, -4.810435, -0.520150, -0.000284] test_list.append(contadj_fixed_CL_naca0012) ################################### @@ -913,7 +913,7 @@ def main(): harmonic_balance.cfg_dir = "harmonic_balance" harmonic_balance.cfg_file = "HB.cfg" harmonic_balance.test_iter = 25 - harmonic_balance.test_vals = [-1.589739, 0.790169, 0.937053, 3.922579] + harmonic_balance.test_vals = [-1.567526, 0.815337, 0.928322, 3.947118] test_list.append(harmonic_balance) # Turbulent pitching NACA 64a010 airfoil @@ -934,7 +934,7 @@ def main(): rot_naca0012.cfg_dir = "rotating/naca0012" rot_naca0012.cfg_file = "rot_NACA0012.cfg" rot_naca0012.test_iter = 25 - rot_naca0012.test_vals = [-2.698005, 2.845328, -0.079439, 0.002128] + rot_naca0012.test_vals = [-2.451409, 2.513129, -0.038116, 0.241393] test_list.append(rot_naca0012) # Lid-driven cavity @@ -971,7 +971,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977520, 3.481804, -0.012377, -0.007389] + sine_gust.test_vals = [-1.977477, 3.481821, -0.018110, -0.008453] sine_gust.unsteady = True test_list.append(sine_gust) @@ -980,7 +980,7 @@ def main(): aeroelastic.cfg_dir = "aeroelastic" aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" aeroelastic.test_iter = 2 - aeroelastic.test_vals = [0.076550, 0.033042, -0.001650, -0.000127] + aeroelastic.test_vals = [0.075115, 0.027461, -0.001581, -0.000159] aeroelastic.unsteady = True test_list.append(aeroelastic) @@ -989,7 +989,7 @@ def main(): ddes_flatplate.cfg_dir = "ddes/flatplate" ddes_flatplate.cfg_file = "ddes_flatplate.cfg" ddes_flatplate.test_iter = 10 - ddes_flatplate.test_vals = [-2.714757, -5.882779, -0.215005, 0.023783, -618.130000] + ddes_flatplate.test_vals = [-2.714788, -5.882721, -0.215049, 0.023758, -617.450000] ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) @@ -1007,7 +1007,7 @@ def main(): flatplate_unsteady.cfg_dir = "navierstokes/flatplate" flatplate_unsteady.cfg_file = "lam_flatplate_unst.cfg" flatplate_unsteady.test_iter = 3 - flatplate_unsteady.test_vals = [7.9509e-06, -8.868859, -8.231652, -6.283262, -5.466675, -3.391163, 0.002078, -0.343642] + flatplate_unsteady.test_vals = [0.000008, -8.876477, -8.249899, -6.294137, -5.468911, -3.398657, 0.002075, -0.324332] flatplate_unsteady.unsteady = True test_list.append(flatplate_unsteady) @@ -1020,7 +1020,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 100 - edge_VW.test_vals = [-5.048044, 1.115667, -0.000009, 0.000000] + edge_VW.test_vals = [-7.403171, -1.171612, -0.000009, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR @@ -1028,7 +1028,7 @@ def main(): edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" edge_PPR.test_iter = 100 - edge_PPR.test_vals = [-5.400790, 0.739723, -0.000035, 0.000000] + edge_PPR.test_vals = [-8.587251, -2.404856, -0.000034, 0.000000] test_list.append(edge_PPR) # Rarefaction Q1D nozzle, include CoolProp fluid model @@ -1036,7 +1036,7 @@ def main(): coolprop_fluidModel.cfg_dir = "nicf/coolprop" coolprop_fluidModel.cfg_file = "fluidModel.cfg" coolprop_fluidModel.test_iter = 5 - coolprop_fluidModel.test_vals = [-4.525459, -1.578697, 3.443116, 0.000000, 0.000000] + coolprop_fluidModel.test_vals = [-4.400283, -1.582864, 3.442204, 0.000000, 0.000000] coolprop_fluidModel.enabled_on_cpu_arch = ["x86_64"] test_list.append(coolprop_fluidModel) @@ -1045,7 +1045,7 @@ def main(): coolprop_transportModel.cfg_dir = "nicf/coolprop" coolprop_transportModel.cfg_file = "transportModel.cfg" coolprop_transportModel.test_iter = 5 - coolprop_transportModel.test_vals = [-4.527922, -1.308648, 4.630717, 0.000000, 0.000000] + coolprop_transportModel.test_vals = [-4.403520, -1.314318, 4.630793, 0.000000, 0.000000] coolprop_transportModel.enabled_on_cpu_arch = ["x86_64"] test_list.append(coolprop_transportModel) @@ -1054,7 +1054,7 @@ def main(): datadriven_fluidModel.cfg_dir = "nicf/datadriven" datadriven_fluidModel.cfg_file = "datadriven_nozzle.cfg" datadriven_fluidModel.test_iter = 50 - datadriven_fluidModel.test_vals = [-2.623890, 0.145236, 4.688439, 0.000000, 0.000000] + datadriven_fluidModel.test_vals = [-2.758908, -0.094885, 4.434958, 0.000000, 0.000000] test_list.append(datadriven_fluidModel) ###################################### @@ -1104,7 +1104,7 @@ def main(): uniform_flow.cfg_dir = "sliding_interface/uniform_flow" uniform_flow.cfg_file = "uniform_NN.cfg" uniform_flow.test_iter = 5 - uniform_flow.test_vals = [5.000000, 0.000000, -0.188747, -10.631538] + uniform_flow.test_vals = [5.000000, 0.000000, -0.194598, -10.631544] uniform_flow.unsteady = True uniform_flow.multizone = True test_list.append(uniform_flow) @@ -1114,7 +1114,7 @@ def main(): channel_2D.cfg_dir = "sliding_interface/channel_2D" channel_2D.cfg_file = "channel_2D_WA.cfg" channel_2D.test_iter = 2 - channel_2D.test_vals = [2.000000, 0.000000, 0.398011, 0.352778, 0.405461] + channel_2D.test_vals = [2.000000, 0.000000, 0.399787, 0.352581, 0.404785] channel_2D.test_vals_aarch64 = [2.000000, 0.000000, 0.398036, 0.352783, 0.405462] channel_2D.timeout = 100 channel_2D.unsteady = True @@ -1126,7 +1126,7 @@ def main(): channel_3D.cfg_dir = "sliding_interface/channel_3D" channel_3D.cfg_file = "channel_3D_WA.cfg" channel_3D.test_iter = 2 - channel_3D.test_vals = [2.000000, 0.000000, 0.620176, 0.505161, 0.415248] + channel_3D.test_vals = [2.000000, 0.000000, 0.620571, 0.504321, 0.412845] channel_3D.test_vals_aarch64 = [2.000000, 0.000000, 0.620182, 0.505302, 0.415257] channel_3D.unsteady = True channel_3D.multizone = True @@ -1137,7 +1137,7 @@ def main(): pipe.cfg_dir = "sliding_interface/pipe" pipe.cfg_file = "pipe_NN.cfg" pipe.test_iter = 2 - pipe.test_vals = [0.150024, 0.491953, 0.677755, 0.963980, 1.006936] + pipe.test_vals = [0.120768, 0.484700, 0.675941, 0.987253, 1.008382] pipe.unsteady = True pipe.multizone = True test_list.append(pipe) @@ -1147,7 +1147,7 @@ def main(): rotating_cylinders.cfg_dir = "sliding_interface/rotating_cylinders" rotating_cylinders.cfg_file = "rot_cylinders_WA.cfg" rotating_cylinders.test_iter = 3 - rotating_cylinders.test_vals = [3.000000, 0.000000, 0.777572, 1.134804, 1.224137] + rotating_cylinders.test_vals = [3.000000, 0.000000, 0.718429, 1.111400, 1.155964] rotating_cylinders.unsteady = True rotating_cylinders.multizone = True test_list.append(rotating_cylinders) @@ -1157,7 +1157,7 @@ def main(): supersonic_vortex_shedding.cfg_dir = "sliding_interface/supersonic_vortex_shedding" supersonic_vortex_shedding.cfg_file = "sup_vor_shed_WA.cfg" supersonic_vortex_shedding.test_iter = 5 - supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.214350, 1.663914] + supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.208203, 1.034377] supersonic_vortex_shedding.unsteady = True supersonic_vortex_shedding.multizone = True test_list.append(supersonic_vortex_shedding) @@ -1221,7 +1221,7 @@ def main(): fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" fsi2d.cfg_file = "configFSI.cfg" fsi2d.test_iter = 4 - fsi2d.test_vals = [4.000000, 0.000000, -3.743210, -4.133483] + fsi2d.test_vals = [4.000000, 0.000000, -3.729689, -4.151490] fsi2d.command = TestCase.Command(exec = "parallel_computation_fsi.py", param = "-f") fsi2d.multizone= True fsi2d.unsteady = True @@ -1232,7 +1232,7 @@ def main(): stat_fsi.cfg_dir = "fea_fsi/stat_fsi" stat_fsi.cfg_file = "config.cfg" stat_fsi.test_iter = 7 - stat_fsi.test_vals = [-3.296605, -4.934646, 0.000000, 7.000000] + stat_fsi.test_vals = [-3.317554, -4.965396, 0.000000, 8.000000] stat_fsi.multizone = True test_list.append(stat_fsi) @@ -1241,7 +1241,7 @@ def main(): dyn_fsi.cfg_dir = "fea_fsi/dyn_fsi" dyn_fsi.cfg_file = "config.cfg" dyn_fsi.test_iter = 4 - dyn_fsi.test_vals = [-4.355829, -4.060587, 5.3837e-08, 98] + dyn_fsi.test_vals = [-4.332187, -4.057753, 0.000000, 97.000000] dyn_fsi.multizone = True dyn_fsi.unsteady = True test_list.append(dyn_fsi) @@ -1251,7 +1251,7 @@ def main(): stat_fsi_restart.cfg_dir = "fea_fsi/stat_fsi" stat_fsi_restart.cfg_file = "config_restart.cfg" stat_fsi_restart.test_iter = 1 - stat_fsi_restart.test_vals = [-3.435926, -4.264912, 0.000000, 28.000000] + stat_fsi_restart.test_vals = [-3.426391, -4.246974, 0.000000, 28.000000] stat_fsi_restart.multizone = True test_list.append(stat_fsi_restart) @@ -1308,7 +1308,7 @@ def main(): sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" sp_pinArray_cht_2d_dp_hf.cfg_file = "configMaster.cfg" sp_pinArray_cht_2d_dp_hf.test_iter = 100 - sp_pinArray_cht_2d_dp_hf.test_vals = [0.104306, -1.005859, -1.028870, -0.753282, 208.023676, 353.490000, -0.000000, -0.753280, 0.753280] + sp_pinArray_cht_2d_dp_hf.test_vals = [0.083031, -0.952832, -1.045857, -0.748205, 208.023676, 352.720000, -0.000000, -0.748200, 0.748200] sp_pinArray_cht_2d_dp_hf.multizone = True test_list.append(sp_pinArray_cht_2d_dp_hf) @@ -1362,7 +1362,7 @@ def main(): pywrapper_aeroelastic.cfg_dir = "aeroelastic" pywrapper_aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" pywrapper_aeroelastic.test_iter = 2 - pywrapper_aeroelastic.test_vals = [0.076550, 0.033042, -0.001650, -0.000127] + pywrapper_aeroelastic.test_vals = [0.075115, 0.027461, -0.001581, -0.000159] pywrapper_aeroelastic.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--parallel -f") pywrapper_aeroelastic.unsteady = True test_list.append(pywrapper_aeroelastic) @@ -1382,7 +1382,7 @@ def main(): pywrapper_fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" pywrapper_fsi2d.cfg_file = "configFSI.cfg" pywrapper_fsi2d.test_iter = 4 - pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.743210, -4.133483] + pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.729689, -4.151490] pywrapper_fsi2d.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--nZone 2 --fsi True --parallel -f") pywrapper_fsi2d.unsteady = True pywrapper_fsi2d.multizone = True @@ -1393,7 +1393,7 @@ def main(): pywrapper_unsteadyFSI.cfg_dir = "py_wrapper/dyn_fsi" pywrapper_unsteadyFSI.cfg_file = "config.cfg" pywrapper_unsteadyFSI.test_iter = 4 - pywrapper_unsteadyFSI.test_vals = [0, 31, 5, 58, -1.756780, -2.828276, -7.652558, -6.863929, 1.5618e-04] + pywrapper_unsteadyFSI.test_vals = [0.000000, 49.000000, 5.000000, 57.000000, -0.771999, -2.968647, -2.722569, -7.592115, 0.001080] pywrapper_unsteadyFSI.command = TestCase.Command("mpirun -np 2", "python", "run.py") pywrapper_unsteadyFSI.unsteady = True pywrapper_unsteadyFSI.multizone = True @@ -1424,7 +1424,7 @@ def main(): pywrapper_deformingBump.cfg_dir = "py_wrapper/deforming_bump_in_channel" pywrapper_deformingBump.cfg_file = "config.cfg" pywrapper_deformingBump.test_iter = 1 - pywrapper_deformingBump.test_vals = [0.500000, 0.000000, -2.554360, -1.084594, -0.024882, 2.907803, 8.785498, -0.363585] + pywrapper_deformingBump.test_vals = [ 0.500000, 0.000000, -2.630401, -1.388343, -0.705917, 2.818404, 6.686423, -0.497850] pywrapper_deformingBump.command = TestCase.Command("mpirun -np 2", "python", "run.py") pywrapper_deformingBump.unsteady = True test_list.append(pywrapper_deformingBump) @@ -1496,7 +1496,7 @@ def main(): species2_primitiveVenturi_mixingmodel.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel.cfg_file = "species2_primitiveVenturi_mixingmodel.cfg" species2_primitiveVenturi_mixingmodel.test_iter = 50 - species2_primitiveVenturi_mixingmodel.test_vals = [-5.359429, -4.504612, -4.480004, -5.629196, -0.059934, -5.596051, 5.000000, -1.870943, 5.000000, -4.915279, 5.000000, -1.183531, 0.000429, 0.000393, 0.000036, 0.000000] + species2_primitiveVenturi_mixingmodel.test_vals = [-5.253422, -4.548567, -4.669310, -5.639565, -0.056375, -5.539197, 5.000000, -2.031561, 5.000000, -4.892504, 5.000000, -1.170435, 0.000577, 0.000508, 0.000069, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel) # 2 species (1 eq) primitive venturi mixing using mixing model and bounded scalar transport @@ -1504,7 +1504,7 @@ def main(): species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_file = "species2_primitiveVenturi_mixingmodel_boundedscalar.cfg" species2_primitiveVenturi_mixingmodel_boundedscalar.test_iter = 50 - species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.336209, -4.445047, -4.432074, -5.785385, -0.127631, -5.672217, 5.000000, -1.944369, 5.000000, -4.878272, 5.000000, -1.806657, 0.000272, 0.000272, 0.000000, 0.000000] + species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.245182, -4.484265, -4.604025, -5.755301, -0.140000, -5.677490, 5.000000, -2.041040, 5.000000, -4.805633, 5.000000, -1.697932, 0.000275, 0.000275, 0.000000, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel_boundedscalar) # 2 species (1 eq) primitive venturi mixing using mixing model including viscosity, thermal conductivity and inlet markers for SA turbulence model @@ -1512,7 +1512,7 @@ def main(): species2_primitiveVenturi_mixingmodel_viscosity.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_viscosity.cfg_file = "species2_primitiveVenturi_mixingmodel_viscosity.cfg" species2_primitiveVenturi_mixingmodel_viscosity.test_iter = 50 - species2_primitiveVenturi_mixingmodel_viscosity.test_vals = [-4.843481, -3.585988, -3.486593, -7.560545, -5.094245, 5.000000, -1.898097, 5.000000, -3.328995, 5.000000, -2.113241, 2.482221, 0.974142, 0.607219, 0.900860] + species2_primitiveVenturi_mixingmodel_viscosity.test_vals = [-4.683799, -3.605373, -3.856939, -7.596825, -5.004036, 5.000000, -1.756685, 5.000000, -3.211492, 5.000000, -2.196172, 2.475062, 0.976018, 0.609194, 0.889849] test_list.append(species2_primitiveVenturi_mixingmodel_viscosity) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity @@ -1536,7 +1536,7 @@ def main(): species2_primitiveVenturi.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi.cfg_file = "species2_primitiveVenturi.cfg" species2_primitiveVenturi.test_iter = 50 - species2_primitiveVenturi.test_vals = [-5.641112, -4.724266, -4.677148, -5.470711, -1.121455, -5.713132, 5.000000, -0.830412, 5.000000, -2.668654, 5.000000, -0.454161, 0.000092, 0.000091, 0.000001, 0.000000] + species2_primitiveVenturi.test_vals = [-5.542102, -4.900688, -4.926701, -5.598524, -1.216075, -5.728735, 5.000000, -1.129509, 5.000000, -2.457650, 5.000000, -0.734335, 0.000184, 0.000182, 0.000002, 0.000000] test_list.append(species2_primitiveVenturi) # 2 species (1 eq) primitive venturi mixing with bounded scalar transport @@ -1544,7 +1544,7 @@ def main(): species_primitiveVenturi_boundedscalar.cfg_dir = "species_transport/venturi_primitive_3species" species_primitiveVenturi_boundedscalar.cfg_file = "species2_primitiveVenturi_boundedscalar.cfg" species_primitiveVenturi_boundedscalar.test_iter = 50 - species_primitiveVenturi_boundedscalar.test_vals = [-5.278467, -4.368236, -4.350556, -5.693359, -0.978845, -5.618393, 5.000000, -1.804015, 5.000000, -4.057089, 5.000000, -2.003816, 0.000415, 0.000415, 0.000000, 0.000000] + species_primitiveVenturi_boundedscalar.test_vals = [-5.127895, -4.405097, -4.514797, -5.665585, -0.954796, -5.619625, 5.000000, -2.144656, 5.000000, -4.019990, 5.000000, -1.751665, 0.000421, 0.000421, 0.000000, 0.000000] test_list.append(species_primitiveVenturi_boundedscalar) # 2 species (1 eq) primitive venturi mixing using mixing model including inlet markers for turbulent intensity and viscosity ratios @@ -1552,7 +1552,7 @@ def main(): species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg_file = "species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg" species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_iter = 50 - species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_vals = [-4.026294, -1.649804, -1.404882, -0.746005, 1.609256, -3.767237, 23.000000, -5.082019, 10.000000, -5.056739, 4.000000, -6.480965, 2.000000, 1.000000, 0.000000, 1.000000] + species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_vals = [-3.965189, -1.676556, -1.657427, -0.681635, 1.478277, -3.761790, 23.000000, -5.105541, 11.000000, -5.356557, 4.000000, -6.578317, 2.000000, 1.000000, 0.000000, 1.000000] test_list.append(species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS) # 3 species (2 eq) primitive venturi mixing with inlet files. @@ -1561,7 +1561,7 @@ def main(): species3_primitiveVenturi_inletFile.cfg_dir = "species_transport/venturi_primitive_3species" species3_primitiveVenturi_inletFile.cfg_file = "species3_primitiveVenturi_inletFile.cfg" species3_primitiveVenturi_inletFile.test_iter = 50 - species3_primitiveVenturi_inletFile.test_vals = [-5.711734, -4.794814, -4.747694, -5.541323, -1.192017, -5.951964, -6.096677, 5.000000, -0.830172, 5.000000, -2.668819, 5.000000, -0.516308] + species3_primitiveVenturi_inletFile.test_vals = [-5.612731, -4.971317, -4.997330, -5.669153, -1.286704, -5.979272, -6.106585, 5.000000, -1.129509, 5.000000, -2.457651, 5.000000, -0.536029] test_list.append(species3_primitiveVenturi_inletFile) # rectangle passive transport validation @@ -1569,7 +1569,7 @@ def main(): species_passive_val.cfg_dir = "species_transport/passive_transport_validation" species_passive_val.cfg_file = "passive_transport.cfg" species_passive_val.test_iter = 50 - species_passive_val.test_vals = [-16.559189, -16.315116, -16.908670, -4.257599, 10, -4.523292, 8, -5.19335, 0.18661, 0] + species_passive_val.test_vals = [-16.552095, -16.335843, -16.932499, -4.257599, 10.000000, -4.652087, 8.000000, -5.193350, 0.186610, 0.000000] species_passive_val.test_vals_aarch64 = [-16.538551, -16.312552, -16.882823, -4.257599, 10, -4.585464, 8, -5.19335, 0.18661, 0] test_list.append(species_passive_val) From ca624c1f24b60b699b454139f77d3e615834fb91 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 8 May 2024 07:34:47 +0200 Subject: [PATCH 092/194] fix regressions --- TestCases/incomp_euler/nozzle/inv_nozzle.cfg | 6 +++--- TestCases/navierstokes/flatplate/lam_flatplate.cfg | 6 +++--- TestCases/vandv.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TestCases/incomp_euler/nozzle/inv_nozzle.cfg b/TestCases/incomp_euler/nozzle/inv_nozzle.cfg index 0c793b2c903..f67f3f69e4c 100644 --- a/TestCases/incomp_euler/nozzle/inv_nozzle.cfg +++ b/TestCases/incomp_euler/nozzle/inv_nozzle.cfg @@ -46,7 +46,7 @@ MARKER_ANALYZE_AVERAGE = AREA % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 15.0 +CFL_NUMBER= 25 % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% % @@ -61,8 +61,8 @@ LINEAR_SOLVER_ITER= 5 MGLEVEL= 3 MGCYCLE= W_CYCLE MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) -MG_POST_SMOOTH= ( 0, 0, 0, 0 ) -MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +MG_POST_SMOOTH= ( 1, 1, 1, 0 ) +MG_CORRECTION_SMOOTH= ( 1, 1, 1, 0 ) MG_DAMP_RESTRICTION= 0.95 MG_DAMP_PROLONGATION= 0.95 diff --git a/TestCases/navierstokes/flatplate/lam_flatplate.cfg b/TestCases/navierstokes/flatplate/lam_flatplate.cfg index 70f595eca06..53cd6bd570d 100644 --- a/TestCases/navierstokes/flatplate/lam_flatplate.cfg +++ b/TestCases/navierstokes/flatplate/lam_flatplate.cfg @@ -60,8 +60,8 @@ LINEAR_SOLVER_ITER= 3 % MGLEVEL= 3 MGCYCLE= V_CYCLE -MG_PRE_SMOOTH= ( 1, 1, 1, 2 ) -MG_POST_SMOOTH= ( 0, 1, 1, 0 ) +MG_PRE_SMOOTH= ( 1, 2, 3, 1 ) +MG_POST_SMOOTH= ( 1, 1, 1, 0 ) MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) MG_DAMP_RESTRICTION= 0.7 MG_DAMP_PROLONGATION= 0.7 @@ -78,7 +78,7 @@ TIME_DISCRE_FLOW= EULER_IMPLICIT CONV_FIELD= RMS_DENSITY CONV_RESIDUAL_MINVAL= -12 CONV_STARTITER= 10 -ITER= 500 +ITER= 5000 % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % diff --git a/TestCases/vandv.py b/TestCases/vandv.py index 3f80cd88fc8..3fc1a7aa673 100644 --- a/TestCases/vandv.py +++ b/TestCases/vandv.py @@ -54,7 +54,7 @@ def main(): flatplate_sst1994m.cfg_dir = "vandv/rans/flatplate" flatplate_sst1994m.cfg_file = "turb_flatplate_sst.cfg" flatplate_sst1994m.test_iter = 5 - flatplate_sst1994m.test_vals = [-13.028095, -11.271115, -11.532461, -8.387610, -11.417974, -5.116988, 0.002808] + flatplate_sst1994m.test_vals = [-13.028410, -10.277801, -11.293512, -8.146806, -10.521546, -5.127399, 0.002775] flatplate_sst1994m.test_vals_aarch64 = [-13.028095, -11.271115, -11.532461, -8.387610, -11.417974, -5.116988, 0.002808] test_list.append(flatplate_sst1994m) @@ -63,7 +63,7 @@ def main(): bump_sst1994m.cfg_dir = "vandv/rans/bump_in_channel" bump_sst1994m.cfg_file = "turb_bump_sst.cfg" bump_sst1994m.test_iter = 5 - bump_sst1994m.test_vals = [-13.034665, -10.510699, -10.627802, -7.661320, -10.680337, -5.749566, 0.004972] + bump_sst1994m.test_vals = [-13.000624, -9.883260, -10.595178, -7.576893, -10.173007, -5.550774, 0.004904] bump_sst1994m.test_vals_aarch64 = [-13.034665, -10.510699, -10.627802, -7.661320, -10.680337, -5.749566, 0.004972] test_list.append(bump_sst1994m) From 98dfead1d62cfbb396b90b4db0d34b1e9bbe3bb9 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 8 May 2024 11:09:28 +0200 Subject: [PATCH 093/194] fix regressions --- .../translating_NACA0012/config.cfg | 20 ++++++++++++------- TestCases/serial_regression_AD.py | 2 +- TestCases/tutorials.py | 2 +- TestCases/vandv.py | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/TestCases/py_wrapper/translating_NACA0012/config.cfg b/TestCases/py_wrapper/translating_NACA0012/config.cfg index 8446a5405a1..a7880927239 100644 --- a/TestCases/py_wrapper/translating_NACA0012/config.cfg +++ b/TestCases/py_wrapper/translating_NACA0012/config.cfg @@ -43,27 +43,33 @@ MARKER_DEFORM_MESH= ( airfoil ) % DISCRETIZATION METHODS % CONV_NUM_METHOD_FLOW= ROE -MUSCL_FLOW= YES -NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +MUSCL_FLOW= NO +NUM_METHOD_GRAD= GREEN_GAUSS SLOPE_LIMITER_FLOW= VENKATAKRISHNAN_WANG VENKAT_LIMITER_COEFF= 0.1 % SOLUTION ACCELERATION % -CFL_NUMBER= 1e3 +CFL_NUMBER= 1000 CFL_ADAPT= NO % MGLEVEL= 3 MGCYCLE= W_CYCLE +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +MG_DAMP_RESTRICTION= 0.7 +MG_DAMP_PROLONGATION= 0.7 + % LINEAR_SOLVER= FGMRES LINEAR_SOLVER_PREC= ILU -LINEAR_SOLVER_ERROR= 0.1 -LINEAR_SOLVER_ITER= 10 +LINEAR_SOLVER_ERROR= 1.0e-6 +LINEAR_SOLVER_ITER= 25 % CONVERGENCE PARAMETERS % -ITER= 250 +ITER= 2500 CONV_FIELD= RMS_DENSITY CONV_RESIDUAL_MINVAL= -9 @@ -71,5 +77,5 @@ CONV_RESIDUAL_MINVAL= -9 % MESH_FILENAME= ../../euler/naca0012/mesh_NACA0012_inv.su2 MESH_FORMAT= SU2 -SCREEN_OUTPUT= (INNER_ITER, RMS_RES, LIFT, DRAG, MOMENT_X, MOMENT_Y, MOMENT_Z) +SCREEN_OUTPUT= (INNER_ITER, RMS_RES, LIFT, DRAG, MOMENT_X, MOMENT_Y, MOMENT_Z, LINSOL_RES, LINSOL_ITER) HISTORY_OUTPUT= (INNER_ITER, RMS_RES, AERO_COEFF) diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index 2a0ac757097..045bdbe20e3 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -328,7 +328,7 @@ def main(): pywrapper_CFD_AD_MeshDisp.cfg_dir = "py_wrapper/disc_adj_flow/mesh_disp_sens" pywrapper_CFD_AD_MeshDisp.cfg_file = "configAD_flow.cfg" pywrapper_CFD_AD_MeshDisp.test_iter = 1000 - pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.518695, 1.390150, 0.000000] #last 4 columns + pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.498365, 1.443758, 0.000000] #last 4 columns pywrapper_CFD_AD_MeshDisp.command = TestCase.Command(exec = "python", param = "run_adjoint.py -f") pywrapper_CFD_AD_MeshDisp.timeout = 1600 pywrapper_CFD_AD_MeshDisp.tol = 0.000001 diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 0f1a303eafc..fd6b5ef4bda 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -116,7 +116,7 @@ def main(): sudo_tutorial.cfg_dir = "../Tutorials/incompressible_flow/Inc_Turbulent_Bend_Wallfunctions" sudo_tutorial.cfg_file = "sudo.cfg" sudo_tutorial.test_iter = 10 - sudo_tutorial.test_vals = [-14.450816, -13.243177, -14.303635, -12.402343, -14.057378, -10.875628, 15.000000, -2.423966] + sudo_tutorial.test_vals = [-14.323795, -13.173296, -14.236070, -12.409590, -14.008028, -10.821351, 15.000000, -2.362015] sudo_tutorial.command = TestCase.Command("mpirun -n 2", "SU2_CFD") test_list.append(sudo_tutorial) diff --git a/TestCases/vandv.py b/TestCases/vandv.py index 3fc1a7aa673..87db07356d4 100644 --- a/TestCases/vandv.py +++ b/TestCases/vandv.py @@ -94,7 +94,7 @@ def main(): sandiajet_sst.cfg_dir = "vandv/species_transport/sandia_jet" sandiajet_sst.cfg_file = "validation.cfg" sandiajet_sst.test_iter = 5 - sandiajet_sst.test_vals = [-17.069026, -13.156800, -15.290567, -11.689831, -9.349978, -14.907311, 5.000000, -2.738947, 5.000000, -4.813747, 5.000000, -3.981740, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] + sandiajet_sst.test_vals = [-17.149598, -13.519201, -15.492514, -12.021166, -9.662163, -15.290253, 5.000000, -2.766857, 5.000000, -4.834011, 5.000000, -3.964822, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] sandiajet_sst.test_vals_aarch64 = [-17.069026, -13.156800, -15.290567, -11.689831, -9.349978, -14.907311, 5.000000, -2.738947, 5.000000, -4.813747, 5.000000, -3.981740, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] test_list.append(sandiajet_sst) From 59985b8ee1be4d61a038d6a416a14364b5fbeec7 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 9 May 2024 00:16:59 +0200 Subject: [PATCH 094/194] fix regressions parallel --- .../lam_prem_ch4_cfd.cfg | 16 ++++---- .../incomp_navierstokes/sphere/sphere.cfg | 4 +- .../chtPinArray_2d/of_grad_findiff.csv.ref | 2 +- TestCases/parallel_regression.py | 38 +++++++++---------- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/TestCases/flamelet/01_laminar_premixed_ch4_flame_cfd/lam_prem_ch4_cfd.cfg b/TestCases/flamelet/01_laminar_premixed_ch4_flame_cfd/lam_prem_ch4_cfd.cfg index 1b927581780..25f64af930d 100644 --- a/TestCases/flamelet/01_laminar_premixed_ch4_flame_cfd/lam_prem_ch4_cfd.cfg +++ b/TestCases/flamelet/01_laminar_premixed_ch4_flame_cfd/lam_prem_ch4_cfd.cfg @@ -13,7 +13,7 @@ SOLVER = INC_NAVIER_STOKES KIND_TURB_MODEL= NONE MATH_PROBLEM= DIRECT -RESTART_SOL = YES +RESTART_SOL = NO % % ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% % @@ -37,15 +37,16 @@ KIND_SCALAR_MODEL= FLAMELET DIFFUSIVITY_MODEL= FLAMELET VISCOSITY_MODEL= FLAMELET CONDUCTIVITY_MODEL= FLAMELET +FLAME_INIT_METHOD= FLAME_FRONT FLAME_INIT= (0.0032, 0.00, 0.00, 1.0, 0.1, 0.0, 1.0e-3, 0.1) % # progvar, enthalpy SPECIES_INIT = (0.0, -210000, 0.0, 0.0) -CONV_NUM_METHOD_SPECIES= SCALAR_UPWIND +CONV_NUM_METHOD_SPECIES= BOUNDED_SCALAR MUSCL_SPECIES= YES SLOPE_LIMITER_SPECIES= NONE TIME_DISCRE_SPECIES= EULER_IMPLICIT % SCALAR CLIPPING -SPECIES_CLIPPING= YES +SPECIES_CLIPPING= NO SPECIES_CLIPPING_MIN= 0 -2e6 0 0 SPECIES_CLIPPING_MAX= 1 2e6 1 1 % @@ -85,9 +86,10 @@ MARKER_ANALYZE_AVERAGE = AREA % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 350 +CFL_NUMBER= 50 +%CFL_NUMBER= 100 CFL_ADAPT= NO -ITER= 100 +ITER= 10000 OUTPUT_WRT_FREQ= 100 % % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% @@ -126,8 +128,8 @@ MESH_FILENAME = mesh_structured.cgns MESH_OUT_FILENAME= mesh_out.su2 SOLUTION_FILENAME= solution RESTART_FILENAME= restart -%OUTPUT_FILES = (RESTART,PARAVIEW,PARAVIEW_MULTIBLOCK) -OUTPUT_FILES = (RESTART) +OUTPUT_FILES = (RESTART,PARAVIEW,PARAVIEW_MULTIBLOCK) +%OUTPUT_FILES = (RESTART) TABULAR_FORMAT = CSV CONV_FILENAME= history VOLUME_FILENAME= ch4_flame_cfd diff --git a/TestCases/incomp_navierstokes/sphere/sphere.cfg b/TestCases/incomp_navierstokes/sphere/sphere.cfg index d526c68e9e1..45237ad8429 100644 --- a/TestCases/incomp_navierstokes/sphere/sphere.cfg +++ b/TestCases/incomp_navierstokes/sphere/sphere.cfg @@ -52,6 +52,8 @@ CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) ITER=1000 VENKAT_LIMITER_COEFF= 0.01 +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% LINEAR_SOLVER= FGMRES LINEAR_SOLVER_PREC= ILU LINEAR_SOLVER_ERROR= 1E-05 @@ -78,7 +80,7 @@ CONV_CAUCHY_EPS= 1E-6 % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % -MESH_FILENAME= sphere_2syms.su2 +MESH_FILENAME= slice_2syms.su2 MESH_FORMAT= SU2 SOLUTION_FILENAME= solution_flow.dat TABULAR_FORMAT= CSV diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref index f959a481490..615bfd49df3 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref @@ -1,2 +1,2 @@ "VARIABLE" , "AVG_DENSITY[0]", "AVG_ENTHALPY[0]", "AVG_NORMALVEL[0]", "DRAG[0]" , "EFFICIENCY[0]" , "FORCE_X[0]" , "FORCE_Y[0]" , "FORCE_Z[0]" , "LIFT[0]" , "MOMENT_X[0]" , "MOMENT_Y[0]" , "MOMENT_Z[0]" , "SIDEFORCE[0]" , "SURFACE_MACH[0]", "SURFACE_MASSFLOW[0]", "SURFACE_MOM_DISTORTION[0]", "SURFACE_PRESSURE_DROP[0]", "SURFACE_SECONDARY[0]", "SURFACE_SECOND_OVER_UNIFORM[0]", "SURFACE_STATIC_PRESSURE[0]", "SURFACE_STATIC_TEMPERATURE[0]", "SURFACE_TOTAL_PRESSURE[0]", "SURFACE_TOTAL_TEMPERATURE[0]", "SURFACE_UNIFORMITY[0]", "AVG_TEMPERATURE[1]", "MAXIMUM_HEATFLUX[1]", "TOTAL_HEATFLUX[1]", "FINDIFF_STEP" -0 , 0.0 , -199999.9862164259, -5.551100000002363e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.02000000026702864, 5.550999999230055e-08, -0.6560000001543109 , 0.0 , 0.6520000012111282 , 1.1399999999550658 , 319.9999980552093 , -39.999997625272954 , 260.999999568412 , -39.999997625272954 , -0.4999999969612645 , -269.99999818144715, 0.0 , -560.0000008598727, 1e-08 +0 , 0.0 , -99999.96982514858, -2.2204000000409886e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.12000000021439305, -1.1100000001884e-08, -0.26799999996995894 , 0.0 , 0.3110000007522373 , 0.3400000003761505 , -170.00000411826477 , -19.99999312829459 , 805.9999998977219 , -19.99999312829459 , 1.1000000021965661 , -349.99999911633495, 0.0 , -680.0000051043753, 1e-08 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 937b3c74583..b6e42f9540c 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -65,7 +65,7 @@ def main(): cfd_flamelet_ch4_partial_premix.cfg_dir = "flamelet/06_laminar_partial_premixed_ch4_flame_cfd" cfd_flamelet_ch4_partial_premix.cfg_file = "lam_partial_prem_ch4_cfd.cfg" cfd_flamelet_ch4_partial_premix.test_iter = 10 - cfd_flamelet_ch4_partial_premix.test_vals = [-10.072805, -11.301138, -4.658971, -13.158224, -11.087511] + cfd_flamelet_ch4_partial_premix.test_vals = [-9.616159, -11.304005, -3.674974, -13.158350, -11.087896] cfd_flamelet_ch4_partial_premix.new_output = True test_list.append(cfd_flamelet_ch4_partial_premix) @@ -74,7 +74,7 @@ def main(): cfd_flamelet_h2.cfg_dir = "flamelet/07_laminar_premixed_h2_flame_cfd" cfd_flamelet_h2.cfg_file = "laminar_premixed_h2_flame_cfd.cfg" cfd_flamelet_h2.test_iter = 5 - cfd_flamelet_h2.test_vals = [-10.003106, -9.843748, -3.289857, -11.338273] + cfd_flamelet_h2.test_vals = [-9.980083, -9.843943, -3.290032, -11.338454] cfd_flamelet_h2.new_output = True test_list.append(cfd_flamelet_h2) @@ -112,7 +112,7 @@ def main(): invwedge_a.cfg_dir = "nonequilibrium/invwedge" invwedge_a.cfg_file = "invwedge_ausm.cfg" invwedge_a.test_iter = 10 - invwedge_a.test_vals = [-1.070904, -1.595667, -18.299980, -18.627372, -18.573382, 2.244654, 1.871030, 5.289134, 0.846502] + invwedge_a.test_vals = [-1.109675, -1.634438, -6.926132, -18.589689, -18.535098, 2.210085, 1.773860, 5.248397, 0.806059] invwedge_a.test_vals_aarch64 = [-1.070904, -1.595667, -18.299980, -18.627372, -18.573382, 2.244654, 1.871030, 5.289134, 0.846502] test_list.append(invwedge_a) @@ -130,7 +130,7 @@ def main(): invwedge_msw.cfg_dir = "nonequilibrium/invwedge" invwedge_msw.cfg_file = "invwedge_msw.cfg" invwedge_msw.test_iter = 10 - invwedge_msw.test_vals = [-1.224649, -1.749412, -18.299151, -18.626550, -18.572552, 2.094106, 1.635779, 5.131012, 0.692821] + invwedge_msw.test_vals = [-1.285985, -1.810748, -6.628826, -18.591401, -18.537038, 2.033350, 1.562604, 5.068007, 0.633614] invwedge_msw.test_vals_aarch64 = [-1.224649, -1.749412, -18.299151, -18.626550, -18.572552, 2.094106, 1.635779, 5.131012, 0.692821] test_list.append(invwedge_msw) @@ -139,7 +139,7 @@ def main(): invwedge_roe.cfg_dir = "nonequilibrium/invwedge" invwedge_roe.cfg_file = "invwedge_roe.cfg" invwedge_roe.test_iter = 10 - invwedge_roe.test_vals = [-1.069128, -1.593891, -17.208222, -17.537969, -17.481352, 2.249020, 1.852904, 5.287143, 0.879852] + invwedge_roe.test_vals = [-1.123344, -1.648108, -6.078352, -17.537650, -17.481027, 2.196776, 1.761928, 5.229494, 0.805395] invwedge_roe.test_vals_aarch64 = [-1.069128, -1.593891, -17.208222, -17.537969, -17.481352, 2.249020, 1.852904, 5.287143, 0.879852] test_list.append(invwedge_roe) @@ -157,7 +157,7 @@ def main(): invwedge_ausm_m.cfg_dir = "nonequilibrium/invwedge" invwedge_ausm_m.cfg_file = "invwedge_am.cfg" invwedge_ausm_m.test_iter = 10 - invwedge_ausm_m.test_vals = [-1.171654, -1.696417, -16.739585, -17.063491, -17.012691, 2.125633, 1.966511, 5.184281, 0.749068] + invwedge_ausm_m.test_vals = [-1.172678, -1.697441, -8.915913, -17.063492, -17.012692, 2.125373, 1.959193, 5.183192, 0.747483] invwedge_ausm_m.test_vals_aarch64 = [-1.171654, -1.696417, -16.739585, -17.063491, -17.012691, 2.125633, 1.966511, 5.184281, 0.749068] test_list.append(invwedge_ausm_m) @@ -166,7 +166,7 @@ def main(): invwedge_ss_inlet.cfg_dir = "nonequilibrium/invwedge" invwedge_ss_inlet.cfg_file = "invwedge_ss_inlet.cfg" invwedge_ss_inlet.test_iter = 10 - invwedge_ss_inlet.test_vals = [-1.069892, -1.594654, -18.250175, -18.579516, -18.523248, 2.245827, 1.871123, 5.290054, 0.847476] + invwedge_ss_inlet.test_vals = [-1.108983, -1.633746, -7.213741, -18.549271, -18.492808, 2.210879, 1.774114, 5.249053, 0.806728] invwedge_ss_inlet.test_vals_aarch64 = [-1.069892, -1.594654, -18.250175, -18.579516, -18.523248, 2.245827, 1.871123, 5.290054, 0.847476] test_list.append(invwedge_ss_inlet) @@ -175,7 +175,7 @@ def main(): visc_cone.cfg_dir = "nonequilibrium/visc_wedge" visc_cone.cfg_file = "axi_visccone.cfg" visc_cone.test_iter = 10 - visc_cone.test_vals = [-5.222267, -5.746523, -20.560279, -20.510152, -20.409102, 1.255758, -3.208380, -0.016014, 0.093462, 32633.000000] + visc_cone.test_vals = [-5.222270, -5.746525, -20.560273, -20.510152, -20.409102, 1.255757, -3.208382, -0.016014, 0.093462, 32619.000000] visc_cone.test_vals_aarch64 = [-5.222267, -5.746523, -20.560279, -20.510152, -20.409102, 1.255758, -3.208380, -0.016014, 0.093462, 32633.000000] test_list.append(visc_cone) @@ -192,7 +192,7 @@ def main(): super_cat.cfg_dir = "nonequilibrium/visc_wedge" super_cat.cfg_file = "super_cat.cfg" super_cat.test_iter = 10 - super_cat.test_vals = [-5.232586, -5.757880, -20.641415, -20.640623, -20.541670, 1.246867, -3.205252, -0.028406, 0.250849, 32457.000000] + super_cat.test_vals = [-5.232595, -5.757889, -20.641415, -20.640623, -20.541670, 1.246865, -3.205258, -0.028390, 0.250641, 32440.000000] test_list.append(super_cat) # Viscous single wedge - partially catalytic walls @@ -200,7 +200,7 @@ def main(): partial_cat.cfg_dir = "nonequilibrium/visc_wedge" partial_cat.cfg_file = "partial_cat.cfg" partial_cat.test_iter = 10 - partial_cat.test_vals = [-5.210300, -5.735063, -20.880453, -20.825975, -23.475263, 1.806201, -2.813952, -0.078465, 0.495977, 29026.000000] + partial_cat.test_vals = [-5.210302, -5.735065, -20.880449, -20.825971, -23.475263, 1.806201, -2.813952, -0.078419, 0.495601, 29020.000000] test_list.append(partial_cat) # Viscous cylinder, ionization, Gupta-Yos @@ -228,7 +228,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-3.839374, -3.307884, 0.094017, 0.085982] + naca0012.test_vals = [-4.546535, -4.056352, 0.321419, 0.023471] test_list.append(naca0012) # Supersonic wedge @@ -236,7 +236,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-0.878443, 4.857425, -0.218783, 0.038583] + wedge.test_vals = [-0.969507, 4.756553, -0.212992, 0.037562] test_list.append(wedge) # ONERA M6 Wing @@ -303,7 +303,7 @@ def main(): flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" flatplate.test_iter = 100 - flatplate.test_vals = [-8.865290, -3.372402, 0.001112, 0.036276, 2.361500, -2.325300, -2.278600, -2.278600] + flatplate.test_vals = [-9.806515, -4.303156, 0.001085, 0.036281, 2.361500, -2.325300, -1.810800, -1.810800] test_list.append(flatplate) # Custom objective function @@ -397,7 +397,7 @@ def main(): turb_oneram6.cfg_dir = "rans/oneram6" turb_oneram6.cfg_file = "turb_ONERAM6.cfg" turb_oneram6.test_iter = 10 - turb_oneram6.test_vals = [-2.388839, -6.689426, 0.230321, 0.157640, -32539.000000] + turb_oneram6.test_vals = [-2.392609, -6.689653, 0.230566, 0.158760, -33786.000000] turb_oneram6.timeout = 3200 test_list.append(turb_oneram6) @@ -415,7 +415,7 @@ def main(): turb_oneram6_nk.cfg_dir = "rans/oneram6" turb_oneram6_nk.cfg_file = "turb_ONERAM6_nk.cfg" turb_oneram6_nk.test_iter = 20 - turb_oneram6_nk.test_vals = [-4.892252, -4.514006, -11.432306, 0.221025, 0.045570, 2.000000, -0.899460, 31.384000] + turb_oneram6_nk.test_vals = [-4.816917, -4.402702, -11.500895, 0.213302, 0.049275, 5.000000, -0.548969, 13.709000] turb_oneram6_nk.timeout = 600 turb_oneram6_nk.tol = 0.0001 test_list.append(turb_oneram6_nk) @@ -514,7 +514,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-12.063597, -7.006585, -8.702557, -4.039824, -2019.8] + axi_rans_air_nozzle_restart.test_vals = [-12.151264, -6.610825, -9.178079, -4.504737, -2019.700000] axi_rans_air_nozzle_restart.tol = 0.0001 test_list.append(axi_rans_air_nozzle_restart) @@ -542,7 +542,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-4.801273, -3.773079, 0.495236, 0.007346] + inc_euler_naca0012.test_vals = [-6.841054, -5.995001, 0.531798, 0.008474] test_list.append(inc_euler_naca0012) # C-D nozzle with pressure inlet and mass flow outlet @@ -550,7 +550,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-5.982321, -4.953536, 0.000454, 0.121390] + inc_nozzle.test_vals = [-5.625156, -4.969409, -0.000001, 0.136610] test_list.append(inc_nozzle) ############################# @@ -1578,7 +1578,7 @@ def main(): species3_multizone_restart.cfg_dir = "species_transport/multizone" species3_multizone_restart.cfg_file = "configMaster.cfg" species3_multizone_restart.test_iter = 5 - species3_multizone_restart.test_vals = [-6.175178, -5.763030] + species3_multizone_restart.test_vals = [-6.235284, -5.746397] species3_multizone_restart.multizone = True test_list.append(species3_multizone_restart) From d9b9dec4d410be359526534a215430a103615f17 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 10 May 2024 14:33:23 +0200 Subject: [PATCH 095/194] fix another bunch of tests --- TestCases/parallel_regression_AD.py | 22 ++++++------ TestCases/serial_regression.py | 56 ++++++++++++++--------------- TestCases/serial_regression_AD.py | 12 +++---- 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 59576fdc410..e4c9d0789f9 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -47,7 +47,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.561506, -8.926634, -0.000000, 0.005587] + discadj_naca0012.test_vals = [-3.563782, -8.924462, -0.000000, 0.005520] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) @@ -55,7 +55,7 @@ def main(): discadj_cylinder3D.cfg_dir = "disc_adj_euler/cylinder3D" discadj_cylinder3D.cfg_file = "inv_cylinder3D.cfg" discadj_cylinder3D.test_iter = 5 - discadj_cylinder3D.test_vals = [-3.734502, -3.839637, 0.000000, 0.000000] + discadj_cylinder3D.test_vals = [-3.815372, -3.772484, 0.000000, 0.000000] test_list.append(discadj_cylinder3D) # Arina nozzle 2D @@ -63,7 +63,7 @@ def main(): discadj_arina2k.cfg_dir = "disc_adj_euler/arina2k" discadj_arina2k.cfg_file = "Arina2KRS.cfg" discadj_arina2k.test_iter = 20 - discadj_arina2k.test_vals = [-3.111181, -3.501516, 6.8705e-02, 0] + discadj_arina2k.test_vals = [-3.258794, -3.542983, 0.056941, 0.000000] test_list.append(discadj_arina2k) # Equivalent area NACA64-206 @@ -71,7 +71,7 @@ def main(): ea_naca64206.cfg_dir = "optimization_euler/equivalentarea_naca64206" ea_naca64206.cfg_file = "NACA64206.cfg" ea_naca64206.test_iter = 10 - ea_naca64206.test_vals = [3.181093, 2.471539, -5487700.0, 8.3604] + ea_naca64206.test_vals = [3.178974, 2.469137, -5469000.000000, 5.525100] test_list.append(ea_naca64206) #################################### @@ -104,7 +104,7 @@ def main(): discadj_incomp_NACA0012.cfg_dir = "disc_adj_incomp_euler/naca0012" discadj_incomp_NACA0012.cfg_file = "incomp_NACA0012_disc.cfg" discadj_incomp_NACA0012.test_iter = 20 - discadj_incomp_NACA0012.test_vals = [20.000000, -4.095412, -2.690483, 0.000000] + discadj_incomp_NACA0012.test_vals = [20.000000, -4.089055, -2.680890, 0.000000] test_list.append(discadj_incomp_NACA0012) ##################################### @@ -150,7 +150,7 @@ def main(): discadj_axisymmetric_rans_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle" discadj_axisymmetric_rans_nozzle.cfg_file = "air_nozzle_restart.cfg" discadj_axisymmetric_rans_nozzle.test_iter = 10 - discadj_axisymmetric_rans_nozzle.test_vals = [9.516464, 5.022130, 7.370705, 2.744551] + discadj_axisymmetric_rans_nozzle.test_vals = [9.558083, 4.972144, 7.373955, 2.749238] discadj_axisymmetric_rans_nozzle.no_restart = True test_list.append(discadj_axisymmetric_rans_nozzle) @@ -217,7 +217,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.223480, -1.639387, -0.007591, 0.000013] + discadj_pitchingNACA0012.test_vals = [-1.224169, -1.645870, -0.007583, 0.000013] discadj_pitchingNACA0012.unsteady = True test_list.append(discadj_pitchingNACA0012) @@ -256,7 +256,7 @@ def main(): discadj_heat.cfg_dir = "disc_adj_heat" discadj_heat.cfg_file = "disc_adj_heat.cfg" discadj_heat.test_iter = 10 - discadj_heat.test_vals = [-2.226539, 0.605868, 0.000000, -6.256400] + discadj_heat.test_vals = [-2.191005, 0.673809, 0.000000, -1.459900] discadj_heat.test_vals_aarch64 = [-2.226539, 0.605868, 0.000000, -6.256400] test_list.append(discadj_heat) @@ -299,7 +299,7 @@ def main(): da_sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" da_sp_pinArray_cht_2d_dp_hf.cfg_file = "DA_configMaster.cfg" da_sp_pinArray_cht_2d_dp_hf.test_iter = 100 - da_sp_pinArray_cht_2d_dp_hf.test_vals = [-4.743218, -4.059800, -4.138231] + da_sp_pinArray_cht_2d_dp_hf.test_vals = [-4.714597, -4.059490, -4.138377] da_sp_pinArray_cht_2d_dp_hf.multizone = True test_list.append(da_sp_pinArray_cht_2d_dp_hf) @@ -308,7 +308,7 @@ def main(): da_sp_pinArray_cht_2d_mf.cfg_dir = "incomp_navierstokes/streamwise_periodic/dp-adjoint_chtPinArray_2d" da_sp_pinArray_cht_2d_mf.cfg_file = "configMaster.cfg" da_sp_pinArray_cht_2d_mf.test_iter = 100 - da_sp_pinArray_cht_2d_mf.test_vals = [-4.611237, -1.290668, -1.453678, -18.507826, -0.859013, -5.755971, -19.067984, -47.993931] + da_sp_pinArray_cht_2d_mf.test_vals = [-4.590241, -1.298039, -1.483182, -18.504193, -0.870844, -5.769486, -19.069564, -47.958462] da_sp_pinArray_cht_2d_mf.multizone = True test_list.append(da_sp_pinArray_cht_2d_mf) @@ -511,7 +511,7 @@ def main(): pywrapper_CFD_AD_MeshDisp.cfg_dir = "py_wrapper/disc_adj_flow/mesh_disp_sens" pywrapper_CFD_AD_MeshDisp.cfg_file = "configAD_flow.cfg" pywrapper_CFD_AD_MeshDisp.test_iter = 1000 - pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.520972485907894, 1.3848377455328362, 0.000000] #last 4 columns + pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.498932, 1.442486, 0.000000] #last 4 columns pywrapper_CFD_AD_MeshDisp.command = TestCase.Command("mpirun -n 2", "python", "run_adjoint.py --parallel -f") pywrapper_CFD_AD_MeshDisp.timeout = 1600 pywrapper_CFD_AD_MeshDisp.tol = 0.000001 diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 8ead4fe8ccf..5ee8f4e24b2 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -64,7 +64,7 @@ def main(): invwedge.cfg_dir = "nonequilibrium/invwedge" invwedge.cfg_file = "invwedge_ausm.cfg" invwedge.test_iter = 10 - invwedge.test_vals = [-1.074519, -1.599282, -18.299959, -18.627370, -18.573382, 2.241084, 1.866240, 5.285351, 0.842916] + invwedge.test_vals = [-1.109139, -1.633902, -6.926718, -18.595761, -18.541262, 2.210611, 1.773983, 5.248999, 0.806600] invwedge.test_vals_aarch64 = [-1.046323, -1.571086, -18.301361, -18.628744, -18.574788, 2.271778, 1.875687, 5.315769, 0.870008] test_list.append(invwedge) @@ -73,7 +73,7 @@ def main(): visc_cone.cfg_dir = "nonequilibrium/visc_wedge" visc_cone.cfg_file = "axi_visccone.cfg" visc_cone.test_iter = 10 - visc_cone.test_vals = [-5.215236, -5.739371, -20.560910, -20.517094, -20.406632, 1.262780, -3.205483, -0.015695, 0.093205, 32655.000000] + visc_cone.test_vals = [-5.215239, -5.739373, -20.560904, -20.517094, -20.406632, 1.262779, -3.205484, -0.015695, 0.093205, 32641.000000] visc_cone.test_vals_aarch64 = [-5.215229, -5.739368, -20.556662, -20.517022, -20.437459, 1.262784, -3.205455, -0.015696, 0.093207, 32656.000000] test_list.append(visc_cone) @@ -101,7 +101,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-3.839778, -3.314410, 0.101982, 0.086755] + naca0012.test_vals = [-4.522897, -4.048118, 0.317967, 0.023046] test_list.append(naca0012) # Supersonic wedge @@ -109,7 +109,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-0.878239, 4.855758, -0.217331, 0.038329] + wedge.test_vals = [-0.970990, 4.753109, -0.212841, 0.037538] test_list.append(wedge) # ONERA M6 Wing @@ -335,7 +335,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-12.063377, -7.005051, -8.705733, -4.036815, -2019.8] + axi_rans_air_nozzle_restart.test_vals = [-12.151561, -6.611250, -9.182304, -4.504822, -2019.700000] axi_rans_air_nozzle_restart.test_vals_aarch64 = [-12.063354, -7.004772, -8.705740, -4.036824, -2019.800000] axi_rans_air_nozzle_restart.tol = 0.0001 test_list.append(axi_rans_air_nozzle_restart) @@ -371,7 +371,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-4.560214, -3.573893, 0.482483, -0.165393] + inc_euler_naca0012.test_vals = [-6.842195, -5.994731, 0.531783, 0.008474] test_list.append(inc_euler_naca0012) # C-D nozzle with pressure inlet and mass flow outlet @@ -379,7 +379,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-5.273920, -4.365578, -0.000035, 0.130649] + inc_nozzle.test_vals = [-5.624852, -4.988399, -0.000123, 0.137031] test_list.append(inc_nozzle) ############################# @@ -558,7 +558,7 @@ def main(): schubauer_klebanoff_transition.cfg_dir = "transition/Schubauer_Klebanoff" schubauer_klebanoff_transition.cfg_file = "transitional_BC_model_ConfigFile.cfg" schubauer_klebanoff_transition.test_iter = 10 - schubauer_klebanoff_transition.test_vals = [-8.002250, -13.240235, 0.000056, 0.007985] + schubauer_klebanoff_transition.test_vals = [-7.957764, -13.240355, 0.000056, 0.007981] test_list.append(schubauer_klebanoff_transition) ##################################### @@ -594,7 +594,7 @@ def main(): contadj_wedge.cfg_dir = "cont_adj_euler/wedge" contadj_wedge.cfg_file = "inv_wedge_ROE.cfg" contadj_wedge.test_iter = 10 - contadj_wedge.test_vals = [2.872447, -2.755769, 1011900.000000, 0.000000] + contadj_wedge.test_vals = [2.872064, -2.756210, 1010800.000000, 0.000000] test_list.append(contadj_wedge) # Inviscid fixed CL NACA0012 @@ -602,7 +602,7 @@ def main(): contadj_fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" contadj_fixedCL_naca0012.cfg_file = "inv_NACA0012_ContAdj.cfg" contadj_fixedCL_naca0012.test_iter = 100 - contadj_fixedCL_naca0012.test_vals = [0.756719, -4.770533, -0.509920, -0.000016] + contadj_fixedCL_naca0012.test_vals = [0.754957, -4.793799, -0.524680, -0.000229] test_list.append(contadj_fixedCL_naca0012) ################################### @@ -725,7 +725,7 @@ def main(): harmonic_balance.cfg_dir = "harmonic_balance" harmonic_balance.cfg_file = "HB.cfg" harmonic_balance.test_iter = 25 - harmonic_balance.test_vals = [-1.567440, 0.815498, 0.928381, 3.947221] + harmonic_balance.test_vals = [-1.567526, 0.815337, 0.928322, 3.947118] test_list.append(harmonic_balance) # Turbulent pitching NACA 64a010 airfoil @@ -745,7 +745,7 @@ def main(): rot_naca0012.cfg_dir = "rotating/naca0012" rot_naca0012.cfg_file = "rot_NACA0012.cfg" rot_naca0012.test_iter = 25 - rot_naca0012.test_vals = [-2.286632, 2.541708, -0.054757, 0.241346] + rot_naca0012.test_vals = [-2.504828, 2.516263, -0.038206, 0.241403] test_list.append(rot_naca0012) # Lid-driven cavity @@ -907,7 +907,7 @@ def main(): uniform_flow.cfg_dir = "sliding_interface/uniform_flow" uniform_flow.cfg_file = "uniform_NN.cfg" uniform_flow.test_iter = 2 - uniform_flow.test_vals = [2.000000, 0.000000, -0.205134, -13.251542] + uniform_flow.test_vals = [2.000000, 0.000000, -0.227792, -13.249789] uniform_flow.test_vals_aarch64 = [2.000000, 0.000000, -0.205134, -13.250720] #last 4 columns uniform_flow.tol = 0.000001 uniform_flow.unsteady = True @@ -919,7 +919,7 @@ def main(): channel_2D.cfg_dir = "sliding_interface/channel_2D" channel_2D.cfg_file = "channel_2D_WA.cfg" channel_2D.test_iter = 2 - channel_2D.test_vals = [2.000000, 0.000000, 0.397995, 0.352789, 0.405474] + channel_2D.test_vals = [2.000000, 0.000000, 0.399774, 0.352588, 0.404800] channel_2D.test_vals_aarch64 = [2.000000, 0.000000, 0.398053, 0.352788, 0.405474] #last 5 columns channel_2D.timeout = 100 channel_2D.unsteady = True @@ -931,7 +931,7 @@ def main(): channel_3D.cfg_dir = "sliding_interface/channel_3D" channel_3D.cfg_file = "channel_3D_WA.cfg" channel_3D.test_iter = 1 - channel_3D.test_vals = [1.000000, 0.000000, 0.661408, 0.769988, 0.696033] + channel_3D.test_vals = [1.000000, 0.000000, 0.650336, 0.768240, 0.693527] channel_3D.test_vals_aarch64 = [1.000000, 0.000000, 0.661408, 0.769902, 0.695663] #last 5 columns channel_3D.unsteady = True channel_3D.multizone = True @@ -942,7 +942,7 @@ def main(): pipe.cfg_dir = "sliding_interface/pipe" pipe.cfg_file = "pipe_NN.cfg" pipe.test_iter = 2 - pipe.test_vals = [0.491954, 0.677756, 0.963981, 1.006936] + pipe.test_vals = [0.484701, 0.675941, 0.987253, 1.008382] pipe.unsteady = True pipe.multizone = True test_list.append(pipe) @@ -952,7 +952,7 @@ def main(): rotating_cylinders.cfg_dir = "sliding_interface/rotating_cylinders" rotating_cylinders.cfg_file = "rot_cylinders_WA.cfg" rotating_cylinders.test_iter = 3 - rotating_cylinders.test_vals = [3.000000, 0.000000, 0.777574, 1.134794, 1.224127] + rotating_cylinders.test_vals = [3.000000, 0.000000, 0.718431, 1.111400, 1.155961] rotating_cylinders.unsteady = True rotating_cylinders.multizone = True test_list.append(rotating_cylinders) @@ -962,7 +962,7 @@ def main(): supersonic_vortex_shedding.cfg_dir = "sliding_interface/supersonic_vortex_shedding" supersonic_vortex_shedding.cfg_file = "sup_vor_shed_WA.cfg" supersonic_vortex_shedding.test_iter = 5 - supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.214359, 1.663910] + supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.208204, 1.034380] supersonic_vortex_shedding.unsteady = True supersonic_vortex_shedding.multizone = True test_list.append(supersonic_vortex_shedding) @@ -1040,7 +1040,7 @@ def main(): fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" fsi2d.cfg_file = "configFSI.cfg" fsi2d.test_iter = 4 - fsi2d.test_vals = [4.000000, 0.000000, -3.743214, -4.133482] + fsi2d.test_vals = [4.000000, 0.000000, -3.729692, -4.151488] fsi2d.multizone = True fsi2d.unsteady = True test_list.append(fsi2d) @@ -1050,7 +1050,7 @@ def main(): stat_fsi.cfg_dir = "fea_fsi/stat_fsi" stat_fsi.cfg_file = "config.cfg" stat_fsi.test_iter = 7 - stat_fsi.test_vals = [-3.326934, -4.981505, 0.000000, 7.000000] + stat_fsi.test_vals = [-3.349405, -4.998915, 0.000000, 6.000000] stat_fsi.multizone = True test_list.append(stat_fsi) @@ -1059,7 +1059,7 @@ def main(): stat_fsi_restart.cfg_dir = "fea_fsi/stat_fsi" stat_fsi_restart.cfg_file = "config_restart.cfg" stat_fsi_restart.test_iter = 1 - stat_fsi_restart.test_vals = [-3.407486, -4.339837, 0.000000, 27.000000] + stat_fsi_restart.test_vals = [-3.395762, -4.286378, 0.000000, 27.000000] stat_fsi_restart.multizone = True test_list.append(stat_fsi_restart) @@ -1068,7 +1068,7 @@ def main(): dyn_fsi.cfg_dir = "fea_fsi/dyn_fsi" dyn_fsi.cfg_file = "config.cfg" dyn_fsi.test_iter = 4 - dyn_fsi.test_vals = [-4.355809, -4.060588, 0.000000, 87.000000] + dyn_fsi.test_vals = [-4.332169, -4.057750, 0.000000, 85.000000] dyn_fsi.test_vals_aarch64 = [-4.355809, -4.060588, 0.000000, 86.000000] #last 4 columns dyn_fsi.multizone = True dyn_fsi.unsteady = True @@ -1426,7 +1426,7 @@ def main(): shape_opt_euler_py.cfg_dir = "optimization_euler/steady_naca0012" shape_opt_euler_py.cfg_file = "inv_NACA0012_adv.cfg" shape_opt_euler_py.test_iter = 1 - shape_opt_euler_py.test_vals = [1, 1, 2.134974E-05, 0.003847] #last 4 columns + shape_opt_euler_py.test_vals = [1.000000, 1.000000, 0.000021, 0.003643] #last 4 columns shape_opt_euler_py.command = TestCase.Command(exec = "shape_optimization.py", param = "-g CONTINUOUS_ADJOINT -f") shape_opt_euler_py.timeout = 1600 shape_opt_euler_py.tol = 0.00001 @@ -1478,7 +1478,7 @@ def main(): opt_multiobj1surf_py.cfg_dir = "optimization_euler/multiobjective_wedge" opt_multiobj1surf_py.cfg_file = "inv_wedge_ROE_multiobj_1surf.cfg" opt_multiobj1surf_py.test_iter = 1 - opt_multiobj1surf_py.test_vals = [1.000000, 1.000000, 30.428280, 2.039416] + opt_multiobj1surf_py.test_vals = [1.000000, 1.000000, 36.215620, 5.286740] opt_multiobj1surf_py.command = TestCase.Command(exec = "shape_optimization.py", param = "-g CONTINUOUS_ADJOINT -f") opt_multiobj1surf_py.timeout = 1600 opt_multiobj1surf_py.tol = 0.00001 @@ -1491,7 +1491,7 @@ def main(): opt_2surf1obj_py.cfg_dir = "optimization_euler/multiobjective_wedge" opt_2surf1obj_py.cfg_file = "inv_wedge_ROE_2surf_1obj.cfg" opt_2surf1obj_py.test_iter = 1 - opt_2surf1obj_py.test_vals = [1.000000, 1.000000, 2.005694, 0.000185] + opt_2surf1obj_py.test_vals = [1.000000, 1.000000, 2.005211, 0.000439] opt_2surf1obj_py.command = TestCase.Command(exec = "shape_optimization.py", param = "-g CONTINUOUS_ADJOINT -f") opt_2surf1obj_py.timeout = 1600 opt_2surf1obj_py.tol = 0.00001 @@ -1508,7 +1508,7 @@ def main(): pywrapper_naca0012.cfg_dir = "euler/naca0012" pywrapper_naca0012.cfg_file = "inv_NACA0012_Roe.cfg" pywrapper_naca0012.test_iter = 20 - pywrapper_naca0012.test_vals = [-4.023999, -3.515034, 0.339426, 0.022217] + pywrapper_naca0012.test_vals = [-4.522897, -4.048118, 0.317967, 0.023046] pywrapper_naca0012.command = TestCase.Command(exec = "SU2_CFD.py", param = "-f") pywrapper_naca0012.timeout = 1600 pywrapper_naca0012.tol = 0.00001 @@ -1549,7 +1549,7 @@ def main(): pywrapper_aeroelastic.cfg_dir = "aeroelastic" pywrapper_aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" pywrapper_aeroelastic.test_iter = 2 - pywrapper_aeroelastic.test_vals = [0.074836, 0.033102, -0.001650, -0.000127] + pywrapper_aeroelastic.test_vals = [0.074344, 0.027575, -0.001579, -0.000160] pywrapper_aeroelastic.command = TestCase.Command(exec = "SU2_CFD.py", param = "-f") pywrapper_aeroelastic.timeout = 1600 pywrapper_aeroelastic.tol = 0.00001 @@ -1563,7 +1563,7 @@ def main(): pywrapper_fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" pywrapper_fsi2d.cfg_file = "configFSI.cfg" pywrapper_fsi2d.test_iter = 4 - pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.743214, -4.133482] + pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.729692, -4.151488] pywrapper_fsi2d.command = TestCase.Command(exec = "SU2_CFD.py", param = "--nZone 2 --fsi True -f") pywrapper_fsi2d.unsteady = True pywrapper_fsi2d.multizone = True diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index a29872c3a61..c5e8ceb4010 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -58,7 +58,7 @@ def main(): discadj_cylinder3D.cfg_dir = "disc_adj_euler/cylinder3D" discadj_cylinder3D.cfg_file = "inv_cylinder3D.cfg" discadj_cylinder3D.test_iter = 5 - discadj_cylinder3D.test_vals = [-3.737675, -3.842311, -0.000000, 0.000000] + discadj_cylinder3D.test_vals = [-3.817600, -3.773760, -0.000000, 0.000000] test_list.append(discadj_cylinder3D) # Arina nozzle 2D @@ -66,7 +66,7 @@ def main(): discadj_arina2k.cfg_dir = "disc_adj_euler/arina2k" discadj_arina2k.cfg_file = "Arina2KRS.cfg" discadj_arina2k.test_iter = 20 - discadj_arina2k.test_vals = [-3.087863, -3.481496, 6.8879e-02, 0] + discadj_arina2k.test_vals = [-3.242098, -3.481371, 0.056338, 0.000000] test_list.append(discadj_arina2k) ####################################################### @@ -98,7 +98,7 @@ def main(): discadj_incomp_NACA0012.cfg_dir = "disc_adj_incomp_euler/naca0012" discadj_incomp_NACA0012.cfg_file = "incomp_NACA0012_disc.cfg" discadj_incomp_NACA0012.test_iter = 20 - discadj_incomp_NACA0012.test_vals = [20.000000, -4.092007, -2.652750, 0.000000] + discadj_incomp_NACA0012.test_vals = [20.000000, -4.084633, -2.650488, 0.000000] test_list.append(discadj_incomp_NACA0012) ##################################### @@ -148,7 +148,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.218846, -1.645199, -0.007645, 0.000013] + discadj_pitchingNACA0012.test_vals = [-1.217443, -1.644605, -0.007635, 0.000013] discadj_pitchingNACA0012.unsteady = True test_list.append(discadj_pitchingNACA0012) @@ -157,7 +157,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform_ad.cfg" unst_deforming_naca0012.test_iter = 4 - unst_deforming_naca0012.test_vals = [-1.958006, -1.841808, 1081.700000, 0.000004] + unst_deforming_naca0012.test_vals = [-1.960344, -1.845102, 2781.900000, 0.000004] unst_deforming_naca0012.unsteady = True test_list.append(unst_deforming_naca0012) @@ -183,7 +183,7 @@ def main(): discadj_heat.cfg_dir = "disc_adj_heat" discadj_heat.cfg_file = "disc_adj_heat.cfg" discadj_heat.test_iter = 10 - discadj_heat.test_vals = [-2.227530, 0.577932, 0.000000, -7.754000] + discadj_heat.test_vals = [-2.200172, 0.565096, 0.000000, -2.087800] test_list.append(discadj_heat) ################################### From ba329169ce9a5b8433c02772f4d1c2227958e9e6 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 11 May 2024 10:22:48 +0200 Subject: [PATCH 096/194] make enum class of mpi_quantities --- Common/include/geometry/CGeometry.hpp | 6 +- Common/include/geometry/CPhysicalGeometry.hpp | 9 +- .../meshreader/CCGNSMeshReaderFVM.hpp | 9 +- Common/include/linear_algebra/CSysMatrix.hpp | 4 +- Common/include/option_structure.hpp | 30 +++- Common/src/geometry/CGeometry.cpp | 42 +++--- Common/src/geometry/CPhysicalGeometry.cpp | 4 +- .../src/grid_movement/CVolumetricMovement.cpp | 4 +- Common/src/linear_algebra/CSysMatrix.cpp | 26 ++-- .../gradients/computeGradientsGreenGauss.hpp | 109 +------------- .../computeGradientsLeastSquares.hpp | 4 +- .../gradients/computeGradientsSymmetry.hpp | 124 ++++++++++++++- SU2_CFD/include/limiters/computeLimiters.hpp | 2 +- .../include/limiters/computeLimiters_impl.hpp | 2 +- .../include/solvers/CFVMFlowSolverBase.hpp | 16 +- .../include/solvers/CFVMFlowSolverBase.inl | 22 +-- SU2_CFD/include/solvers/CScalarSolver.inl | 4 +- SU2_CFD/include/solvers/CSolver.hpp | 6 +- SU2_CFD/src/drivers/CDriver.cpp | 4 +- SU2_CFD/src/drivers/CDriverBase.cpp | 4 +- .../src/integration/CMultiGridIntegration.cpp | 12 +- .../integration/CSingleGridIntegration.cpp | 8 +- .../src/iteration/CDiscAdjFEAIteration.cpp | 8 +- .../src/iteration/CDiscAdjFluidIteration.cpp | 20 +-- .../src/iteration/CDiscAdjHeatIteration.cpp | 4 +- SU2_CFD/src/solvers/CAdjEulerSolver.cpp | 32 ++-- SU2_CFD/src/solvers/CAdjNSSolver.cpp | 4 +- SU2_CFD/src/solvers/CAdjTurbSolver.cpp | 8 +- SU2_CFD/src/solvers/CBaselineSolver.cpp | 12 +- SU2_CFD/src/solvers/CEulerSolver.cpp | 40 ++--- SU2_CFD/src/solvers/CFEASolver.cpp | 4 +- .../src/solvers/CGradientSmoothingSolver.cpp | 8 +- SU2_CFD/src/solvers/CHeatSolver.cpp | 16 +- SU2_CFD/src/solvers/CMeshSolver.cpp | 22 +-- SU2_CFD/src/solvers/CNEMOEulerSolver.cpp | 4 +- SU2_CFD/src/solvers/CNEMONSSolver.cpp | 2 +- SU2_CFD/src/solvers/CRadP1Solver.cpp | 4 +- SU2_CFD/src/solvers/CRadSolver.cpp | 4 +- SU2_CFD/src/solvers/CSolver.cpp | 142 +++++++++--------- .../src/solvers/CSpeciesFlameletSolver.cpp | 10 +- SU2_CFD/src/solvers/CSpeciesSolver.cpp | 12 +- SU2_CFD/src/solvers/CTransLMSolver.cpp | 12 +- SU2_CFD/src/solvers/CTurbSASolver.cpp | 4 +- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 4 +- SU2_CFD/src/solvers/CTurbSolver.cpp | 8 +- .../chtPinArray_2d/of_grad_findiff.csv.ref | 2 +- UnitTests/SU2_CFD/gradients.cpp | 8 +- 47 files changed, 452 insertions(+), 393 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index 1896e90a7e9..5b99629f5e4 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -426,7 +426,7 @@ class CGeometry { * \param[out] COUNT_PER_POINT - Number of communicated variables per point. * \param[out] MPI_TYPE - Enumerated type for the datatype of the quantity to be communicated. */ - void GetCommCountAndType(const CConfig* config, unsigned short commType, unsigned short& COUNT_PER_POINT, + void GetCommCountAndType(const CConfig* config, ENUM_MPI_QUANTITIES commType, unsigned short& COUNT_PER_POINT, unsigned short& MPI_TYPE) const; /*! @@ -436,14 +436,14 @@ class CGeometry { * \param[in] config - Definition of the particular problem. * \param[in] commType - Enumerated type for the quantity to be communicated. */ - void InitiateComms(CGeometry* geometry, const CConfig* config, unsigned short commType) const; + void InitiateComms(CGeometry* geometry, const CConfig* config, ENUM_MPI_QUANTITIES commType) const; /*! * \brief Routine to complete the set of non-blocking communications launched by InitiateComms() and unpacking of the * data into the geometry class. \param[in] geometry - Geometrical definition of the problem. \param[in] config - * Definition of the particular problem. \param[in] commType - Enumerated type for the quantity to be unpacked. */ - void CompleteComms(CGeometry* geometry, const CConfig* config, unsigned short commType); + void CompleteComms(CGeometry* geometry, const CConfig* config, ENUM_MPI_QUANTITIES commType); /*! * \brief Get number of coordinates. diff --git a/Common/include/geometry/CPhysicalGeometry.hpp b/Common/include/geometry/CPhysicalGeometry.hpp index 10e781cb85e..070bf015ab8 100644 --- a/Common/include/geometry/CPhysicalGeometry.hpp +++ b/Common/include/geometry/CPhysicalGeometry.hpp @@ -208,10 +208,13 @@ class CPhysicalGeometry final : public CGeometry { * \brief Routine to launch non-blocking sends and recvs amongst all processors. * \param[in] bufSend - Buffer of data to be sent. * \param[in] nElemSend - Array containing the number of elements to send to other processors in cumulative storage - * format. \param[in] sendReq - Array of MPI send requests. \param[in] bufRecv - Buffer of data to be received. + * format. + * \param[in] sendReq - Array of MPI send requests. + * \param[in] bufRecv - Buffer of data to be received. * \param[in] nElemSend - Array containing the number of elements to receive from other processors in cumulative - * storage format. \param[in] sendReq - Array of MPI recv requests. \param[in] countPerElem - Pieces of data per - * element communicated. + * storage format. + * \param[in] sendReq - Array of MPI recv requests. + * \param[in] countPerElem - Pieces of data per element communicated. */ void InitiateCommsAll(void* bufSend, const int* nElemSend, SU2_MPI::Request* sendReq, void* bufRecv, const int* nElemRecv, SU2_MPI::Request* recvReq, unsigned short countPerElem, diff --git a/Common/include/geometry/meshreader/CCGNSMeshReaderFVM.hpp b/Common/include/geometry/meshreader/CCGNSMeshReaderFVM.hpp index 7ef5ef88206..3b072222d41 100644 --- a/Common/include/geometry/meshreader/CCGNSMeshReaderFVM.hpp +++ b/Common/include/geometry/meshreader/CCGNSMeshReaderFVM.hpp @@ -121,10 +121,13 @@ class CCGNSMeshReaderFVM : public CMeshReaderFVM { * \brief Routine to launch non-blocking sends and recvs amongst all processors. * \param[in] bufSend - Buffer of data to be sent. * \param[in] nElemSend - Array containing the number of elements to send to other processors in cumulative storage - * format. \param[in] sendReq - Array of MPI send requests. \param[in] bufRecv - Buffer of data to be received. + * format. + * \param[in] sendReq - Array of MPI send requests. + * \param[in] bufRecv - Buffer of data to be received. * \param[in] nElemSend - Array containing the number of elements to receive from other processors in cumulative - * storage format. \param[in] sendReq - Array of MPI recv requests. \param[in] countPerElem - Pieces of data per - * element communicated. + * storage format. + * \param[in] sendReq - Array of MPI recv requests. + * \param[in] countPerElem - Pieces of data per element communicated. */ void InitiateCommsAll(void* bufSend, const int* nElemSend, SU2_MPI::Request* sendReq, void* bufRecv, const int* nElemRecv, SU2_MPI::Request* recvReq, unsigned short countPerElem, diff --git a/Common/include/linear_algebra/CSysMatrix.hpp b/Common/include/linear_algebra/CSysMatrix.hpp index 573e6217d93..b1db01f0c1a 100644 --- a/Common/include/linear_algebra/CSysMatrix.hpp +++ b/Common/include/linear_algebra/CSysMatrix.hpp @@ -92,7 +92,7 @@ struct CSysMatrixComms { */ template static void Initiate(const CSysVector& x, CGeometry* geometry, const CConfig* config, - unsigned short commType = SOLUTION_MATRIX); + ENUM_MPI_QUANTITIES commType = ENUM_MPI_QUANTITIES::SOLUTION_MATRIX); /*! * \brief Routine to complete the set of non-blocking communications launched by @@ -104,7 +104,7 @@ struct CSysMatrixComms { */ template static void Complete(CSysVector& x, CGeometry* geometry, const CConfig* config, - unsigned short commType = SOLUTION_MATRIX); + ENUM_MPI_QUANTITIES commType = ENUM_MPI_QUANTITIES::SOLUTION_MATRIX); }; /*! diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 919aefa65b9..55b8fcf54d6 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -2498,7 +2498,7 @@ enum PERIODIC_QUANTITIES { /*! * \brief Vertex-based quantities exchanged in MPI point-to-point communications. */ -enum MPI_QUANTITIES { +enum class ENUM_MPI_QUANTITIES { SOLUTION , /*!< \brief Conservative solution communication. */ SOLUTION_OLD , /*!< \brief Conservative solution old communication. */ SOLUTION_GRADIENT , /*!< \brief Conservative solution gradient communication. */ @@ -2526,6 +2526,34 @@ enum MPI_QUANTITIES { SOLUTION_TIME_N1 , /*!< \brief Solution at time n-1. */ }; +static const MapType MPI_Quantities_Map = { + MakePair("SOLUTION", ENUM_MPI_QUANTITIES::SOLUTION) + MakePair("SOLUTION_OLD", ENUM_MPI_QUANTITIES::SOLUTION_OLD) + MakePair("SOLUTION_GRADIENT", ENUM_MPI_QUANTITIES::SOLUTION_GRADIENT) + MakePair("SOLUTION_GRAD_REC", ENUM_MPI_QUANTITIES::SOLUTION_GRAD_REC) + MakePair("SOLUTION_LIMITER", ENUM_MPI_QUANTITIES::SOLUTION_LIMITER) + MakePair("SOLUTION_GEOMETRY", ENUM_MPI_QUANTITIES::SOLUTION_GEOMETRY) + MakePair("PRIMITIVE_GRADIENT", ENUM_MPI_QUANTITIES::PRIMITIVE_GRADIENT) + MakePair("PRIMITIVE_GRAD_REC", ENUM_MPI_QUANTITIES::PRIMITIVE_GRAD_REC) + MakePair("PRIMITIVE_LIMITER", ENUM_MPI_QUANTITIES::PRIMITIVE_LIMITER) + MakePair("UNDIVIDED_LAPLACIAN", ENUM_MPI_QUANTITIES::UNDIVIDED_LAPLACIAN) + MakePair("MAX_EIGENVALUE", ENUM_MPI_QUANTITIES::MAX_EIGENVALUE) + MakePair("SENSOR", ENUM_MPI_QUANTITIES::SENSOR) + MakePair("AUXVAR_GRADIENT", ENUM_MPI_QUANTITIES::AUXVAR_GRADIENT) + MakePair("COORDINATES", ENUM_MPI_QUANTITIES::COORDINATES) + MakePair("COORDINATES_OLD", ENUM_MPI_QUANTITIES::COORDINATES_OLD) + MakePair("MAX_LENGTH", ENUM_MPI_QUANTITIES::MAX_LENGTH) + MakePair("GRID_VELOCITY", ENUM_MPI_QUANTITIES::GRID_VELOCITY) + MakePair("SOLUTION_EDDY", ENUM_MPI_QUANTITIES::SOLUTION_EDDY) + MakePair("SOLUTION_MATRIX", ENUM_MPI_QUANTITIES::SOLUTION_MATRIX) + MakePair("SOLUTION_MATRIXTRANS", ENUM_MPI_QUANTITIES::SOLUTION_MATRIXTRANS) + MakePair("NEIGHBORS", ENUM_MPI_QUANTITIES::NEIGHBORS) + MakePair("SOLUTION_FEA", ENUM_MPI_QUANTITIES::SOLUTION_FEA) + MakePair("MESH_DISPLACEMENTS", ENUM_MPI_QUANTITIES::MESH_DISPLACEMENTS) + MakePair("SOLUTION_TIME_N", ENUM_MPI_QUANTITIES::SOLUTION_TIME_N) + MakePair("SOLUTION_TIME_N1", ENUM_MPI_QUANTITIES::SOLUTION_TIME_N1) +}; + /*! * \brief MPI communication level */ diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index bd4a2836e66..b43d8bed396 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -543,29 +543,29 @@ void CGeometry::PostP2PSends(CGeometry* geometry, const CConfig* config, unsigne END_SU2_OMP_MASTER } -void CGeometry::GetCommCountAndType(const CConfig* config, unsigned short commType, unsigned short& COUNT_PER_POINT, - unsigned short& MPI_TYPE) const { +void CGeometry::GetCommCountAndType(const CConfig* config, ENUM_MPI_QUANTITIES commType, + unsigned short& COUNT_PER_POINT, unsigned short& MPI_TYPE) const { switch (commType) { - case COORDINATES: + case ENUM_MPI_QUANTITIES::COORDINATES: COUNT_PER_POINT = nDim; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case GRID_VELOCITY: + case ENUM_MPI_QUANTITIES::GRID_VELOCITY: COUNT_PER_POINT = nDim; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case COORDINATES_OLD: + case ENUM_MPI_QUANTITIES::COORDINATES_OLD: if (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_2ND) COUNT_PER_POINT = nDim * 2; else COUNT_PER_POINT = nDim; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case MAX_LENGTH: + case ENUM_MPI_QUANTITIES::MAX_LENGTH: COUNT_PER_POINT = 1; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case NEIGHBORS: + case ENUM_MPI_QUANTITIES::NEIGHBORS: COUNT_PER_POINT = 1; MPI_TYPE = COMM_TYPE_UNSIGNED_SHORT; break; @@ -575,7 +575,7 @@ void CGeometry::GetCommCountAndType(const CConfig* config, unsigned short commTy } } -void CGeometry::InitiateComms(CGeometry* geometry, const CConfig* config, unsigned short commType) const { +void CGeometry::InitiateComms(CGeometry* geometry, const CConfig* config, ENUM_MPI_QUANTITIES commType) const { if (nP2PSend == 0) return; /*--- Local variables ---*/ @@ -633,15 +633,15 @@ void CGeometry::InitiateComms(CGeometry* geometry, const CConfig* config, unsign buf_offset = (msg_offset + iSend) * COUNT_PER_POINT; switch (commType) { - case COORDINATES: + case ENUM_MPI_QUANTITIES::COORDINATES: vector = nodes->GetCoord(iPoint); for (iDim = 0; iDim < nDim; iDim++) bufDSend[buf_offset + iDim] = vector[iDim]; break; - case GRID_VELOCITY: + case ENUM_MPI_QUANTITIES::GRID_VELOCITY: vector = nodes->GetGridVel(iPoint); for (iDim = 0; iDim < nDim; iDim++) bufDSend[buf_offset + iDim] = vector[iDim]; break; - case COORDINATES_OLD: + case ENUM_MPI_QUANTITIES::COORDINATES_OLD: vector = nodes->GetCoord_n(iPoint); for (iDim = 0; iDim < nDim; iDim++) { bufDSend[buf_offset + iDim] = vector[iDim]; @@ -653,10 +653,10 @@ void CGeometry::InitiateComms(CGeometry* geometry, const CConfig* config, unsign } } break; - case MAX_LENGTH: + case ENUM_MPI_QUANTITIES::MAX_LENGTH: bufDSend[buf_offset] = nodes->GetMaxLength(iPoint); break; - case NEIGHBORS: + case ENUM_MPI_QUANTITIES::NEIGHBORS: bufSSend[buf_offset] = geometry->nodes->GetnNeighbor(iPoint); break; default: @@ -672,7 +672,7 @@ void CGeometry::InitiateComms(CGeometry* geometry, const CConfig* config, unsign } } -void CGeometry::CompleteComms(CGeometry* geometry, const CConfig* config, unsigned short commType) { +void CGeometry::CompleteComms(CGeometry* geometry, const CConfig* config, ENUM_MPI_QUANTITIES commType) { if (nP2PRecv == 0) return; /*--- Local variables ---*/ @@ -734,21 +734,21 @@ void CGeometry::CompleteComms(CGeometry* geometry, const CConfig* config, unsign /*--- Store the data correctly depending on the quantity. ---*/ switch (commType) { - case COORDINATES: + case ENUM_MPI_QUANTITIES::COORDINATES: for (iDim = 0; iDim < nDim; iDim++) nodes->SetCoord(iPoint, iDim, bufDRecv[buf_offset + iDim]); break; - case GRID_VELOCITY: + case ENUM_MPI_QUANTITIES::GRID_VELOCITY: for (iDim = 0; iDim < nDim; iDim++) nodes->SetGridVel(iPoint, iDim, bufDRecv[buf_offset + iDim]); break; - case COORDINATES_OLD: + case ENUM_MPI_QUANTITIES::COORDINATES_OLD: nodes->SetCoord_n(iPoint, &bufDRecv[buf_offset]); if (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_2ND) nodes->SetCoord_n1(iPoint, &bufDRecv[buf_offset + nDim]); break; - case MAX_LENGTH: + case ENUM_MPI_QUANTITIES::MAX_LENGTH: nodes->SetMaxLength(iPoint, bufDRecv[buf_offset]); break; - case NEIGHBORS: + case ENUM_MPI_QUANTITIES::NEIGHBORS: nodes->SetnNeighbor(iPoint, bufSRecv[buf_offset]); break; default: @@ -2327,8 +2327,8 @@ void CGeometry::RegisterCoordinates() const { } void CGeometry::UpdateGeometry(CGeometry** geometry_container, CConfig* config) { - geometry_container[MESH_0]->InitiateComms(geometry_container[MESH_0], config, COORDINATES); - geometry_container[MESH_0]->CompleteComms(geometry_container[MESH_0], config, COORDINATES); + geometry_container[MESH_0]->InitiateComms(geometry_container[MESH_0], config, ENUM_MPI_QUANTITIES::COORDINATES); + geometry_container[MESH_0]->CompleteComms(geometry_container[MESH_0], config, ENUM_MPI_QUANTITIES::COORDINATES); geometry_container[MESH_0]->SetControlVolume(config, UPDATE); geometry_container[MESH_0]->SetBoundControlVolume(config, UPDATE); diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 0d06dac6eec..91f76063098 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -6364,8 +6364,8 @@ void CPhysicalGeometry::SetMaxLength(CConfig* config) { } END_SU2_OMP_FOR - InitiateComms(this, config, MAX_LENGTH); - CompleteComms(this, config, MAX_LENGTH); + InitiateComms(this, config, ENUM_MPI_QUANTITIES::MAX_LENGTH); + CompleteComms(this, config, ENUM_MPI_QUANTITIES::MAX_LENGTH); } void CPhysicalGeometry::MatchActuator_Disk(const CConfig* config) { diff --git a/Common/src/grid_movement/CVolumetricMovement.cpp b/Common/src/grid_movement/CVolumetricMovement.cpp index 5b09a9cdd71..0c4aff9595c 100644 --- a/Common/src/grid_movement/CVolumetricMovement.cpp +++ b/Common/src/grid_movement/CVolumetricMovement.cpp @@ -76,8 +76,8 @@ void CVolumetricMovement::UpdateGridCoord(CGeometry* geometry, CConfig* config) * Hence we still need a communication of the transformed coordinates, otherwise periodicity * is not maintained. ---*/ - geometry->InitiateComms(geometry, config, COORDINATES); - geometry->CompleteComms(geometry, config, COORDINATES); + geometry->InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::COORDINATES); + geometry->CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::COORDINATES); } void CVolumetricMovement::UpdateDualGrid(CGeometry* geometry, CConfig* config) { diff --git a/Common/src/linear_algebra/CSysMatrix.cpp b/Common/src/linear_algebra/CSysMatrix.cpp index 10747fadbcb..55c0be66cfd 100644 --- a/Common/src/linear_algebra/CSysMatrix.cpp +++ b/Common/src/linear_algebra/CSysMatrix.cpp @@ -226,7 +226,7 @@ void CSysMatrix::Initialize(unsigned long npoint, unsigned long npoi template void CSysMatrixComms::Initiate(const CSysVector& x, CGeometry* geometry, const CConfig* config, - unsigned short commType) { + ENUM_MPI_QUANTITIES commType) { if (geometry->nP2PSend == 0) return; /*--- Local variables ---*/ @@ -236,13 +236,13 @@ void CSysMatrixComms::Initiate(const CSysVector& x, CGeometry* geometry, cons /*--- Create a boolean for reversing the order of comms. ---*/ - const bool reverse = (commType == SOLUTION_MATRIXTRANS); + const bool reverse = (commType == ENUM_MPI_QUANTITIES::SOLUTION_MATRIXTRANS); /*--- Set the size of the data packet and type depending on quantity. ---*/ switch (commType) { - case SOLUTION_MATRIX: - case SOLUTION_MATRIXTRANS: + case ENUM_MPI_QUANTITIES::SOLUTION_MATRIX: + case ENUM_MPI_QUANTITIES::SOLUTION_MATRIXTRANS: break; default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", CURRENT_FUNCTION); @@ -265,7 +265,7 @@ void CSysMatrixComms::Initiate(const CSysVector& x, CGeometry* geometry, cons for (auto iMessage = 0; iMessage < geometry->nP2PSend; iMessage++) { switch (commType) { - case SOLUTION_MATRIX: { + case ENUM_MPI_QUANTITIES::SOLUTION_MATRIX: { su2double* bufDSend = geometry->bufD_P2PSend; /*--- Get the offset for the start of this message. ---*/ @@ -294,7 +294,7 @@ void CSysMatrixComms::Initiate(const CSysVector& x, CGeometry* geometry, cons break; } - case SOLUTION_MATRIXTRANS: { + case ENUM_MPI_QUANTITIES::SOLUTION_MATRIXTRANS: { /*--- We are going to communicate in reverse, so we use the recv buffer for the send instead. Also, all of the offsets and counts are derived from the recv data structures. ---*/ @@ -341,7 +341,8 @@ void CSysMatrixComms::Initiate(const CSysVector& x, CGeometry* geometry, cons } template -void CSysMatrixComms::Complete(CSysVector& x, CGeometry* geometry, const CConfig* config, unsigned short commType) { +void CSysMatrixComms::Complete(CSysVector& x, CGeometry* geometry, const CConfig* config, + ENUM_MPI_QUANTITIES commType) { if (geometry->nP2PRecv == 0) return; /*--- Local variables ---*/ @@ -366,7 +367,7 @@ void CSysMatrixComms::Complete(CSysVector& x, CGeometry* geometry, const CCon const auto source = status.MPI_SOURCE; switch (commType) { - case SOLUTION_MATRIX: { + case ENUM_MPI_QUANTITIES::SOLUTION_MATRIX: { const su2double* bufDRecv = geometry->bufD_P2PRecv; /*--- We know the offsets based on the source rank. ---*/ @@ -400,7 +401,7 @@ void CSysMatrixComms::Complete(CSysVector& x, CGeometry* geometry, const CCon break; } - case SOLUTION_MATRIXTRANS: { + case ENUM_MPI_QUANTITIES::SOLUTION_MATRIXTRANS: { /*--- We are going to communicate in reverse, so we use the send buffer for the recv instead. Also, all of the offsets and counts are derived from the send data structures. ---*/ @@ -1196,9 +1197,10 @@ void CSysMatrix::ComputePastixPreconditioner(const CSysVector(const CSysVector&, CGeometry*, const CConfig*, unsigned short); \ - template void CSysMatrixComms::Complete(CSysVector&, CGeometry*, const CConfig*, unsigned short); +#define INSTANTIATE_COMMS(TYPE) \ + template void CSysMatrixComms::Initiate(const CSysVector&, CGeometry*, const CConfig*, \ + ENUM_MPI_QUANTITIES); \ + template void CSysMatrixComms::Complete(CSysVector&, CGeometry*, const CConfig*, ENUM_MPI_QUANTITIES); #define INSTANTIATE_MATRIX(TYPE) \ template class CSysMatrix; \ diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 9a35a57c378..4c44c90ce73 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -57,11 +57,11 @@ namespace detail { * \param[out] gradient - Generic object implementing operator (iPoint, iVar, iDim). */ template -void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, +void computeGradientsGreenGauss(CSolver* solver, ENUM_MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, size_t varEnd, GradientType& gradient) { const size_t nPointDomain = geometry.GetnPointDomain(); - bool isFlowSolver = solver->GetSolverName().find("FLOW") != string::npos; + bool isFlowSolver = (solver->GetSolverName().find("FLOW") != string::npos) ; #ifdef HAVE_OMP constexpr size_t OMP_MAX_CHUNK = 512; @@ -163,108 +163,9 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } //found right marker } // iMarkers - /* For symmetry planes, we need to impose the conditions (Blazek eq. 8.40): - * 1. n.grad(phi) = 0 - * 2. n.grad(v.t) = 0 - * 3. t.grad(v.n) = 0 - */ - /*--- Check how many symmetry planes there are ---*/ - unsigned short Syms[MAXNSYMS] = {0}; - unsigned short nSym = 0; - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { - if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - Syms[nSym] = iMarker; - nSym++; - } - } - - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { - - if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - SU2_OMP_FOR_STAT(32) - for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { - - size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - - /*--- Normal vector for this vertex (negate for outward convention). ---*/ - const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); - - const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); - - su2double UnitNormal[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; iDim++) - UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - - /*--- Normal of the primary symmetry plane ---*/ - su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - - /*--- At this point we can find out if the node is shared with another symmetry. - * Step 1: do we have other symmetries? ---*/ - if (nSym>1) { - /*--- Step 2: are we on a shared node? ---*/ - for (auto jMarker=0;jMarkerGetNode(); - if (iPoint==jPoint) { - /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ - if (Syms[jMarker]GetNormal(NormalPrim); - su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - for(unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - } - - /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ - su2double ProjNorm = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - /*--- We check if the normal of the 2 planes coincide. - * We only update the normal if the normals of the symmetry planes are different. ---*/ - if (fabs(1.0-ProjNorm)>EPS) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - /* Make normalized vector ---*/ - su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; - } - } - } - } - } - } - } - - - /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ - su2activematrix TensorMap(nDim,nDim); - - /*--- Compute a new base for TensorMap aligned with the unit normal ---*/ - BaseFromNormal(nDim,UnitNormal,TensorMap); - - su2activematrix Gradients_iPoint(varEnd-varBegin,nDim); - - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - Gradients_iPoint[iVar][iDim] = gradient(iPoint, iVar, iDim); - } - } - - ReflectGradient(nDim, varBegin,varEnd, isFlowSolver, TensorMap, Gradients_iPoint); - - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradient(iPoint, iVar, iDim) = Gradients_iPoint[iVar][iDim]; - } - } - - } // loop over vertices - END_SU2_OMP_FOR - } // symmetry - } // markers + /* --- compute the corrections for symmetry planes and Euler walls. --- */ + computeGradientsSymmetry(nDim, solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, varEnd, gradient); /*--- If no solver was provided we do not communicate ---*/ @@ -291,7 +192,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER * \ingroup FvmAlgos */ template -void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, +void computeGradientsGreenGauss(CSolver* solver, ENUM_MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, size_t varEnd, GradientType& gradient) { switch (geometry.GetnDim()) { diff --git a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp index 31461ab38a7..4c506d03f2f 100644 --- a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp +++ b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp @@ -181,7 +181,7 @@ FORCEINLINE void solveLeastSquares(size_t iPoint, */ template void computeGradientsLeastSquares(CSolver* solver, - MPI_QUANTITIES kindMpiComm, + ENUM_MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, @@ -440,7 +440,7 @@ void computeGradientsLeastSquares(CSolver* solver, */ template void computeGradientsLeastSquares(CSolver* solver, - MPI_QUANTITIES kindMpiComm, + ENUM_MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index 87c96770423..f33b3dd9217 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -32,7 +32,7 @@ #include "../../../Common/include/parallelization/omp_structure.hpp" #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" - +namespace detail { /*! * \brief Reflect a gradient using a tensor mapping. Used for symmetry reflection. @@ -197,3 +197,125 @@ inline void BaseFromNormal(Int nDim, const Scalar* UnitNormal, Matrix& TensorMap } } // switch } + + +} + + +template +void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, ENUM_MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, + CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, + size_t varEnd, GradientType& gradient) { + + const size_t nPointDomain = geometry.GetnPointDomain(); + bool isFlowSolver = (solver->GetSolverName().find("FLOW") != string::npos) ; + + static constexpr size_t MAXNVAR = 20; + static constexpr size_t MAXNDIM = 3; + static constexpr size_t MAXNSYMS = 100; + + /* For symmetry planes, we need to impose the conditions (Blazek eq. 8.40): + * 1. n.grad(phi) = 0 + * 2. n.grad(v.t) = 0 + * 3. t.grad(v.n) = 0 + */ + /*--- Check how many symmetry planes there are ---*/ + unsigned short Syms[MAXNSYMS] = {0}; + unsigned short nSym = 0; + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { + if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + Syms[nSym] = iMarker; + nSym++; + } + } + + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { + + if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + SU2_OMP_FOR_STAT(32) + for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { + + size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); + + /*--- Normal vector for this vertex (negate for outward convention). ---*/ + const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); + + const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); + + su2double UnitNormal[nDim] = {0.0}; + for (size_t iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = VertexNormal[iDim] / NormArea; + + /*--- Normal of the primary symmetry plane ---*/ + su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; + + /*--- At this point we can find out if the node is shared with another symmetry. + * Step 1: do we have other symmetries? ---*/ + if (nSym>1) { + /*--- Step 2: are we on a shared node? ---*/ + for (auto jMarker=0;jMarkerGetNode(); + if (iPoint==jPoint) { + /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ + if (Syms[jMarker]GetNormal(NormalPrim); + su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); + for(unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; + } + + /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ + su2double ProjNorm = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + /*--- We check if the normal of the 2 planes coincide. + * We only update the normal if the normals of the symmetry planes are different. ---*/ + if (fabs(1.0-ProjNorm)>EPS) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; + /* Make normalized vector ---*/ + su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; + } + } + } + } + } + } + } + + /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ + su2activematrix TensorMap(nDim,nDim); + + /*--- Compute a new base for TensorMap aligned with the unit normal ---*/ + detail::BaseFromNormal(nDim,UnitNormal,TensorMap); + + su2activematrix Gradients_iPoint(varEnd-varBegin,nDim); + + for (auto iVar = varBegin; iVar < varEnd; iVar++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + Gradients_iPoint[iVar][iDim] = gradient(iPoint, iVar, iDim); + } + } + + detail::ReflectGradient(nDim, varBegin,varEnd, isFlowSolver, TensorMap, Gradients_iPoint); + + for (auto iVar = varBegin; iVar < varEnd; iVar++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + gradient(iPoint, iVar, iDim) = Gradients_iPoint[iVar][iDim]; + } + } + + } // loop over vertices + END_SU2_OMP_FOR + } // symmetry + } // markers + + + +} + diff --git a/SU2_CFD/include/limiters/computeLimiters.hpp b/SU2_CFD/include/limiters/computeLimiters.hpp index fe92064fd04..34ba4d2bfa1 100644 --- a/SU2_CFD/include/limiters/computeLimiters.hpp +++ b/SU2_CFD/include/limiters/computeLimiters.hpp @@ -38,7 +38,7 @@ template void computeLimiters(LIMITER LimiterKind, CSolver* solver, - MPI_QUANTITIES kindMpiComm, + ENUM_MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm1, PERIODIC_QUANTITIES kindPeriodicComm2, CGeometry& geometry, diff --git a/SU2_CFD/include/limiters/computeLimiters_impl.hpp b/SU2_CFD/include/limiters/computeLimiters_impl.hpp index ec835610f65..ebbf056fafb 100644 --- a/SU2_CFD/include/limiters/computeLimiters_impl.hpp +++ b/SU2_CFD/include/limiters/computeLimiters_impl.hpp @@ -63,7 +63,7 @@ */ template void computeLimiters_impl(CSolver* solver, - MPI_QUANTITIES kindMpiComm, + ENUM_MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm1, PERIODIC_QUANTITIES kindPeriodicComm2, CGeometry& geometry, diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index 9a9eae08fdc..a1a6f9dfb6b 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -714,8 +714,8 @@ class CFVMFlowSolverBase : public CSolver { /*--- MPI parallelization ---*/ - InitiateComms(geometry, config, MAX_EIGENVALUE); - CompleteComms(geometry, config, MAX_EIGENVALUE); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::MAX_EIGENVALUE); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::MAX_EIGENVALUE); } /*! @@ -784,8 +784,8 @@ class CFVMFlowSolverBase : public CSolver { /*--- MPI parallelization ---*/ - InitiateComms(geometry, config, SENSOR); - CompleteComms(geometry, config, SENSOR); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SENSOR); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SENSOR); } @@ -875,8 +875,8 @@ class CFVMFlowSolverBase : public CSolver { /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); if (!adjoint) { /*--- For verification cases, compute the global error metrics. ---*/ @@ -1000,8 +1000,8 @@ class CFVMFlowSolverBase : public CSolver { CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); } - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- For verification cases, compute the global error metrics. ---*/ ComputeVerificationError(geometry, config); diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 2eddc2f4497..da8106c0a10 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -266,8 +266,8 @@ void CFVMFlowSolverBase::CommunicateInitialState(CGeometry* geometry, cons /*--- Perform the MPI communication of the solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- Store the initial CFL number for all grid points. ---*/ @@ -383,7 +383,7 @@ void CFVMFlowSolverBase::SetPrimitive_Gradient_GG(CGeometry* geometry, con bool reconstruction) { const auto& primitives = nodes->GetPrimitive(); auto& gradient = reconstruction ? nodes->GetGradient_Reconstruction() : nodes->GetGradient_Primitive(); - const auto comm = reconstruction? PRIMITIVE_GRAD_REC : PRIMITIVE_GRADIENT; + const auto comm = reconstruction? ENUM_MPI_QUANTITIES::PRIMITIVE_GRAD_REC : ENUM_MPI_QUANTITIES::PRIMITIVE_GRADIENT; const auto commPer = reconstruction? PERIODIC_PRIM_GG_R : PERIODIC_PRIM_GG; computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, primitives, 0, nPrimVarGrad, gradient); @@ -408,7 +408,7 @@ void CFVMFlowSolverBase::SetPrimitive_Gradient_LS(CGeometry* geometry, con const auto& primitives = nodes->GetPrimitive(); auto& rmatrix = nodes->GetRmatrix(); auto& gradient = reconstruction ? nodes->GetGradient_Reconstruction() : nodes->GetGradient_Primitive(); - const auto comm = reconstruction? PRIMITIVE_GRAD_REC : PRIMITIVE_GRADIENT; + const auto comm = reconstruction? ENUM_MPI_QUANTITIES::PRIMITIVE_GRAD_REC : ENUM_MPI_QUANTITIES::PRIMITIVE_GRADIENT; computeGradientsLeastSquares(this, comm, commPer, *geometry, *config, weighted, primitives, 0, nPrimVarGrad, gradient, rmatrix); @@ -423,7 +423,7 @@ void CFVMFlowSolverBase::SetPrimitive_Limiter(CGeometry* geometry, const C auto& primMax = nodes->GetSolution_Max(); auto& limiter = nodes->GetLimiter_Primitive(); - computeLimiters(kindLimiter, this, PRIMITIVE_LIMITER, PERIODIC_LIM_PRIM_1, PERIODIC_LIM_PRIM_2, *geometry, *config, 0, + computeLimiters(kindLimiter, this, ENUM_MPI_QUANTITIES::PRIMITIVE_LIMITER, PERIODIC_LIM_PRIM_1, PERIODIC_LIM_PRIM_2, *geometry, *config, 0, nPrimVarGrad, primitives, gradient, primMin, primMax, limiter); } @@ -929,8 +929,8 @@ void CFVMFlowSolverBase::LoadRestart_impl(CGeometry **geometry, CSolver ** /*--- Compute the grid velocities on the coarser levels. ---*/ if (iMesh) geometry[iMesh]->SetRestricted_GridVelocity(geometry[iMesh - 1]); else { - geometry[MESH_0]->InitiateComms(geometry[MESH_0], config, GRID_VELOCITY); - geometry[MESH_0]->CompleteComms(geometry[MESH_0], config, GRID_VELOCITY); + geometry[MESH_0]->InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::GRID_VELOCITY); + geometry[MESH_0]->CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::GRID_VELOCITY); } } } @@ -941,8 +941,8 @@ void CFVMFlowSolverBase::LoadRestart_impl(CGeometry **geometry, CSolver ** on the fine level in order to have all necessary quantities updated, especially if this is a turbulent simulation (eddy viscosity). ---*/ - solver[MESH_0][FLOW_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION); - solver[MESH_0][FLOW_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION); + solver[MESH_0][FLOW_SOL]->InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[MESH_0][FLOW_SOL]->CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- For turbulent/species simulations the flow preprocessing is done by the turbulence/species solver * after it loads its variables (they are needed to compute flow primitives). In case turbulence and species, the @@ -957,8 +957,8 @@ void CFVMFlowSolverBase::LoadRestart_impl(CGeometry **geometry, CSolver ** for (auto iMesh = 1u; iMesh <= config->GetnMGLevels(); iMesh++) { MultigridRestriction(*geometry[iMesh - 1], solver[iMesh - 1][FLOW_SOL]->GetNodes()->GetSolution(), *geometry[iMesh], solver[iMesh][FLOW_SOL]->GetNodes()->GetSolution()); - solver[iMesh][FLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); - solver[iMesh][FLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); + solver[iMesh][FLOW_SOL]->InitiateComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[iMesh][FLOW_SOL]->CompleteComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); if (config->GetKind_Turb_Model() == TURB_MODEL::NONE && config->GetKind_Species_Model() == SPECIES_MODEL::NONE) { diff --git a/SU2_CFD/include/solvers/CScalarSolver.inl b/SU2_CFD/include/solvers/CScalarSolver.inl index 6f9aeafac4a..5f0c917c6fd 100644 --- a/SU2_CFD/include/solvers/CScalarSolver.inl +++ b/SU2_CFD/include/solvers/CScalarSolver.inl @@ -531,8 +531,8 @@ void CScalarSolver::CompleteImplicitIteration(CGeometry* geometry, CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); } - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); } template diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index 2b114a7714b..8dafcecb2fe 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -240,7 +240,7 @@ class CSolver { * \param[out] MPI_TYPE - Enumerated type for the datatype of the quantity to be communicated. */ void GetCommCountAndType(const CConfig* config, - unsigned short commType, + ENUM_MPI_QUANTITIES commType, unsigned short &COUNT_PER_POINT, unsigned short &MPI_TYPE) const; @@ -252,7 +252,7 @@ class CSolver { */ void InitiateComms(CGeometry *geometry, const CConfig *config, - unsigned short commType); + ENUM_MPI_QUANTITIES commType); /*! * \brief Routine to complete the set of non-blocking communications launched by InitiateComms() and unpacking of the data in the solver class. @@ -262,7 +262,7 @@ class CSolver { */ void CompleteComms(CGeometry *geometry, const CConfig *config, - unsigned short commType); + ENUM_MPI_QUANTITIES commType); /*! * \brief Helper function to define the type and number of variables per point for each communication type. diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 248b580aa36..32f67e52edb 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -912,8 +912,8 @@ void CDriver::InitializeGeometryFVM(CConfig *config, CGeometry **&geometry) { if ((rank == MASTER_NODE) && (size > SINGLE_NODE) && (iMGlevel == MESH_0)) cout << "Communicating number of neighbors." << endl; - geometry[iMGlevel]->InitiateComms(geometry[iMGlevel], config, NEIGHBORS); - geometry[iMGlevel]->CompleteComms(geometry[iMGlevel], config, NEIGHBORS); + geometry[iMGlevel]->InitiateComms(geometry[iMGlevel], config, ENUM_MPI_QUANTITIES::NEIGHBORS); + geometry[iMGlevel]->CompleteComms(geometry[iMGlevel], config, ENUM_MPI_QUANTITIES::NEIGHBORS); } } diff --git a/SU2_CFD/src/drivers/CDriverBase.cpp b/SU2_CFD/src/drivers/CDriverBase.cpp index c964677e623..bda4bdbeb15 100644 --- a/SU2_CFD/src/drivers/CDriverBase.cpp +++ b/SU2_CFD/src/drivers/CDriverBase.cpp @@ -391,8 +391,8 @@ vector CDriverBase::GetMarkerVertexNormals(unsigned short iMarker } void CDriverBase::CommunicateMeshDisplacements() { - solver_container[selected_zone][INST_0][MESH_0][MESH_SOL]->InitiateComms(main_geometry, main_config, MESH_DISPLACEMENTS); - solver_container[selected_zone][INST_0][MESH_0][MESH_SOL]->CompleteComms(main_geometry, main_config, MESH_DISPLACEMENTS); + solver_container[selected_zone][INST_0][MESH_0][MESH_SOL]->InitiateComms(main_geometry, main_config, ENUM_MPI_QUANTITIES::MESH_DISPLACEMENTS); + solver_container[selected_zone][INST_0][MESH_0][MESH_SOL]->CompleteComms(main_geometry, main_config, ENUM_MPI_QUANTITIES::MESH_DISPLACEMENTS); } map CDriverBase::GetSolverIndices() const { diff --git a/SU2_CFD/src/integration/CMultiGridIntegration.cpp b/SU2_CFD/src/integration/CMultiGridIntegration.cpp index a6750435d97..14647a2a205 100644 --- a/SU2_CFD/src/integration/CMultiGridIntegration.cpp +++ b/SU2_CFD/src/integration/CMultiGridIntegration.cpp @@ -366,8 +366,8 @@ void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqS /*--- MPI the set solution old ---*/ - sol_coarse->InitiateComms(geo_coarse, config, SOLUTION_OLD); - sol_coarse->CompleteComms(geo_coarse, config, SOLUTION_OLD); + sol_coarse->InitiateComms(geo_coarse, config, ENUM_MPI_QUANTITIES::SOLUTION_OLD); + sol_coarse->CompleteComms(geo_coarse, config, ENUM_MPI_QUANTITIES::SOLUTION_OLD); SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads())) for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { @@ -479,8 +479,8 @@ void CMultiGridIntegration::SetProlongated_Correction(CSolver *sol_fine, CGeomet /*--- MPI the new interpolated solution ---*/ - sol_fine->InitiateComms(geo_fine, config, SOLUTION); - sol_fine->CompleteComms(geo_fine, config, SOLUTION); + sol_fine->InitiateComms(geo_fine, config, ENUM_MPI_QUANTITIES::SOLUTION); + sol_fine->CompleteComms(geo_fine, config, ENUM_MPI_QUANTITIES::SOLUTION); } @@ -608,8 +608,8 @@ void CMultiGridIntegration::SetRestricted_Solution(unsigned short RunTime_EqSyst /*--- MPI the new interpolated solution ---*/ - sol_coarse->InitiateComms(geo_coarse, config, SOLUTION); - sol_coarse->CompleteComms(geo_coarse, config, SOLUTION); + sol_coarse->InitiateComms(geo_coarse, config, ENUM_MPI_QUANTITIES::SOLUTION); + sol_coarse->CompleteComms(geo_coarse, config, ENUM_MPI_QUANTITIES::SOLUTION); } diff --git a/SU2_CFD/src/integration/CSingleGridIntegration.cpp b/SU2_CFD/src/integration/CSingleGridIntegration.cpp index 56b74282cde..6fd9c763aec 100644 --- a/SU2_CFD/src/integration/CSingleGridIntegration.cpp +++ b/SU2_CFD/src/integration/CSingleGridIntegration.cpp @@ -111,8 +111,8 @@ void CSingleGridIntegration::SetRestricted_Solution(unsigned short RunTime_EqSys CGeometry *geo_fine, CGeometry *geo_coarse, CConfig *config) { CSolver::MultigridRestriction(*geo_fine, sol_fine->GetNodes()->GetSolution(), *geo_coarse, sol_coarse->GetNodes()->GetSolution()); - sol_coarse->InitiateComms(geo_coarse, config, SOLUTION); - sol_coarse->CompleteComms(geo_coarse, config, SOLUTION); + sol_coarse->InitiateComms(geo_coarse, config, ENUM_MPI_QUANTITIES::SOLUTION); + sol_coarse->CompleteComms(geo_coarse, config, ENUM_MPI_QUANTITIES::SOLUTION); } void CSingleGridIntegration::SetRestricted_EddyVisc(unsigned short RunTime_EqSystem, CSolver *sol_fine, CSolver *sol_coarse, @@ -160,7 +160,7 @@ void CSingleGridIntegration::SetRestricted_EddyVisc(unsigned short RunTime_EqSys /*--- MPI the new interpolated solution (this also includes the eddy viscosity) ---*/ - sol_coarse->InitiateComms(geo_coarse, config, SOLUTION_EDDY); - sol_coarse->CompleteComms(geo_coarse, config, SOLUTION_EDDY); + sol_coarse->InitiateComms(geo_coarse, config, ENUM_MPI_QUANTITIES::SOLUTION_EDDY); + sol_coarse->CompleteComms(geo_coarse, config, ENUM_MPI_QUANTITIES::SOLUTION_EDDY); } diff --git a/SU2_CFD/src/iteration/CDiscAdjFEAIteration.cpp b/SU2_CFD/src/iteration/CDiscAdjFEAIteration.cpp index d7848499f62..d4f1f36c013 100644 --- a/SU2_CFD/src/iteration/CDiscAdjFEAIteration.cpp +++ b/SU2_CFD/src/iteration/CDiscAdjFEAIteration.cpp @@ -233,11 +233,11 @@ void CDiscAdjFEAIteration::SetDependencies(CSolver***** solver, CGeometry**** ge /*--- MPI dependencies. ---*/ - dir_solver->InitiateComms(structural_geometry, config[iZone], SOLUTION_FEA); - dir_solver->CompleteComms(structural_geometry, config[iZone], SOLUTION_FEA); + dir_solver->InitiateComms(structural_geometry, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION_FEA); + dir_solver->CompleteComms(structural_geometry, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION_FEA); - structural_geometry->InitiateComms(structural_geometry, config[iZone], COORDINATES); - structural_geometry->CompleteComms(structural_geometry, config[iZone], COORDINATES); + structural_geometry->InitiateComms(structural_geometry, config[iZone], ENUM_MPI_QUANTITIES::COORDINATES); + structural_geometry->CompleteComms(structural_geometry, config[iZone], ENUM_MPI_QUANTITIES::COORDINATES); } END_SU2_OMP_PARALLEL diff --git a/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp b/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp index 6bde7b99418..aaf755248c8 100644 --- a/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp @@ -468,26 +468,26 @@ void CDiscAdjFluidIteration::SetDependencies(CSolver***** solver, CGeometry**** /*--- Compute coupling between flow, turbulent and species equations ---*/ solvers0[FLOW_SOL]->Preprocessing(geometry0, solvers0, config[iZone], MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS, true); - solvers0[FLOW_SOL]->InitiateComms(geometry0, config[iZone], SOLUTION); - solvers0[FLOW_SOL]->CompleteComms(geometry0, config[iZone], SOLUTION); + solvers0[FLOW_SOL]->InitiateComms(geometry0, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); + solvers0[FLOW_SOL]->CompleteComms(geometry0, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); if (turbulent && !config[iZone]->GetFrozen_Visc_Disc()) { solvers0[TURB_SOL]->Postprocessing(geometry0, solvers0, config[iZone], MESH_0); - solvers0[TURB_SOL]->InitiateComms(geometry0, config[iZone], SOLUTION); - solvers0[TURB_SOL]->CompleteComms(geometry0, config[iZone], SOLUTION); + solvers0[TURB_SOL]->InitiateComms(geometry0, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); + solvers0[TURB_SOL]->CompleteComms(geometry0, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); } if (config[iZone]->GetKind_Species_Model() != SPECIES_MODEL::NONE) { solvers0[SPECIES_SOL]->Preprocessing(geometry0, solvers0, config[iZone], MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS, true); - solvers0[SPECIES_SOL]->InitiateComms(geometry0, config[iZone], SOLUTION); - solvers0[SPECIES_SOL]->CompleteComms(geometry0, config[iZone], SOLUTION); + solvers0[SPECIES_SOL]->InitiateComms(geometry0, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); + solvers0[SPECIES_SOL]->CompleteComms(geometry0, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); } if (config[iZone]->GetWeakly_Coupled_Heat()) { solvers0[HEAT_SOL]->Set_Heatflux_Areas(geometry0, config[iZone]); solvers0[HEAT_SOL]->Preprocessing(geometry0, solvers0, config[iZone], MESH_0, NO_RK_ITER, RUNTIME_HEAT_SYS, true); solvers0[HEAT_SOL]->Postprocessing(geometry0, solvers0, config[iZone], MESH_0); - solvers0[HEAT_SOL]->InitiateComms(geometry0, config[iZone], SOLUTION); - solvers0[HEAT_SOL]->CompleteComms(geometry0, config[iZone], SOLUTION); + solvers0[HEAT_SOL]->InitiateComms(geometry0, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); + solvers0[HEAT_SOL]->CompleteComms(geometry0, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); } } @@ -495,8 +495,8 @@ void CDiscAdjFluidIteration::SetDependencies(CSolver***** solver, CGeometry**** if (config[iZone]->AddRadiation()) { solvers0[RAD_SOL]->Postprocessing(geometry0, solvers0, config[iZone], MESH_0); - solvers0[RAD_SOL]->InitiateComms(geometry0, config[iZone], SOLUTION); - solvers0[RAD_SOL]->CompleteComms(geometry0, config[iZone], SOLUTION); + solvers0[RAD_SOL]->InitiateComms(geometry0, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); + solvers0[RAD_SOL]->CompleteComms(geometry0, config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); } } diff --git a/SU2_CFD/src/iteration/CDiscAdjHeatIteration.cpp b/SU2_CFD/src/iteration/CDiscAdjHeatIteration.cpp index 1c3666d5216..7c6bdcf6127 100644 --- a/SU2_CFD/src/iteration/CDiscAdjHeatIteration.cpp +++ b/SU2_CFD/src/iteration/CDiscAdjHeatIteration.cpp @@ -213,8 +213,8 @@ void CDiscAdjHeatIteration::SetDependencies(CSolver***** solver, CGeometry**** g solvers0[HEAT_SOL]->Preprocessing(geometries[MESH_0], solvers0, config[iZone], MESH_0, NO_RK_ITER, RUNTIME_HEAT_SYS, true); solvers0[HEAT_SOL]->Postprocessing(geometries[MESH_0], solvers0, config[iZone], MESH_0); - solvers0[HEAT_SOL]->InitiateComms(geometries[MESH_0], config[iZone], SOLUTION); - solvers0[HEAT_SOL]->CompleteComms(geometries[MESH_0], config[iZone], SOLUTION); + solvers0[HEAT_SOL]->InitiateComms(geometries[MESH_0], config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); + solvers0[HEAT_SOL]->CompleteComms(geometries[MESH_0], config[iZone], ENUM_MPI_QUANTITIES::SOLUTION); } void CDiscAdjHeatIteration::RegisterOutput(CSolver***** solver, CGeometry**** geometry, CConfig** config, diff --git a/SU2_CFD/src/solvers/CAdjEulerSolver.cpp b/SU2_CFD/src/solvers/CAdjEulerSolver.cpp index e43bd91c871..d6299b3c20c 100644 --- a/SU2_CFD/src/solvers/CAdjEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CAdjEulerSolver.cpp @@ -328,8 +328,8 @@ CAdjEulerSolver::CAdjEulerSolver(CGeometry *geometry, CConfig *config, unsigned /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); SolverName = "ADJ.FLOW"; } @@ -888,8 +888,8 @@ void CAdjEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve for (auto iMesh = 1ul; iMesh <= config->GetnMGLevels(); iMesh++) { MultigridRestriction(*geometry[iMesh - 1], solver_container[iMesh - 1][ADJFLOW_SOL]->GetNodes()->GetSolution(), *geometry[iMesh], solver_container[iMesh][ADJFLOW_SOL]->GetNodes()->GetSolution()); - solver_container[iMesh][ADJFLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); - solver_container[iMesh][ADJFLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); + solver_container[iMesh][ADJFLOW_SOL]->InitiateComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver_container[iMesh][ADJFLOW_SOL]->CompleteComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); } } @@ -1343,8 +1343,8 @@ void CAdjEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfi /*--- MPI parallelization ---*/ - InitiateComms(geometry, config, SENSOR); - CompleteComms(geometry, config, SENSOR); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SENSOR); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SENSOR); } @@ -1377,8 +1377,8 @@ void CAdjEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- Compute the root mean square residual ---*/ SetResidual_RMS(geometry, config); @@ -1411,8 +1411,8 @@ void CAdjEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **sol /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- Compute the root mean square residual ---*/ SetResidual_RMS(geometry, config); @@ -1491,8 +1491,8 @@ void CAdjEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- Compute the root mean square residual ---*/ @@ -3880,8 +3880,8 @@ void CAdjEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf it down to the coarse levels. We also call the preprocessing routine on the fine level in order to have all necessary quantities updated. ---*/ - solver[MESH_0][ADJFLOW_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION); - solver[MESH_0][ADJFLOW_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION); + solver[MESH_0][ADJFLOW_SOL]->InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[MESH_0][ADJFLOW_SOL]->CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); solver[MESH_0][ADJFLOW_SOL]->Preprocessing(geometry[MESH_0], solver[MESH_0], config, MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS, false); /*--- Interpolate the solution down to the coarse multigrid levels ---*/ @@ -3889,8 +3889,8 @@ void CAdjEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) { MultigridRestriction(*geometry[iMesh - 1], solver[iMesh - 1][ADJFLOW_SOL]->GetNodes()->GetSolution(), *geometry[iMesh], solver[iMesh][ADJFLOW_SOL]->GetNodes()->GetSolution()); - solver[iMesh][ADJFLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); - solver[iMesh][ADJFLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); + solver[iMesh][ADJFLOW_SOL]->InitiateComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[iMesh][ADJFLOW_SOL]->CompleteComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); solver[iMesh][ADJFLOW_SOL]->Preprocessing(geometry[iMesh], solver[iMesh], config, iMesh, NO_RK_ITER, RUNTIME_FLOW_SYS, false); } diff --git a/SU2_CFD/src/solvers/CAdjNSSolver.cpp b/SU2_CFD/src/solvers/CAdjNSSolver.cpp index b9da5ad2b63..d0c9a0b828b 100644 --- a/SU2_CFD/src/solvers/CAdjNSSolver.cpp +++ b/SU2_CFD/src/solvers/CAdjNSSolver.cpp @@ -281,8 +281,8 @@ CAdjNSSolver::CAdjNSSolver(CGeometry *geometry, CConfig *config, unsigned short /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); } diff --git a/SU2_CFD/src/solvers/CAdjTurbSolver.cpp b/SU2_CFD/src/solvers/CAdjTurbSolver.cpp index 58403f541a4..2cb527d1f74 100644 --- a/SU2_CFD/src/solvers/CAdjTurbSolver.cpp +++ b/SU2_CFD/src/solvers/CAdjTurbSolver.cpp @@ -158,8 +158,8 @@ CAdjTurbSolver::CAdjTurbSolver(CGeometry *geometry, CConfig *config, unsigned sh /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); } @@ -511,8 +511,8 @@ void CAdjTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- Compute the root mean square residual ---*/ diff --git a/SU2_CFD/src/solvers/CBaselineSolver.cpp b/SU2_CFD/src/solvers/CBaselineSolver.cpp index bc8b9c1ebc5..8b181087dd1 100644 --- a/SU2_CFD/src/solvers/CBaselineSolver.cpp +++ b/SU2_CFD/src/solvers/CBaselineSolver.cpp @@ -459,8 +459,8 @@ void CBaselineSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf /*--- MPI solution ---*/ - InitiateComms(geometry[iInst], config, SOLUTION); - CompleteComms(geometry[iInst], config, SOLUTION); + InitiateComms(geometry[iInst], config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry[iInst], config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- Update the geometry for flows on dynamic meshes ---*/ @@ -468,11 +468,11 @@ void CBaselineSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf /*--- Communicate the new coordinates and grid velocities at the halos ---*/ - geometry[iInst]->InitiateComms(geometry[iInst], config, COORDINATES); - geometry[iInst]->CompleteComms(geometry[iInst], config, COORDINATES); + geometry[iInst]->InitiateComms(geometry[iInst], config, ENUM_MPI_QUANTITIES::COORDINATES); + geometry[iInst]->CompleteComms(geometry[iInst], config, ENUM_MPI_QUANTITIES::COORDINATES); - geometry[iInst]->InitiateComms(geometry[iInst], config, GRID_VELOCITY); - geometry[iInst]->CompleteComms(geometry[iInst], config, GRID_VELOCITY); + geometry[iInst]->InitiateComms(geometry[iInst], config, ENUM_MPI_QUANTITIES::GRID_VELOCITY); + geometry[iInst]->CompleteComms(geometry[iInst], config, ENUM_MPI_QUANTITIES::GRID_VELOCITY); } diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 5ffca7e989a..1d2e27e6987 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -2351,8 +2351,8 @@ void CEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, const CConfig *co /*--- MPI parallelization ---*/ - InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN); - CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::UNDIVIDED_LAPLACIAN); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::UNDIVIDED_LAPLACIAN); } @@ -2415,8 +2415,8 @@ void CEulerSolver::SetUpwind_Ducros_Sensor(CGeometry *geometry, CConfig *config) } END_SU2_OMP_FOR - InitiateComms(geometry, config, SENSOR); - CompleteComms(geometry, config, SENSOR); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SENSOR); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SENSOR); } @@ -5067,8 +5067,8 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, su2double Velocity_i[MAXNDIM]={0}; for (auto iDim=0u; iDim < nDim; iDim++) Velocity_i[iDim] = nodes->GetVelocity(iPoint,iDim); - - const auto Velocity2_i = GeometryToolbox::SquaredNorm(nDim, Velocity_i); + + const auto Velocity2_i = GeometryToolbox::SquaredNorm(nDim, Velocity_i); const auto Density_i = nodes->GetDensity(iPoint); @@ -5090,7 +5090,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, T_Total{0}, P_Total{0}, Density_e{0}, StaticEnthalpy_e{0}, StaticEnergy_e{0}; su2double Velocity2_e{0}, NormalVelocity{0}, TangVelocity{0}, VelMag_e{0}; - su2double Velocity_e[MAXNDIM] = {0}; + su2double Velocity_e[MAXNDIM] = {0}; const su2double * Flow_Dir, * Mach; switch(config->GetKind_Data_Riemann(Marker_Tag)) { @@ -5146,10 +5146,10 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, GetFluidModel()->SetTDState_PT(P_static, T_static); /* --- Compute the boundary state u_e --- */ - for (auto iDim = 0u; iDim < nDim; iDim++) + for (auto iDim = 0u; iDim < nDim; iDim++) Velocity_e[iDim] = Mach[iDim]*GetFluidModel()->GetSoundSpeed(); - Velocity2_e = GeometryToolbox::SquaredNorm(nDim, Velocity_e); + Velocity2_e = GeometryToolbox::SquaredNorm(nDim, Velocity_e); Density_e = GetFluidModel()->GetDensity(); StaticEnergy_e = GetFluidModel()->GetStaticEnergy(); Energy_e = StaticEnergy_e + 0.5 * Velocity2_e; @@ -5176,7 +5176,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, for (auto iDim = 0u; iDim < nDim; iDim++) Velocity_e[iDim] = Mach[iDim]*GetFluidModel()->GetSoundSpeed(); - Velocity2_e = GeometryToolbox::SquaredNorm(nDim, Velocity_e); + Velocity2_e = GeometryToolbox::SquaredNorm(nDim, Velocity_e); Density_e = GetFluidModel()->GetDensity(); StaticEnergy_e = GetFluidModel()->GetStaticEnergy(); Energy_e = StaticEnergy_e + 0.5 * Velocity2_e; @@ -5208,10 +5208,10 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, /* --- Compute the boundary state u_e --- */ GetFluidModel()->SetTDState_Prho(Pressure_e, Density_e); - for (auto iDim = 0u; iDim < nDim; iDim++) + for (auto iDim = 0u; iDim < nDim; iDim++) Velocity_e[iDim] = Velocity_i[iDim]; - Velocity2_e = GeometryToolbox::SquaredNorm(nDim, Velocity_e); + Velocity2_e = GeometryToolbox::SquaredNorm(nDim, Velocity_e); Energy_e = GetFluidModel()->GetStaticEnergy() + 0.5*Velocity2_e; break; @@ -5235,7 +5235,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, } /*--- Flow eigenvalues, boundary state u_e and u_i ---*/ - su2double Lambda_i[MAXNVAR] = {0}, u_e[MAXNVAR] = {0}, u_i[MAXNVAR]={0}, u_b[MAXNVAR]={0}, + su2double Lambda_i[MAXNVAR] = {0}, u_e[MAXNVAR] = {0}, u_i[MAXNVAR]={0}, u_b[MAXNVAR]={0}, dw[MAXNVAR]={0}; u_e[0] = Density_e; u_i[0] = Density_i; @@ -5302,7 +5302,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, LinSysRes.AddBlock(iPoint, Residual); if (implicit) { - su2double **Jacobian_b = new su2double*[nVar], + su2double **Jacobian_b = new su2double*[nVar], **Jacobian_i = new su2double*[nVar]; su2double **DubDu = new su2double*[nVar]; for (auto iVar = 0u; iVar < nVar; iVar++){ @@ -5333,7 +5333,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, if (dynamic_grid){ const auto gridVel = geometry->nodes->GetGridVel(iPoint); const auto projVelocity = GeometryToolbox::DotProduct(nDim, gridVel, Normal); - for (auto iVar = 0u; iVar < nVar; iVar++) + for (auto iVar = 0u; iVar < nVar; iVar++) Jacobian_b[iVar][iVar] -= projVelocity; } @@ -5394,7 +5394,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); /*--- Secondary variables ---*/ - + auto S_domain = nodes->GetSecondary(iPoint); /*--- Compute secondary thermodynamic properties (partial derivatives...) ---*/ @@ -8795,9 +8795,9 @@ void CEulerSolver::PreprocessAverage(CSolver **solver, CGeometry *geometry, CCon const auto nSpanWiseSections = config->GetnSpanWiseSections(); const auto iZone = config->GetiZone(); - + for (auto iSpan= 0u; iSpan < nSpanWiseSections; iSpan++){ - su2double TotalAreaVelocity[MAXNDIM]={0.0}, + su2double TotalAreaVelocity[MAXNDIM]={0.0}, TotalAreaPressure{0}, TotalAreaDensity{0}; for (auto iMarker = 0u; iMarker < config->GetnMarker_All(); iMarker++){ @@ -9325,9 +9325,9 @@ void CEulerSolver::MixedOut_Average(CConfig *config, su2double val_init_pressure su2double vel[MAXNDIM] = {0}; vel[0] = (val_Averaged_Flux[1] - pressure_mix) / val_Averaged_Flux[0]; - for (auto iDim = 1u; iDim < nDim; iDim++) + for (auto iDim = 1u; iDim < nDim; iDim++) vel[iDim] = val_Averaged_Flux[iDim+1] / val_Averaged_Flux[0]; - + const su2double velsq = GeometryToolbox::DotProduct(nDim, vel, vel); diff --git a/SU2_CFD/src/solvers/CFEASolver.cpp b/SU2_CFD/src/solvers/CFEASolver.cpp index f67a0199d01..7beb666f40a 100644 --- a/SU2_CFD/src/solvers/CFEASolver.cpp +++ b/SU2_CFD/src/solvers/CFEASolver.cpp @@ -3116,8 +3116,8 @@ void CFEASolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *c /*--- MPI. If dynamic, we also need to communicate the old solution. ---*/ - InitiateComms(geometry[MESH_0], config, SOLUTION_FEA); - CompleteComms(geometry[MESH_0], config, SOLUTION_FEA); + InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION_FEA); + CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION_FEA); /*--- It's important to not push back the solution when this function is used to load solutions for * unsteady discrete adjoints, otherwise we overwrite one of the two solutions needed. ---*/ diff --git a/SU2_CFD/src/solvers/CGradientSmoothingSolver.cpp b/SU2_CFD/src/solvers/CGradientSmoothingSolver.cpp index 1f3a425aae6..372f6ffb131 100644 --- a/SU2_CFD/src/solvers/CGradientSmoothingSolver.cpp +++ b/SU2_CFD/src/solvers/CGradientSmoothingSolver.cpp @@ -287,8 +287,8 @@ void CGradientSmoothingSolver::ApplyGradientSmoothingDV(CGeometry* geometry, CNu /*--- Matrix vector product with the Laplace-Beltrami stiffness matrix. ---*/ if (config->GetSmoothOnSurface()) { - CSysMatrixComms::Initiate(helperVecIn, geometry, config, SOLUTION_MATRIX); - CSysMatrixComms::Complete(helperVecIn, geometry, config, SOLUTION_MATRIX); + CSysMatrixComms::Initiate(helperVecIn, geometry, config, ENUM_MPI_QUANTITIES::SOLUTION_MATRIX); + CSysMatrixComms::Complete(helperVecIn, geometry, config, ENUM_MPI_QUANTITIES::SOLUTION_MATRIX); mat_vec(helperVecIn, helperVecAux); @@ -306,8 +306,8 @@ void CGradientSmoothingSolver::ApplyGradientSmoothingDV(CGeometry* geometry, CNu grid_movement->SetVolume_Deformation(geometry, config, false, true, true); CGradientSmoothingSolverDetails::ReadVectorToGeometry(geometry, helperVecIn); - CSysMatrixComms::Initiate(helperVecIn, geometry, config, SOLUTION_MATRIX); - CSysMatrixComms::Complete(helperVecIn, geometry, config, SOLUTION_MATRIX); + CSysMatrixComms::Initiate(helperVecIn, geometry, config, ENUM_MPI_QUANTITIES::SOLUTION_MATRIX); + CSysMatrixComms::Complete(helperVecIn, geometry, config, ENUM_MPI_QUANTITIES::SOLUTION_MATRIX); mat_vec(helperVecIn, helperVecAux); diff --git a/SU2_CFD/src/solvers/CHeatSolver.cpp b/SU2_CFD/src/solvers/CHeatSolver.cpp index b01870e29bb..50f65f46c96 100644 --- a/SU2_CFD/src/solvers/CHeatSolver.cpp +++ b/SU2_CFD/src/solvers/CHeatSolver.cpp @@ -152,8 +152,8 @@ CHeatSolver::CHeatSolver(CGeometry *geometry, CConfig *config, unsigned short iM /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- Store the initial CFL number for all grid points. ---*/ @@ -246,8 +246,8 @@ void CHeatSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * on the fine level in order to have all necessary quantities updated, especially if this is a turbulent simulation (eddy viscosity). ---*/ - solver[MESH_0][HEAT_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION); - solver[MESH_0][HEAT_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION); + solver[MESH_0][HEAT_SOL]->InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[MESH_0][HEAT_SOL]->CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); solver[MESH_0][HEAT_SOL]->Preprocessing(geometry[MESH_0], solver[MESH_0], config, MESH_0, NO_RK_ITER, RUNTIME_HEAT_SYS, false); @@ -256,8 +256,8 @@ void CHeatSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * for (auto iMesh = 1u; iMesh <= config->GetnMGLevels(); iMesh++) { MultigridRestriction(*geometry[iMesh - 1], solver[iMesh - 1][HEAT_SOL]->GetNodes()->GetSolution(), *geometry[iMesh], solver[iMesh][HEAT_SOL]->GetNodes()->GetSolution()); - solver[iMesh][HEAT_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); - solver[iMesh][HEAT_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); + solver[iMesh][HEAT_SOL]->InitiateComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[iMesh][HEAT_SOL]->CompleteComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); solver[iMesh][HEAT_SOL]->Preprocessing(geometry[iMesh], solver[iMesh], config, iMesh, NO_RK_ITER, RUNTIME_HEAT_SYS, false); } @@ -934,8 +934,8 @@ void CHeatSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_co for (auto iMesh = 1u; iMesh <= config->GetnMGLevels(); iMesh++) { MultigridRestriction(*geometry[iMesh - 1], solver_container[iMesh - 1][HEAT_SOL]->GetNodes()->GetSolution(), *geometry[iMesh], solver_container[iMesh][HEAT_SOL]->GetNodes()->GetSolution()); - solver_container[iMesh][HEAT_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); - solver_container[iMesh][HEAT_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); + solver_container[iMesh][HEAT_SOL]->InitiateComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver_container[iMesh][HEAT_SOL]->CompleteComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); } } diff --git a/SU2_CFD/src/solvers/CMeshSolver.cpp b/SU2_CFD/src/solvers/CMeshSolver.cpp index 39e17b322c8..cc2cb0a38fe 100644 --- a/SU2_CFD/src/solvers/CMeshSolver.cpp +++ b/SU2_CFD/src/solvers/CMeshSolver.cpp @@ -479,14 +479,14 @@ void CMeshSolver::DeformMesh(CGeometry **geometry, CNumerics **numerics, CConfig if (multizone) nodes->Set_BGSSolution_k(); /*--- Capture a few MPI dependencies for AD. ---*/ - geometry[MESH_0]->InitiateComms(geometry[MESH_0], config, COORDINATES); - geometry[MESH_0]->CompleteComms(geometry[MESH_0], config, COORDINATES); + geometry[MESH_0]->InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::COORDINATES); + geometry[MESH_0]->CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::COORDINATES); - InitiateComms(geometry[MESH_0], config, SOLUTION); - CompleteComms(geometry[MESH_0], config, SOLUTION); + InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); - InitiateComms(geometry[MESH_0], config, MESH_DISPLACEMENTS); - CompleteComms(geometry[MESH_0], config, MESH_DISPLACEMENTS); + InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::MESH_DISPLACEMENTS); + CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::MESH_DISPLACEMENTS); /*--- Compute the stiffness matrix, no point recording because we clear the residual. ---*/ @@ -562,8 +562,8 @@ void CMeshSolver::UpdateGridCoord(CGeometry *geometry, const CConfig *config){ END_SU2_OMP_FOR /*--- Communicate the updated displacements and mesh coordinates. ---*/ - geometry->InitiateComms(geometry, config, COORDINATES); - geometry->CompleteComms(geometry, config, COORDINATES); + geometry->InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::COORDINATES); + geometry->CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::COORDINATES); } @@ -818,8 +818,8 @@ void CMeshSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * } /*--- Communicate the loaded displacements. ---*/ - solver[MESH_0][MESH_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION); - solver[MESH_0][MESH_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION); + solver[MESH_0][MESH_SOL]->InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[MESH_0][MESH_SOL]->CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- Init the linear system solution. ---*/ for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) { @@ -880,7 +880,7 @@ void CMeshSolver::RestartOldGeometry(CGeometry *geometry, const CConfig *config) for(unsigned short iStep = 1; iStep <= nSteps; ++iStep) { - unsigned short CommType = (iStep == 1) ? SOLUTION_TIME_N : SOLUTION_TIME_N1; + ENUM_MPI_QUANTITIES CommType = (iStep == 1) ? ENUM_MPI_QUANTITIES::SOLUTION_TIME_N : ENUM_MPI_QUANTITIES::SOLUTION_TIME_N1; /*--- Modify file name for an unsteady restart ---*/ int Unst_RestartIter; diff --git a/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp b/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp index 0905ddeda32..3170ac4286b 100644 --- a/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp @@ -2354,7 +2354,7 @@ void CNEMOEulerSolver::SetPressureDiffusionSensor(CGeometry *geometry, CConfig * /*--- MPI parallelization ---*/ - InitiateComms(geometry, config, SENSOR); - CompleteComms(geometry, config, SENSOR); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SENSOR); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SENSOR); } diff --git a/SU2_CFD/src/solvers/CNEMONSSolver.cpp b/SU2_CFD/src/solvers/CNEMONSSolver.cpp index b6642b5cf8d..9c353bda22e 100644 --- a/SU2_CFD/src/solvers/CNEMONSSolver.cpp +++ b/SU2_CFD/src/solvers/CNEMONSSolver.cpp @@ -146,7 +146,7 @@ unsigned long CNEMONSSolver::SetPrimitive_Variables(CSolver **solver_container,C void CNEMONSSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, const CConfig *config, bool reconstruction) { auto& gradient = reconstruction ? nodes->GetGradient_Reconstruction() : nodes->GetGradient_Primitive(); - const auto comm = reconstruction? PRIMITIVE_GRAD_REC : PRIMITIVE_GRADIENT; + const auto comm = reconstruction? ENUM_MPI_QUANTITIES::PRIMITIVE_GRAD_REC : ENUM_MPI_QUANTITIES::PRIMITIVE_GRADIENT; const auto commPer = reconstruction? PERIODIC_PRIM_GG_R : PERIODIC_PRIM_GG; /*--- Get indices of species & mixture density ---*/ diff --git a/SU2_CFD/src/solvers/CRadP1Solver.cpp b/SU2_CFD/src/solvers/CRadP1Solver.cpp index af40b22f2bc..59fca5265f1 100644 --- a/SU2_CFD/src/solvers/CRadP1Solver.cpp +++ b/SU2_CFD/src/solvers/CRadP1Solver.cpp @@ -553,8 +553,8 @@ void CRadP1Solver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- Compute the root mean square residual ---*/ diff --git a/SU2_CFD/src/solvers/CRadSolver.cpp b/SU2_CFD/src/solvers/CRadSolver.cpp index ca5becad7af..92c8436129a 100644 --- a/SU2_CFD/src/solvers/CRadSolver.cpp +++ b/SU2_CFD/src/solvers/CRadSolver.cpp @@ -149,8 +149,8 @@ void CRadSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *c } /*--- MPI communication ---*/ - solver[MESH_0][RAD_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION); - solver[MESH_0][RAD_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION); + solver[MESH_0][RAD_SOL]->InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[MESH_0][RAD_SOL]->CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- Preprocess the fluid solver to compute the primitive variables ---*/ solver[MESH_0][FLOW_SOL]->Preprocessing(geometry[MESH_0], solver[MESH_0], config, MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS, false); diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 03c79b46fc3..8f2ad7c284a 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -1322,60 +1322,60 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, } void CSolver::GetCommCountAndType(const CConfig* config, - unsigned short commType, + ENUM_MPI_QUANTITIES commType, unsigned short &COUNT_PER_POINT, unsigned short &MPI_TYPE) const { switch (commType) { - case SOLUTION: - case SOLUTION_OLD: - case UNDIVIDED_LAPLACIAN: - case SOLUTION_LIMITER: + case ENUM_MPI_QUANTITIES::SOLUTION: + case ENUM_MPI_QUANTITIES::SOLUTION_OLD: + case ENUM_MPI_QUANTITIES::UNDIVIDED_LAPLACIAN: + case ENUM_MPI_QUANTITIES::SOLUTION_LIMITER: COUNT_PER_POINT = nVar; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case MAX_EIGENVALUE: - case SENSOR: + case ENUM_MPI_QUANTITIES::MAX_EIGENVALUE: + case ENUM_MPI_QUANTITIES::SENSOR: COUNT_PER_POINT = 1; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case SOLUTION_GRADIENT: - case SOLUTION_GRAD_REC: + case ENUM_MPI_QUANTITIES::SOLUTION_GRADIENT: + case ENUM_MPI_QUANTITIES::SOLUTION_GRAD_REC: COUNT_PER_POINT = nVar*nDim; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case PRIMITIVE_GRADIENT: - case PRIMITIVE_GRAD_REC: + case ENUM_MPI_QUANTITIES::PRIMITIVE_GRADIENT: + case ENUM_MPI_QUANTITIES::PRIMITIVE_GRAD_REC: COUNT_PER_POINT = nPrimVarGrad*nDim; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case PRIMITIVE_LIMITER: + case ENUM_MPI_QUANTITIES::PRIMITIVE_LIMITER: COUNT_PER_POINT = nPrimVarGrad; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case SOLUTION_EDDY: + case ENUM_MPI_QUANTITIES::SOLUTION_EDDY: COUNT_PER_POINT = nVar+1; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case SOLUTION_FEA: + case ENUM_MPI_QUANTITIES::SOLUTION_FEA: if (config->GetTime_Domain()) COUNT_PER_POINT = nVar*3; else COUNT_PER_POINT = nVar; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case AUXVAR_GRADIENT: + case ENUM_MPI_QUANTITIES::AUXVAR_GRADIENT: COUNT_PER_POINT = nDim*base_nodes->GetnAuxVar(); MPI_TYPE = COMM_TYPE_DOUBLE; break; - case MESH_DISPLACEMENTS: + case ENUM_MPI_QUANTITIES::MESH_DISPLACEMENTS: COUNT_PER_POINT = nDim; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case SOLUTION_TIME_N: + case ENUM_MPI_QUANTITIES::SOLUTION_TIME_N: COUNT_PER_POINT = nVar; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case SOLUTION_TIME_N1: + case ENUM_MPI_QUANTITIES::SOLUTION_TIME_N1: COUNT_PER_POINT = nVar; MPI_TYPE = COMM_TYPE_DOUBLE; break; @@ -1387,25 +1387,25 @@ void CSolver::GetCommCountAndType(const CConfig* config, } namespace CommHelpers { - CVectorOfMatrix& selectGradient(CVariable* nodes, unsigned short commType) { + CVectorOfMatrix& selectGradient(CVariable* nodes, ENUM_MPI_QUANTITIES commType) { switch(commType) { - case SOLUTION_GRAD_REC: return nodes->GetGradient_Reconstruction(); - case PRIMITIVE_GRADIENT: return nodes->GetGradient_Primitive(); - case PRIMITIVE_GRAD_REC: return nodes->GetGradient_Reconstruction(); - case AUXVAR_GRADIENT: return nodes->GetAuxVarGradient(); + case ENUM_MPI_QUANTITIES::SOLUTION_GRAD_REC: return nodes->GetGradient_Reconstruction(); + case ENUM_MPI_QUANTITIES::PRIMITIVE_GRADIENT: return nodes->GetGradient_Primitive(); + case ENUM_MPI_QUANTITIES::PRIMITIVE_GRAD_REC: return nodes->GetGradient_Reconstruction(); + case ENUM_MPI_QUANTITIES::AUXVAR_GRADIENT: return nodes->GetAuxVarGradient(); default: return nodes->GetGradient(); } } - su2activematrix& selectLimiter(CVariable* nodes, unsigned short commType) { - if (commType == PRIMITIVE_LIMITER) return nodes->GetLimiter_Primitive(); + su2activematrix& selectLimiter(CVariable* nodes, ENUM_MPI_QUANTITIES commType) { + if (commType == ENUM_MPI_QUANTITIES::PRIMITIVE_LIMITER) return nodes->GetLimiter_Primitive(); return nodes->GetLimiter(); } } void CSolver::InitiateComms(CGeometry *geometry, const CConfig *config, - unsigned short commType) { + ENUM_MPI_QUANTITIES commType) { /*--- Local variables ---*/ @@ -1470,44 +1470,44 @@ void CSolver::InitiateComms(CGeometry *geometry, buf_offset = (msg_offset + iSend)*COUNT_PER_POINT; switch (commType) { - case SOLUTION: + case ENUM_MPI_QUANTITIES::SOLUTION: for (iVar = 0; iVar < nVar; iVar++) bufDSend[buf_offset+iVar] = base_nodes->GetSolution(iPoint, iVar); break; - case SOLUTION_OLD: + case ENUM_MPI_QUANTITIES::SOLUTION_OLD: for (iVar = 0; iVar < nVar; iVar++) bufDSend[buf_offset+iVar] = base_nodes->GetSolution_Old(iPoint, iVar); break; - case SOLUTION_EDDY: + case ENUM_MPI_QUANTITIES::SOLUTION_EDDY: for (iVar = 0; iVar < nVar; iVar++) bufDSend[buf_offset+iVar] = base_nodes->GetSolution(iPoint, iVar); bufDSend[buf_offset+nVar] = base_nodes->GetmuT(iPoint); break; - case UNDIVIDED_LAPLACIAN: + case ENUM_MPI_QUANTITIES::UNDIVIDED_LAPLACIAN: for (iVar = 0; iVar < nVar; iVar++) bufDSend[buf_offset+iVar] = base_nodes->GetUndivided_Laplacian(iPoint, iVar); break; - case SOLUTION_LIMITER: - case PRIMITIVE_LIMITER: + case ENUM_MPI_QUANTITIES::SOLUTION_LIMITER: + case ENUM_MPI_QUANTITIES::PRIMITIVE_LIMITER: for (iVar = 0; iVar < COUNT_PER_POINT; iVar++) bufDSend[buf_offset+iVar] = limiter(iPoint, iVar); break; - case MAX_EIGENVALUE: + case ENUM_MPI_QUANTITIES::MAX_EIGENVALUE: bufDSend[buf_offset] = base_nodes->GetLambda(iPoint); break; - case SENSOR: + case ENUM_MPI_QUANTITIES::SENSOR: bufDSend[buf_offset] = base_nodes->GetSensor(iPoint); break; - case SOLUTION_GRADIENT: - case PRIMITIVE_GRADIENT: - case SOLUTION_GRAD_REC: - case PRIMITIVE_GRAD_REC: - case AUXVAR_GRADIENT: + case ENUM_MPI_QUANTITIES::SOLUTION_GRADIENT: + case ENUM_MPI_QUANTITIES::PRIMITIVE_GRADIENT: + case ENUM_MPI_QUANTITIES::SOLUTION_GRAD_REC: + case ENUM_MPI_QUANTITIES::PRIMITIVE_GRAD_REC: + case ENUM_MPI_QUANTITIES::AUXVAR_GRADIENT: for (iVar = 0; iVar < nVarGrad; iVar++) for (iDim = 0; iDim < nDim; iDim++) bufDSend[buf_offset+iVar*nDim+iDim] = gradient(iPoint, iVar, iDim); break; - case SOLUTION_FEA: + case ENUM_MPI_QUANTITIES::SOLUTION_FEA: for (iVar = 0; iVar < nVar; iVar++) { bufDSend[buf_offset+iVar] = base_nodes->GetSolution(iPoint, iVar); if (config->GetTime_Domain()) { @@ -1516,15 +1516,15 @@ void CSolver::InitiateComms(CGeometry *geometry, } } break; - case MESH_DISPLACEMENTS: + case ENUM_MPI_QUANTITIES::MESH_DISPLACEMENTS: for (iDim = 0; iDim < nDim; iDim++) bufDSend[buf_offset+iDim] = base_nodes->GetBound_Disp(iPoint, iDim); break; - case SOLUTION_TIME_N: + case ENUM_MPI_QUANTITIES::SOLUTION_TIME_N: for (iVar = 0; iVar < nVar; iVar++) bufDSend[buf_offset+iVar] = base_nodes->GetSolution_time_n(iPoint, iVar); break; - case SOLUTION_TIME_N1: + case ENUM_MPI_QUANTITIES::SOLUTION_TIME_N1: for (iVar = 0; iVar < nVar; iVar++) bufDSend[buf_offset+iVar] = base_nodes->GetSolution_time_n1(iPoint, iVar); break; @@ -1547,7 +1547,7 @@ void CSolver::InitiateComms(CGeometry *geometry, void CSolver::CompleteComms(CGeometry *geometry, const CConfig *config, - unsigned short commType) { + ENUM_MPI_QUANTITIES commType) { /*--- Local variables ---*/ @@ -1618,44 +1618,44 @@ void CSolver::CompleteComms(CGeometry *geometry, /*--- Store the data correctly depending on the quantity. ---*/ switch (commType) { - case SOLUTION: + case ENUM_MPI_QUANTITIES::SOLUTION: for (iVar = 0; iVar < nVar; iVar++) base_nodes->SetSolution(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; - case SOLUTION_OLD: + case ENUM_MPI_QUANTITIES::SOLUTION_OLD: for (iVar = 0; iVar < nVar; iVar++) base_nodes->SetSolution_Old(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; - case SOLUTION_EDDY: + case ENUM_MPI_QUANTITIES::SOLUTION_EDDY: for (iVar = 0; iVar < nVar; iVar++) base_nodes->SetSolution(iPoint, iVar, bufDRecv[buf_offset+iVar]); base_nodes->SetmuT(iPoint,bufDRecv[buf_offset+nVar]); break; - case UNDIVIDED_LAPLACIAN: + case ENUM_MPI_QUANTITIES::UNDIVIDED_LAPLACIAN: for (iVar = 0; iVar < nVar; iVar++) base_nodes->SetUnd_Lapl(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; - case SOLUTION_LIMITER: - case PRIMITIVE_LIMITER: + case ENUM_MPI_QUANTITIES::SOLUTION_LIMITER: + case ENUM_MPI_QUANTITIES::PRIMITIVE_LIMITER: for (iVar = 0; iVar < COUNT_PER_POINT; iVar++) limiter(iPoint,iVar) = bufDRecv[buf_offset+iVar]; break; - case MAX_EIGENVALUE: + case ENUM_MPI_QUANTITIES::MAX_EIGENVALUE: base_nodes->SetLambda(iPoint,bufDRecv[buf_offset]); break; - case SENSOR: + case ENUM_MPI_QUANTITIES::SENSOR: base_nodes->SetSensor(iPoint,bufDRecv[buf_offset]); break; - case SOLUTION_GRADIENT: - case PRIMITIVE_GRADIENT: - case SOLUTION_GRAD_REC: - case PRIMITIVE_GRAD_REC: - case AUXVAR_GRADIENT: + case ENUM_MPI_QUANTITIES::SOLUTION_GRADIENT: + case ENUM_MPI_QUANTITIES::PRIMITIVE_GRADIENT: + case ENUM_MPI_QUANTITIES::SOLUTION_GRAD_REC: + case ENUM_MPI_QUANTITIES::PRIMITIVE_GRAD_REC: + case ENUM_MPI_QUANTITIES::AUXVAR_GRADIENT: for (iVar = 0; iVar < nVarGrad; iVar++) for (iDim = 0; iDim < nDim; iDim++) gradient(iPoint,iVar,iDim) = bufDRecv[buf_offset+iVar*nDim+iDim]; break; - case SOLUTION_FEA: + case ENUM_MPI_QUANTITIES::SOLUTION_FEA: for (iVar = 0; iVar < nVar; iVar++) { base_nodes->SetSolution(iPoint, iVar, bufDRecv[buf_offset+iVar]); if (config->GetTime_Domain()) { @@ -1664,15 +1664,15 @@ void CSolver::CompleteComms(CGeometry *geometry, } } break; - case MESH_DISPLACEMENTS: + case ENUM_MPI_QUANTITIES::MESH_DISPLACEMENTS: for (iDim = 0; iDim < nDim; iDim++) base_nodes->SetBound_Disp(iPoint, iDim, bufDRecv[buf_offset+iDim]); break; - case SOLUTION_TIME_N: + case ENUM_MPI_QUANTITIES::SOLUTION_TIME_N: for (iVar = 0; iVar < nVar; iVar++) base_nodes->Set_Solution_time_n(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; - case SOLUTION_TIME_N1: + case ENUM_MPI_QUANTITIES::SOLUTION_TIME_N1: for (iVar = 0; iVar < nVar; iVar++) base_nodes->Set_Solution_time_n1(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; @@ -2095,7 +2095,7 @@ void CSolver::SetAuxVar_Gradient_GG(CGeometry *geometry, const CConfig *config) const auto& solution = base_nodes->GetAuxVar(); auto& gradient = base_nodes->GetAuxVarGradient(); - computeGradientsGreenGauss(this, AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, + computeGradientsGreenGauss(this, ENUM_MPI_QUANTITIES::AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, *config, solution, 0, base_nodes->GetnAuxVar(), gradient); } @@ -2106,7 +2106,7 @@ void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, const CConfig *config) auto& gradient = base_nodes->GetAuxVarGradient(); auto& rmatrix = base_nodes->GetRmatrix(); - computeGradientsLeastSquares(this, AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, *config, + computeGradientsLeastSquares(this, ENUM_MPI_QUANTITIES::AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, *config, weighted, solution, 0, base_nodes->GetnAuxVar(), gradient, rmatrix); } @@ -2114,7 +2114,7 @@ void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config const auto& solution = base_nodes->GetSolution(); auto& gradient = reconstruction? base_nodes->GetGradient_Reconstruction() : base_nodes->GetGradient(); - const auto comm = reconstruction? SOLUTION_GRAD_REC : SOLUTION_GRADIENT; + const auto comm = reconstruction? ENUM_MPI_QUANTITIES::SOLUTION_GRAD_REC : ENUM_MPI_QUANTITIES::SOLUTION_GRADIENT; const auto commPer = reconstruction? PERIODIC_SOL_GG_R : PERIODIC_SOL_GG; computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, solution, 0, nVar, gradient); @@ -2138,7 +2138,7 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config const auto& solution = base_nodes->GetSolution(); auto& rmatrix = base_nodes->GetRmatrix(); auto& gradient = reconstruction? base_nodes->GetGradient_Reconstruction() : base_nodes->GetGradient(); - const auto comm = reconstruction? SOLUTION_GRAD_REC : SOLUTION_GRADIENT; + const auto comm = reconstruction? ENUM_MPI_QUANTITIES::SOLUTION_GRAD_REC : ENUM_MPI_QUANTITIES::SOLUTION_GRADIENT; computeGradientsLeastSquares(this, comm, commPer, *geometry, *config, weighted, solution, 0, nVar, gradient, rmatrix); } @@ -2183,8 +2183,8 @@ void CSolver::SetUndivided_Laplacian(CGeometry *geometry, const CConfig *config) /*--- MPI parallelization ---*/ - InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN); - CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::UNDIVIDED_LAPLACIAN); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::UNDIVIDED_LAPLACIAN); } @@ -2238,7 +2238,7 @@ void CSolver::SetGridVel_Gradient(CGeometry *geometry, const CConfig *config) co auto& gridVelGrad = geometry->nodes->GetGridVel_Grad(); auto rmatrix = CVectorOfMatrix(nPoint,nDim,nDim); - computeGradientsLeastSquares(nullptr, GRID_VELOCITY, PERIODIC_NONE, *geometry, *config, + computeGradientsLeastSquares(nullptr, ENUM_MPI_QUANTITIES::GRID_VELOCITY, PERIODIC_NONE, *geometry, *config, true, gridVel, 0, nDim, gridVelGrad, rmatrix); } @@ -2251,7 +2251,7 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, const CConfig *config) { auto& solMax = base_nodes->GetSolution_Max(); auto& limiter = base_nodes->GetLimiter(); - computeLimiters(kindLimiter, this, SOLUTION_LIMITER, PERIODIC_LIM_SOL_1, PERIODIC_LIM_SOL_2, + computeLimiters(kindLimiter, this, ENUM_MPI_QUANTITIES::SOLUTION_LIMITER, PERIODIC_LIM_SOL_1, PERIODIC_LIM_SOL_2, *geometry, *config, 0, nVar, solution, gradient, solMin, solMax, limiter); } @@ -2723,8 +2723,8 @@ void CSolver::Restart_OldGeometry(CGeometry *geometry, CConfig *config) const { /*--- It's necessary to communicate this information ---*/ - geometry->InitiateComms(geometry, config, COORDINATES_OLD); - geometry->CompleteComms(geometry, config, COORDINATES_OLD); + geometry->InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::COORDINATES_OLD); + geometry->CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::COORDINATES_OLD); } diff --git a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp index 661c9543024..42b129b56d8 100644 --- a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp +++ b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp @@ -265,11 +265,11 @@ void CSpeciesFlameletSolver::SetInitialCondition(CGeometry** geometry, CSolver** solver_container[i_mesh][SPECIES_SOL]->GetNodes()->SetSolution(i_point, scalar_init); } - solver_container[i_mesh][SPECIES_SOL]->InitiateComms(geometry[i_mesh], config, SOLUTION); - solver_container[i_mesh][SPECIES_SOL]->CompleteComms(geometry[i_mesh], config, SOLUTION); + solver_container[i_mesh][SPECIES_SOL]->InitiateComms(geometry[i_mesh], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver_container[i_mesh][SPECIES_SOL]->CompleteComms(geometry[i_mesh], config, ENUM_MPI_QUANTITIES::SOLUTION); - solver_container[i_mesh][FLOW_SOL]->InitiateComms(geometry[i_mesh], config, SOLUTION); - solver_container[i_mesh][FLOW_SOL]->CompleteComms(geometry[i_mesh], config, SOLUTION); + solver_container[i_mesh][FLOW_SOL]->InitiateComms(geometry[i_mesh], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver_container[i_mesh][FLOW_SOL]->CompleteComms(geometry[i_mesh], config, ENUM_MPI_QUANTITIES::SOLUTION); solver_container[i_mesh][FLOW_SOL]->Preprocessing(geometry[i_mesh], solver_container[i_mesh], config, i_mesh, NO_RK_ITER, RUNTIME_FLOW_SYS, false); @@ -543,7 +543,7 @@ unsigned long CSpeciesFlameletSolver::SetScalarLookUps(const CConfig* config, CF nodes->SetLookupScalar(iPoint, lookup_scalar[i_lookup], i_lookup); } } - + return misses; } diff --git a/SU2_CFD/src/solvers/CSpeciesSolver.cpp b/SU2_CFD/src/solvers/CSpeciesSolver.cpp index fbdb7bc046d..a72798f0b07 100644 --- a/SU2_CFD/src/solvers/CSpeciesSolver.cpp +++ b/SU2_CFD/src/solvers/CSpeciesSolver.cpp @@ -60,8 +60,8 @@ CSpeciesSolver::CSpeciesSolver(CGeometry* geometry, CConfig* config, unsigned sh /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); SlidingState.resize(nMarker); SlidingStateNodes.resize(nMarker); @@ -248,8 +248,8 @@ void CSpeciesSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfi /*--- MPI solution and compute the eddy viscosity ---*/ - solver[MESH_0][SPECIES_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION); - solver[MESH_0][SPECIES_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION); + solver[MESH_0][SPECIES_SOL]->InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[MESH_0][SPECIES_SOL]->CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); // Flow-Pre computes/sets mixture properties solver[MESH_0][FLOW_SOL]->Preprocessing(geometry[MESH_0], solver[MESH_0], config, MESH_0, NO_RK_ITER, @@ -267,8 +267,8 @@ void CSpeciesSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfi for (auto iMesh = 1u; iMesh <= config->GetnMGLevels(); iMesh++) { MultigridRestriction(*geometry[iMesh - 1], solver[iMesh - 1][SPECIES_SOL]->GetNodes()->GetSolution(), *geometry[iMesh], solver[iMesh][SPECIES_SOL]->GetNodes()->GetSolution()); - solver[iMesh][SPECIES_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); - solver[iMesh][SPECIES_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); + solver[iMesh][SPECIES_SOL]->InitiateComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[iMesh][SPECIES_SOL]->CompleteComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); solver[iMesh][FLOW_SOL]->Preprocessing(geometry[iMesh], solver[iMesh], config, iMesh, NO_RK_ITER, RUNTIME_FLOW_SYS, false); diff --git a/SU2_CFD/src/solvers/CTransLMSolver.cpp b/SU2_CFD/src/solvers/CTransLMSolver.cpp index af89924ea2e..ca6e604d288 100644 --- a/SU2_CFD/src/solvers/CTransLMSolver.cpp +++ b/SU2_CFD/src/solvers/CTransLMSolver.cpp @@ -132,8 +132,8 @@ CTransLMSolver::CTransLMSolver(CGeometry *geometry, CConfig *config, unsigned sh /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- Initializate quantities for SlidingMesh Interface ---*/ @@ -561,8 +561,8 @@ void CTransLMSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfi /*--- MPI solution and compute the eddy viscosity ---*/ - solver[MESH_0][TRANS_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION); - solver[MESH_0][TRANS_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION); + solver[MESH_0][TRANS_SOL]->InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[MESH_0][TRANS_SOL]->CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- For turbulent+species simulations the solver Pre-/Postprocessing is done by the species solver. ---*/ if (config->GetKind_Species_Model() == SPECIES_MODEL::NONE) { @@ -578,8 +578,8 @@ void CTransLMSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfi MultigridRestriction(*geometry[iMesh - 1], solver[iMesh - 1][TRANS_SOL]->GetNodes()->GetSolution(), *geometry[iMesh], solver[iMesh][TRANS_SOL]->GetNodes()->GetSolution()); - solver[iMesh][TRANS_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); - solver[iMesh][TRANS_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); + solver[iMesh][TRANS_SOL]->InitiateComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[iMesh][TRANS_SOL]->CompleteComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); if (config->GetKind_Species_Model() == SPECIES_MODEL::NONE) { solver[iMesh][FLOW_SOL]->Preprocessing(geometry[iMesh], solver[iMesh], config, iMesh, NO_RK_ITER, RUNTIME_FLOW_SYS, diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index d84b56e1dc6..9dfe4aa202d 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -134,8 +134,8 @@ CTurbSASolver::CTurbSASolver(CGeometry *geometry, CConfig *config, unsigned shor /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION_EDDY); - CompleteComms(geometry, config, SOLUTION_EDDY); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION_EDDY); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION_EDDY); /*--- Initializate quantities for SlidingMesh Interface ---*/ diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index ea316e9a0cd..fd8d5bd0e30 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -142,8 +142,8 @@ CTurbSSTSolver::CTurbSSTSolver(CGeometry *geometry, CConfig *config, unsigned sh /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION_EDDY); - CompleteComms(geometry, config, SOLUTION_EDDY); + InitiateComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION_EDDY); + CompleteComms(geometry, config, ENUM_MPI_QUANTITIES::SOLUTION_EDDY); /*--- Initialize quantities for SlidingMesh Interface ---*/ diff --git a/SU2_CFD/src/solvers/CTurbSolver.cpp b/SU2_CFD/src/solvers/CTurbSolver.cpp index c4b5a0b2e2b..0c9229b3f6c 100644 --- a/SU2_CFD/src/solvers/CTurbSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSolver.cpp @@ -167,8 +167,8 @@ void CTurbSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfig* /*--- MPI solution and compute the eddy viscosity ---*/ - solver[MESH_0][TURB_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION); - solver[MESH_0][TURB_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION); + solver[MESH_0][TURB_SOL]->InitiateComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[MESH_0][TURB_SOL]->CompleteComms(geometry[MESH_0], config, ENUM_MPI_QUANTITIES::SOLUTION); /*--- For turbulent+species simulations the solver Pre-/Postprocessing is done by the species solver. ---*/ if (config->GetKind_Species_Model() == SPECIES_MODEL::NONE && config->GetKind_Trans_Model() == TURB_TRANS_MODEL::NONE) { @@ -182,8 +182,8 @@ void CTurbSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfig* for (auto iMesh = 1u; iMesh <= config->GetnMGLevels(); iMesh++) { MultigridRestriction(*geometry[iMesh - 1], solver[iMesh - 1][TURB_SOL]->GetNodes()->GetSolution(), *geometry[iMesh], solver[iMesh][TURB_SOL]->GetNodes()->GetSolution()); - solver[iMesh][TURB_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); - solver[iMesh][TURB_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); + solver[iMesh][TURB_SOL]->InitiateComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); + solver[iMesh][TURB_SOL]->CompleteComms(geometry[iMesh], config, ENUM_MPI_QUANTITIES::SOLUTION); if (config->GetKind_Species_Model() == SPECIES_MODEL::NONE) { solver[iMesh][FLOW_SOL]->Preprocessing(geometry[iMesh], solver[iMesh], config, iMesh, NO_RK_ITER, RUNTIME_FLOW_SYS, diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref index 615bfd49df3..4d8648efc5b 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref @@ -1,2 +1,2 @@ "VARIABLE" , "AVG_DENSITY[0]", "AVG_ENTHALPY[0]", "AVG_NORMALVEL[0]", "DRAG[0]" , "EFFICIENCY[0]" , "FORCE_X[0]" , "FORCE_Y[0]" , "FORCE_Z[0]" , "LIFT[0]" , "MOMENT_X[0]" , "MOMENT_Y[0]" , "MOMENT_Z[0]" , "SIDEFORCE[0]" , "SURFACE_MACH[0]", "SURFACE_MASSFLOW[0]", "SURFACE_MOM_DISTORTION[0]", "SURFACE_PRESSURE_DROP[0]", "SURFACE_SECONDARY[0]", "SURFACE_SECOND_OVER_UNIFORM[0]", "SURFACE_STATIC_PRESSURE[0]", "SURFACE_STATIC_TEMPERATURE[0]", "SURFACE_TOTAL_PRESSURE[0]", "SURFACE_TOTAL_TEMPERATURE[0]", "SURFACE_UNIFORMITY[0]", "AVG_TEMPERATURE[1]", "MAXIMUM_HEATFLUX[1]", "TOTAL_HEATFLUX[1]", "FINDIFF_STEP" -0 , 0.0 , -99999.96982514858, -2.2204000000409886e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.12000000021439305, -1.1100000001884e-08, -0.26799999996995894 , 0.0 , 0.3110000007522373 , 0.3400000003761505 , -170.00000411826477 , -19.99999312829459 , 805.9999998977219 , -19.99999312829459 , 1.1000000021965661 , -349.99999911633495, 0.0 , -680.0000051043753, 1e-08 ++0 , 0.0 , -99999.96982514858, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.02999999970665357, 1.1099999991544242e-08, -0.8910000001693952 , 0.0 , 0.906000000022722 , 1.5900000011059845 , 449.9999988638592 , -40.000008993956726 , 347.0000002891993 , -50.00000555810402 , -0.7000000135093387 , -280.00000042993634, 0.0 , -529.999999798747, 1e-08 diff --git a/UnitTests/SU2_CFD/gradients.cpp b/UnitTests/SU2_CFD/gradients.cpp index e0829ce1104..8e37c8e2788 100644 --- a/UnitTests/SU2_CFD/gradients.cpp +++ b/UnitTests/SU2_CFD/gradients.cpp @@ -132,8 +132,8 @@ void testGreenGauss() { TestField field; C3DDoubleMatrix gradient(field.geometry->GetnPoint(), field.nVar, field.geometry->GetnDim()); - computeGradientsGreenGauss(nullptr, SOLUTION, PERIODIC_NONE, *field.geometry.get(), *field.config.get(), field, 0, - field.nVar, gradient); + computeGradientsGreenGauss(nullptr, ENUM_MPI_QUANTITIES::SOLUTION, PERIODIC_NONE, *field.geometry.get(), + *field.config.get(), field, 0, field.nVar, gradient); check(field, gradient); } @@ -144,8 +144,8 @@ void testLeastSquares(bool weighted) { C3DDoubleMatrix R(field.geometry->GetnPoint(), nDim, nDim); C3DDoubleMatrix gradient(field.geometry->GetnPoint(), field.nVar, nDim); - computeGradientsLeastSquares(nullptr, SOLUTION, PERIODIC_NONE, *field.geometry.get(), *field.config.get(), weighted, - field, 0, field.nVar, gradient, R); + computeGradientsLeastSquares(nullptr, ENUM_MPI_QUANTITIES::SOLUTION, PERIODIC_NONE, *field.geometry.get(), + *field.config.get(), weighted, field, 0, field.nVar, gradient, R); check(field, gradient); } From 848cacb065fcdbfd3d8ebf9ccf99ebb3c1185430 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 11 May 2024 13:24:06 +0200 Subject: [PATCH 097/194] remove unused variables --- SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp | 4 +--- SU2_CFD/include/gradients/computeGradientsSymmetry.hpp | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 4c44c90ce73..980ec9c6b42 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -61,7 +61,7 @@ void computeGradientsGreenGauss(CSolver* solver, ENUM_MPI_QUANTITIES kindMpiComm CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, size_t varEnd, GradientType& gradient) { const size_t nPointDomain = geometry.GetnPointDomain(); - bool isFlowSolver = (solver->GetSolverName().find("FLOW") != string::npos) ; + //bool isFlowSolver = (solver->GetSolverName().find("FLOW") != string::npos) ; #ifdef HAVE_OMP constexpr size_t OMP_MAX_CHUNK = 512; @@ -70,8 +70,6 @@ void computeGradientsGreenGauss(CSolver* solver, ENUM_MPI_QUANTITIES kindMpiComm #endif static constexpr size_t MAXNVAR = 20; - static constexpr size_t MAXNDIM = 3; - static constexpr size_t MAXNSYMS = 100; /*--- For each (non-halo) volume integrate over its faces (edges). ---*/ diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index f33b3dd9217..eef4f484072 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -207,10 +207,8 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, ENUM_MPI_QUA CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, size_t varEnd, GradientType& gradient) { - const size_t nPointDomain = geometry.GetnPointDomain(); bool isFlowSolver = (solver->GetSolverName().find("FLOW") != string::npos) ; - static constexpr size_t MAXNVAR = 20; static constexpr size_t MAXNDIM = 3; static constexpr size_t MAXNSYMS = 100; @@ -243,7 +241,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, ENUM_MPI_QUA const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); - su2double UnitNormal[nDim] = {0.0}; + su2double UnitNormal[MAXNDIM] = {0.0}; for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; From a429470298e941c3638c9be51e1ebb675cfe58a0 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 11 May 2024 21:27:02 +0200 Subject: [PATCH 098/194] add idx_vel as argument to gradient functions --- .../gradients/computeGradientsGreenGauss.hpp | 13 +- .../computeGradientsLeastSquares.hpp | 120 ++---------------- .../gradients/computeGradientsSymmetry.hpp | 20 +-- .../include/solvers/CFVMFlowSolverBase.inl | 4 +- SU2_CFD/include/solvers/CScalarSolver.inl | 10 +- SU2_CFD/include/solvers/CSolver.hpp | 6 +- SU2_CFD/src/solvers/CAdjEulerSolver.cpp | 10 +- SU2_CFD/src/solvers/CAdjNSSolver.cpp | 14 +- SU2_CFD/src/solvers/CAdjTurbSolver.cpp | 8 +- SU2_CFD/src/solvers/CNEMONSSolver.cpp | 2 +- SU2_CFD/src/solvers/CRadP1Solver.cpp | 10 +- SU2_CFD/src/solvers/CSolver.cpp | 17 ++- SU2_CFD/src/solvers/CTransLMSolver.cpp | 4 +- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 4 +- TestCases/TestCase.py | 2 +- .../lam_prem_ch4_cht_cfd_fluid.cfg | 7 +- .../lam_prem_ch4_cht_cfd_master.cfg | 2 +- TestCases/parallel_regression.py | 4 +- ...iveVenturi_mixingmodel_heatcapacity_H2.cfg | 2 +- ...Venturi_mixingmodel_heatcapacity_H2_ND.cfg | 6 +- UnitTests/SU2_CFD/gradients.cpp | 5 +- 21 files changed, 86 insertions(+), 184 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 980ec9c6b42..0f7e597d406 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -54,14 +54,14 @@ namespace detail { * \param[in] field - Generic object implementing operator (iPoint, iVar). * \param[in] varBegin - Index of first variable for which to compute the gradient. * \param[in] varEnd - Index of last variable for which to compute the gradient. + * \param[in] idx_vel - Index of velocity, or -1 if no velocity present. * \param[out] gradient - Generic object implementing operator (iPoint, iVar, iDim). */ template void computeGradientsGreenGauss(CSolver* solver, ENUM_MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient) { + size_t varEnd, GradientType& gradient, int idx_vel) { const size_t nPointDomain = geometry.GetnPointDomain(); - //bool isFlowSolver = (solver->GetSolverName().find("FLOW") != string::npos) ; #ifdef HAVE_OMP constexpr size_t OMP_MAX_CHUNK = 512; @@ -163,7 +163,8 @@ void computeGradientsGreenGauss(CSolver* solver, ENUM_MPI_QUANTITIES kindMpiComm /* --- compute the corrections for symmetry planes and Euler walls. --- */ - computeGradientsSymmetry(nDim, solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, varEnd, gradient); + + computeGradientsSymmetry(nDim, solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, varEnd, gradient, idx_vel); /*--- If no solver was provided we do not communicate ---*/ @@ -192,15 +193,15 @@ void computeGradientsGreenGauss(CSolver* solver, ENUM_MPI_QUANTITIES kindMpiComm template void computeGradientsGreenGauss(CSolver* solver, ENUM_MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient) { + size_t varEnd, GradientType& gradient, int idx_vel) { switch (geometry.GetnDim()) { case 2: detail::computeGradientsGreenGauss<2>(solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, - varEnd, gradient); + varEnd, gradient, idx_vel); break; case 3: detail::computeGradientsGreenGauss<3>(solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, - varEnd, gradient); + varEnd, gradient, idx_vel); break; default: SU2_MPI::Error("Too many dimensions to compute gradients.", CURRENT_FUNCTION); diff --git a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp index 4c506d03f2f..dc6000e1d8d 100644 --- a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp +++ b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp @@ -178,6 +178,7 @@ FORCEINLINE void solveLeastSquares(size_t iPoint, * \param[in] varEnd - Index of last variable for which to compute the gradient. * \param[out] gradient - Generic object implementing operator (iPoint, iVar, iDim). * \param[out] Rmatrix - Generic object implementing operator (iPoint, iDim, iDim). + * \param[in] idx_vel - index to velocity, -1 if no velocity present in solver. */ template void computeGradientsLeastSquares(CSolver* solver, @@ -190,10 +191,10 @@ void computeGradientsLeastSquares(CSolver* solver, size_t varBegin, size_t varEnd, GradientType& gradient, - RMatrixType& Rmatrix) + RMatrixType& Rmatrix, + int idx_vel) { const bool periodic = (solver != nullptr) && (config.GetnMarker_Periodic() > 0); - bool isFlowSolver = solver->GetSolverName().find("FLOW") != string::npos; const size_t nPointDomain = geometry.GetnPointDomain(); @@ -204,9 +205,6 @@ void computeGradientsLeastSquares(CSolver* solver, omp_get_max_threads(), OMP_MAX_CHUNK); #endif - static constexpr size_t MAXNDIM = 3; - static constexpr size_t MAXNSYMS = 100; - /*--- First loop over non-halo points of the grid. ---*/ SU2_OMP_FOR_DYN(chunkSize) @@ -317,109 +315,9 @@ void computeGradientsLeastSquares(CSolver* solver, END_SU2_OMP_FOR } + /* --- compute the corrections for symmetry planes and Euler walls. --- */ + computeGradientsSymmetry(nDim, solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, varEnd, gradient, idx_vel); - /* For symmetry planes, we need to impose the conditions (Blazek eq. 8.40): - * 1. n.grad(phi) = 0 - * 2. n.grad(v.t) = 0 - * 3. t.grad(v.n) = 0 - */ - - /*--- Check how many symmetry planes there are ---*/ - unsigned short Syms[MAXNSYMS] = {0}; - unsigned short nSym = 0; - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { - if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - Syms[nSym] = iMarker; - nSym++; - } - } - - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { - - if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - SU2_OMP_FOR_STAT(32) - for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { - - size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - - /*--- Normal vector for this vertex (negate for outward convention). ---*/ - const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); - - const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); - - su2double UnitNormal[nDim] = {0.0}; - for (size_t iDim = 0; iDim < nDim; iDim++) - UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - - /*--- Normal of the primary symmetry plane ---*/ - su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - - /*--- At this point we can find out if the node is shared with another symmetry. - * Step 1: do we have other symmetries? ---*/ - if (nSym>1) { - /*--- Step 2: are we on a shared node? ---*/ - for (auto jMarker=0;jMarkerGetNode(); - if (iPoint==jPoint) { - /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ - if (Syms[jMarker]GetNormal(NormalPrim); - su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - for(unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - } - - /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ - su2double ProjNorm = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - /*--- We check if the normal of the 2 planes coincide. - * We only update the normal if the normals of the symmetry planes are different. ---*/ - if (fabs(1.0-ProjNorm)>EPS) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - /* Make normalized vector ---*/ - su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; - } - } - } - } - } - } - } - - - /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ - su2activematrix TensorMap(nDim,nDim); - - /*--- Compute a new base for TensorMap aligned with the unit normal ---*/ - BaseFromNormal(nDim,UnitNormal,TensorMap); - - su2activematrix Gradients_iPoint(varEnd-varBegin,nDim); - - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - Gradients_iPoint[iVar][iDim] = gradient(iPoint, iVar, iDim); - } - } - - ReflectGradient(nDim, varBegin,varEnd, isFlowSolver, TensorMap, Gradients_iPoint); - - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradient(iPoint, iVar, iDim) = Gradients_iPoint[iVar][iDim]; - } - } - - } // loop over vertices - END_SU2_OMP_FOR - } // symmetry - } // markers /*--- If no solver was provided we do not communicate ---*/ @@ -449,15 +347,17 @@ void computeGradientsLeastSquares(CSolver* solver, size_t varBegin, size_t varEnd, GradientType& gradient, - RMatrixType& Rmatrix) { + RMatrixType& Rmatrix, + int idx_vel + ) { switch (geometry.GetnDim()) { case 2: detail::computeGradientsLeastSquares<2>(solver, kindMpiComm, kindPeriodicComm, geometry, config, - weighted, field, varBegin, varEnd, gradient, Rmatrix); + weighted, field, varBegin, varEnd, gradient, Rmatrix, idx_vel); break; case 3: detail::computeGradientsLeastSquares<3>(solver, kindMpiComm, kindPeriodicComm, geometry, config, - weighted, field, varBegin, varEnd, gradient, Rmatrix); + weighted, field, varBegin, varEnd, gradient, Rmatrix, idx_vel); break; default: SU2_MPI::Error("Too many dimensions to compute gradients.", CURRENT_FUNCTION); diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index eef4f484072..1949e16a238 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -47,8 +47,8 @@ namespace detail { template -inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isFlowSolver, Matrix& TensorMap, - Matrix& Gradients_iPoint) { +inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& TensorMap, + Matrix& Gradients_iPoint, int idx_vel) { static constexpr size_t MAXNDIM = 3; su2activematrix Gradients_Velocity(nDim, nDim); @@ -56,12 +56,12 @@ inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isF su2double gradPhi[MAXNDIM] = {0.0}; su2double gradPhiReflected[MAXNDIM] = {0.0}; - if (isFlowSolver == true) { + if (idx_vel != -1) { /*--- Get gradients of primitives of boundary cell ---*/ for (auto iVar = 0u; iVar < nDim; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { // todo: 1 ->idx.velocity - Gradients_Velocity[iVar][iDim] = Gradients_iPoint[1 + iVar][iDim]; + Gradients_Velocity[iVar][iDim] = Gradients_iPoint[idx_vel + iVar][iDim]; Gradients_Velocity_Reflected[iVar][iDim] = 0.0; } } @@ -109,14 +109,14 @@ inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, bool isF for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { // todo: 1->idx.velocity - Gradients_iPoint[iDim + 1][jDim] = Gradients_Velocity[iDim][jDim]; + Gradients_iPoint[iDim + idx_vel][jDim] = Gradients_Velocity[iDim][jDim]; } } } /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) { - if ((isFlowSolver == false) || ((isFlowSolver == true) && (iVar == 0 || iVar > nDim))) { + if ((idx_vel == -1) || ((idx_vel != -1) && (iVar == 0 || iVar > nDim))) { /*--- project to symmetry aligned base ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { gradPhi[iDim] = Gradients_iPoint[iVar][iDim]; @@ -205,9 +205,7 @@ inline void BaseFromNormal(Int nDim, const Scalar* UnitNormal, Matrix& TensorMap template void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, ENUM_MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient) { - - bool isFlowSolver = (solver->GetSolverName().find("FLOW") != string::npos) ; + size_t varEnd, GradientType& gradient, int idx_vel) { static constexpr size_t MAXNDIM = 3; static constexpr size_t MAXNSYMS = 100; @@ -228,6 +226,8 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, ENUM_MPI_QUA } } + if (nSym==0) return; + for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { @@ -300,7 +300,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, ENUM_MPI_QUA } } - detail::ReflectGradient(nDim, varBegin,varEnd, isFlowSolver, TensorMap, Gradients_iPoint); + detail::ReflectGradient(nDim, varBegin,varEnd, TensorMap, Gradients_iPoint, idx_vel); for (auto iVar = varBegin; iVar < varEnd; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index da8106c0a10..454121afebf 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -386,7 +386,7 @@ void CFVMFlowSolverBase::SetPrimitive_Gradient_GG(CGeometry* geometry, con const auto comm = reconstruction? ENUM_MPI_QUANTITIES::PRIMITIVE_GRAD_REC : ENUM_MPI_QUANTITIES::PRIMITIVE_GRADIENT; const auto commPer = reconstruction? PERIODIC_PRIM_GG_R : PERIODIC_PRIM_GG; - computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, primitives, 0, nPrimVarGrad, gradient); + computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, primitives, 0, nPrimVarGrad, gradient, prim_idx.Velocity()); } template @@ -411,7 +411,7 @@ void CFVMFlowSolverBase::SetPrimitive_Gradient_LS(CGeometry* geometry, con const auto comm = reconstruction? ENUM_MPI_QUANTITIES::PRIMITIVE_GRAD_REC : ENUM_MPI_QUANTITIES::PRIMITIVE_GRADIENT; computeGradientsLeastSquares(this, comm, commPer, *geometry, *config, weighted, - primitives, 0, nPrimVarGrad, gradient, rmatrix); + primitives, 0, nPrimVarGrad, gradient, rmatrix, prim_idx.Velocity()); } template diff --git a/SU2_CFD/include/solvers/CScalarSolver.inl b/SU2_CFD/include/solvers/CScalarSolver.inl index 5f0c917c6fd..584f32a0cc6 100644 --- a/SU2_CFD/include/solvers/CScalarSolver.inl +++ b/SU2_CFD/include/solvers/CScalarSolver.inl @@ -111,15 +111,15 @@ void CScalarSolver::CommonPreprocessing(CGeometry *geometry, const if (config->GetReconstructionGradientRequired()) { switch(config->GetKind_Gradient_Method_Recon()) { - case GREEN_GAUSS: SetSolution_Gradient_GG(geometry, config, true); break; - case LEAST_SQUARES: SetSolution_Gradient_LS(geometry, config, true); break; - case WEIGHTED_LEAST_SQUARES: SetSolution_Gradient_LS(geometry, config, true); break; + case GREEN_GAUSS: SetSolution_Gradient_GG(geometry, config, -1, true); break; + case LEAST_SQUARES: SetSolution_Gradient_LS(geometry, config, -1, true); break; + case WEIGHTED_LEAST_SQUARES: SetSolution_Gradient_LS(geometry, config, -1, true); break; } } switch(config->GetKind_Gradient_Method()) { - case GREEN_GAUSS: SetSolution_Gradient_GG(geometry, config); break; - case WEIGHTED_LEAST_SQUARES: SetSolution_Gradient_LS(geometry, config); break; + case GREEN_GAUSS: SetSolution_Gradient_GG(geometry, config, -1); break; + case WEIGHTED_LEAST_SQUARES: SetSolution_Gradient_LS(geometry, config, -1); break; } if (limiter && muscl) SetSolution_Limiter(geometry, config); diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index 8dafcecb2fe..db76617506e 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -543,17 +543,19 @@ class CSolver { * \brief Compute the Green-Gauss gradient of the solution. * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. + * \param[in] idx_vel - index to velocity, or -1 when no velocity present. * \param[in] reconstruction - indicator that the gradient being computed is for upwind reconstruction. */ - void SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, bool reconstruction = false); + void SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, int idx_vel, bool reconstruction = false); /*! * \brief Compute the Least Squares gradient of the solution. * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. + * \param[in] idx_vel - index to velocity, or -1 when no velocity present. * \param[in] reconstruction - indicator that the gradient being computed is for upwind reconstruction. */ - void SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, bool reconstruction = false); + void SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, int idx_vel, bool reconstruction = false); /*! * \brief Compute the Least Squares gradient of the grid velocity. diff --git a/SU2_CFD/src/solvers/CAdjEulerSolver.cpp b/SU2_CFD/src/solvers/CAdjEulerSolver.cpp index d6299b3c20c..70b051e177b 100644 --- a/SU2_CFD/src/solvers/CAdjEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CAdjEulerSolver.cpp @@ -952,11 +952,11 @@ void CAdjEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contai /*--- Gradient computation for MUSCL reconstruction. ---*/ if (config->GetKind_Gradient_Method_Recon() == GREEN_GAUSS) - SetSolution_Gradient_GG(geometry, config, true); + SetSolution_Gradient_GG(geometry, config, 1, true); if (config->GetKind_Gradient_Method_Recon() == LEAST_SQUARES) - SetSolution_Gradient_LS(geometry, config, true); + SetSolution_Gradient_LS(geometry, config, 1, true); if (config->GetKind_Gradient_Method_Recon() == WEIGHTED_LEAST_SQUARES) - SetSolution_Gradient_LS(geometry, config, true); + SetSolution_Gradient_LS(geometry, config, 1, true); /*--- Limiter computation ---*/ @@ -970,8 +970,8 @@ void CAdjEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contai if ((center_jst) && (iMesh == MESH_0)) { SetCentered_Dissipation_Sensor(geometry, config); SetUndivided_Laplacian(geometry, config); - if (config->GetKind_Gradient_Method() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config); - if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config); + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config, 1); + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config, 1); } } diff --git a/SU2_CFD/src/solvers/CAdjNSSolver.cpp b/SU2_CFD/src/solvers/CAdjNSSolver.cpp index d0c9a0b828b..e17d230ee44 100644 --- a/SU2_CFD/src/solvers/CAdjNSSolver.cpp +++ b/SU2_CFD/src/solvers/CAdjNSSolver.cpp @@ -345,14 +345,14 @@ void CAdjNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container if (config->GetReconstructionGradientRequired()) { if (config->GetKind_Gradient_Method_Recon() == GREEN_GAUSS) - SetSolution_Gradient_GG(geometry, config, true); + SetSolution_Gradient_GG(geometry, config, 1, true); if (config->GetKind_Gradient_Method_Recon() == LEAST_SQUARES) - SetSolution_Gradient_LS(geometry, config, true); + SetSolution_Gradient_LS(geometry, config, 1, true); if (config->GetKind_Gradient_Method_Recon() == WEIGHTED_LEAST_SQUARES) - SetSolution_Gradient_LS(geometry, config, true); + SetSolution_Gradient_LS(geometry, config, 1, true); } - if (config->GetKind_Gradient_Method() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config); - if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config); + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config, 1); + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config, 1); /*--- Limiter computation (upwind reconstruction) ---*/ @@ -361,8 +361,8 @@ void CAdjNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container /*--- Compute gradients adj for viscous term coupling ---*/ if ((config->GetKind_Solver() == MAIN_SOLVER::ADJ_RANS) && (!config->GetFrozen_Visc_Cont())) { - if (config->GetKind_Gradient_Method() == GREEN_GAUSS) solver_container[ADJTURB_SOL]->SetSolution_Gradient_GG(geometry, config); - if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) solver_container[ADJTURB_SOL]->SetSolution_Gradient_LS(geometry, config); + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) solver_container[ADJTURB_SOL]->SetSolution_Gradient_GG(geometry, config, 1); + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) solver_container[ADJTURB_SOL]->SetSolution_Gradient_LS(geometry, config, 1); } /*--- Artificial dissipation for centered schemes ---*/ diff --git a/SU2_CFD/src/solvers/CAdjTurbSolver.cpp b/SU2_CFD/src/solvers/CAdjTurbSolver.cpp index 2cb527d1f74..2eb6ee4e45c 100644 --- a/SU2_CFD/src/solvers/CAdjTurbSolver.cpp +++ b/SU2_CFD/src/solvers/CAdjTurbSolver.cpp @@ -257,12 +257,12 @@ void CAdjTurbSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain Jacobian.SetValZero(); /*--- Gradient of the adjoint turbulent variables ---*/ - if (config->GetKind_Gradient_Method() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config); - if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config); + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config, -1); + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config, -1); /*--- Gradient of the turbulent variables ---*/ - if (config->GetKind_Gradient_Method() == GREEN_GAUSS) solver_container[TURB_SOL]->SetSolution_Gradient_GG(geometry, config); - if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) solver_container[TURB_SOL]->SetSolution_Gradient_LS(geometry, config); + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) solver_container[TURB_SOL]->SetSolution_Gradient_GG(geometry, config, -1); + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) solver_container[TURB_SOL]->SetSolution_Gradient_LS(geometry, config, -1); } diff --git a/SU2_CFD/src/solvers/CNEMONSSolver.cpp b/SU2_CFD/src/solvers/CNEMONSSolver.cpp index 9c353bda22e..3181f349efa 100644 --- a/SU2_CFD/src/solvers/CNEMONSSolver.cpp +++ b/SU2_CFD/src/solvers/CNEMONSSolver.cpp @@ -166,7 +166,7 @@ void CNEMONSSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, const CConfig const auto& primitives = nodes->GetPrimitive_Aux(); - computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, primitives, 0, nPrimVarGrad, gradient); + computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, primitives, 0, nPrimVarGrad, gradient, prim_idx.Velocity()); } void CNEMONSSolver::Viscous_Residual(CGeometry *geometry, diff --git a/SU2_CFD/src/solvers/CRadP1Solver.cpp b/SU2_CFD/src/solvers/CRadP1Solver.cpp index 59fca5265f1..3bc6c8e9e79 100644 --- a/SU2_CFD/src/solvers/CRadP1Solver.cpp +++ b/SU2_CFD/src/solvers/CRadP1Solver.cpp @@ -150,12 +150,12 @@ void CRadP1Solver::Preprocessing(CGeometry *geometry, CSolver **solver_container /*--- Compute the Solution gradients ---*/ if (config->GetReconstructionGradientRequired()) { - if (config->GetKind_Gradient_Method_Recon() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config, true); - if (config->GetKind_Gradient_Method_Recon() == LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config, true); - if (config->GetKind_Gradient_Method_Recon() == WEIGHTED_LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config, true); + if (config->GetKind_Gradient_Method_Recon() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config, -1, true); + if (config->GetKind_Gradient_Method_Recon() == LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config, -1, true); + if (config->GetKind_Gradient_Method_Recon() == WEIGHTED_LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config, -1, true); } - if (config->GetKind_Gradient_Method() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config); - if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config); + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config, -1); + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) SetSolution_Gradient_LS(geometry, config, -1); } diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 8f2ad7c284a..239d3d5a6fc 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -2096,7 +2096,7 @@ void CSolver::SetAuxVar_Gradient_GG(CGeometry *geometry, const CConfig *config) auto& gradient = base_nodes->GetAuxVarGradient(); computeGradientsGreenGauss(this, ENUM_MPI_QUANTITIES::AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, - *config, solution, 0, base_nodes->GetnAuxVar(), gradient); + *config, solution, 0, base_nodes->GetnAuxVar(), gradient, -1); } void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, const CConfig *config) { @@ -2107,20 +2107,19 @@ void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, const CConfig *config) auto& rmatrix = base_nodes->GetRmatrix(); computeGradientsLeastSquares(this, ENUM_MPI_QUANTITIES::AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, *config, - weighted, solution, 0, base_nodes->GetnAuxVar(), gradient, rmatrix); + weighted, solution, 0, base_nodes->GetnAuxVar(), gradient, rmatrix, -1); } -void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, bool reconstruction) { +void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, int idx_vel, bool reconstruction) { const auto& solution = base_nodes->GetSolution(); auto& gradient = reconstruction? base_nodes->GetGradient_Reconstruction() : base_nodes->GetGradient(); const auto comm = reconstruction? ENUM_MPI_QUANTITIES::SOLUTION_GRAD_REC : ENUM_MPI_QUANTITIES::SOLUTION_GRADIENT; const auto commPer = reconstruction? PERIODIC_SOL_GG_R : PERIODIC_SOL_GG; - - computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, solution, 0, nVar, gradient); + computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, solution, 0, nVar, gradient, idx_vel); } -void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, bool reconstruction) { +void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, int idx_vel, bool reconstruction) { /*--- Set a flag for unweighted or weighted least-squares. ---*/ bool weighted; @@ -2140,7 +2139,7 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config auto& gradient = reconstruction? base_nodes->GetGradient_Reconstruction() : base_nodes->GetGradient(); const auto comm = reconstruction? ENUM_MPI_QUANTITIES::SOLUTION_GRAD_REC : ENUM_MPI_QUANTITIES::SOLUTION_GRADIENT; - computeGradientsLeastSquares(this, comm, commPer, *geometry, *config, weighted, solution, 0, nVar, gradient, rmatrix); + computeGradientsLeastSquares(this, comm, commPer, *geometry, *config, weighted, solution, 0, nVar, gradient, rmatrix, idx_vel); } void CSolver::SetUndivided_Laplacian(CGeometry *geometry, const CConfig *config) { @@ -2237,9 +2236,9 @@ void CSolver::SetGridVel_Gradient(CGeometry *geometry, const CConfig *config) co const auto& gridVel = geometry->nodes->GetGridVel(); auto& gridVelGrad = geometry->nodes->GetGridVel_Grad(); auto rmatrix = CVectorOfMatrix(nPoint,nDim,nDim); - + // nijso TODO: this contains only the grid velocities, so index is 0? check! computeGradientsLeastSquares(nullptr, ENUM_MPI_QUANTITIES::GRID_VELOCITY, PERIODIC_NONE, *geometry, *config, - true, gridVel, 0, nDim, gridVelGrad, rmatrix); + true, gridVel, 0, nDim, gridVelGrad, rmatrix, 0); } void CSolver::SetSolution_Limiter(CGeometry *geometry, const CConfig *config) { diff --git a/SU2_CFD/src/solvers/CTransLMSolver.cpp b/SU2_CFD/src/solvers/CTransLMSolver.cpp index ca6e604d288..508905cb57d 100644 --- a/SU2_CFD/src/solvers/CTransLMSolver.cpp +++ b/SU2_CFD/src/solvers/CTransLMSolver.cpp @@ -185,10 +185,10 @@ void CTransLMSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai /*--- Compute LM model gradients. ---*/ if (config->GetKind_Gradient_Method() == GREEN_GAUSS) { - SetSolution_Gradient_GG(geometry, config); + SetSolution_Gradient_GG(geometry, config, -1); } if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { - SetSolution_Gradient_LS(geometry, config); + SetSolution_Gradient_LS(geometry, config, -1); } AD::StartNoSharedReading(); diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index fd8d5bd0e30..ae33502f051 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -200,10 +200,10 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai /*--- Compute turbulence gradients. ---*/ if (config->GetKind_Gradient_Method() == GREEN_GAUSS) { - SetSolution_Gradient_GG(geometry, config); + SetSolution_Gradient_GG(geometry, config, -1); } if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { - SetSolution_Gradient_LS(geometry, config); + SetSolution_Gradient_LS(geometry, config, -1); } AD::StartNoSharedReading(); diff --git a/TestCases/TestCase.py b/TestCases/TestCase.py index 0818c6074a0..1170ae71e05 100644 --- a/TestCases/TestCase.py +++ b/TestCases/TestCase.py @@ -361,7 +361,7 @@ def run_filediff(self, with_tsan=False, with_asan=False): # Assert that both files have the same number of lines if len(fromlines) != len(tolines): - diff = ["ERROR: Number of lines in " + fromfile + " and " + tofile + " differ."] + diff = ["ERROR: Number of lines in " + fromfile + " and " + tofile + " differ: " + len(fromlines) + " vs " + len(tolines) + "."] passed = False # Loop through all lines diff --git a/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg b/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg index e0828cc4d44..adf9a65020f 100644 --- a/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg +++ b/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg @@ -19,7 +19,7 @@ HISTORY_OUTPUT= RMS_RES AERO_COEFF FLOW_COEFF FLOW_COEFF_SURF VOLUME_OUTPUT= SOLUTION PRIMITIVE SOURCE RESIDUAL LOOKUP -OUTPUT_FILES= (RESTART_ASCII) +OUTPUT_FILES= (RESTART_ASCII, PARAVIEW) INNER_ITER= 1 @@ -55,6 +55,7 @@ FLUID_MODEL= FLUID_FLAMELET FILENAMES_INTERPOLATOR= (fgm_ch4.drg) CONTROLLING_VARIABLE_NAMES= (ProgressVariable, EnthalpyTot) CONTROLLING_VARIABLE_SOURCE_NAMES= (ProdRateTot_PV, NULL) +FLAME_INIT_METHOD= NONE FLAME_INIT= (0.004, 0.0, 0.0, 1.0, 0.0, 0.0, 0.2e-3, 1.0) % -------------------- SPECIES TRANSPORT ---------------------------------------% @@ -88,8 +89,8 @@ VISCOSITY_MODEL= FLAMELET % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% -%NUM_METHOD_GRAD= GREEN_GAUSS -NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +NUM_METHOD_GRAD= GREEN_GAUSS +%NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES CFL_NUMBER= 25 CFL_ADAPT= NO diff --git a/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_master.cfg b/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_master.cfg index 1ca70ab9d79..9a674d7a8e5 100644 --- a/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_master.cfg +++ b/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_master.cfg @@ -37,7 +37,7 @@ RESTART_ADJ_FILENAME= restart_adj TIME_DOMAIN= NO OUTER_ITER= 10 -OUTPUT_WRT_FREQ= 500 +OUTPUT_WRT_FREQ= 100 SCREEN_WRT_FREQ_INNER= 1 SCREEN_WRT_FREQ_OUTER= 1 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 3c80438970a..01ebb0856e6 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -570,7 +570,7 @@ def main(): inc_lam_sphere.cfg_dir = "incomp_navierstokes/sphere" inc_lam_sphere.cfg_file = "sphere.cfg" inc_lam_sphere.test_iter = 5 - inc_lam_sphere.test_vals = [-4.004072, -3.194881, -0.076553, 7.780048] + inc_lam_sphere.test_vals = [-3.275295, -2.999656, 0.001735, 0.319892] test_list.append(inc_lam_sphere) # Buoyancy-driven cavity @@ -1332,7 +1332,7 @@ def main(): pywrapper_naca0012.cfg_dir = "euler/naca0012" pywrapper_naca0012.cfg_file = "inv_NACA0012_Roe.cfg" pywrapper_naca0012.test_iter = 100 - pywrapper_naca0012.test_vals = [-6.747210, -6.149915, 0.333445, 0.021241] + pywrapper_naca0012.test_vals = [-9.456838, -8.939955, 0.335418, 0.023332] pywrapper_naca0012.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--parallel -f") test_list.append(pywrapper_naca0012) diff --git a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg index 239ae7647de..7ce89091193 100644 --- a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg +++ b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg @@ -81,7 +81,7 @@ MARKER_OUTLET= ( outlet, 0.0 ) % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES % -CFL_NUMBER= 150 +CFL_NUMBER= 80 CFL_REDUCTION_SPECIES= 0.1 CFL_REDUCTION_TURB= 1.0 % diff --git a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg index 1ba87a48301..f851455c179 100644 --- a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg +++ b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg @@ -82,7 +82,7 @@ MARKER_OUTLET= ( outlet, 0.0 ) % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES % -CFL_NUMBER= 150 +CFL_NUMBER= 80 CFL_REDUCTION_SPECIES= 0.1 CFL_REDUCTION_TURB= 1.0 % @@ -93,8 +93,8 @@ ITER= 1000 % LINEAR_SOLVER= FGMRES LINEAR_SOLVER_PREC= ILU -LINEAR_SOLVER_ERROR= 1E-8 -LINEAR_SOLVER_ITER= 30 +LINEAR_SOLVER_ERROR= 1E-5 +LINEAR_SOLVER_ITER= 10 % % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % diff --git a/UnitTests/SU2_CFD/gradients.cpp b/UnitTests/SU2_CFD/gradients.cpp index 8e37c8e2788..b03ae371099 100644 --- a/UnitTests/SU2_CFD/gradients.cpp +++ b/UnitTests/SU2_CFD/gradients.cpp @@ -131,9 +131,8 @@ template void testGreenGauss() { TestField field; C3DDoubleMatrix gradient(field.geometry->GetnPoint(), field.nVar, field.geometry->GetnDim()); - computeGradientsGreenGauss(nullptr, ENUM_MPI_QUANTITIES::SOLUTION, PERIODIC_NONE, *field.geometry.get(), - *field.config.get(), field, 0, field.nVar, gradient); + *field.config.get(), field, 0, field.nVar, gradient, -1); check(field, gradient); } @@ -145,7 +144,7 @@ void testLeastSquares(bool weighted) { C3DDoubleMatrix gradient(field.geometry->GetnPoint(), field.nVar, nDim); computeGradientsLeastSquares(nullptr, ENUM_MPI_QUANTITIES::SOLUTION, PERIODIC_NONE, *field.geometry.get(), - *field.config.get(), weighted, field, 0, field.nVar, gradient, R); + *field.config.get(), weighted, field, 0, field.nVar, gradient, R, -1); check(field, gradient); } From 33ea2dcd83b81e25935ac3af2adfb85f69deeae5 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 12 May 2024 09:09:40 +0200 Subject: [PATCH 099/194] fix some regressions parallel --- TestCases/parallel_regression.py | 42 +++++++++++++++++--------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 01ebb0856e6..8558a9d92b1 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -56,7 +56,7 @@ def main(): cfd_flamelet_ch4_axi.cfg_dir = "flamelet/05_laminar_premixed_ch4_flame_cfd_axi" cfd_flamelet_ch4_axi.cfg_file = "lam_prem_ch4_cfd_axi.cfg" cfd_flamelet_ch4_axi.test_iter = 10 - cfd_flamelet_ch4_axi.test_vals = [-11.054149, -12.276393, -11.299388, -13.877670, -6.291548] + cfd_flamelet_ch4_axi.test_vals = [-10.698747, -12.043414, -11.798367, -12.661449, -6.292390] cfd_flamelet_ch4_axi.new_output = True test_list.append(cfd_flamelet_ch4_axi) @@ -112,7 +112,7 @@ def main(): invwedge_a.cfg_dir = "nonequilibrium/invwedge" invwedge_a.cfg_file = "invwedge_ausm.cfg" invwedge_a.test_iter = 10 - invwedge_a.test_vals = [-1.109675, -1.634438, -6.926132, -18.589689, -18.535098, 2.210085, 1.773860, 5.248397, 0.806059] + invwedge_a.test_vals = [-1.063839, -1.588608, -18.301559, -18.628931, -18.574965, 2.251488, 1.878418, 5.295899, 0.853255] invwedge_a.test_vals_aarch64 = [-1.070904, -1.595667, -18.299980, -18.627372, -18.573382, 2.244654, 1.871030, 5.289134, 0.846502] test_list.append(invwedge_a) @@ -130,7 +130,7 @@ def main(): invwedge_msw.cfg_dir = "nonequilibrium/invwedge" invwedge_msw.cfg_file = "invwedge_msw.cfg" invwedge_msw.test_iter = 10 - invwedge_msw.test_vals = [-1.285985, -1.810748, -6.628826, -18.591401, -18.537038, 2.033350, 1.562604, 5.068007, 0.633614] + invwedge_msw.test_vals = [-1.221686, -1.746504, -18.298053, -18.625471, -18.571455, 2.097151, 1.636737, 5.133824, 0.695380] invwedge_msw.test_vals_aarch64 = [-1.224649, -1.749412, -18.299151, -18.626550, -18.572552, 2.094106, 1.635779, 5.131012, 0.692821] test_list.append(invwedge_msw) @@ -139,7 +139,7 @@ def main(): invwedge_roe.cfg_dir = "nonequilibrium/invwedge" invwedge_roe.cfg_file = "invwedge_roe.cfg" invwedge_roe.test_iter = 10 - invwedge_roe.test_vals = [-1.123344, -1.648108, -6.078352, -17.537650, -17.481027, 2.196776, 1.761928, 5.229494, 0.805395] + invwedge_roe.test_vals = [-1.076208, -1.601054, -17.208284, -17.538036, -17.481414, 2.242618, 1.826124, 5.278939, 0.877576] invwedge_roe.test_vals_aarch64 = [-1.069128, -1.593891, -17.208222, -17.537969, -17.481352, 2.249020, 1.852904, 5.287143, 0.879852] test_list.append(invwedge_roe) @@ -157,7 +157,7 @@ def main(): invwedge_ausm_m.cfg_dir = "nonequilibrium/invwedge" invwedge_ausm_m.cfg_file = "invwedge_am.cfg" invwedge_ausm_m.test_iter = 10 - invwedge_ausm_m.test_vals = [-1.172678, -1.697441, -8.915913, -17.063492, -17.012692, 2.125373, 1.959193, 5.183192, 0.747483] + invwedge_ausm_m.test_vals = [-1.173349, -1.698112, -16.739586, -17.063491, -17.012692, 2.124432, 1.961881, 5.182534, 0.747053] invwedge_ausm_m.test_vals_aarch64 = [-1.171654, -1.696417, -16.739585, -17.063491, -17.012691, 2.125633, 1.966511, 5.184281, 0.749068] test_list.append(invwedge_ausm_m) @@ -166,7 +166,7 @@ def main(): invwedge_ss_inlet.cfg_dir = "nonequilibrium/invwedge" invwedge_ss_inlet.cfg_file = "invwedge_ss_inlet.cfg" invwedge_ss_inlet.test_iter = 10 - invwedge_ss_inlet.test_vals = [-1.108983, -1.633746, -7.213741, -18.549271, -18.492808, 2.210879, 1.774114, 5.249053, 0.806728] + invwedge_ss_inlet.test_vals = [-1.063621, -1.588388, -18.250175, -18.579516, -18.523248, 2.251739, 1.878447, 5.296108, 0.853467] invwedge_ss_inlet.test_vals_aarch64 = [-1.069892, -1.594654, -18.250175, -18.579516, -18.523248, 2.245827, 1.871123, 5.290054, 0.847476] test_list.append(invwedge_ss_inlet) @@ -406,7 +406,7 @@ def main(): turb_oneram6_vc.cfg_dir = "rans/oneram6" turb_oneram6_vc.cfg_file = "turb_ONERAM6_vc.cfg" turb_oneram6_vc.test_iter = 15 - turb_oneram6_vc.test_vals = [-2.262387, -6.626454, 0.228392, 0.140799, -27107.000000] + turb_oneram6_vc.test_vals = [-2.265783, -6.627835, 0.228340, 0.142009, -28396.000000] turb_oneram6_vc.timeout = 3200 test_list.append(turb_oneram6_vc) @@ -781,7 +781,7 @@ def main(): contadj_oneram6.cfg_dir = "cont_adj_euler/oneram6" contadj_oneram6.cfg_file = "inv_ONERAM6.cfg" contadj_oneram6.test_iter = 10 - contadj_oneram6.test_vals = [-12.130993, -12.702085, 0.685900, 0.007594] + contadj_oneram6.test_vals = [-10.846560, -11.361108, -1.086100, 0.007556] test_list.append(contadj_oneram6) # Inviscid WEDGE: tests averaged outflow total pressure adjoint @@ -1521,7 +1521,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-6.118333, -4.985699, -4.918326, -7.249080, 2.445213, -5.624080, 30.000000, -5.681895, 12.000000, -8.186475, 10.000000, -8.853067, 2.083524, 1.000000, 0.600000, 0.483524] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.626439, -4.517831, -4.580189, -6.573548, 2.300030, -5.417622, 30.000000, -7.086028, 13.000000, -8.236048, 8.000000, -9.131349, 2.079216, 1.000000, 0.600000, 0.479216] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity NonDimensional case @@ -1529,7 +1529,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.724191, -5.290524, -5.223195, -8.252900, 2.140394, -5.229908, 30.000000, -5.681850, 12.000000, -8.186296, 10.000000, -8.852858, 2.083526, 1.000000, 0.600000, 0.483526] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.220388, -4.813965, -4.869765, -7.513357, 1.992341, -5.016403, 10.000000, -2.850321, 3.000000, -5.197045, 5.000000, -5.720050, 2.079247, 1.000000, 0.600000, 0.479247] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND) # 2 species (1 eq) primitive venturi mixing @@ -1630,7 +1630,7 @@ def main(): cfd_flamelet_ch4_cht.test_file = "restart_0.csv" cfd_flamelet_ch4_cht.multizone = True cfd_flamelet_ch4_cht.comp_threshold = 1e-6 - cfd_flamelet_ch4_cht.tol_file_percent = 0.1 + cfd_flamelet_ch4_cht.tol_file_percent = 0.2 pass_list.append(cfd_flamelet_ch4_cht.run_filediff()) test_list.append(cfd_flamelet_ch4_cht) @@ -1837,16 +1837,18 @@ def main(): test_list.append(naca0012_cst) # 2D FD streamwise periodic cht, avg temp obj func - fd_sp_pinArray_cht_2d_dp_hf = TestCase('fd_sp_pinArray_cht_2d_dp_hf') - fd_sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" - fd_sp_pinArray_cht_2d_dp_hf.cfg_file = "FD_configMaster.cfg" - fd_sp_pinArray_cht_2d_dp_hf.test_iter = 100 - fd_sp_pinArray_cht_2d_dp_hf.command = TestCase.Command(exec = "finite_differences.py", param = "-z 2 -n 2 -f") - fd_sp_pinArray_cht_2d_dp_hf.timeout = 1600 - fd_sp_pinArray_cht_2d_dp_hf.reference_file = "of_grad_findiff.csv.ref" + fd_sp_pinArray_cht_2d_dp_hf = TestCase('fd_sp_pinArray_cht_2d_dp_hf') + fd_sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" + fd_sp_pinArray_cht_2d_dp_hf.cfg_file = "FD_configMaster.cfg" + fd_sp_pinArray_cht_2d_dp_hf.test_iter = 100 + fd_sp_pinArray_cht_2d_dp_hf.command = TestCase.Command(exec = "finite_differences.py", param = "-z 2 -n 2 -f") + fd_sp_pinArray_cht_2d_dp_hf.timeout = 1600 + fd_sp_pinArray_cht_2d_dp_hf.comp_threshold = 1e-6 + fd_sp_pinArray_cht_2d_dp_hf.tol_file_percent = 0.2 + fd_sp_pinArray_cht_2d_dp_hf.reference_file = "of_grad_findiff.csv.ref" fd_sp_pinArray_cht_2d_dp_hf.reference_file_aarch64 = "of_grad_findiff_aarch64.csv.ref" - fd_sp_pinArray_cht_2d_dp_hf.test_file = "FINDIFF/of_grad_findiff.csv" - fd_sp_pinArray_cht_2d_dp_hf.multizone = True + fd_sp_pinArray_cht_2d_dp_hf.test_file = "FINDIFF/of_grad_findiff.csv" + fd_sp_pinArray_cht_2d_dp_hf.multizone = True pass_list.append(fd_sp_pinArray_cht_2d_dp_hf.run_filediff()) test_list.append(fd_sp_pinArray_cht_2d_dp_hf) From 327725d0e8d167f3ad7d6939c7b4af646cf4e090 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 12 May 2024 10:09:19 +0200 Subject: [PATCH 100/194] fix some regressions parallel --- .../01_laminar_premixed_ch4_flame_cfd/lam_prem_ch4_cfd.cfg | 3 +-- TestCases/parallel_regression.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/TestCases/flamelet/01_laminar_premixed_ch4_flame_cfd/lam_prem_ch4_cfd.cfg b/TestCases/flamelet/01_laminar_premixed_ch4_flame_cfd/lam_prem_ch4_cfd.cfg index 25f64af930d..f2b6bd919aa 100644 --- a/TestCases/flamelet/01_laminar_premixed_ch4_flame_cfd/lam_prem_ch4_cfd.cfg +++ b/TestCases/flamelet/01_laminar_premixed_ch4_flame_cfd/lam_prem_ch4_cfd.cfg @@ -13,7 +13,7 @@ SOLVER = INC_NAVIER_STOKES KIND_TURB_MODEL= NONE MATH_PROBLEM= DIRECT -RESTART_SOL = NO +RESTART_SOL = YES % % ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% % @@ -87,7 +87,6 @@ MARKER_ANALYZE_AVERAGE = AREA % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES CFL_NUMBER= 50 -%CFL_NUMBER= 100 CFL_ADAPT= NO ITER= 10000 OUTPUT_WRT_FREQ= 100 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 8558a9d92b1..2fc12b627d0 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -290,7 +290,7 @@ def main(): ramp.cfg_dir = "euler/ramp" ramp.cfg_file = "inv_ramp.cfg" ramp.test_iter = 10 - ramp.test_vals = [-13.399623, -7.788893, -0.081064, 0.056474] + ramp.test_vals = [-13.652847, -8.018011, -0.076277, 0.054839] ramp.test_vals_aarch64 = [-13.398422, -7.786461, -0.081064, 0.056474] test_list.append(ramp) From a1e48105706f3578c0555403dbf2b0fde4159d36 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 12 May 2024 11:02:11 +0200 Subject: [PATCH 101/194] fix some regressions parallel --- TestCases/parallel_regression.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 2fc12b627d0..fba136928de 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -47,7 +47,7 @@ def main(): cfd_flamelet_ch4.cfg_dir = "flamelet/01_laminar_premixed_ch4_flame_cfd" cfd_flamelet_ch4.cfg_file = "lam_prem_ch4_cfd.cfg" cfd_flamelet_ch4.test_iter = 10 - cfd_flamelet_ch4.test_vals = [-15.313265, -15.180884, -15.291808, -8.488238, -15.010141, -15.920950] + cfd_flamelet_ch4.test_vals = [-11.296485, -10.063260, -12.148081, -5.024236, -12.791892, -15.558522] cfd_flamelet_ch4.new_output = True test_list.append(cfd_flamelet_ch4) @@ -773,7 +773,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-9.300816, -14.587365, 0.300920, 0.019552] + contadj_naca0012.test_vals = [-9.047686, -14.483842, -1.056500, 0.019964] test_list.append(contadj_naca0012) # Inviscid ONERA M6 @@ -1630,7 +1630,7 @@ def main(): cfd_flamelet_ch4_cht.test_file = "restart_0.csv" cfd_flamelet_ch4_cht.multizone = True cfd_flamelet_ch4_cht.comp_threshold = 1e-6 - cfd_flamelet_ch4_cht.tol_file_percent = 0.2 + cfd_flamelet_ch4_cht.tol_file_percent = 1.0 pass_list.append(cfd_flamelet_ch4_cht.run_filediff()) test_list.append(cfd_flamelet_ch4_cht) From dda969ac5beb61d6f3ad23d24e1a275e0f11b965 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 12 May 2024 12:16:26 +0200 Subject: [PATCH 102/194] fix some regressions parallel --- TestCases/navierstokes/flatplate/lam_flatplate.cfg | 2 +- TestCases/parallel_regression_AD.py | 4 ++-- TestCases/serial_regression.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/TestCases/navierstokes/flatplate/lam_flatplate.cfg b/TestCases/navierstokes/flatplate/lam_flatplate.cfg index 53cd6bd570d..09172e6c7d0 100644 --- a/TestCases/navierstokes/flatplate/lam_flatplate.cfg +++ b/TestCases/navierstokes/flatplate/lam_flatplate.cfg @@ -46,7 +46,7 @@ MARKER_ANALYZE= (inlet, outlet) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 10000 +CFL_NUMBER= 4000 CFL_ADAPT= NO % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index e4c9d0789f9..87fe3a4605a 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -277,7 +277,7 @@ def main(): discadj_fsi2.cfg_dir = "disc_adj_fsi/Airfoil_2d" discadj_fsi2.cfg_file = "config.cfg" discadj_fsi2.test_iter = 8 - discadj_fsi2.test_vals = [-4.349377, 0.192713, -1.303589, 0.75407, 2.3244] + discadj_fsi2.test_vals = [-3.418240, 1.432738, -1.306071, 0.849980, 1.768100] discadj_fsi2.test_vals_aarch64 = [-4.349372, 0.190601, -1.303589, 0.754070, 2.324400] discadj_fsi2.tol = 0.00001 test_list.append(discadj_fsi2) @@ -299,7 +299,7 @@ def main(): da_sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" da_sp_pinArray_cht_2d_dp_hf.cfg_file = "DA_configMaster.cfg" da_sp_pinArray_cht_2d_dp_hf.test_iter = 100 - da_sp_pinArray_cht_2d_dp_hf.test_vals = [-4.714597, -4.059490, -4.138377] + da_sp_pinArray_cht_2d_dp_hf.test_vals = [-4.714704, -4.059485, -4.138393] da_sp_pinArray_cht_2d_dp_hf.multizone = True test_list.append(da_sp_pinArray_cht_2d_dp_hf) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 5ee8f4e24b2..c2cade6230d 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -64,7 +64,7 @@ def main(): invwedge.cfg_dir = "nonequilibrium/invwedge" invwedge.cfg_file = "invwedge_ausm.cfg" invwedge.test_iter = 10 - invwedge.test_vals = [-1.109139, -1.633902, -6.926718, -18.595761, -18.541262, 2.210611, 1.773983, 5.248999, 0.806600] + invwedge.test_vals = [-1.067133, -1.591903, -18.301537, -18.628929, -18.574965, 2.248225, 1.874391, 5.292468, 0.849987] invwedge.test_vals_aarch64 = [-1.046323, -1.571086, -18.301361, -18.628744, -18.574788, 2.271778, 1.875687, 5.315769, 0.870008] test_list.append(invwedge) @@ -126,7 +126,7 @@ def main(): fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" fixedCL_naca0012.cfg_file = "inv_NACA0012.cfg" fixedCL_naca0012.test_iter = 10 - fixedCL_naca0012.test_vals = [-7.382410, -1.879887, 0.300000, 0.019471] + fixedCL_naca0012.test_vals = [-3.845114, 1.691548, 0.301154, 0.019489] test_list.append(fixedCL_naca0012) # Polar sweep of the inviscid NACA0012 @@ -577,7 +577,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-9.289565, -14.563859, 0.300920, 0.019552] + contadj_naca0012.test_vals = [-9.058594, -14.482725, -1.056500, 0.019964] contadj_naca0012.tol = 0.001 test_list.append(contadj_naca0012) @@ -586,7 +586,7 @@ def main(): contadj_oneram6.cfg_dir = "cont_adj_euler/oneram6" contadj_oneram6.cfg_file = "inv_ONERAM6.cfg" contadj_oneram6.test_iter = 10 - contadj_oneram6.test_vals = [-12.133160, -12.706697, 0.685900, 0.007594] + contadj_oneram6.test_vals = [-10.847199, -11.349970, -1.086100, 0.007556] test_list.append(contadj_oneram6) # Inviscid WEDGE: tests averaged outflow total pressure adjoint From 645c82487b2c846d88a06e925a85e11c1e1ccf86 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 14 May 2024 14:05:15 +0200 Subject: [PATCH 103/194] regressions --- .../naca0012/of_grad_directdiff.dat.ref | 6 +++--- TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref | 16 ++++++++-------- TestCases/hybrid_regression.py | 4 ++-- .../multiple_ffd/naca0012/of_grad_cd.dat.ref | 4 ++-- TestCases/parallel_regression.py | 2 +- TestCases/serial_regression_AD.py | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref index 4992e46a279..edbd5c6ef72 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref @@ -1,4 +1,4 @@ VARIABLES="VARIABLE" , "DRAG" , "EFFICIENCY" , "FORCE_X" , "FORCE_Y" , "FORCE_Z" , "LIFT" , "MOMENT_X" , "MOMENT_Y" , "MOMENT_Z" , "SIDEFORCE" - 0 , 0.2253591473 , -105.6097088 , 0.2588459007 , -1.5322178 , 0.0 , -1.537499867 , 0.0 , 0.0 , 1.202899757 , 0.0 - 1 , 0.3835809166 , -173.3502205 , 0.4363886002 , -2.415957492 , 0.0 , -2.424902327 , 0.0 , 0.0 , 1.053347497 , 0.0 - 2 , 0.5151776249 , -228.9760041 , 0.5835870252 , -3.129538494 , 0.0 , -3.141524632 , 0.0 , 0.0 , 0.6540715539 , 0.0 + 0 , 0.2309673955 , -88.97718745 , 0.2660797549 , -1.606657083 , 0.0 , -1.612079241 , 0.0 , 0.0 , 1.138523047 , 0.0 + 1 , 0.4028405685 , -143.6613123 , 0.4556335581 , -2.415073975 , 0.0 , -2.424438847 , 0.0 , 0.0 , 1.001184021 , 0.0 + 2 , 0.5416188832 , -187.4461705 , 0.6084171529 , -3.055412978 , 0.0 , -3.067958423 , 0.0 , 0.0 , 0.6259826966 , 0.0 diff --git a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref index b2e428bed5a..a7bd9a3c21f 100644 --- a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref +++ b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref @@ -1,9 +1,9 @@ INDEX GRAD -0 -3.461460667601000e-03 -1 -1.841786311588663e-03 -2 -7.915536257748967e-04 -3 -2.739622082729717e-04 -4 -2.734869133461104e-04 -5 -7.881162428890206e-04 -6 -1.828978290516677e-03 -7 -3.427219398258316e-03 +0 -3.333351314841423e-03 +1 -1.759598701280316e-03 +2 -7.415705666767014e-04 +3 -2.415031765746721e-04 +4 -2.430854749957427e-04 +5 -7.438535443891803e-04 +6 -1.754770668984535e-03 +7 -3.306851225764228e-03 diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index c218179d8bb..5156d19f99a 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -59,7 +59,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-3.843223, -3.318001, 0.101992, 0.089762] + naca0012.test_vals = [-4.522791, -4.048014, 0.317968, 0.023046] test_list.append(naca0012) # Supersonic wedge @@ -83,7 +83,7 @@ def main(): fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" fixedCL_naca0012.cfg_file = "inv_NACA0012.cfg" fixedCL_naca0012.test_iter = 10 - fixedCL_naca0012.test_vals = [-7.374806, -1.872330, 0.300000, 0.019471] + fixedCL_naca0012.test_vals = [-3.903317, 1.629400, 0.301071, 0.019483] test_list.append(fixedCL_naca0012) # HYPERSONIC FLOW PAST BLUNT BODY diff --git a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref index 81759ef4cd7..74bba7bf496 100644 --- a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref +++ b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref @@ -1,3 +1,3 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , 0.0767137 , 0.001 - 1 , -0.113024 , 0.001 + 0 , 0.0786679 , 0.001 + 1 , -0.117253 , 0.001 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index fba136928de..260ac7e6466 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1623,7 +1623,7 @@ def main(): cfd_flamelet_ch4_cht = TestCase('cfd_flamelet_ch4_cht') cfd_flamelet_ch4_cht.cfg_dir = "flamelet/03_laminar_premixed_ch4_flame_cht_cfd" cfd_flamelet_ch4_cht.cfg_file = "lam_prem_ch4_cht_cfd_master.cfg" - cfd_flamelet_ch4_cht.test_iter = 10 + cfd_flamelet_ch4_cht.test_iter = 5 cfd_flamelet_ch4_cht.command = TestCase.Command("mpirun -n 2", "SU2_CFD") cfd_flamelet_ch4_cht.timeout = 1600 cfd_flamelet_ch4_cht.reference_file = "restart_0.csv.ref" diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index c5e8ceb4010..b1f11e50944 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -50,7 +50,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.561506, -8.926634, -0.000000, 0.005587] + discadj_naca0012.test_vals = [-3.563782, -8.924462, -0.000000, 0.005520] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) From 384186238410c85590472b7035c364f16c5d63a2 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 14 May 2024 14:36:09 +0200 Subject: [PATCH 104/194] merge develop --- Common/include/linear_algebra/CSysMatrix.hpp | 5 ++--- SU2_CFD/src/solvers/CSolver.cpp | 6 +++--- UnitTests/SU2_CFD/gradients.cpp | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Common/include/linear_algebra/CSysMatrix.hpp b/Common/include/linear_algebra/CSysMatrix.hpp index 922ab9f291b..fe6f194d43b 100644 --- a/Common/include/linear_algebra/CSysMatrix.hpp +++ b/Common/include/linear_algebra/CSysMatrix.hpp @@ -104,10 +104,9 @@ struct CSysMatrixComms { */ template static void Complete(CSysVector& x, CGeometry* geometry, const CConfig* config, -<<<<<<< HEAD - ENUM_MPI_QUANTITIES commType = ENUM_MPI_QUANTITIES::SOLUTION_MATRIX); -======= MPI_QUANTITIES commType = MPI_QUANTITIES::SOLUTION_MATRIX); +}; + /*! * \ingroup SpLinSys * \brief Main class for defining block-compressed-row-storage sparse matrices. diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 76258b1f2ac..a1a91b81f0b 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -2096,7 +2096,7 @@ void CSolver::SetAuxVar_Gradient_GG(CGeometry *geometry, const CConfig *config) auto& gradient = base_nodes->GetAuxVarGradient(); computeGradientsGreenGauss(this, MPI_QUANTITIES::AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, - *config, solution, 0, base_nodes->GetnAuxVar(), gradient); + *config, solution, 0, base_nodes->GetnAuxVar(), gradient, -1); } void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, const CConfig *config) { @@ -2107,7 +2107,7 @@ void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, const CConfig *config) auto& rmatrix = base_nodes->GetRmatrix(); computeGradientsLeastSquares(this, MPI_QUANTITIES::AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, *config, - weighted, solution, 0, base_nodes->GetnAuxVar(), gradient, rmatrix); + weighted, solution, 0, base_nodes->GetnAuxVar(), gradient, rmatrix, -1); } void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, int idx_vel, bool reconstruction) { @@ -2238,7 +2238,7 @@ void CSolver::SetGridVel_Gradient(CGeometry *geometry, const CConfig *config) co auto rmatrix = CVectorOfMatrix(nPoint,nDim,nDim); computeGradientsLeastSquares(nullptr, MPI_QUANTITIES::GRID_VELOCITY, PERIODIC_NONE, *geometry, *config, - true, gridVel, 0, nDim, gridVelGrad, rmatrix); + true, gridVel, 0, nDim, gridVelGrad, rmatrix, 0); } void CSolver::SetSolution_Limiter(CGeometry *geometry, const CConfig *config) { diff --git a/UnitTests/SU2_CFD/gradients.cpp b/UnitTests/SU2_CFD/gradients.cpp index 2f69d407d3a..195ce25a640 100644 --- a/UnitTests/SU2_CFD/gradients.cpp +++ b/UnitTests/SU2_CFD/gradients.cpp @@ -133,7 +133,7 @@ void testGreenGauss() { C3DDoubleMatrix gradient(field.geometry->GetnPoint(), field.nVar, field.geometry->GetnDim()); computeGradientsGreenGauss(nullptr, MPI_QUANTITIES::SOLUTION, PERIODIC_NONE, *field.geometry.get(), - *field.config.get(), field, 0, field.nVar, gradient); + *field.config.get(), field, 0, field.nVar, gradient, -1); check(field, gradient); } @@ -145,7 +145,7 @@ void testLeastSquares(bool weighted) { C3DDoubleMatrix gradient(field.geometry->GetnPoint(), field.nVar, nDim); computeGradientsLeastSquares(nullptr, MPI_QUANTITIES::SOLUTION, PERIODIC_NONE, *field.geometry.get(), - *field.config.get(), weighted, field, 0, field.nVar, gradient, R); + *field.config.get(), weighted, field, 0, field.nVar, gradient, R, -1); check(field, gradient); } From d61ba49cecbc65b7837333b527fae79d639e886a Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 17 May 2024 10:33:31 +0200 Subject: [PATCH 105/194] update regression --- TestCases/parallel_regression.py | 2 +- TestCases/serial_regression.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 260ac7e6466..21593a2dc2b 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -303,7 +303,7 @@ def main(): flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" flatplate.test_iter = 100 - flatplate.test_vals = [-9.806515, -4.303156, 0.001085, 0.036281, 2.361500, -2.325300, -1.810800, -1.810800] + flatplate.test_vals = [-8.858013, -3.379631, 0.001085, 0.036280, 2.361500, -2.325300, -1.810200, -1.810200] test_list.append(flatplate) # Custom objective function diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index c2cade6230d..6da6ca0853d 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -166,7 +166,7 @@ def main(): flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" flatplate.test_iter = 100 - flatplate.test_vals = [-9.196938, -3.712725, 0.001112, 0.036276, 2.361500, -2.325300, -2.277100, -2.277100] + flatplate.test_vals = [-9.239265, -3.771626, 0.001085, 0.036281, 2.361500, -2.325300, -1.810500, -1.810500] test_list.append(flatplate) # Laminar cylinder (steady) From 9d32bc6b200db6eafbe87f021eeae17a96999f30 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 25 May 2024 15:49:53 +0200 Subject: [PATCH 106/194] update regression --- TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref | 16 ++++++++-------- .../chtPinArray_3d/configMaster.cfg | 4 ++-- TestCases/parallel_regression.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref index a7bd9a3c21f..afe9c6fd617 100644 --- a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref +++ b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref @@ -1,9 +1,9 @@ INDEX GRAD -0 -3.333351314841423e-03 -1 -1.759598701280316e-03 -2 -7.415705666767014e-04 -3 -2.415031765746721e-04 -4 -2.430854749957427e-04 -5 -7.438535443891803e-04 -6 -1.754770668984535e-03 -7 -3.306851225764228e-03 +0 -3.333352409548554e-03 +1 -1.759599290368175e-03 +2 -7.415708239440701e-04 +3 -2.415032700112433e-04 +4 -2.430855699935505e-04 +5 -7.438538063598917e-04 +6 -1.754771265132214e-03 +7 -3.306852328510545e-03 diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg index 8ff23f71359..7823cce2519 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg @@ -18,11 +18,11 @@ MARKER_ZONE_INTERFACE= (fluid_bottom_interface, solid_bottom_interface, fluid_pi % MARKER_CHT_INTERFACE= (fluid_bottom_interface, solid_bottom_interface, fluid_pin1, solid_pin1, fluid_pin2, solid_pin2, fluid_pin3, solid_pin3 ) % -OUTER_ITER = 31 +OUTER_ITER = 310 % CONV_RESIDUAL_MINVAL= -26 SCREEN_OUTPUT= (OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1], TOTAL_HEATFLUX[0] ) -SCREEN_WRT_FREQ_OUTER= 100 +SCREEN_WRT_FREQ_OUTER= 10 % HISTORY_OUTPUT= ( ITER, RMS_RES[0], RMS_RES[1], STREAMWISE_PERIODIC[0], FLOW_COEFF[0], HEAT[1] ) % diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 21593a2dc2b..163c7d40fae 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1318,7 +1318,7 @@ def main(): sp_pinArray_3d_cht_mf_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_3d" sp_pinArray_3d_cht_mf_hf_tp.cfg_file = "configMaster.cfg" sp_pinArray_3d_cht_mf_hf_tp.test_iter = 30 - sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-5.128577, -5.425081, -6.788413, -0.009675, 104.655438, 419.210000, 0.0] + sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-5.046694, -5.630566, -5.769483, -0.009675, 101.266917, 418.360000, 0.000000] sp_pinArray_3d_cht_mf_hf_tp.test_vals_aarch64 = [-5.128577, -5.425081, -6.788413, -0.009675, 104.655438, 419.210000, 0.0] sp_pinArray_3d_cht_mf_hf_tp.multizone = True test_list.append(sp_pinArray_3d_cht_mf_hf_tp) From 16b583b4bd0016711c9380d030c1fdae7eb45b2e Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 25 May 2024 21:18:07 +0200 Subject: [PATCH 107/194] update regression --- .../naca0012/of_grad_cd.dat.ref | 76 +++++++++---------- .../wedge/of_grad_combo.dat.ref | 8 +- TestCases/parallel_regression.py | 4 +- TestCases/serial_regression.py | 2 +- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref index 2f88439a0b9..825d10e13cf 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , 0.00534068 , 0.0001 - 1 , 0.024277 , 0.0001 - 2 , 0.0299625 , 0.0001 - 3 , 0.0234274 , 0.0001 - 4 , 0.00339532 , 0.0001 - 5 , -0.0308111 , 0.0001 - 6 , -0.0775489 , 0.0001 - 7 , -0.132033 , 0.0001 - 8 , -0.186824 , 0.0001 - 9 , -0.233924 , 0.0001 - 10 , -0.268068 , 0.0001 - 11 , -0.289743 , 0.0001 - 12 , -0.305716 , 0.0001 - 13 , -0.325863 , 0.0001 - 14 , -0.358209 , 0.0001 - 15 , -0.407234 , 0.0001 - 16 , -0.47926 , 0.0001 - 17 , -0.595838 , 0.0001 - 18 , -0.850012 , 0.0001 - 19 , 0.565996 , 0.0001 - 20 , 1.14457 , 0.0001 - 21 , 1.50247 , 0.0001 - 22 , 1.62875 , 0.0001 - 23 , 1.54948 , 0.0001 - 24 , 1.31563 , 0.0001 - 25 , 0.989959 , 0.0001 - 26 , 0.634653 , 0.0001 - 27 , 0.301875 , 0.0001 - 28 , 0.0291654 , 0.0001 - 29 , -0.160196 , 0.0001 - 30 , -0.253741 , 0.0001 - 31 , -0.247195 , 0.0001 - 32 , -0.147396 , 0.0001 - 33 , 0.0181901 , 0.0001 - 34 , 0.197238 , 0.0001 - 35 , 0.341451 , 0.0001 - 36 , 0.467151 , 0.0001 - 37 , 0.682825 , 0.0001 + 0 , -0.3957 , 0.0001 + 1 , -0.296173 , 0.0001 + 2 , -0.213567 , 0.0001 + 3 , -0.15797 , 0.0001 + 4 , -0.129897 , 0.0001 + 5 , -0.127172 , 0.0001 + 6 , -0.145365 , 0.0001 + 7 , -0.177645 , 0.0001 + 8 , -0.215406 , 0.0001 + 9 , -0.250173 , 0.0001 + 10 , -0.276475 , 0.0001 + 11 , -0.294359 , 0.0001 + 12 , -0.309628 , 0.0001 + 13 , -0.330814 , 0.0001 + 14 , -0.364804 , 0.0001 + 15 , -0.415697 , 0.0001 + 16 , -0.490218 , 0.0001 + 17 , -0.611024 , 0.0001 + 18 , -0.874971 , 0.0001 + 19 , 0.0510475 , 0.0001 + 20 , 0.782353 , 0.0001 + 21 , 1.26329 , 0.0001 + 22 , 1.47992 , 0.0001 + 23 , 1.46463 , 0.0001 + 24 , 1.27505 , 0.0001 + 25 , 0.979585 , 0.0001 + 26 , 0.644706 , 0.0001 + 27 , 0.325487 , 0.0001 + 28 , 0.0610001 , 0.0001 + 29 , -0.125212 , 0.0001 + 30 , -0.221301 , 0.0001 + 31 , -0.223531 , 0.0001 + 32 , -0.137307 , 0.0001 + 33 , 0.0153574 , 0.0001 + 34 , 0.190118 , 0.0001 + 35 , 0.339925 , 0.0001 + 36 , 0.471371 , 0.0001 + 37 , 0.692488 , 0.0001 diff --git a/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref b/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref index 0d54e740402..9f8664e9dcd 100644 --- a/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref +++ b/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref @@ -1,5 +1,5 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , 0.00766235 , 0.0001 - 1 , 0.00499567 , 0.0001 - 2 , 0.00249665 , 0.0001 - 3 , 0.000904607 , 0.0001 + 0 , 0.00750752 , 0.0001 + 1 , 0.00491594 , 0.0001 + 2 , 0.00245399 , 0.0001 + 3 , 0.000898752 , 0.0001 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 163c7d40fae..5a75324c9c7 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1318,8 +1318,8 @@ def main(): sp_pinArray_3d_cht_mf_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_3d" sp_pinArray_3d_cht_mf_hf_tp.cfg_file = "configMaster.cfg" sp_pinArray_3d_cht_mf_hf_tp.test_iter = 30 - sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-5.046694, -5.630566, -5.769483, -0.009675, 101.266917, 418.360000, 0.000000] - sp_pinArray_3d_cht_mf_hf_tp.test_vals_aarch64 = [-5.128577, -5.425081, -6.788413, -0.009675, 104.655438, 419.210000, 0.0] + sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-5.071056, -5.681337, -5.843843, -0.009675, 101.265480, 418.360000, 0.000000] + sp_pinArray_3d_cht_mf_hf_tp.test_vals_aarch64 = [-5.071056, -5.681337, -5.843843, -0.009675, 101.265480, 418.360000, 0.000000] sp_pinArray_3d_cht_mf_hf_tp.multizone = True test_list.append(sp_pinArray_3d_cht_mf_hf_tp) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 6da6ca0853d..9340524b62b 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -1080,7 +1080,7 @@ def main(): airfoilRBF.cfg_file = "config.cfg" airfoilRBF.test_iter = 1 - airfoilRBF.test_vals = [1.000000, -2.786186, -4.977944] + airfoilRBF.test_vals = [1.000000, -2.585553, -5.058878] airfoilRBF.tol = 0.0001 airfoilRBF.multizone = True test_list.append(airfoilRBF) From a554ef44b687a22eecdbda96c315b57676bc4b90 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 26 May 2024 00:53:36 +0200 Subject: [PATCH 108/194] update regression --- .../naca0012/of_grad_cd.dat.ref | 76 +++++++++---------- .../naca0012/of_grad_directdiff.dat.ref | 6 +- TestCases/hybrid_regression.py | 6 +- .../naca0012/of_grad_directdiff.dat.ref | 4 +- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref index 825d10e13cf..110a774a5c3 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -0.3957 , 0.0001 - 1 , -0.296173 , 0.0001 - 2 , -0.213567 , 0.0001 - 3 , -0.15797 , 0.0001 - 4 , -0.129897 , 0.0001 - 5 , -0.127172 , 0.0001 - 6 , -0.145365 , 0.0001 - 7 , -0.177645 , 0.0001 - 8 , -0.215406 , 0.0001 - 9 , -0.250173 , 0.0001 - 10 , -0.276475 , 0.0001 - 11 , -0.294359 , 0.0001 - 12 , -0.309628 , 0.0001 - 13 , -0.330814 , 0.0001 - 14 , -0.364804 , 0.0001 - 15 , -0.415697 , 0.0001 - 16 , -0.490218 , 0.0001 - 17 , -0.611024 , 0.0001 - 18 , -0.874971 , 0.0001 - 19 , 0.0510475 , 0.0001 - 20 , 0.782353 , 0.0001 - 21 , 1.26329 , 0.0001 - 22 , 1.47992 , 0.0001 - 23 , 1.46463 , 0.0001 - 24 , 1.27505 , 0.0001 - 25 , 0.979585 , 0.0001 - 26 , 0.644706 , 0.0001 - 27 , 0.325487 , 0.0001 - 28 , 0.0610001 , 0.0001 - 29 , -0.125212 , 0.0001 - 30 , -0.221301 , 0.0001 - 31 , -0.223531 , 0.0001 - 32 , -0.137307 , 0.0001 - 33 , 0.0153574 , 0.0001 - 34 , 0.190118 , 0.0001 - 35 , 0.339925 , 0.0001 - 36 , 0.471371 , 0.0001 - 37 , 0.692488 , 0.0001 + 0 , 0.0220522 , 0.001 + 1 , 0.029455 , 0.001 + 2 , 0.0323176 , 0.001 + 3 , 0.02894 , 0.001 + 4 , 0.0146338 , 0.001 + 5 , -0.0139999 , 0.001 + 6 , -0.056986 , 0.001 + 7 , -0.110088 , 0.001 + 8 , -0.165436 , 0.001 + 9 , -0.213991 , 0.001 + 10 , -0.249417 , 0.001 + 11 , -0.271717 , 0.001 + 12 , -0.288163 , 0.001 + 13 , -0.309834 , 0.001 + 14 , -0.345318 , 0.001 + 15 , -0.39696 , 0.001 + 16 , -0.465307 , 0.001 + 17 , -0.562786 , 0.001 + 18 , -0.787662 , 0.001 + 19 , 0.627669 , 0.001 + 20 , 1.15867 , 0.001 + 21 , 1.47742 , 0.001 + 22 , 1.57632 , 0.001 + 23 , 1.47748 , 0.001 + 24 , 1.22667 , 0.001 + 25 , 0.882211 , 0.001 + 26 , 0.503649 , 0.001 + 27 , 0.143221 , 0.001 + 28 , -0.157985 , 0.001 + 29 , -0.369231 , 0.001 + 30 , -0.467284 , 0.001 + 31 , -0.436815 , 0.001 + 32 , -0.280489 , 0.001 + 33 , -0.0395581 , 0.001 + 34 , 0.196769 , 0.001 + 35 , 0.347452 , 0.001 + 36 , 0.464267 , 0.001 + 37 , 0.679782 , 0.001 diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref index edbd5c6ef72..b7df4c28157 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref @@ -1,4 +1,4 @@ VARIABLES="VARIABLE" , "DRAG" , "EFFICIENCY" , "FORCE_X" , "FORCE_Y" , "FORCE_Z" , "LIFT" , "MOMENT_X" , "MOMENT_Y" , "MOMENT_Z" , "SIDEFORCE" - 0 , 0.2309673955 , -88.97718745 , 0.2660797549 , -1.606657083 , 0.0 , -1.612079241 , 0.0 , 0.0 , 1.138523047 , 0.0 - 1 , 0.4028405685 , -143.6613123 , 0.4556335581 , -2.415073975 , 0.0 , -2.424438847 , 0.0 , 0.0 , 1.001184021 , 0.0 - 2 , 0.5416188832 , -187.4461705 , 0.6084171529 , -3.055412978 , 0.0 , -3.067958423 , 0.0 , 0.0 , 0.6259826966 , 0.0 + 0 , 0.2509197975 , -106.54431 , 0.2854149208 , -1.578151901 , 0.0 , -1.584002637 , 0.0 , 0.0 , 1.183802518 , 0.0 + 1 , 0.4229063213 , -171.6950679 , 0.4757279649 , -2.416168278 , 0.0 , -2.425971246 , 0.0 , 0.0 , 1.021118266 , 0.0 + 2 , 0.5601115716 , -224.4907895 , 0.6281074099 , -3.110095039 , 0.0 , -3.123057011 , 0.0 , 0.0 , 0.613240305 , 0.0 diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 5156d19f99a..eb471eea463 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -357,8 +357,8 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-5.971249, -4.910844, -0.000196, 0.121635] - inc_nozzle.test_vals_aarch64 = [-5.971248, -4.910844, -0.000196, 0.121635] + inc_nozzle.test_vals = [-5.624385, -4.988472, -0.000096, 0.137032] + inc_nozzle.test_vals_aarch64 = [-5.624385, -4.988472, -0.000096, 0.137032] test_list.append(inc_nozzle) ############################# @@ -424,7 +424,7 @@ def main(): inc_weakly_coupled.cfg_dir = "disc_adj_heat" inc_weakly_coupled.cfg_file = "primal.cfg" inc_weakly_coupled.test_iter = 10 - inc_weakly_coupled.test_vals = [-10.178878, -9.034942, -9.789683, -10.295431, -14.202552, -1.024140, 5.547700] + inc_weakly_coupled.test_vals = [-18.894811, -17.879327, -18.412938, -17.855948, -18.343462, -15.659612, 5.545700] test_list.append(inc_weakly_coupled) ###################################### diff --git a/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref b/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref index da2e3f10472..4e63d0895fe 100644 --- a/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref +++ b/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref @@ -1,3 +1,3 @@ VARIABLES="VARIABLE" , "DRAG" , "EFFICIENCY" , "FORCE_X" , "FORCE_Y" , "FORCE_Z" , "LIFT" , "MOMENT_X" , "MOMENT_Y" , "MOMENT_Z" , "SIDEFORCE" - 0 , 0.05685349197 , -0.4081397694 , 0.05417489043 , 0.1233787706 , 0.0 , 0.1221675908 , 0.0 , 0.0 , 0.009249264651 , 0.0 - 1 , -0.08020555475 , 8.976256797 , -0.08614647972 , 0.2713937953 , 0.0 , 0.2732084865 , 0.0 , 0.0 , 0.00847918122 , 0.0 + 0 , 0.0613099408 , -0.6388128098 , 0.05873666295 , 0.1186004687 , 0.0 , 0.1172909114 , 0.0 , 0.0 , 0.009158961247 , 0.0 + 1 , -0.08576129864 , 8.41979213 , -0.09137272102 , 0.2562322995 , 0.0 , 0.2581646086 , 0.0 , 0.0 , 0.004947438045 , 0.0 From de90bc8fab84b77f0768d62df4656d772d5667bc Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 26 May 2024 14:33:47 +0200 Subject: [PATCH 109/194] update regression --- TestCases/parallel_regression.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 5a75324c9c7..92884151b1d 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -773,7 +773,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-9.047686, -14.483842, -1.056500, 0.019964] + contadj_naca0012.test_vals = [-11.276777, -16.835340, -1.056500, 0.019964] test_list.append(contadj_naca0012) # Inviscid ONERA M6 @@ -1318,8 +1318,8 @@ def main(): sp_pinArray_3d_cht_mf_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_3d" sp_pinArray_3d_cht_mf_hf_tp.cfg_file = "configMaster.cfg" sp_pinArray_3d_cht_mf_hf_tp.test_iter = 30 - sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-5.071056, -5.681337, -5.843843, -0.009675, 101.265480, 418.360000, 0.000000] - sp_pinArray_3d_cht_mf_hf_tp.test_vals_aarch64 = [-5.071056, -5.681337, -5.843843, -0.009675, 101.265480, 418.360000, 0.000000] + sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-4.941475, -5.624404, -5.768771, -0.009675, 101.266576, 418.360000, 0.000000] + sp_pinArray_3d_cht_mf_hf_tp.test_vals_aarch64 = [-4.941475, -5.624404, -5.768771, -0.009675, 101.266576, 418.360000, 0.000000] sp_pinArray_3d_cht_mf_hf_tp.multizone = True test_list.append(sp_pinArray_3d_cht_mf_hf_tp) From 93307d3e22b99f3f5d829370fc8792964249b2aa Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 26 May 2024 14:41:08 +0200 Subject: [PATCH 110/194] update regression --- TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref | 16 ++++++++-------- TestCases/parallel_regression_AD.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref index afe9c6fd617..ce314cec31a 100644 --- a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref +++ b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref @@ -1,9 +1,9 @@ INDEX GRAD -0 -3.333352409548554e-03 -1 -1.759599290368175e-03 -2 -7.415708239440701e-04 -3 -2.415032700112433e-04 -4 -2.430855699935505e-04 -5 -7.438538063598917e-04 -6 -1.754771265132214e-03 -7 -3.306852328510545e-03 +0 -3.333351481260664e-03 +1 -1.759598795069318e-03 +2 -7.415706123961727e-04 +3 -2.415031962403668e-04 +4 -2.430854892363347e-04 +5 -7.438535736860117e-04 +6 -1.754770734917792e-03 +7 -3.306851351743173e-03 diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 87fe3a4605a..a346fa6c9bf 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -47,7 +47,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.563782, -8.924462, -0.000000, 0.005520] + discadj_naca0012.test_vals = [-3.564238, -8.924950, -0.000000, 0.005510] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) From 8a3a125a5a74ef7ca4496552c5c8e26a6331223f Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 26 May 2024 15:38:50 +0200 Subject: [PATCH 111/194] update regression --- .../naca0012/of_grad_cd.dat.ref | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref index 110a774a5c3..825d10e13cf 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , 0.0220522 , 0.001 - 1 , 0.029455 , 0.001 - 2 , 0.0323176 , 0.001 - 3 , 0.02894 , 0.001 - 4 , 0.0146338 , 0.001 - 5 , -0.0139999 , 0.001 - 6 , -0.056986 , 0.001 - 7 , -0.110088 , 0.001 - 8 , -0.165436 , 0.001 - 9 , -0.213991 , 0.001 - 10 , -0.249417 , 0.001 - 11 , -0.271717 , 0.001 - 12 , -0.288163 , 0.001 - 13 , -0.309834 , 0.001 - 14 , -0.345318 , 0.001 - 15 , -0.39696 , 0.001 - 16 , -0.465307 , 0.001 - 17 , -0.562786 , 0.001 - 18 , -0.787662 , 0.001 - 19 , 0.627669 , 0.001 - 20 , 1.15867 , 0.001 - 21 , 1.47742 , 0.001 - 22 , 1.57632 , 0.001 - 23 , 1.47748 , 0.001 - 24 , 1.22667 , 0.001 - 25 , 0.882211 , 0.001 - 26 , 0.503649 , 0.001 - 27 , 0.143221 , 0.001 - 28 , -0.157985 , 0.001 - 29 , -0.369231 , 0.001 - 30 , -0.467284 , 0.001 - 31 , -0.436815 , 0.001 - 32 , -0.280489 , 0.001 - 33 , -0.0395581 , 0.001 - 34 , 0.196769 , 0.001 - 35 , 0.347452 , 0.001 - 36 , 0.464267 , 0.001 - 37 , 0.679782 , 0.001 + 0 , -0.3957 , 0.0001 + 1 , -0.296173 , 0.0001 + 2 , -0.213567 , 0.0001 + 3 , -0.15797 , 0.0001 + 4 , -0.129897 , 0.0001 + 5 , -0.127172 , 0.0001 + 6 , -0.145365 , 0.0001 + 7 , -0.177645 , 0.0001 + 8 , -0.215406 , 0.0001 + 9 , -0.250173 , 0.0001 + 10 , -0.276475 , 0.0001 + 11 , -0.294359 , 0.0001 + 12 , -0.309628 , 0.0001 + 13 , -0.330814 , 0.0001 + 14 , -0.364804 , 0.0001 + 15 , -0.415697 , 0.0001 + 16 , -0.490218 , 0.0001 + 17 , -0.611024 , 0.0001 + 18 , -0.874971 , 0.0001 + 19 , 0.0510475 , 0.0001 + 20 , 0.782353 , 0.0001 + 21 , 1.26329 , 0.0001 + 22 , 1.47992 , 0.0001 + 23 , 1.46463 , 0.0001 + 24 , 1.27505 , 0.0001 + 25 , 0.979585 , 0.0001 + 26 , 0.644706 , 0.0001 + 27 , 0.325487 , 0.0001 + 28 , 0.0610001 , 0.0001 + 29 , -0.125212 , 0.0001 + 30 , -0.221301 , 0.0001 + 31 , -0.223531 , 0.0001 + 32 , -0.137307 , 0.0001 + 33 , 0.0153574 , 0.0001 + 34 , 0.190118 , 0.0001 + 35 , 0.339925 , 0.0001 + 36 , 0.471371 , 0.0001 + 37 , 0.692488 , 0.0001 From cc7a53d42c93db97e417bf2894cf37375510fca4 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 26 May 2024 15:44:59 +0200 Subject: [PATCH 112/194] update regression --- .../naca0012/of_grad_cd_disc.dat.ref | 76 +++++++++---------- TestCases/hybrid_regression_AD.py | 2 +- TestCases/serial_regression_AD.py | 2 +- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref index 272a21372a2..825d10e13cf 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -2656.96 , 0.001 - 1 , -12995.9 , 0.001 - 2 , -21781.3 , 0.001 - 3 , -27675.3 , 0.001 - 4 , -30437.9 , 0.001 - 5 , -30443.9 , 0.001 - 6 , -28343.1 , 0.001 - 7 , -24794.2 , 0.001 - 8 , -20329.4 , 0.001 - 9 , -15376.6 , 0.001 - 10 , -10418.0 , 0.001 - 11 , -6201.67 , 0.001 - 12 , -3878.08 , 0.001 - 13 , -4910.93 , 0.001 - 14 , -10573.5 , 0.001 - 15 , -20610.7 , 0.001 - 16 , -30110.4 , 0.001 - 17 , -26294.5 , 0.001 - 18 , -62393.8 , 0.001 - 19 , -2797.26 , 0.001 - 20 , -832.067 , 0.001 - 21 , -668.081 , 0.001 - 22 , -1773.25 , 0.001 - 23 , -5718.86 , 0.001 - 24 , -13717.8 , 0.001 - 25 , -25699.0 , 0.001 - 26 , -40061.9 , 0.001 - 27 , -53729.8 , 0.001 - 28 , -62415.6 , 0.001 - 29 , -61293.4 , 0.001 - 30 , -46505.9 , 0.001 - 31 , -17841.7 , 0.001 - 32 , 18183.8 , 0.001 - 33 , 48447.5 , 0.001 - 34 , 62322.0 , 0.001 - 35 , 64139.5 , 0.001 - 36 , 54568.2 , 0.001 - 37 , 64856.8 , 0.001 + 0 , -0.3957 , 0.0001 + 1 , -0.296173 , 0.0001 + 2 , -0.213567 , 0.0001 + 3 , -0.15797 , 0.0001 + 4 , -0.129897 , 0.0001 + 5 , -0.127172 , 0.0001 + 6 , -0.145365 , 0.0001 + 7 , -0.177645 , 0.0001 + 8 , -0.215406 , 0.0001 + 9 , -0.250173 , 0.0001 + 10 , -0.276475 , 0.0001 + 11 , -0.294359 , 0.0001 + 12 , -0.309628 , 0.0001 + 13 , -0.330814 , 0.0001 + 14 , -0.364804 , 0.0001 + 15 , -0.415697 , 0.0001 + 16 , -0.490218 , 0.0001 + 17 , -0.611024 , 0.0001 + 18 , -0.874971 , 0.0001 + 19 , 0.0510475 , 0.0001 + 20 , 0.782353 , 0.0001 + 21 , 1.26329 , 0.0001 + 22 , 1.47992 , 0.0001 + 23 , 1.46463 , 0.0001 + 24 , 1.27505 , 0.0001 + 25 , 0.979585 , 0.0001 + 26 , 0.644706 , 0.0001 + 27 , 0.325487 , 0.0001 + 28 , 0.0610001 , 0.0001 + 29 , -0.125212 , 0.0001 + 30 , -0.221301 , 0.0001 + 31 , -0.223531 , 0.0001 + 32 , -0.137307 , 0.0001 + 33 , 0.0153574 , 0.0001 + 34 , 0.190118 , 0.0001 + 35 , 0.339925 , 0.0001 + 36 , 0.471371 , 0.0001 + 37 , 0.692488 , 0.0001 diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index 4f61f064af6..1de27b7b52d 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -50,7 +50,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.563782, -8.924462, -0.000000, 0.005520] + discadj_naca0012.test_vals = [-3.564238, -8.924949, -0.000000, 0.005510] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index b1f11e50944..97cb50f324c 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -50,7 +50,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.563782, -8.924462, -0.000000, 0.005520] + discadj_naca0012.test_vals = [-3.564237, -8.924949, -0.000000, 0.005510] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) From 5dcf80abcbd465aed870445b68b2d34bf71b041f Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 26 May 2024 16:33:23 +0200 Subject: [PATCH 113/194] update regression --- .../naca0012/of_grad_cd.dat.ref | 76 +++++++++---------- TestCases/parallel_regression.py | 2 +- TestCases/parallel_regression_AD.py | 2 +- TestCases/serial_regression.py | 2 +- TestCases/serial_regression_AD.py | 2 +- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref index 825d10e13cf..019db8cdfd0 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -0.3957 , 0.0001 - 1 , -0.296173 , 0.0001 - 2 , -0.213567 , 0.0001 - 3 , -0.15797 , 0.0001 - 4 , -0.129897 , 0.0001 - 5 , -0.127172 , 0.0001 - 6 , -0.145365 , 0.0001 - 7 , -0.177645 , 0.0001 - 8 , -0.215406 , 0.0001 - 9 , -0.250173 , 0.0001 - 10 , -0.276475 , 0.0001 - 11 , -0.294359 , 0.0001 - 12 , -0.309628 , 0.0001 - 13 , -0.330814 , 0.0001 - 14 , -0.364804 , 0.0001 - 15 , -0.415697 , 0.0001 - 16 , -0.490218 , 0.0001 - 17 , -0.611024 , 0.0001 - 18 , -0.874971 , 0.0001 - 19 , 0.0510475 , 0.0001 - 20 , 0.782353 , 0.0001 - 21 , 1.26329 , 0.0001 - 22 , 1.47992 , 0.0001 - 23 , 1.46463 , 0.0001 - 24 , 1.27505 , 0.0001 - 25 , 0.979585 , 0.0001 - 26 , 0.644706 , 0.0001 - 27 , 0.325487 , 0.0001 - 28 , 0.0610001 , 0.0001 - 29 , -0.125212 , 0.0001 - 30 , -0.221301 , 0.0001 - 31 , -0.223531 , 0.0001 - 32 , -0.137307 , 0.0001 - 33 , 0.0153574 , 0.0001 - 34 , 0.190118 , 0.0001 - 35 , 0.339925 , 0.0001 - 36 , 0.471371 , 0.0001 - 37 , 0.692488 , 0.0001 + 0 , -11784.5 , 0.001 + 1 , -20498.0 , 0.001 + 2 , -26411.1 , 0.001 + 3 , -28542.9 , 0.001 + 4 , -26959.4 , 0.001 + 5 , -22178.8 , 0.001 + 6 , -14933.5 , 0.001 + 7 , -5954.65 , 0.001 + 8 , 4138.42 , 0.001 + 9 , 14769.0 , 0.001 + 10 , 25158.8 , 0.001 + 11 , 34023.1 , 0.001 + 12 , 39433.0 , 0.001 + 13 , 39180.1 , 0.001 + 14 , 32123.8 , 0.001 + 15 , 21333.1 , 0.001 + 16 , 20106.1 , 0.001 + 17 , 58036.6 , 0.001 + 18 , 82290.7 , 0.001 + 19 , -5788.24 , 0.001 + 20 , -5771.9 , 0.001 + 21 , -7848.48 , 0.001 + 22 , -11044.0 , 0.001 + 23 , -16517.7 , 0.001 + 24 , -25572.0 , 0.001 + 25 , -38637.9 , 0.001 + 26 , -54795.0 , 0.001 + 27 , -71562.6 , 0.001 + 28 , -84908.7 , 0.001 + 29 , -89694.9 , 0.001 + 30 , -81046.3 , 0.001 + 31 , -57113.9 , 0.001 + 32 , -22614.6 , 0.001 + 33 , 10602.4 , 0.001 + 34 , 32935.4 , 0.001 + 35 , 52354.2 , 0.001 + 36 , 70359.3 , 0.001 + 37 , -19353.5 , 0.001 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 92884151b1d..003e18d969f 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -773,7 +773,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-11.276777, -16.835340, -1.056500, 0.019964] + contadj_naca0012.test_vals = [-11.276936, -16.838537, -1.056500, 0.019964] test_list.append(contadj_naca0012) # Inviscid ONERA M6 diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index a346fa6c9bf..87fe3a4605a 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -47,7 +47,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.564238, -8.924950, -0.000000, 0.005510] + discadj_naca0012.test_vals = [-3.563782, -8.924462, -0.000000, 0.005520] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 9340524b62b..14ac6228b61 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -577,7 +577,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-9.058594, -14.482725, -1.056500, 0.019964] + contadj_naca0012.test_vals = [-11.283212, -16.846767, -1.056500, 0.019964] contadj_naca0012.tol = 0.001 test_list.append(contadj_naca0012) diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index 97cb50f324c..b1f11e50944 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -50,7 +50,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.564237, -8.924949, -0.000000, 0.005510] + discadj_naca0012.test_vals = [-3.563782, -8.924462, -0.000000, 0.005520] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) From 19de368c78b6e4f3507fb993d30e19dd7585d333 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 26 May 2024 19:34:20 +0200 Subject: [PATCH 114/194] update regression --- .../naca0012/of_grad_cd.dat.ref | 76 +++++++++---------- .../naca0012/of_grad_cd_disc.dat.ref | 76 +++++++++---------- TestCases/hybrid_regression_AD.py | 2 +- 3 files changed, 77 insertions(+), 77 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref index 019db8cdfd0..70caf6bb64b 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -11784.5 , 0.001 - 1 , -20498.0 , 0.001 - 2 , -26411.1 , 0.001 - 3 , -28542.9 , 0.001 - 4 , -26959.4 , 0.001 - 5 , -22178.8 , 0.001 - 6 , -14933.5 , 0.001 - 7 , -5954.65 , 0.001 - 8 , 4138.42 , 0.001 - 9 , 14769.0 , 0.001 - 10 , 25158.8 , 0.001 - 11 , 34023.1 , 0.001 - 12 , 39433.0 , 0.001 - 13 , 39180.1 , 0.001 - 14 , 32123.8 , 0.001 - 15 , 21333.1 , 0.001 - 16 , 20106.1 , 0.001 - 17 , 58036.6 , 0.001 - 18 , 82290.7 , 0.001 - 19 , -5788.24 , 0.001 - 20 , -5771.9 , 0.001 - 21 , -7848.48 , 0.001 - 22 , -11044.0 , 0.001 - 23 , -16517.7 , 0.001 - 24 , -25572.0 , 0.001 - 25 , -38637.9 , 0.001 - 26 , -54795.0 , 0.001 - 27 , -71562.6 , 0.001 - 28 , -84908.7 , 0.001 - 29 , -89694.9 , 0.001 - 30 , -81046.3 , 0.001 - 31 , -57113.9 , 0.001 - 32 , -22614.6 , 0.001 - 33 , 10602.4 , 0.001 - 34 , 32935.4 , 0.001 - 35 , 52354.2 , 0.001 - 36 , 70359.3 , 0.001 - 37 , -19353.5 , 0.001 + 0 , -0.3957 , 0.0001 + 1 , -0.296173 , 0.0001 + 2 , -0.213567 , 0.0001 + 3 , -0.15797 , 0.0001 + 4 , -0.129897 , 0.0001 + 5 , -0.127172 , 0.0001 + 6 , -0.145365 , 0.0001 + 7 , -0.177645 , 0.0001 + 8 , -0.215406 , 0.0001 + 9 , -0.250173 , 0.0001 + 10 , -0.276475 , 0.0001 + 11 , -0.294359 , 0.0001 + 12 , -0.309628 , 0.0001 + 13 , -0.330814 , 0.0001 + 14 , -0.364804 , 0.0001 + 15 , -0.415697 , 0.0001 + 16 , -0.490218 , 0.0001 + 17 , -0.611024 , 0.0001 + 18 , -0.874971 , 0.0001 + 19 , 0.0510475 , 0.0001 + 20 , 0.782353 , 0.0001 + 21 , 1.26329 , 0.0001 + 22 , 1.47992 , 0.0001 + 23 , 1.46463 , 0.0001 + 24 , 1.27505 , 0.0001 + 25 , 0.979585 , 0.0001 + 26 , 0.644706 , 0.0001 + 27 , 0.325487 , 0.0001 + 28 , 0.0610001 , 0.0001 + 29 , -0.125212 , 0.0001 + 30 , -0.221301 , 0.0001 + 31 , -0.223531 , 0.0001 + 32 , -0.137307 , 0.0001 + 33 , 0.0153574 , 0.0001 + 34 , 0.190118 , 0.0001 + 35 , 0.339925 , 0.0001 + 36 , 0.471371 , 0.0001 + 37 , 0.692488 , 0.0001 diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref index 825d10e13cf..c964ebdc5a8 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -0.3957 , 0.0001 - 1 , -0.296173 , 0.0001 - 2 , -0.213567 , 0.0001 - 3 , -0.15797 , 0.0001 - 4 , -0.129897 , 0.0001 - 5 , -0.127172 , 0.0001 - 6 , -0.145365 , 0.0001 - 7 , -0.177645 , 0.0001 - 8 , -0.215406 , 0.0001 - 9 , -0.250173 , 0.0001 - 10 , -0.276475 , 0.0001 - 11 , -0.294359 , 0.0001 - 12 , -0.309628 , 0.0001 - 13 , -0.330814 , 0.0001 - 14 , -0.364804 , 0.0001 - 15 , -0.415697 , 0.0001 - 16 , -0.490218 , 0.0001 - 17 , -0.611024 , 0.0001 - 18 , -0.874971 , 0.0001 - 19 , 0.0510475 , 0.0001 - 20 , 0.782353 , 0.0001 - 21 , 1.26329 , 0.0001 - 22 , 1.47992 , 0.0001 - 23 , 1.46463 , 0.0001 - 24 , 1.27505 , 0.0001 - 25 , 0.979585 , 0.0001 - 26 , 0.644706 , 0.0001 - 27 , 0.325487 , 0.0001 - 28 , 0.0610001 , 0.0001 - 29 , -0.125212 , 0.0001 - 30 , -0.221301 , 0.0001 - 31 , -0.223531 , 0.0001 - 32 , -0.137307 , 0.0001 - 33 , 0.0153574 , 0.0001 - 34 , 0.190118 , 0.0001 - 35 , 0.339925 , 0.0001 - 36 , 0.471371 , 0.0001 - 37 , 0.692488 , 0.0001 + 0 , -11784.5 , 0.001 + 1 , -20498.0 , 0.001 + 2 , -26411.1 , 0.001 + 3 , -28542.9 , 0.001 + 4 , -26959.4 , 0.001 + 5 , -22178.8 , 0.001 + 6 , -14933.5 , 0.001 + 7 , -5954.65 , 0.001 + 8 , 4138.42 , 0.001 + 9 , 14769.0 , 0.001 + 10 , 25158.8 , 0.001 + 11 , 34023.1 , 0.001 + 12 , 39433.0 , 0.001 + 13 , 39180.1 , 0.001 + 14 , 32123.8 , 0.001 + 15 , 21333.1 , 0.001 + 16 , 20106.1 , 0.001 + 17 , 58036.6 , 0.001 + 18 , 82290.7 , 0.001 + 19 , -5788.24 , 0.001 + 20 , -5771.9 , 0.001 + 21 , -7848.48 , 0.001 + 22 , -11044.0 , 0.001 + 23 , -16517.7 , 0.001 + 24 , -25572.0 , 0.001 + 25 , -38637.9 , 0.001 + 26 , -54795.0 , 0.001 + 27 , -71562.6 , 0.001 + 28 , -84908.7 , 0.001 + 29 , -89694.9 , 0.001 + 30 , -81046.3 , 0.001 + 31 , -57113.9 , 0.001 + 32 , -22614.6 , 0.001 + 33 , 10602.4 , 0.001 + 34 , 32935.4 , 0.001 + 35 , 52354.2 , 0.001 + 36 , 70359.3 , 0.001 + 37 , -19353.5 , 0.001 diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index 1de27b7b52d..cd57e8e7ebd 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -50,7 +50,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.564238, -8.924949, -0.000000, 0.005510] + discadj_naca0012.test_vals = [-3.563781, -8.924461, -0.000000, 0.005520] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) From c2579d4e8a81e18cb282b47585fe1ce2cacd9ecc Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 31 May 2024 08:14:43 +0200 Subject: [PATCH 115/194] update grid velocity --- Common/include/linear_algebra/CSysMatrix.hpp | 1 + .../include/solvers/CFVMFlowSolverBase.inl | 61 +++++++++++++------ .../naca0012/of_grad_cd.dat.ref | 2 +- 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/Common/include/linear_algebra/CSysMatrix.hpp b/Common/include/linear_algebra/CSysMatrix.hpp index fe6f194d43b..02747f8be07 100644 --- a/Common/include/linear_algebra/CSysMatrix.hpp +++ b/Common/include/linear_algebra/CSysMatrix.hpp @@ -108,6 +108,7 @@ struct CSysMatrixComms { }; /*! + * \class CSysMatrix * \ingroup SpLinSys * \brief Main class for defining block-compressed-row-storage sparse matrices. */ diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 381911fc28f..3790a7d7fe3 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1089,8 +1089,8 @@ void CFVMFlowSolverBase::PushSolutionBackInTime(unsigned long TimeIter, bo } } -template -void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, +template +void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) { const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const auto iVel = prim_idx.Velocity(); @@ -1178,12 +1178,18 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve if (dynamic_grid) conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); + /*--- Normal vector for this vertex (negate for outward convention). ---*/ + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Normal[iDim] = -Normal[iDim]; + conv_numerics->SetNormal(Normal); + + for (auto iVar = 0u; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); su2double ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); - /*--- Adjustment to v.n due to grid movement. ---*/ if (dynamic_grid) ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); @@ -1191,38 +1197,56 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve for (auto iDim = 0u; iDim < nDim; iDim++) V_reflected[iDim + iVel] = nodes->GetVelocity(iPoint, iDim) - ProjVelocity_i * UnitNormal[iDim]; - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Normal[iDim] = -Normal[iDim]; - conv_numerics->SetNormal(Normal); - /*--- Get current solution at this boundary node ---*/ - su2double* V_domain = nodes->GetPrimitive(iPoint); + const su2double* V_domain = nodes->GetPrimitive(iPoint); /*--- Set Primitive and Secondary for numerics class. ---*/ conv_numerics->SetPrimitive(V_domain, V_reflected); conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); + + /*--- Compute the residual using an upwind scheme. ---*/ auto residual = conv_numerics->ComputeResidual(config); + /*--- Old method of updating residual - remove! ---*/ + //LinSysRes.AddBlock(iPoint, residual); + + /*--- Explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ su2double* solutionOld = nodes->GetSolution_Old(iPoint); + + su2double gridVel[MAXNVAR] = {0.0}; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + gridVel[iDim] = geometry->nodes->GetGridVel(iPoint)[iDim]; + } + + if (FlowRegime == ENUM_REGIME::COMPRESSIBLE) { + for(unsigned short iDim = 0; iDim < nDim; iDim++) { + gridVel[iDim] *= solutionOld[prim_idx.Density()]; + } + } + su2double vp = 0.0; - for(unsigned short iDim = 0; iDim < nDim; iDim++) - vp += solutionOld[iVel+iDim] * UnitNormal[iDim]; - for(unsigned short iDim = 0; iDim < nDim; iDim++) + + for (unsigned short iDim = 0; iDim < nDim; iDim++) + vp += (solutionOld[iVel+iDim] - gridVel[iDim]) * UnitNormal[iDim]; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) solutionOld[iVel + iDim] -= vp * UnitNormal[iDim]; - nodes->SetSolution_Old(iPoint, solutionOld); /*--- Keep only the tangential part of the momentum residuals. ---*/ su2double NormalProduct = 0.0; - for(unsigned short iDim = 0; iDim < nDim; iDim++) + + for (unsigned short iDim = 0; iDim < nDim; iDim++) NormalProduct += LinSysRes(iPoint, iVel + iDim) * UnitNormal[iDim]; - for(unsigned short iDim = 0; iDim < nDim; iDim++) - LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; + } /*--- Jacobian contribution for implicit integration. ---*/ if (implicit) { @@ -1234,15 +1258,16 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solve /*--- Correction for multigrid ---*/ NormalProduct = 0.0; su2double* Res_TruncError = nodes->GetResTruncError(iPoint); - for(unsigned short iDim = 0; iDim < nDim; iDim++) + for (unsigned short iDim = 0; iDim < nDim; iDim++) NormalProduct += Res_TruncError[iVel + iDim] * UnitNormal[iDim]; - for(unsigned short iDim = 0; iDim < nDim; iDim++) + for (unsigned short iDim = 0; iDim < nDim; iDim++) Res_TruncError[iVel + iDim] -= NormalProduct * UnitNormal[iDim]; nodes->SetResTruncError(iPoint, Res_TruncError); } END_SU2_OMP_FOR + } template diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref index 70caf6bb64b..825d10e13cf 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref @@ -36,4 +36,4 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" 34 , 0.190118 , 0.0001 35 , 0.339925 , 0.0001 36 , 0.471371 , 0.0001 - 37 , 0.692488 , 0.0001 + 37 , 0.692488 , 0.0001 From fec6872ec3a1c624748072091839c973d60b024c Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 31 May 2024 16:25:32 +0200 Subject: [PATCH 116/194] update grid velocity --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 3790a7d7fe3..019ef279191 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1219,13 +1219,15 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve su2double gridVel[MAXNVAR] = {0.0}; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - gridVel[iDim] = geometry->nodes->GetGridVel(iPoint)[iDim]; - } + if (dynamic_grid) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + gridVel[iDim] = geometry->nodes->GetGridVel(iPoint)[iDim]; + } - if (FlowRegime == ENUM_REGIME::COMPRESSIBLE) { - for(unsigned short iDim = 0; iDim < nDim; iDim++) { - gridVel[iDim] *= solutionOld[prim_idx.Density()]; + if (FlowRegime == ENUM_REGIME::COMPRESSIBLE) { + for(unsigned short iDim = 0; iDim < nDim; iDim++) { + gridVel[iDim] *= solutionOld[prim_idx.Density()]; + } } } From 102f9ebffb33caa311ef7332d90041740c268216 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 1 Jun 2024 00:31:27 +0200 Subject: [PATCH 117/194] update grid velocity --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 019ef279191..4164c2443cf 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1207,8 +1207,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve /*--- Compute the residual using an upwind scheme. ---*/ auto residual = conv_numerics->ComputeResidual(config); - /*--- Old method of updating residual - remove! ---*/ - //LinSysRes.AddBlock(iPoint, residual); + /*--- Old method of updating residual ---*/ + LinSysRes.AddBlock(iPoint, residual); /*--- Explicitly set the velocity components normal to the symmetry plane to zero. @@ -1236,9 +1236,9 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve for (unsigned short iDim = 0; iDim < nDim; iDim++) vp += (solutionOld[iVel+iDim] - gridVel[iDim]) * UnitNormal[iDim]; - for (unsigned short iDim = 0; iDim < nDim; iDim++) + for (unsigned short iDim = 0; iDim < nDim; iDim++) { solutionOld[iVel + iDim] -= vp * UnitNormal[iDim]; - + } /*--- Keep only the tangential part of the momentum residuals. ---*/ su2double NormalProduct = 0.0; From 67d0172ae3d85e007863b9253246ec62c887b3e4 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 1 Jun 2024 13:23:22 +0200 Subject: [PATCH 118/194] update grid velocity --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 4164c2443cf..e46c8be2c4e 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1226,7 +1226,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve if (FlowRegime == ENUM_REGIME::COMPRESSIBLE) { for(unsigned short iDim = 0; iDim < nDim; iDim++) { - gridVel[iDim] *= solutionOld[prim_idx.Density()]; + /* --- multiply by density --- */ + gridVel[iDim] *= solutionOld[0]; } } } From b71cccac9f378b06ae624db2ba9dd73f71209ab8 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 1 Jun 2024 23:12:47 +0200 Subject: [PATCH 119/194] update grid velocity --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index e46c8be2c4e..9529f54e36d 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1207,9 +1207,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve /*--- Compute the residual using an upwind scheme. ---*/ auto residual = conv_numerics->ComputeResidual(config); - /*--- Old method of updating residual ---*/ - LinSysRes.AddBlock(iPoint, residual); - + /*--- We need only an update of energy here. ---*/ + LinSysRes(iPoint, nDim + 1) += residual.residual[nDim + 1]; /*--- Explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem @@ -1248,14 +1247,15 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve NormalProduct += LinSysRes(iPoint, iVel + iDim) * UnitNormal[iDim]; for (unsigned short iDim = 0; iDim < nDim; iDim++) { - LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; + LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; } /*--- Jacobian contribution for implicit integration. ---*/ if (implicit) { + Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); /*--- Add Jacobian again for more diagonal dominance. ---*/ - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + //Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); } /*--- Correction for multigrid ---*/ @@ -1265,8 +1265,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve NormalProduct += Res_TruncError[iVel + iDim] * UnitNormal[iDim]; for (unsigned short iDim = 0; iDim < nDim; iDim++) Res_TruncError[iVel + iDim] -= NormalProduct * UnitNormal[iDim]; - - nodes->SetResTruncError(iPoint, Res_TruncError); + // not necessary + //nodes->SetResTruncError(iPoint, Res_TruncError); } END_SU2_OMP_FOR From b927dd86151804c229290d97975c42f88d619834 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 10 Jun 2024 07:46:37 +0200 Subject: [PATCH 120/194] update vandv --- TestCases/vandv.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TestCases/vandv.py b/TestCases/vandv.py index 87db07356d4..fda2a589a74 100644 --- a/TestCases/vandv.py +++ b/TestCases/vandv.py @@ -54,7 +54,7 @@ def main(): flatplate_sst1994m.cfg_dir = "vandv/rans/flatplate" flatplate_sst1994m.cfg_file = "turb_flatplate_sst.cfg" flatplate_sst1994m.test_iter = 5 - flatplate_sst1994m.test_vals = [-13.028410, -10.277801, -11.293512, -8.146806, -10.521546, -5.127399, 0.002775] + flatplate_sst1994m.test_vals = [-13.026767, -10.276424, -11.302313, -8.131872, -10.520174, -5.127374, 0.002775] flatplate_sst1994m.test_vals_aarch64 = [-13.028095, -11.271115, -11.532461, -8.387610, -11.417974, -5.116988, 0.002808] test_list.append(flatplate_sst1994m) @@ -63,7 +63,7 @@ def main(): bump_sst1994m.cfg_dir = "vandv/rans/bump_in_channel" bump_sst1994m.cfg_file = "turb_bump_sst.cfg" bump_sst1994m.test_iter = 5 - bump_sst1994m.test_vals = [-13.000624, -9.883260, -10.595178, -7.576893, -10.173007, -5.550774, 0.004904] + bump_sst1994m.test_vals = [-13.011264, -9.882617, -10.577459, -7.598922, -10.172437, -5.549156, 0.004904] bump_sst1994m.test_vals_aarch64 = [-13.034665, -10.510699, -10.627802, -7.661320, -10.680337, -5.749566, 0.004972] test_list.append(bump_sst1994m) @@ -94,7 +94,7 @@ def main(): sandiajet_sst.cfg_dir = "vandv/species_transport/sandia_jet" sandiajet_sst.cfg_file = "validation.cfg" sandiajet_sst.test_iter = 5 - sandiajet_sst.test_vals = [-17.149598, -13.519201, -15.492514, -12.021166, -9.662163, -15.290253, 5.000000, -2.766857, 5.000000, -4.834011, 5.000000, -3.964822, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] + sandiajet_sst.test_vals = [-17.136489, -13.518189, -15.465498, -12.021165, -9.661118, -15.289570, 5.000000, -2.744100, 5.000000, -4.836054, 5.000000, -3.965812, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] sandiajet_sst.test_vals_aarch64 = [-17.069026, -13.156800, -15.290567, -11.689831, -9.349978, -14.907311, 5.000000, -2.738947, 5.000000, -4.813747, 5.000000, -3.981740, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] test_list.append(sandiajet_sst) From 609fd2cf651554c8911695a9828e679f253d7425 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 10 Jun 2024 07:54:48 +0200 Subject: [PATCH 121/194] update tutorials --- TestCases/tutorials.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index fd6b5ef4bda..6e4aec4f6b9 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -71,7 +71,7 @@ def main(): sp_pinArray_2d_mf_hf.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" sp_pinArray_2d_mf_hf.cfg_file = "sp_pinArray_2d_mf_hf.cfg" sp_pinArray_2d_mf_hf.test_iter = 25 - sp_pinArray_2d_mf_hf.test_vals = [-4.504174, 1.569752, -0.747804, 241.767008] + sp_pinArray_2d_mf_hf.test_vals = [-4.554316, 1.527556, -0.746546, 241.772257] test_list.append(sp_pinArray_2d_mf_hf) # 2D pin case pressure drop periodic with heatflux BC and temperature periodicity @@ -79,7 +79,7 @@ def main(): sp_pinArray_2d_dp_hf_tp.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" sp_pinArray_2d_dp_hf_tp.cfg_file = "sp_pinArray_2d_dp_hf_tp.cfg" sp_pinArray_2d_dp_hf_tp.test_iter = 25 - sp_pinArray_2d_dp_hf_tp.test_vals = [-4.528950, 1.539981, -0.706095, 208.023676] + sp_pinArray_2d_dp_hf_tp.test_vals = [-4.577668, 1.492071, -0.704858, 208.023676] test_list.append(sp_pinArray_2d_dp_hf_tp) ### Species Transport @@ -89,7 +89,7 @@ def main(): species3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" species3_primitiveVenturi.cfg_file = "species3_primitiveVenturi.cfg" species3_primitiveVenturi.test_iter = 50 - species3_primitiveVenturi.test_vals = [-5.913968, -5.289629, -5.242978, -6.004174, -1.801167, -6.357795, -6.503730, 5.000000, -0.865450, 5.000000, -2.224839, 5.000000, -0.537583, 1.652289, 0.500844, 0.596928, 0.554518] + species3_primitiveVenturi.test_vals = [-5.881995, -5.266239, -5.103460, -5.962606, -1.666781, -6.215600, -6.309526, 5.000000, -0.818218, 5.000000, -2.070867, 5.000000, -0.438404, 1.653246, 0.499867, 0.598308, 0.555071] test_list.append(species3_primitiveVenturi) # 3 species (2 eq) primitive venturi mixing @@ -97,7 +97,7 @@ def main(): DAspecies3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" DAspecies3_primitiveVenturi.cfg_file = "DAspecies3_primitiveVenturi.cfg" DAspecies3_primitiveVenturi.test_iter = 50 - DAspecies3_primitiveVenturi.test_vals = [-7.865411, -7.548131, -7.347978, -7.217536, -11.822422, -10.968444, -10.193225] + DAspecies3_primitiveVenturi.test_vals = [-8.135219, -7.384583, -7.573770, -7.218395, -11.802139, -10.966913, -10.192017] DAspecies3_primitiveVenturi.test_vals_aarch64 = [-7.865411, -7.548131, -7.347978, -7.217536, -11.822422, -10.968444, -10.193225] DAspecies3_primitiveVenturi.command = TestCase.Command("mpirun -n 2", "SU2_CFD_AD") test_list.append(DAspecies3_primitiveVenturi) @@ -116,7 +116,7 @@ def main(): sudo_tutorial.cfg_dir = "../Tutorials/incompressible_flow/Inc_Turbulent_Bend_Wallfunctions" sudo_tutorial.cfg_file = "sudo.cfg" sudo_tutorial.test_iter = 10 - sudo_tutorial.test_vals = [-14.323795, -13.173296, -14.236070, -12.409590, -14.008028, -10.821351, 15.000000, -2.362015] + sudo_tutorial.test_vals = [-14.530162, -13.196430, -13.543569, -12.568202, -13.992006, -10.811607, 15.000000, -2.325681] sudo_tutorial.command = TestCase.Command("mpirun -n 2", "SU2_CFD") test_list.append(sudo_tutorial) @@ -127,7 +127,7 @@ def main(): premixed_hydrogen.cfg_dir = "../Tutorials/incompressible_flow/Inc_Combustion/1__premixed_hydrogen" premixed_hydrogen.cfg_file = "H2_burner.cfg" premixed_hydrogen.test_iter = 10 - premixed_hydrogen.test_vals = [-9.867500, -10.384793, -11.046230, -4.332015, -11.884493] + premixed_hydrogen.test_vals = [-9.788006, -10.279292, -11.043104, -4.331539, -11.884939] test_list.append(premixed_hydrogen) ### Compressible Flow @@ -137,7 +137,7 @@ def main(): tutorial_inv_bump.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Bump" tutorial_inv_bump.cfg_file = "inv_channel.cfg" tutorial_inv_bump.test_iter = 0 - tutorial_inv_bump.test_vals = [-1.437425, 4.075857, -0.004083, 0.067355] + tutorial_inv_bump.test_vals = [-1.437425, 3.983585, 0.041771, 0.055613] test_list.append(tutorial_inv_bump) # Inviscid Wedge @@ -145,7 +145,7 @@ def main(): tutorial_inv_wedge.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Wedge" tutorial_inv_wedge.cfg_file = "inv_wedge_HLLC.cfg" tutorial_inv_wedge.test_iter = 0 - tutorial_inv_wedge.test_vals = [-0.481460, 5.253008, -0.293451, 0.051695] + tutorial_inv_wedge.test_vals = [-0.481460, 4.850246, -0.276518, 0.048670] tutorial_inv_wedge.no_restart = True test_list.append(tutorial_inv_wedge) @@ -154,7 +154,7 @@ def main(): tutorial_inv_onera.cfg_dir = "../Tutorials/compressible_flow/Inviscid_ONERAM6" tutorial_inv_onera.cfg_file = "inv_ONERAM6.cfg" tutorial_inv_onera.test_iter = 0 - tutorial_inv_onera.test_vals = [-5.204928, -4.597762, 0.255459, 0.112835] + tutorial_inv_onera.test_vals = [-5.204928, -4.895776, 0.238992, 0.105223] tutorial_inv_onera.no_restart = True test_list.append(tutorial_inv_onera) @@ -199,7 +199,7 @@ def main(): tutorial_trans_flatplate_T3A.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A" tutorial_trans_flatplate_T3A.cfg_file = "transitional_LM_model_ConfigFile.cfg" tutorial_trans_flatplate_T3A.test_iter = 20 - tutorial_trans_flatplate_T3A.test_vals = [-5.837368, -2.092246, -3.984172, -0.302357, -1.928108, 1.667157, -3.496279, 0.391610] + tutorial_trans_flatplate_T3A.test_vals = [-5.837340, -2.092244, -3.983527, -0.302296, -1.921023, 1.667165, -3.496279, 0.391601] tutorial_trans_flatplate_T3A.test_vals_aarch64 = [-5.837368, -2.092246, -3.984172, -0.302357, -1.928108, 1.667157, -3.496279, 0.391610] tutorial_trans_flatplate_T3A.no_restart = True test_list.append(tutorial_trans_flatplate_T3A) @@ -209,7 +209,7 @@ def main(): tutorial_trans_flatplate_T3Am.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A-" tutorial_trans_flatplate_T3Am.cfg_file = "transitional_LM_model_ConfigFile.cfg" tutorial_trans_flatplate_T3Am.test_iter = 20 - tutorial_trans_flatplate_T3Am.test_vals = [-6.063726, -1.945088, -3.946923, -0.549166, -3.863794, 2.664439, -2.517601, 1.112978] + tutorial_trans_flatplate_T3Am.test_vals = [-6.063716, -1.945087, -3.946836, -0.549162, -3.863794, 2.664442, -2.517598, 1.112979] tutorial_trans_flatplate_T3Am.test_vals_aarch64 = [-6.063726, -1.945088, -3.946923, -0.549166, -3.863794, 2.664439, -2.517601, 1.112978] tutorial_trans_flatplate_T3Am.no_restart = True test_list.append(tutorial_trans_flatplate_T3Am) @@ -237,7 +237,7 @@ def main(): tutorial_turb_oneram6.cfg_dir = "../Tutorials/compressible_flow/Turbulent_ONERAM6" tutorial_turb_oneram6.cfg_file = "turb_ONERAM6.cfg" tutorial_turb_oneram6.test_iter = 0 - tutorial_turb_oneram6.test_vals = [-4.564441, -11.529247, 0.327435, 0.097253] + tutorial_turb_oneram6.test_vals = [-4.564441, -11.524295, 0.327905, 0.097340] test_list.append(tutorial_turb_oneram6) # NICD Nozzle @@ -245,7 +245,7 @@ def main(): tutorial_nicfd_nozzle.cfg_dir = "../Tutorials/compressible_flow/NICFD_nozzle" tutorial_nicfd_nozzle.cfg_file = "NICFD_nozzle.cfg" tutorial_nicfd_nozzle.test_iter = 20 - tutorial_nicfd_nozzle.test_vals = [-2.063934, -2.344744, 3.596583, 0.000000, 0.000000] + tutorial_nicfd_nozzle.test_vals = [-2.217601, -2.321330, 3.694830, 0.000000, 0.000000] tutorial_nicfd_nozzle.no_restart = True test_list.append(tutorial_nicfd_nozzle) @@ -275,7 +275,7 @@ def main(): tutorial_design_inv_naca0012.cfg_dir = "../Tutorials/design/Inviscid_2D_Unconstrained_NACA0012" tutorial_design_inv_naca0012.cfg_file = "inv_NACA0012_basic.cfg" tutorial_design_inv_naca0012.test_iter = 0 - tutorial_design_inv_naca0012.test_vals = [-3.585391, -2.989014, 0.132704, 0.204686] + tutorial_design_inv_naca0012.test_vals = [-3.585391, -3.332494, 0.134725, 0.204369] tutorial_design_inv_naca0012.no_restart = True test_list.append(tutorial_design_inv_naca0012) From 7fe3866c83d5c83fc5a7d2ceb408ba7df6f2eb58 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 10 Jun 2024 08:02:26 +0200 Subject: [PATCH 122/194] update hybrid_regression_AD --- TestCases/hybrid_regression_AD.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index cd57e8e7ebd..aa5ead03982 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -50,7 +50,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.563781, -8.924461, -0.000000, 0.005520] + discadj_naca0012.test_vals = [-3.560717, -8.925500, -0.000000, 0.005562] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) @@ -58,7 +58,7 @@ def main(): discadj_cylinder3D.cfg_dir = "disc_adj_euler/cylinder3D" discadj_cylinder3D.cfg_file = "inv_cylinder3D.cfg" discadj_cylinder3D.test_iter = 5 - discadj_cylinder3D.test_vals = [-3.811884, -3.768379, -0.000000, 0.000000] + discadj_cylinder3D.test_vals = [-3.765584, -3.720278, -0.000000, 0.000000] test_list.append(discadj_cylinder3D) # Arina nozzle 2D @@ -66,7 +66,7 @@ def main(): discadj_arina2k.cfg_dir = "disc_adj_euler/arina2k" discadj_arina2k.cfg_file = "Arina2KRS.cfg" discadj_arina2k.test_iter = 20 - discadj_arina2k.test_vals = [-3.242104, -3.481387, 0.056340, 0.000000] + discadj_arina2k.test_vals = [-3.498083, -3.736791, 0.026277, 0.000000] test_list.append(discadj_arina2k) #################################### @@ -98,7 +98,7 @@ def main(): discadj_incomp_NACA0012.cfg_dir = "disc_adj_incomp_euler/naca0012" discadj_incomp_NACA0012.cfg_file = "incomp_NACA0012_disc.cfg" discadj_incomp_NACA0012.test_iter = 20 - discadj_incomp_NACA0012.test_vals = [20.000000, -4.084634, -2.650488, 0.000000] + discadj_incomp_NACA0012.test_vals = [20.000000, -4.088910, -2.654830, 0.000000] test_list.append(discadj_incomp_NACA0012) ##################################### @@ -185,7 +185,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.218226, -1.645219, -0.007565, 0.000013] + discadj_pitchingNACA0012.test_vals = [-1.220701, -1.647361, -0.007528, 0.000013] discadj_pitchingNACA0012.unsteady = True discadj_pitchingNACA0012.enabled_with_tsan = False test_list.append(discadj_pitchingNACA0012) From 080c87bd6407530a1351c7a57d1ad9448d94435b Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 10 Jun 2024 21:36:39 +0200 Subject: [PATCH 123/194] use proper index for temperature --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 835d7308a65..cf9a53c771a 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1135,8 +1135,10 @@ void CFVMFlowSolverBase::PushSolutionBackInTime(unsigned long TimeIter, bo template void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const auto iVel = prim_idx.Velocity(); + const auto iTmp = prim_idx.Temperature(); /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. * The components of the residual normal to the symmetry plane are then zeroed out. @@ -1251,7 +1253,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve auto residual = conv_numerics->ComputeResidual(config); /*--- We need only an update of energy here. ---*/ - LinSysRes(iPoint, nDim + 1) += residual.residual[nDim + 1]; + LinSysRes(iPoint, iTmp) += residual.residual[iTmp]; /*--- Explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem From 4453aea3727cd322b9be8fb06f3a1c919f1fa95a Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 10 Jun 2024 22:20:01 +0200 Subject: [PATCH 124/194] use proper index for temperature --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index cf9a53c771a..835d7308a65 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1135,10 +1135,8 @@ void CFVMFlowSolverBase::PushSolutionBackInTime(unsigned long TimeIter, bo template void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) { - const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const auto iVel = prim_idx.Velocity(); - const auto iTmp = prim_idx.Temperature(); /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. * The components of the residual normal to the symmetry plane are then zeroed out. @@ -1253,7 +1251,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve auto residual = conv_numerics->ComputeResidual(config); /*--- We need only an update of energy here. ---*/ - LinSysRes(iPoint, iTmp) += residual.residual[iTmp]; + LinSysRes(iPoint, nDim + 1) += residual.residual[nDim + 1]; /*--- Explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem From dea340ea85649f5258805cd14abd98027566790b Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 11 Jun 2024 07:08:58 +0200 Subject: [PATCH 125/194] fix convergence of edge_PPR --- TestCases/nicf/edge/edge_PPR.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TestCases/nicf/edge/edge_PPR.cfg b/TestCases/nicf/edge/edge_PPR.cfg index 759187d1229..d9a5707b1e3 100644 --- a/TestCases/nicf/edge/edge_PPR.cfg +++ b/TestCases/nicf/edge/edge_PPR.cfg @@ -50,9 +50,9 @@ MARKER_MONITORING= ( WALL1 ) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 10 -CFL_ADAPT= NO -CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +CFL_NUMBER= 0.01 +CFL_ADAPT= YES +CFL_ADAPT_PARAM= ( 0.9, 1.1, 0.01, 100.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) ITER= 500 @@ -105,4 +105,4 @@ GRAD_OBJFUNC_FILENAME= of_grad.dat SURFACE_FILENAME= surface_flow SURFACE_ADJ_FILENAME= surface_adjoint OUTPUT_WRT_FREQ= 250 -SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, LIFT, DRAG) +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, LIFT, DRAG, AVG_CFL) From 51c804b5833254edfb5ed1d15984d3ebad520923 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 13 Jun 2024 00:14:18 +0200 Subject: [PATCH 126/194] not just energy --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 835d7308a65..42924ee88bd 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1251,8 +1251,10 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve auto residual = conv_numerics->ComputeResidual(config); /*--- We need only an update of energy here. ---*/ - LinSysRes(iPoint, nDim + 1) += residual.residual[nDim + 1]; - + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + if ((iVar= iVel+nDim)) + LinSysRes(iPoint, iVar) += residual.residual[iVar]; + } /*--- Explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ @@ -1295,10 +1297,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve /*--- Jacobian contribution for implicit integration. ---*/ if (implicit) { - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); - /*--- Add Jacobian again for more diagonal dominance. ---*/ - //Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); } /*--- Correction for multigrid ---*/ From 1b0924f6857fa62e6f4e5e51ac409a6b18c3ef47 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 16 Jun 2024 11:47:34 +0200 Subject: [PATCH 127/194] small update --- .../include/solvers/CFVMFlowSolverBase.inl | 7 +- .../naca0012/of_grad_cd.dat.ref | 76 +++++++++---------- .../wedge/of_grad_combo.dat.ref | 8 +- TestCases/disc_adj_heat/disc_adj_heat.cfg | 2 +- TestCases/euler/bluntbody/blunt.cfg | 2 +- TestCases/euler/channel/inv_channel_RK.cfg | 2 +- TestCases/euler/naca0012/inv_NACA0012_Roe.cfg | 2 +- TestCases/euler/wedge/inv_wedge_HLLC.cfg | 2 +- TestCases/hybrid_regression_AD.py | 12 +-- .../incomp_euler/naca0012/incomp_NACA0012.cfg | 8 +- TestCases/incomp_euler/nozzle/inv_nozzle.cfg | 2 +- .../navierstokes/flatplate/lam_flatplate.cfg | 6 +- TestCases/nicf/edge/edge_PPR.cfg | 8 +- TestCases/parallel_regression.py | 16 ++-- TestCases/parallel_regression_AD.py | 22 +++--- TestCases/rotating/naca0012/rot_NACA0012.cfg | 2 +- TestCases/serial_regression.py | 68 ++++++++--------- TestCases/serial_regression_AD.py | 16 ++-- TestCases/tutorials.py | 2 +- TestCases/vandv.py | 6 +- 20 files changed, 137 insertions(+), 132 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 42924ee88bd..a607b5ca946 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1232,7 +1232,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); su2double ProjVelocity_i = nodes->GetProjVel(iPoint, UnitNormal); - /*--- Adjustment to v.n due to grid movement. ---*/ if (dynamic_grid) ProjVelocity_i -= GeometryToolbox::DotProduct(nDim, geometry->nodes->GetGridVel(iPoint), UnitNormal); @@ -1255,6 +1254,9 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve if ((iVar= iVel+nDim)) LinSysRes(iPoint, iVar) += residual.residual[iVar]; } + ///LinSysRes(iPoint, nDim+1) += residual.residual[nDim+1]; + ///LinSysRes.AddBlock(iPoint, residual); + /*--- Explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem * underconstrained (the normal residual is zero regardless of the normal velocity). ---*/ @@ -1295,6 +1297,9 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; } + + + /*--- Jacobian contribution for implicit integration. ---*/ if (implicit) { Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref index 825d10e13cf..8322fc8077e 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -0.3957 , 0.0001 - 1 , -0.296173 , 0.0001 - 2 , -0.213567 , 0.0001 - 3 , -0.15797 , 0.0001 - 4 , -0.129897 , 0.0001 - 5 , -0.127172 , 0.0001 - 6 , -0.145365 , 0.0001 - 7 , -0.177645 , 0.0001 - 8 , -0.215406 , 0.0001 - 9 , -0.250173 , 0.0001 - 10 , -0.276475 , 0.0001 - 11 , -0.294359 , 0.0001 - 12 , -0.309628 , 0.0001 - 13 , -0.330814 , 0.0001 - 14 , -0.364804 , 0.0001 - 15 , -0.415697 , 0.0001 - 16 , -0.490218 , 0.0001 - 17 , -0.611024 , 0.0001 - 18 , -0.874971 , 0.0001 - 19 , 0.0510475 , 0.0001 - 20 , 0.782353 , 0.0001 - 21 , 1.26329 , 0.0001 - 22 , 1.47992 , 0.0001 - 23 , 1.46463 , 0.0001 - 24 , 1.27505 , 0.0001 - 25 , 0.979585 , 0.0001 - 26 , 0.644706 , 0.0001 - 27 , 0.325487 , 0.0001 - 28 , 0.0610001 , 0.0001 - 29 , -0.125212 , 0.0001 - 30 , -0.221301 , 0.0001 - 31 , -0.223531 , 0.0001 - 32 , -0.137307 , 0.0001 - 33 , 0.0153574 , 0.0001 - 34 , 0.190118 , 0.0001 - 35 , 0.339925 , 0.0001 - 36 , 0.471371 , 0.0001 - 37 , 0.692488 , 0.0001 + 0 , -0.405334 , 0.0001 + 1 , -0.300634 , 0.0001 + 2 , -0.211062 , 0.0001 + 3 , -0.148746 , 0.0001 + 4 , -0.115552 , 0.0001 + 5 , -0.110114 , 0.0001 + 6 , -0.128222 , 0.0001 + 7 , -0.162634 , 0.0001 + 8 , -0.20377 , 0.0001 + 9 , -0.241877 , 0.0001 + 10 , -0.270344 , 0.0001 + 11 , -0.288742 , 0.0001 + 12 , -0.303382 , 0.0001 + 13 , -0.324065 , 0.0001 + 14 , -0.35884 , 0.0001 + 15 , -0.411905 , 0.0001 + 16 , -0.489011 , 0.0001 + 17 , -0.610158 , 0.0001 + 18 , -0.861925 , 0.0001 + 19 , 0.0455288 , 0.0001 + 20 , 0.772193 , 0.0001 + 21 , 1.2507 , 0.0001 + 22 , 1.46632 , 0.0001 + 23 , 1.45121 , 0.0001 + 24 , 1.26277 , 0.0001 + 25 , 0.969139 , 0.0001 + 26 , 0.636433 , 0.0001 + 27 , 0.319367 , 0.0001 + 28 , 0.0567211 , 0.0001 + 29 , -0.128146 , 0.0001 + 30 , -0.223501 , 0.0001 + 31 , -0.225775 , 0.0001 + 32 , -0.140749 , 0.0001 + 33 , 0.00916305 , 0.0001 + 34 , 0.180472 , 0.0001 + 35 , 0.329347 , 0.0001 + 36 , 0.462811 , 0.0001 + 37 , 0.686302 , 0.0001 diff --git a/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref b/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref index 9f8664e9dcd..6afe0fa470c 100644 --- a/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref +++ b/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref @@ -1,5 +1,5 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , 0.00750752 , 0.0001 - 1 , 0.00491594 , 0.0001 - 2 , 0.00245399 , 0.0001 - 3 , 0.000898752 , 0.0001 + 0 , 0.00736649 , 0.0001 + 1 , 0.00518066 , 0.0001 + 2 , 0.00272704 , 0.0001 + 3 , 0.0010838 , 0.0001 diff --git a/TestCases/disc_adj_heat/disc_adj_heat.cfg b/TestCases/disc_adj_heat/disc_adj_heat.cfg index 85e7d30e98c..cb258ec6333 100644 --- a/TestCases/disc_adj_heat/disc_adj_heat.cfg +++ b/TestCases/disc_adj_heat/disc_adj_heat.cfg @@ -208,6 +208,6 @@ SURFACE_FILENAME= surface_flow SURFACE_ADJ_FILENAME= surface_adjoint -OUTPUT_WRT_FREQ= 1 +OUTPUT_WRT_FREQ= 100 SCREEN_OUTPUT= (INNER_ITER, RMS_ADJ_PRESSURE, RMS_ADJ_NU_TILDE, RMS_ADJ_HEAT, SENS_VEL_IN, SENS_PRESS_OUT) diff --git a/TestCases/euler/bluntbody/blunt.cfg b/TestCases/euler/bluntbody/blunt.cfg index f9ece1cbae4..a76c6be19ba 100644 --- a/TestCases/euler/bluntbody/blunt.cfg +++ b/TestCases/euler/bluntbody/blunt.cfg @@ -43,7 +43,7 @@ MARKER_MONITORING = ( wall ) % ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 3.0 +CFL_NUMBER= 6.0 CFL_ADAPT= NO CFL_ADAPT_PARAM= ( 1.1, 0.9, 5.0, 50.0 ) ITER= 2500 diff --git a/TestCases/euler/channel/inv_channel_RK.cfg b/TestCases/euler/channel/inv_channel_RK.cfg index ee2b3513e14..8e20a09f14c 100644 --- a/TestCases/euler/channel/inv_channel_RK.cfg +++ b/TestCases/euler/channel/inv_channel_RK.cfg @@ -44,7 +44,7 @@ MARKER_MONITORING= ( upper_wall, lower_wall ) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 2.0 +CFL_NUMBER= 2.5 CFL_ADAPT= NO CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) diff --git a/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg b/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg index 3fbc79377bb..e06614fb096 100644 --- a/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg +++ b/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg @@ -41,7 +41,7 @@ MARKER_MONITORING= ( airfoil ) % ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 20.0 +CFL_NUMBER= 50.0 CFL_ADAPT= NO CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) diff --git a/TestCases/euler/wedge/inv_wedge_HLLC.cfg b/TestCases/euler/wedge/inv_wedge_HLLC.cfg index 30120e792dd..77c20175c22 100644 --- a/TestCases/euler/wedge/inv_wedge_HLLC.cfg +++ b/TestCases/euler/wedge/inv_wedge_HLLC.cfg @@ -42,7 +42,7 @@ MARKER_MONITORING= ( upper, lower ) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 1.0 +CFL_NUMBER= 4.0 CFL_ADAPT= NO CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index aa5ead03982..903e9c06554 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -50,7 +50,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.560717, -8.925500, -0.000000, 0.005562] + discadj_naca0012.test_vals = [-3.560692, -8.925239, -0.000000, 0.005559] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) @@ -58,7 +58,7 @@ def main(): discadj_cylinder3D.cfg_dir = "disc_adj_euler/cylinder3D" discadj_cylinder3D.cfg_file = "inv_cylinder3D.cfg" discadj_cylinder3D.test_iter = 5 - discadj_cylinder3D.test_vals = [-3.765584, -3.720278, -0.000000, 0.000000] + discadj_cylinder3D.test_vals = [-3.764562, -3.719982, -0.000000, 0.000000] test_list.append(discadj_cylinder3D) # Arina nozzle 2D @@ -66,7 +66,7 @@ def main(): discadj_arina2k.cfg_dir = "disc_adj_euler/arina2k" discadj_arina2k.cfg_file = "Arina2KRS.cfg" discadj_arina2k.test_iter = 20 - discadj_arina2k.test_vals = [-3.498083, -3.736791, 0.026277, 0.000000] + discadj_arina2k.test_vals = [-3.534954, -3.773310, 0.027244, 0.000000] test_list.append(discadj_arina2k) #################################### @@ -98,7 +98,7 @@ def main(): discadj_incomp_NACA0012.cfg_dir = "disc_adj_incomp_euler/naca0012" discadj_incomp_NACA0012.cfg_file = "incomp_NACA0012_disc.cfg" discadj_incomp_NACA0012.test_iter = 20 - discadj_incomp_NACA0012.test_vals = [20.000000, -4.088910, -2.654830, 0.000000] + discadj_incomp_NACA0012.test_vals = [20.000000, -4.087948, -2.655204, 0.000000] test_list.append(discadj_incomp_NACA0012) ##################################### @@ -185,7 +185,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.220701, -1.647361, -0.007528, 0.000013] + discadj_pitchingNACA0012.test_vals = [-1.221198, -1.647772, -0.007510, 0.000013] discadj_pitchingNACA0012.unsteady = True discadj_pitchingNACA0012.enabled_with_tsan = False test_list.append(discadj_pitchingNACA0012) @@ -253,7 +253,7 @@ def main(): pywrapper_CFD_AD_MeshDisp.cfg_dir = "py_wrapper/disc_adj_flow/mesh_disp_sens" pywrapper_CFD_AD_MeshDisp.cfg_file = "configAD_flow.cfg" pywrapper_CFD_AD_MeshDisp.test_iter = 1000 - pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.499079, 1.440068, 0.000000] #last 4 columns + pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.505396, 1.403846, 0.000000] pywrapper_CFD_AD_MeshDisp.test_vals_aarch64 = [30.000000, -2.499079, 1.440068, 0.000000] pywrapper_CFD_AD_MeshDisp.command = TestCase.Command(exec = "python", param = "run_adjoint.py --parallel -f") pywrapper_CFD_AD_MeshDisp.timeout = 1600 diff --git a/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg b/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg index 456ca08e23e..300dd64a5b5 100644 --- a/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg +++ b/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg @@ -43,7 +43,7 @@ MARKER_MONITORING= ( airfoil ) % ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% % NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 100.0 +CFL_NUMBER= 200.0 CFL_ADAPT= NO CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) @@ -51,13 +51,13 @@ ITER= 9999 % -------------------------- MULTIGRID PARAMETERS -----------------------------% % -MGLEVEL= 2 +MGLEVEL= 3 MGCYCLE= W_CYCLE MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) MG_POST_SMOOTH= ( 1, 1, 1, 1 ) MG_CORRECTION_SMOOTH= ( 1, 1, 1, 1 ) -MG_DAMP_RESTRICTION= 0.85 -MG_DAMP_PROLONGATION= 0.85 +MG_DAMP_RESTRICTION= 0.9 +MG_DAMP_PROLONGATION= 0.9 % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % diff --git a/TestCases/incomp_euler/nozzle/inv_nozzle.cfg b/TestCases/incomp_euler/nozzle/inv_nozzle.cfg index f67f3f69e4c..9633d08fba5 100644 --- a/TestCases/incomp_euler/nozzle/inv_nozzle.cfg +++ b/TestCases/incomp_euler/nozzle/inv_nozzle.cfg @@ -46,7 +46,7 @@ MARKER_ANALYZE_AVERAGE = AREA % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 25 +CFL_NUMBER= 500 % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% % diff --git a/TestCases/navierstokes/flatplate/lam_flatplate.cfg b/TestCases/navierstokes/flatplate/lam_flatplate.cfg index 09172e6c7d0..abcee420143 100644 --- a/TestCases/navierstokes/flatplate/lam_flatplate.cfg +++ b/TestCases/navierstokes/flatplate/lam_flatplate.cfg @@ -46,7 +46,7 @@ MARKER_ANALYZE= (inlet, outlet) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 4000 +CFL_NUMBER= 10000 CFL_ADAPT= NO % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% @@ -63,8 +63,8 @@ MGCYCLE= V_CYCLE MG_PRE_SMOOTH= ( 1, 2, 3, 1 ) MG_POST_SMOOTH= ( 1, 1, 1, 0 ) MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) -MG_DAMP_RESTRICTION= 0.7 -MG_DAMP_PROLONGATION= 0.7 +MG_DAMP_RESTRICTION= 0.8 +MG_DAMP_PROLONGATION= 0.8 % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % diff --git a/TestCases/nicf/edge/edge_PPR.cfg b/TestCases/nicf/edge/edge_PPR.cfg index d9a5707b1e3..95b3c6cc969 100644 --- a/TestCases/nicf/edge/edge_PPR.cfg +++ b/TestCases/nicf/edge/edge_PPR.cfg @@ -50,9 +50,9 @@ MARKER_MONITORING= ( WALL1 ) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 0.01 +CFL_NUMBER= 1 CFL_ADAPT= YES -CFL_ADAPT_PARAM= ( 0.9, 1.1, 0.01, 100.0 ) +CFL_ADAPT_PARAM= ( 0.9, 1.1, 1.0, 200.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) ITER= 500 @@ -65,8 +65,8 @@ LINEAR_SOLVER_ITER= 10 % -------------------------- MULTIGRID PARAMETERS -----------------------------% % -MGLEVEL= 2 -MGCYCLE= V_CYCLE +MGLEVEL= 3 +MGCYCLE= W_CYCLE MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) MG_POST_SMOOTH= ( 0, 0, 0, 0 ) MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 003e18d969f..1614b3331ed 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -65,7 +65,7 @@ def main(): cfd_flamelet_ch4_partial_premix.cfg_dir = "flamelet/06_laminar_partial_premixed_ch4_flame_cfd" cfd_flamelet_ch4_partial_premix.cfg_file = "lam_partial_prem_ch4_cfd.cfg" cfd_flamelet_ch4_partial_premix.test_iter = 10 - cfd_flamelet_ch4_partial_premix.test_vals = [-9.616159, -11.304005, -3.674974, -13.158350, -11.087896] + cfd_flamelet_ch4_partial_premix.test_vals = [-9.641526, -11.303947, -3.675920, -13.158386, -11.087893] cfd_flamelet_ch4_partial_premix.new_output = True test_list.append(cfd_flamelet_ch4_partial_premix) @@ -220,7 +220,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 20 - channel.test_vals = [-2.741010, 2.728838, 0.037995, 0.007932] + channel.test_vals = [-2.741060, 2.728759, 0.037973, 0.007932] test_list.append(channel) # NACA0012 @@ -228,7 +228,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-4.546535, -4.056352, 0.321419, 0.023471] + naca0012.test_vals = [-4.492453, -3.984774, 0.313405, 0.022911] test_list.append(naca0012) # Supersonic wedge @@ -236,7 +236,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-0.969507, 4.756553, -0.212992, 0.037562] + wedge.test_vals = [-0.960148, 4.767710, -0.212522, 0.037479] test_list.append(wedge) # ONERA M6 Wing @@ -253,7 +253,7 @@ def main(): fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" fixedCL_naca0012.cfg_file = "inv_NACA0012.cfg" fixedCL_naca0012.test_iter = 10 - fixedCL_naca0012.test_vals = [-3.848065, 1.685467, 0.301124, 0.019487] + fixedCL_naca0012.test_vals = [-3.770457, 1.761954, 0.299675, 0.019365] test_list.append(fixedCL_naca0012) # Polar sweep of the inviscid NACA0012 @@ -262,7 +262,7 @@ def main(): polar_naca0012.cfg_file = "inv_NACA0012.cfg" polar_naca0012.polar = True polar_naca0012.test_iter = 10 - polar_naca0012.test_vals = [-1.083394, 4.386134, 0.001588, 0.033513] + polar_naca0012.test_vals = [-1.549821, 3.877926, 0.000072, 0.010125] polar_naca0012.test_vals_aarch64 = [-1.083394, 4.386134, 0.001588, 0.033513] polar_naca0012.command = TestCase.Command(exec = "compute_polar.py", param = "-i 11") # flaky test on arm64 @@ -274,7 +274,7 @@ def main(): bluntbody.cfg_dir = "euler/bluntbody" bluntbody.cfg_file = "blunt.cfg" bluntbody.test_iter = 20 - bluntbody.test_vals = [0.581950, 6.955500, 0.000000, 1.757414] + bluntbody.test_vals = [0.585420, 6.959408, 0.000000, 1.790747] test_list.append(bluntbody) # Equivalent area NACA64-206 @@ -282,7 +282,7 @@ def main(): ea_naca64206.cfg_dir = "optimization_euler/equivalentarea_naca64206" ea_naca64206.cfg_file = "NACA64206.cfg" ea_naca64206.test_iter = 10 - ea_naca64206.test_vals = [-1.114938, -0.436978, -0.002475, 67775.000000] + ea_naca64206.test_vals = [-1.150939, -0.455629, -0.003834, 67775.000000] test_list.append(ea_naca64206) # SUPERSONIC FLOW PAST A RAMP IN A CHANNEL diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 87fe3a4605a..d870ad2efe4 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -47,7 +47,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.563782, -8.924462, -0.000000, 0.005520] + discadj_naca0012.test_vals = [-3.560692, -8.925239, -0.000000, 0.005559] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) @@ -55,7 +55,7 @@ def main(): discadj_cylinder3D.cfg_dir = "disc_adj_euler/cylinder3D" discadj_cylinder3D.cfg_file = "inv_cylinder3D.cfg" discadj_cylinder3D.test_iter = 5 - discadj_cylinder3D.test_vals = [-3.815372, -3.772484, 0.000000, 0.000000] + discadj_cylinder3D.test_vals = [-3.768909, -3.725727, 0.000000, 0.000000] test_list.append(discadj_cylinder3D) # Arina nozzle 2D @@ -63,7 +63,7 @@ def main(): discadj_arina2k.cfg_dir = "disc_adj_euler/arina2k" discadj_arina2k.cfg_file = "Arina2KRS.cfg" discadj_arina2k.test_iter = 20 - discadj_arina2k.test_vals = [-3.258794, -3.542983, 0.056941, 0.000000] + discadj_arina2k.test_vals = [-3.540396, -3.828299, 0.027959, 0.000000] test_list.append(discadj_arina2k) # Equivalent area NACA64-206 @@ -71,7 +71,7 @@ def main(): ea_naca64206.cfg_dir = "optimization_euler/equivalentarea_naca64206" ea_naca64206.cfg_file = "NACA64206.cfg" ea_naca64206.test_iter = 10 - ea_naca64206.test_vals = [3.178974, 2.469137, -5469000.000000, 5.525100] + ea_naca64206.test_vals = [3.182290, 2.473505, -5513300.000000, 5.483900] test_list.append(ea_naca64206) #################################### @@ -104,7 +104,7 @@ def main(): discadj_incomp_NACA0012.cfg_dir = "disc_adj_incomp_euler/naca0012" discadj_incomp_NACA0012.cfg_file = "incomp_NACA0012_disc.cfg" discadj_incomp_NACA0012.test_iter = 20 - discadj_incomp_NACA0012.test_vals = [20.000000, -4.089055, -2.680890, 0.000000] + discadj_incomp_NACA0012.test_vals = [20.000000, -4.093433, -2.686134, 0.000000] test_list.append(discadj_incomp_NACA0012) ##################################### @@ -150,7 +150,7 @@ def main(): discadj_axisymmetric_rans_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle" discadj_axisymmetric_rans_nozzle.cfg_file = "air_nozzle_restart.cfg" discadj_axisymmetric_rans_nozzle.test_iter = 10 - discadj_axisymmetric_rans_nozzle.test_vals = [9.558083, 4.972144, 7.373955, 2.749238] + discadj_axisymmetric_rans_nozzle.test_vals = [9.508489, 5.086848, 7.377942, 2.753320] discadj_axisymmetric_rans_nozzle.no_restart = True test_list.append(discadj_axisymmetric_rans_nozzle) @@ -217,7 +217,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.224169, -1.645870, -0.007583, 0.000013] + discadj_pitchingNACA0012.test_vals = [-1.227073, -1.648410, -0.007541, 0.000012] discadj_pitchingNACA0012.unsteady = True test_list.append(discadj_pitchingNACA0012) @@ -256,7 +256,7 @@ def main(): discadj_heat.cfg_dir = "disc_adj_heat" discadj_heat.cfg_file = "disc_adj_heat.cfg" discadj_heat.test_iter = 10 - discadj_heat.test_vals = [-2.191005, 0.673809, 0.000000, -1.459900] + discadj_heat.test_vals = [-2.117979, 0.783623, 0.000000, -0.575210] discadj_heat.test_vals_aarch64 = [-2.226539, 0.605868, 0.000000, -6.256400] test_list.append(discadj_heat) @@ -299,7 +299,7 @@ def main(): da_sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" da_sp_pinArray_cht_2d_dp_hf.cfg_file = "DA_configMaster.cfg" da_sp_pinArray_cht_2d_dp_hf.test_iter = 100 - da_sp_pinArray_cht_2d_dp_hf.test_vals = [-4.714704, -4.059485, -4.138393] + da_sp_pinArray_cht_2d_dp_hf.test_vals = [-4.706855, -4.062651, -4.137373] da_sp_pinArray_cht_2d_dp_hf.multizone = True test_list.append(da_sp_pinArray_cht_2d_dp_hf) @@ -308,7 +308,7 @@ def main(): da_sp_pinArray_cht_2d_mf.cfg_dir = "incomp_navierstokes/streamwise_periodic/dp-adjoint_chtPinArray_2d" da_sp_pinArray_cht_2d_mf.cfg_file = "configMaster.cfg" da_sp_pinArray_cht_2d_mf.test_iter = 100 - da_sp_pinArray_cht_2d_mf.test_vals = [-4.590241, -1.298039, -1.483182, -18.504193, -0.870844, -5.769486, -19.069564, -47.958462] + da_sp_pinArray_cht_2d_mf.test_vals = [-4.600060, -1.298170, -1.427707, -18.503399, -0.869869, -5.768763, -19.069544, -47.953239] da_sp_pinArray_cht_2d_mf.multizone = True test_list.append(da_sp_pinArray_cht_2d_mf) @@ -511,7 +511,7 @@ def main(): pywrapper_CFD_AD_MeshDisp.cfg_dir = "py_wrapper/disc_adj_flow/mesh_disp_sens" pywrapper_CFD_AD_MeshDisp.cfg_file = "configAD_flow.cfg" pywrapper_CFD_AD_MeshDisp.test_iter = 1000 - pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.498932, 1.442486, 0.000000] #last 4 columns + pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.506016, 1.407249, 0.000000] pywrapper_CFD_AD_MeshDisp.command = TestCase.Command("mpirun -n 2", "python", "run_adjoint.py --parallel -f") pywrapper_CFD_AD_MeshDisp.timeout = 1600 pywrapper_CFD_AD_MeshDisp.tol = 0.000001 diff --git a/TestCases/rotating/naca0012/rot_NACA0012.cfg b/TestCases/rotating/naca0012/rot_NACA0012.cfg index a103c5fbcf6..35c932c33b5 100644 --- a/TestCases/rotating/naca0012/rot_NACA0012.cfg +++ b/TestCases/rotating/naca0012/rot_NACA0012.cfg @@ -131,7 +131,7 @@ VOLUME_ADJ_FILENAME= adjoint GRAD_OBJFUNC_FILENAME= of_grad.dat SURFACE_FILENAME= surface_flow SURFACE_ADJ_FILENAME= surface_adjoint -OUTPUT_WRT_FREQ= 1 +OUTPUT_WRT_FREQ= 100 % --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% % diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 75c6bfe43ad..75687b47447 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -93,7 +93,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 10 - channel.test_vals = [-2.559747, 2.953478, -0.072659, 0.021260] + channel.test_vals = [-2.559117, 2.953998, -0.072585, 0.021255] test_list.append(channel) # NACA0012 @@ -101,7 +101,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-4.522897, -4.048118, 0.317967, 0.023046] + naca0012.test_vals = [-4.470098, -3.976707, 0.309587, 0.022496] test_list.append(naca0012) # Supersonic wedge @@ -109,7 +109,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-0.970990, 4.753109, -0.212841, 0.037538] + wedge.test_vals = [-0.961556, 4.764320, -0.212289, 0.037442] test_list.append(wedge) # ONERA M6 Wing @@ -135,7 +135,7 @@ def main(): polar_naca0012.cfg_file = "inv_NACA0012.cfg" polar_naca0012.polar = True polar_naca0012.test_iter = 10 - polar_naca0012.test_vals = [-1.063447, 4.401847, 0.000291, 0.031696] + polar_naca0012.test_vals = [-1.407926, 4.024043, 0.001167, 0.004465] polar_naca0012.test_vals_aarch64 = [-1.063447, 4.401847, 0.000291, 0.031696] polar_naca0012.command = TestCase.Command(exec = "compute_polar.py", param = "-n 1 -i 11") # flaky test on arm64 @@ -165,7 +165,7 @@ def main(): flatplate = TestCase('flatplate') flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" - flatplate.test_iter = 100 + flatplate.test_iter = 20 flatplate.test_vals = [-9.239265, -3.771626, 0.001085, 0.036281, 2.361500, -2.325300, -1.810500, -1.810500] test_list.append(flatplate) @@ -242,7 +242,7 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-4.156817, -6.736063, -0.176192, 0.057478] + turb_flatplate.test_vals = [-4.156102, -6.736064, -0.176184, 0.057478] test_list.append(turb_flatplate) # FLAT PLATE, WALL FUNCTIONS, COMPRESSIBLE SST @@ -250,7 +250,7 @@ def main(): turb_wallfunction_flatplate_sst.cfg_dir = "wallfunctions/flatplate/compressible_SST" turb_wallfunction_flatplate_sst.cfg_file = "turb_SST_flatplate.cfg" turb_wallfunction_flatplate_sst.test_iter = 10 - turb_wallfunction_flatplate_sst.test_vals = [-4.182760, -1.884285, -1.946696, 1.257252, -1.251977, 1.537975, 10.000000, -2.066493, 0.074431, 0.002935] + turb_wallfunction_flatplate_sst.test_vals = [-4.144776, -1.876300, -1.850354, 1.302342, -1.259217, 1.536899, 10.000000, -2.028314, 0.075364, 0.002932] test_list.append(turb_wallfunction_flatplate_sst) # FLAT PLATE, WALL FUNCTIONS, COMPRESSIBLE SA @@ -258,7 +258,7 @@ def main(): turb_wallfunction_flatplate_sa.cfg_dir = "wallfunctions/flatplate/compressible_SA" turb_wallfunction_flatplate_sa.cfg_file = "turb_SA_flatplate.cfg" turb_wallfunction_flatplate_sa.test_iter = 10 - turb_wallfunction_flatplate_sa.test_vals = [-4.361852, -1.994458, -2.149183, 1.075806, -5.387005, 10.000000, -1.759813, 0.069046, 0.002643] + turb_wallfunction_flatplate_sa.test_vals = [-4.139937, -1.945019, -1.836534, 1.328488, -5.388178, 10.000000, -1.746370, 0.068393, 0.002645] test_list.append(turb_wallfunction_flatplate_sa) # ONERA M6 Wing @@ -266,7 +266,7 @@ def main(): turb_oneram6.cfg_dir = "rans/oneram6" turb_oneram6.cfg_file = "turb_ONERAM6.cfg" turb_oneram6.test_iter = 10 - turb_oneram6.test_vals = [-2.392611, -6.689654, 0.230566, 0.158760, -33786.000000] + turb_oneram6.test_vals = [-2.392882, -6.689824, 0.230747, 0.158811, -33786.000000] turb_oneram6.timeout = 3200 test_list.append(turb_oneram6) @@ -422,7 +422,7 @@ def main(): inc_lam_bend.cfg_dir = "incomp_navierstokes/bend" inc_lam_bend.cfg_file = "lam_bend.cfg" inc_lam_bend.test_iter = 10 - inc_lam_bend.test_vals = [-3.480202, -3.250417, -0.017527, 1.008144] + inc_lam_bend.test_vals = [-3.442756, -3.144155, -0.019882, 1.032083] test_list.append(inc_lam_bend) ############################ @@ -457,7 +457,7 @@ def main(): inc_turb_wallfunction_flatplate_sst.cfg_dir = "wallfunctions/flatplate/incompressible_SST" inc_turb_wallfunction_flatplate_sst.cfg_file = "turb_SST_flatplate.cfg" inc_turb_wallfunction_flatplate_sst.test_iter = 10 - inc_turb_wallfunction_flatplate_sst.test_vals = [-6.455603, -5.693013, -6.560772, -4.218571, -7.009774, -1.955796, 10.000000, -3.027629, 0.001076, 0.003642, 0.634400] + inc_turb_wallfunction_flatplate_sst.test_vals = [-6.316002, -5.685545, -6.192078, -4.194542, -7.007482, -1.954553, 10.000000, -3.024432, 0.001082, 0.003644, 0.623780] test_list.append(inc_turb_wallfunction_flatplate_sst) # FLAT PLATE, WALL FUNCTIONS, INCOMPRESSIBLE SA @@ -465,7 +465,7 @@ def main(): inc_turb_wallfunction_flatplate_sa.cfg_dir = "wallfunctions/flatplate/incompressible_SA" inc_turb_wallfunction_flatplate_sa.cfg_file = "turb_SA_flatplate.cfg" inc_turb_wallfunction_flatplate_sa.test_iter = 10 - inc_turb_wallfunction_flatplate_sa.test_vals = [-6.469107, -5.710429, -6.540591, -4.219577, -9.586948, 10.000000, -3.045446, 0.000993, 0.003756] + inc_turb_wallfunction_flatplate_sa.test_vals = [-6.329151, -5.702221, -6.190413, -4.196637, -9.586831, 10.000000, -3.025954, 0.000998, 0.003758] test_list.append(inc_turb_wallfunction_flatplate_sa) #################### @@ -558,7 +558,7 @@ def main(): schubauer_klebanoff_transition.cfg_dir = "transition/Schubauer_Klebanoff" schubauer_klebanoff_transition.cfg_file = "transitional_BC_model_ConfigFile.cfg" schubauer_klebanoff_transition.test_iter = 10 - schubauer_klebanoff_transition.test_vals = [-7.957764, -13.240355, 0.000056, 0.007981] + schubauer_klebanoff_transition.test_vals = [-8.087369, -13.241874, 0.000055, 0.007992] test_list.append(schubauer_klebanoff_transition) ##################################### @@ -594,7 +594,7 @@ def main(): contadj_wedge.cfg_dir = "cont_adj_euler/wedge" contadj_wedge.cfg_file = "inv_wedge_ROE.cfg" contadj_wedge.test_iter = 10 - contadj_wedge.test_vals = [2.872064, -2.756210, 1010800.000000, 0.000000] + contadj_wedge.test_vals = [2.872095, -2.756182, 1018000.000000, 0.000000] test_list.append(contadj_wedge) # Inviscid fixed CL NACA0012 @@ -602,7 +602,7 @@ def main(): contadj_fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" contadj_fixedCL_naca0012.cfg_file = "inv_NACA0012_ContAdj.cfg" contadj_fixedCL_naca0012.test_iter = 100 - contadj_fixedCL_naca0012.test_vals = [0.754957, -4.793799, -0.524680, -0.000229] + contadj_fixedCL_naca0012.test_vals = [0.783629, -4.715066, -0.747290, 0.000364] test_list.append(contadj_fixedCL_naca0012) ################################### @@ -725,7 +725,7 @@ def main(): harmonic_balance.cfg_dir = "harmonic_balance" harmonic_balance.cfg_file = "HB.cfg" harmonic_balance.test_iter = 25 - harmonic_balance.test_vals = [-1.567526, 0.815337, 0.928322, 3.947118] + harmonic_balance.test_vals = [-1.554985, 0.831796, 0.935729, 3.960210 test_list.append(harmonic_balance) # Turbulent pitching NACA 64a010 airfoil @@ -745,7 +745,7 @@ def main(): rot_naca0012.cfg_dir = "rotating/naca0012" rot_naca0012.cfg_file = "rot_NACA0012.cfg" rot_naca0012.test_iter = 25 - rot_naca0012.test_vals = [-2.504828, 2.516263, -0.038206, 0.241403] + rot_naca0012.test_vals = [-2.738864, 2.811401, -0.080279, 0.002160] test_list.append(rot_naca0012) # Lid-driven cavity @@ -782,7 +782,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977477, 3.481821, -0.017967, -0.008371] + sine_gust.test_vals = [-1.977514, 3.481817, -0.010465, -0.007859] sine_gust.unsteady = True test_list.append(sine_gust) @@ -791,7 +791,7 @@ def main(): aeroelastic.cfg_dir = "aeroelastic" aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" aeroelastic.test_iter = 2 - aeroelastic.test_vals = [0.074349, 0.027575, -0.001579, -0.000160] + aeroelastic.test_vals = [0.074291, 0.027620, -0.001641, -0.000128] aeroelastic.unsteady = True test_list.append(aeroelastic) @@ -800,7 +800,7 @@ def main(): ddes_flatplate.cfg_dir = "ddes/flatplate" ddes_flatplate.cfg_file = "ddes_flatplate.cfg" ddes_flatplate.test_iter = 10 - ddes_flatplate.test_vals = [-2.714788, -5.882720, -0.215049, 0.023758, -617.450000] + ddes_flatplate.test_vals = [-2.714785, -5.882735, -0.215042, 0.023758, -617.450000] ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) @@ -818,7 +818,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform.cfg" unst_deforming_naca0012.test_iter = 5 - unst_deforming_naca0012.test_vals = [-3.668036, -3.810252, -3.725464, -3.153093] + unst_deforming_naca0012.test_vals = [-3.665187, -3.793258, -3.716457, -3.148323] unst_deforming_naca0012.unsteady = True test_list.append(unst_deforming_naca0012) @@ -839,7 +839,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 20 - edge_VW.test_vals = [-0.840739, 5.361270, -0.001139, 0.000000] + edge_VW.test_vals = [-0.852047, 5.349957, -0.001136, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR @@ -907,7 +907,7 @@ def main(): uniform_flow.cfg_dir = "sliding_interface/uniform_flow" uniform_flow.cfg_file = "uniform_NN.cfg" uniform_flow.test_iter = 2 - uniform_flow.test_vals = [2.000000, 0.000000, -0.227792, -13.249789] + uniform_flow.test_vals = [2.000000, 0.000000, -0.202697, -13.246876] uniform_flow.test_vals_aarch64 = [2.000000, 0.000000, -0.205134, -13.250720] #last 4 columns uniform_flow.tol = 0.000001 uniform_flow.unsteady = True @@ -919,7 +919,7 @@ def main(): channel_2D.cfg_dir = "sliding_interface/channel_2D" channel_2D.cfg_file = "channel_2D_WA.cfg" channel_2D.test_iter = 2 - channel_2D.test_vals = [2.000000, 0.000000, 0.399774, 0.352588, 0.404800] + channel_2D.test_vals = [2.000000, 0.000000, 0.419778, 0.352185, 0.404395] channel_2D.test_vals_aarch64 = [2.000000, 0.000000, 0.398053, 0.352788, 0.405474] #last 5 columns channel_2D.timeout = 100 channel_2D.unsteady = True @@ -931,7 +931,7 @@ def main(): channel_3D.cfg_dir = "sliding_interface/channel_3D" channel_3D.cfg_file = "channel_3D_WA.cfg" channel_3D.test_iter = 1 - channel_3D.test_vals = [1.000000, 0.000000, 0.650336, 0.768240, 0.693527] + channel_3D.test_vals = [1.000000, 0.000000, 0.657678, 0.767752, 0.692208] channel_3D.test_vals_aarch64 = [1.000000, 0.000000, 0.661408, 0.769902, 0.695663] #last 5 columns channel_3D.unsteady = True channel_3D.multizone = True @@ -942,7 +942,7 @@ def main(): pipe.cfg_dir = "sliding_interface/pipe" pipe.cfg_file = "pipe_NN.cfg" pipe.test_iter = 2 - pipe.test_vals = [0.484701, 0.675941, 0.987253, 1.008382] + pipe.test_vals = [0.481390, 0.648695, 0.982990, 1.018349] pipe.unsteady = True pipe.multizone = True test_list.append(pipe) @@ -952,7 +952,7 @@ def main(): rotating_cylinders.cfg_dir = "sliding_interface/rotating_cylinders" rotating_cylinders.cfg_file = "rot_cylinders_WA.cfg" rotating_cylinders.test_iter = 3 - rotating_cylinders.test_vals = [3.000000, 0.000000, 0.718431, 1.111400, 1.155961] + rotating_cylinders.test_vals = [3.000000, 0.000000, 0.719778, 1.111044, 1.154068] rotating_cylinders.unsteady = True rotating_cylinders.multizone = True test_list.append(rotating_cylinders) @@ -962,7 +962,7 @@ def main(): supersonic_vortex_shedding.cfg_dir = "sliding_interface/supersonic_vortex_shedding" supersonic_vortex_shedding.cfg_file = "sup_vor_shed_WA.cfg" supersonic_vortex_shedding.test_iter = 5 - supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.208204, 1.034380] + supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.207949, 1.036092] supersonic_vortex_shedding.unsteady = True supersonic_vortex_shedding.multizone = True test_list.append(supersonic_vortex_shedding) @@ -1040,7 +1040,7 @@ def main(): fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" fsi2d.cfg_file = "configFSI.cfg" fsi2d.test_iter = 4 - fsi2d.test_vals = [4.000000, 0.000000, -3.729692, -4.151488] + fsi2d.test_vals = [4.000000, 0.000000, -3.729228, -4.153949] fsi2d.multizone = True fsi2d.unsteady = True test_list.append(fsi2d) @@ -1050,7 +1050,7 @@ def main(): stat_fsi.cfg_dir = "fea_fsi/stat_fsi" stat_fsi.cfg_file = "config.cfg" stat_fsi.test_iter = 7 - stat_fsi.test_vals = [-3.349405, -4.998915, 0.000000, 6.000000] + stat_fsi.test_vals = [-3.345064, -4.996078, 0.000000, 7.000000] stat_fsi.multizone = True test_list.append(stat_fsi) @@ -1059,7 +1059,7 @@ def main(): stat_fsi_restart.cfg_dir = "fea_fsi/stat_fsi" stat_fsi_restart.cfg_file = "config_restart.cfg" stat_fsi_restart.test_iter = 1 - stat_fsi_restart.test_vals = [-3.395762, -4.286378, 0.000000, 27.000000] + stat_fsi_restart.test_vals = [-3.404628, -4.288921, 0.000000, 27.000000] stat_fsi_restart.multizone = True test_list.append(stat_fsi_restart) @@ -1068,7 +1068,7 @@ def main(): dyn_fsi.cfg_dir = "fea_fsi/dyn_fsi" dyn_fsi.cfg_file = "config.cfg" dyn_fsi.test_iter = 4 - dyn_fsi.test_vals = [-4.332169, -4.057750, 0.000000, 85.000000] + dyn_fsi.test_vals = [-4.330444, -4.058003, 0.000000, 86.000000] dyn_fsi.test_vals_aarch64 = [-4.355809, -4.060588, 0.000000, 86.000000] #last 4 columns dyn_fsi.multizone = True dyn_fsi.unsteady = True @@ -1478,7 +1478,7 @@ def main(): opt_multiobj1surf_py.cfg_dir = "optimization_euler/multiobjective_wedge" opt_multiobj1surf_py.cfg_file = "inv_wedge_ROE_multiobj_1surf.cfg" opt_multiobj1surf_py.test_iter = 1 - opt_multiobj1surf_py.test_vals = [1.000000, 1.000000, 36.215620, 5.286740] + opt_multiobj1surf_py.test_vals = [1.000000, 1.000000, 36.355460, 3.378262] opt_multiobj1surf_py.command = TestCase.Command(exec = "shape_optimization.py", param = "-g CONTINUOUS_ADJOINT -f") opt_multiobj1surf_py.timeout = 1600 opt_multiobj1surf_py.tol = 0.00001 @@ -1491,7 +1491,7 @@ def main(): opt_2surf1obj_py.cfg_dir = "optimization_euler/multiobjective_wedge" opt_2surf1obj_py.cfg_file = "inv_wedge_ROE_2surf_1obj.cfg" opt_2surf1obj_py.test_iter = 1 - opt_2surf1obj_py.test_vals = [1.000000, 1.000000, 2.005211, 0.000439] + opt_2surf1obj_py.test_vals = [1.000000, 1.000000, 2.005517, 0.000280] opt_2surf1obj_py.command = TestCase.Command(exec = "shape_optimization.py", param = "-g CONTINUOUS_ADJOINT -f") opt_2surf1obj_py.timeout = 1600 opt_2surf1obj_py.tol = 0.00001 diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index b1f11e50944..01c5604bfca 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -50,7 +50,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.563782, -8.924462, -0.000000, 0.005520] + discadj_naca0012.test_vals = [-3.560691, -8.925239, -0.000000, 0.005559] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) @@ -58,7 +58,7 @@ def main(): discadj_cylinder3D.cfg_dir = "disc_adj_euler/cylinder3D" discadj_cylinder3D.cfg_file = "inv_cylinder3D.cfg" discadj_cylinder3D.test_iter = 5 - discadj_cylinder3D.test_vals = [-3.817600, -3.773760, -0.000000, 0.000000] + discadj_cylinder3D.test_vals = [-3.771233, -3.727282, -0.000000, 0.000000] test_list.append(discadj_cylinder3D) # Arina nozzle 2D @@ -66,7 +66,7 @@ def main(): discadj_arina2k.cfg_dir = "disc_adj_euler/arina2k" discadj_arina2k.cfg_file = "Arina2KRS.cfg" discadj_arina2k.test_iter = 20 - discadj_arina2k.test_vals = [-3.242098, -3.481371, 0.056338, 0.000000] + discadj_arina2k.test_vals = [-3.534947, -3.773294, 0.027242, 0.000000] test_list.append(discadj_arina2k) ####################################################### @@ -98,7 +98,7 @@ def main(): discadj_incomp_NACA0012.cfg_dir = "disc_adj_incomp_euler/naca0012" discadj_incomp_NACA0012.cfg_file = "incomp_NACA0012_disc.cfg" discadj_incomp_NACA0012.test_iter = 20 - discadj_incomp_NACA0012.test_vals = [20.000000, -4.084633, -2.650488, 0.000000] + discadj_incomp_NACA0012.test_vals = [20.000000, -4.087948, -2.655204, 0.000000] test_list.append(discadj_incomp_NACA0012) ##################################### @@ -148,7 +148,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.217443, -1.644605, -0.007635, 0.000013] + discadj_pitchingNACA0012.test_vals = [-1.220016, -1.646770, -0.007597, 0.000013] discadj_pitchingNACA0012.unsteady = True test_list.append(discadj_pitchingNACA0012) @@ -157,7 +157,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform_ad.cfg" unst_deforming_naca0012.test_iter = 4 - unst_deforming_naca0012.test_vals = [-1.960344, -1.845102, 2781.900000, 0.000004] + unst_deforming_naca0012.test_vals = [-1.959357, -1.843601, 2729.700000, 0.000004] unst_deforming_naca0012.unsteady = True test_list.append(unst_deforming_naca0012) @@ -183,7 +183,7 @@ def main(): discadj_heat.cfg_dir = "disc_adj_heat" discadj_heat.cfg_file = "disc_adj_heat.cfg" discadj_heat.test_iter = 10 - discadj_heat.test_vals = [-2.200172, 0.565096, 0.000000, -2.087800] + discadj_heat.test_vals = [-2.122649, 0.692345, 0.000000, -0.869760] test_list.append(discadj_heat) ################################### @@ -337,7 +337,7 @@ def main(): pywrapper_CFD_AD_MeshDisp.cfg_dir = "py_wrapper/disc_adj_flow/mesh_disp_sens" pywrapper_CFD_AD_MeshDisp.cfg_file = "configAD_flow.cfg" pywrapper_CFD_AD_MeshDisp.test_iter = 1000 - pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.498365, 1.443758, 0.000000] #last 4 columns + pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.505330, 1.409290, 0.000000] pywrapper_CFD_AD_MeshDisp.command = TestCase.Command(exec = "python", param = "run_adjoint.py -f") pywrapper_CFD_AD_MeshDisp.timeout = 1600 pywrapper_CFD_AD_MeshDisp.tol = 0.000001 diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 6e4aec4f6b9..d4762c0d258 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -275,7 +275,7 @@ def main(): tutorial_design_inv_naca0012.cfg_dir = "../Tutorials/design/Inviscid_2D_Unconstrained_NACA0012" tutorial_design_inv_naca0012.cfg_file = "inv_NACA0012_basic.cfg" tutorial_design_inv_naca0012.test_iter = 0 - tutorial_design_inv_naca0012.test_vals = [-3.585391, -3.332494, 0.134725, 0.204369] + tutorial_design_inv_naca0012.test_vals = [-3.918503, -3.332494, 0.134359, 0.218097] tutorial_design_inv_naca0012.no_restart = True test_list.append(tutorial_design_inv_naca0012) diff --git a/TestCases/vandv.py b/TestCases/vandv.py index fda2a589a74..06c74d893f8 100644 --- a/TestCases/vandv.py +++ b/TestCases/vandv.py @@ -54,7 +54,7 @@ def main(): flatplate_sst1994m.cfg_dir = "vandv/rans/flatplate" flatplate_sst1994m.cfg_file = "turb_flatplate_sst.cfg" flatplate_sst1994m.test_iter = 5 - flatplate_sst1994m.test_vals = [-13.026767, -10.276424, -11.302313, -8.131872, -10.520174, -5.127374, 0.002775] + flatplate_sst1994m.test_vals = [-13.027926, -10.276119, -11.311717, -8.137517, -10.520065, -5.127385, 0.002775] flatplate_sst1994m.test_vals_aarch64 = [-13.028095, -11.271115, -11.532461, -8.387610, -11.417974, -5.116988, 0.002808] test_list.append(flatplate_sst1994m) @@ -63,7 +63,7 @@ def main(): bump_sst1994m.cfg_dir = "vandv/rans/bump_in_channel" bump_sst1994m.cfg_file = "turb_bump_sst.cfg" bump_sst1994m.test_iter = 5 - bump_sst1994m.test_vals = [-13.011264, -9.882617, -10.577459, -7.598922, -10.172437, -5.549156, 0.004904] + bump_sst1994m.test_vals = [-13.022054, -9.882710, -10.557148, -7.605034, -10.172437, -5.549948, 0.004904] bump_sst1994m.test_vals_aarch64 = [-13.034665, -10.510699, -10.627802, -7.661320, -10.680337, -5.749566, 0.004972] test_list.append(bump_sst1994m) @@ -94,7 +94,7 @@ def main(): sandiajet_sst.cfg_dir = "vandv/species_transport/sandia_jet" sandiajet_sst.cfg_file = "validation.cfg" sandiajet_sst.test_iter = 5 - sandiajet_sst.test_vals = [-17.136489, -13.518189, -15.465498, -12.021165, -9.661118, -15.289570, 5.000000, -2.744100, 5.000000, -4.836054, 5.000000, -3.965812, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] + sandiajet_sst.test_vals = [-17.169907, -13.518707, -15.442566, -12.021165, -9.660040, -15.289842, 5.000000, -2.746249, 5.000000, -4.836800, 5.000000, -3.966350, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] sandiajet_sst.test_vals_aarch64 = [-17.069026, -13.156800, -15.290567, -11.689831, -9.349978, -14.907311, 5.000000, -2.738947, 5.000000, -4.813747, 5.000000, -3.981740, 0.000259, 0.000000, 0.000000, 0.000259, 4047.400000, 3946.800000, 49.161000, 51.433000] test_list.append(sandiajet_sst) From fa25b76f90b28d51362cfc19a5e00fe505f74c38 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 17 Jun 2024 08:02:22 +0200 Subject: [PATCH 128/194] small update --- TestCases/serial_regression.py | 2 +- TestCases/tutorials.py | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 75687b47447..6023ba415a1 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -725,7 +725,7 @@ def main(): harmonic_balance.cfg_dir = "harmonic_balance" harmonic_balance.cfg_file = "HB.cfg" harmonic_balance.test_iter = 25 - harmonic_balance.test_vals = [-1.554985, 0.831796, 0.935729, 3.960210 + harmonic_balance.test_vals = [-1.554985, 0.831796, 0.935729, 3.960210] test_list.append(harmonic_balance) # Turbulent pitching NACA 64a010 airfoil diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index d4762c0d258..0cca9896d4c 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -71,7 +71,7 @@ def main(): sp_pinArray_2d_mf_hf.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" sp_pinArray_2d_mf_hf.cfg_file = "sp_pinArray_2d_mf_hf.cfg" sp_pinArray_2d_mf_hf.test_iter = 25 - sp_pinArray_2d_mf_hf.test_vals = [-4.554316, 1.527556, -0.746546, 241.772257] + sp_pinArray_2d_mf_hf.test_vals = [-4.553585, 1.528036, -0.748523, 241.672145] test_list.append(sp_pinArray_2d_mf_hf) # 2D pin case pressure drop periodic with heatflux BC and temperature periodicity @@ -79,7 +79,7 @@ def main(): sp_pinArray_2d_dp_hf_tp.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" sp_pinArray_2d_dp_hf_tp.cfg_file = "sp_pinArray_2d_dp_hf_tp.cfg" sp_pinArray_2d_dp_hf_tp.test_iter = 25 - sp_pinArray_2d_dp_hf_tp.test_vals = [-4.577668, 1.492071, -0.704858, 208.023676] + sp_pinArray_2d_dp_hf_tp.test_vals = [-4.570733, 1.503285, -0.706846, 208.023676] test_list.append(sp_pinArray_2d_dp_hf_tp) ### Species Transport @@ -89,7 +89,7 @@ def main(): species3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" species3_primitiveVenturi.cfg_file = "species3_primitiveVenturi.cfg" species3_primitiveVenturi.test_iter = 50 - species3_primitiveVenturi.test_vals = [-5.881995, -5.266239, -5.103460, -5.962606, -1.666781, -6.215600, -6.309526, 5.000000, -0.818218, 5.000000, -2.070867, 5.000000, -0.438404, 1.653246, 0.499867, 0.598308, 0.555071] + species3_primitiveVenturi.test_vals = [-5.869509, -5.252493, -5.127926, -5.912790, -1.767067, -6.152558, -6.304196, 5.000000, -0.933280, 5.000000, -2.314730, 5.000000, -0.680255, 1.649865, 0.500678, 0.596475, 0.552712] test_list.append(species3_primitiveVenturi) # 3 species (2 eq) primitive venturi mixing @@ -97,7 +97,7 @@ def main(): DAspecies3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" DAspecies3_primitiveVenturi.cfg_file = "DAspecies3_primitiveVenturi.cfg" DAspecies3_primitiveVenturi.test_iter = 50 - DAspecies3_primitiveVenturi.test_vals = [-8.135219, -7.384583, -7.573770, -7.218395, -11.802139, -10.966913, -10.192017] + DAspecies3_primitiveVenturi.test_vals = [-7.584508, -7.211527, -6.740742, -6.896386, -11.472089, -10.865347, -10.096770 DAspecies3_primitiveVenturi.test_vals_aarch64 = [-7.865411, -7.548131, -7.347978, -7.217536, -11.822422, -10.968444, -10.193225] DAspecies3_primitiveVenturi.command = TestCase.Command("mpirun -n 2", "SU2_CFD_AD") test_list.append(DAspecies3_primitiveVenturi) @@ -116,7 +116,7 @@ def main(): sudo_tutorial.cfg_dir = "../Tutorials/incompressible_flow/Inc_Turbulent_Bend_Wallfunctions" sudo_tutorial.cfg_file = "sudo.cfg" sudo_tutorial.test_iter = 10 - sudo_tutorial.test_vals = [-14.530162, -13.196430, -13.543569, -12.568202, -13.992006, -10.811607, 15.000000, -2.325681] + sudo_tutorial.test_vals = [-14.579462, -13.203791, -13.601782, -12.616876, -14.005299, -10.817605, 15.000000, -2.296083] sudo_tutorial.command = TestCase.Command("mpirun -n 2", "SU2_CFD") test_list.append(sudo_tutorial) @@ -127,7 +127,7 @@ def main(): premixed_hydrogen.cfg_dir = "../Tutorials/incompressible_flow/Inc_Combustion/1__premixed_hydrogen" premixed_hydrogen.cfg_file = "H2_burner.cfg" premixed_hydrogen.test_iter = 10 - premixed_hydrogen.test_vals = [-9.788006, -10.279292, -11.043104, -4.331539, -11.884939] + premixed_hydrogen.test_vals = [-9.809794, -10.369804, -11.044267, -4.332945, -11.883789] test_list.append(premixed_hydrogen) ### Compressible Flow @@ -137,7 +137,7 @@ def main(): tutorial_inv_bump.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Bump" tutorial_inv_bump.cfg_file = "inv_channel.cfg" tutorial_inv_bump.test_iter = 0 - tutorial_inv_bump.test_vals = [-1.437425, 3.983585, 0.041771, 0.055613] + tutorial_inv_bump.test_vals = [-1.548003, 3.983585, 0.020973, 0.071064] test_list.append(tutorial_inv_bump) # Inviscid Wedge @@ -145,7 +145,7 @@ def main(): tutorial_inv_wedge.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Wedge" tutorial_inv_wedge.cfg_file = "inv_wedge_HLLC.cfg" tutorial_inv_wedge.test_iter = 0 - tutorial_inv_wedge.test_vals = [-0.481460, 4.850246, -0.276518, 0.048670] + tutorial_inv_wedge.test_vals = [-0.864206, 4.850246, -0.259185, 0.045567] tutorial_inv_wedge.no_restart = True test_list.append(tutorial_inv_wedge) @@ -154,7 +154,7 @@ def main(): tutorial_inv_onera.cfg_dir = "../Tutorials/compressible_flow/Inviscid_ONERAM6" tutorial_inv_onera.cfg_file = "inv_ONERAM6.cfg" tutorial_inv_onera.test_iter = 0 - tutorial_inv_onera.test_vals = [-5.204928, -4.895776, 0.238992, 0.105223] + tutorial_inv_onera.test_vals = [-5.504789, -4.895776, 0.249157, 0.118834] tutorial_inv_onera.no_restart = True test_list.append(tutorial_inv_onera) @@ -199,7 +199,7 @@ def main(): tutorial_trans_flatplate_T3A.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A" tutorial_trans_flatplate_T3A.cfg_file = "transitional_LM_model_ConfigFile.cfg" tutorial_trans_flatplate_T3A.test_iter = 20 - tutorial_trans_flatplate_T3A.test_vals = [-5.837340, -2.092244, -3.983527, -0.302296, -1.921023, 1.667165, -3.496279, 0.391601] + tutorial_trans_flatplate_T3A.test_vals = [-5.837399, -2.092246, -3.983493, -0.302381, -1.920868, 1.667180, -3.496278, 0.391608] tutorial_trans_flatplate_T3A.test_vals_aarch64 = [-5.837368, -2.092246, -3.984172, -0.302357, -1.928108, 1.667157, -3.496279, 0.391610] tutorial_trans_flatplate_T3A.no_restart = True test_list.append(tutorial_trans_flatplate_T3A) @@ -209,7 +209,7 @@ def main(): tutorial_trans_flatplate_T3Am.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A-" tutorial_trans_flatplate_T3Am.cfg_file = "transitional_LM_model_ConfigFile.cfg" tutorial_trans_flatplate_T3Am.test_iter = 20 - tutorial_trans_flatplate_T3Am.test_vals = [-6.063716, -1.945087, -3.946836, -0.549162, -3.863794, 2.664442, -2.517598, 1.112979] + tutorial_trans_flatplate_T3Am.test_vals = [-6.063700, -1.945073, -3.946836, -0.549147, -3.863792, 2.664440, -2.517610, 1.112977] tutorial_trans_flatplate_T3Am.test_vals_aarch64 = [-6.063726, -1.945088, -3.946923, -0.549166, -3.863794, 2.664439, -2.517601, 1.112978] tutorial_trans_flatplate_T3Am.no_restart = True test_list.append(tutorial_trans_flatplate_T3Am) @@ -245,7 +245,7 @@ def main(): tutorial_nicfd_nozzle.cfg_dir = "../Tutorials/compressible_flow/NICFD_nozzle" tutorial_nicfd_nozzle.cfg_file = "NICFD_nozzle.cfg" tutorial_nicfd_nozzle.test_iter = 20 - tutorial_nicfd_nozzle.test_vals = [-2.217601, -2.321330, 3.694830, 0.000000, 0.000000] + tutorial_nicfd_nozzle.test_vals = [-1.847208, -2.303300, 3.803912, 0.000000, 0.000000] tutorial_nicfd_nozzle.no_restart = True test_list.append(tutorial_nicfd_nozzle) From d7818a131b464cc8923ad598049cac0cd902a9e3 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 17 Jun 2024 10:01:15 +0200 Subject: [PATCH 129/194] small update --- TestCases/tutorials.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 0cca9896d4c..01ec8a702e2 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -97,7 +97,7 @@ def main(): DAspecies3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" DAspecies3_primitiveVenturi.cfg_file = "DAspecies3_primitiveVenturi.cfg" DAspecies3_primitiveVenturi.test_iter = 50 - DAspecies3_primitiveVenturi.test_vals = [-7.584508, -7.211527, -6.740742, -6.896386, -11.472089, -10.865347, -10.096770 + DAspecies3_primitiveVenturi.test_vals = [-7.584508, -7.211527, -6.740742, -6.896386, -11.472089, -10.865347, -10.096770] DAspecies3_primitiveVenturi.test_vals_aarch64 = [-7.865411, -7.548131, -7.347978, -7.217536, -11.822422, -10.968444, -10.193225] DAspecies3_primitiveVenturi.command = TestCase.Command("mpirun -n 2", "SU2_CFD_AD") test_list.append(DAspecies3_primitiveVenturi) From 50e97c8183c29c102ef88b9d156bf10ea98c0dd8 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 17 Jun 2024 11:23:31 +0200 Subject: [PATCH 130/194] small update --- TestCases/navierstokes/flatplate/lam_flatplate.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/navierstokes/flatplate/lam_flatplate.cfg b/TestCases/navierstokes/flatplate/lam_flatplate.cfg index abcee420143..75541961acc 100644 --- a/TestCases/navierstokes/flatplate/lam_flatplate.cfg +++ b/TestCases/navierstokes/flatplate/lam_flatplate.cfg @@ -46,7 +46,7 @@ MARKER_ANALYZE= (inlet, outlet) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 10000 +CFL_NUMBER= 1000 CFL_ADAPT= NO % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% @@ -60,7 +60,7 @@ LINEAR_SOLVER_ITER= 3 % MGLEVEL= 3 MGCYCLE= V_CYCLE -MG_PRE_SMOOTH= ( 1, 2, 3, 1 ) +MG_PRE_SMOOTH= ( 1, 2, 3, 0 ) MG_POST_SMOOTH= ( 1, 1, 1, 0 ) MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) MG_DAMP_RESTRICTION= 0.8 From 4b605ca24685f17d741a78ffd974cf67ae807593 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 17 Jun 2024 12:34:20 +0200 Subject: [PATCH 131/194] small update --- .../naca0012/of_grad_cd_disc.dat.ref | 76 +++++++++---------- .../naca0012/of_grad_directdiff.dat.ref | 7 +- TestCases/hybrid_regression.py | 56 +++++++------- .../multiple_ffd/naca0012/of_grad_cd.dat.ref | 4 +- TestCases/nicf/edge/edge_PPR.cfg | 4 +- TestCases/serial_regression.py | 30 ++++---- 6 files changed, 89 insertions(+), 88 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref index c964ebdc5a8..7d8073f94be 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -11784.5 , 0.001 - 1 , -20498.0 , 0.001 - 2 , -26411.1 , 0.001 - 3 , -28542.9 , 0.001 - 4 , -26959.4 , 0.001 - 5 , -22178.8 , 0.001 - 6 , -14933.5 , 0.001 - 7 , -5954.65 , 0.001 - 8 , 4138.42 , 0.001 - 9 , 14769.0 , 0.001 - 10 , 25158.8 , 0.001 - 11 , 34023.1 , 0.001 - 12 , 39433.0 , 0.001 - 13 , 39180.1 , 0.001 - 14 , 32123.8 , 0.001 - 15 , 21333.1 , 0.001 - 16 , 20106.1 , 0.001 - 17 , 58036.6 , 0.001 - 18 , 82290.7 , 0.001 - 19 , -5788.24 , 0.001 - 20 , -5771.9 , 0.001 - 21 , -7848.48 , 0.001 - 22 , -11044.0 , 0.001 - 23 , -16517.7 , 0.001 - 24 , -25572.0 , 0.001 - 25 , -38637.9 , 0.001 - 26 , -54795.0 , 0.001 - 27 , -71562.6 , 0.001 - 28 , -84908.7 , 0.001 - 29 , -89694.9 , 0.001 - 30 , -81046.3 , 0.001 - 31 , -57113.9 , 0.001 - 32 , -22614.6 , 0.001 - 33 , 10602.4 , 0.001 - 34 , 32935.4 , 0.001 - 35 , 52354.2 , 0.001 - 36 , 70359.3 , 0.001 - 37 , -19353.5 , 0.001 + 0 , -2431.38 , 0.001 + 1 , -6779.34 , 0.001 + 2 , -10706.2 , 0.001 + 3 , -12152.6 , 0.001 + 4 , -10810.4 , 0.001 + 5 , -6991.71 , 0.001 + 6 , -1252.83 , 0.001 + 7 , 5852.21 , 0.001 + 8 , 13872.3 , 0.001 + 9 , 22359.0 , 0.001 + 10 , 30580.0 , 0.001 + 11 , 37174.2 , 0.001 + 12 , 40014.9 , 0.001 + 13 , 36701.9 , 0.001 + 14 , 26346.2 , 0.001 + 15 , 13749.0 , 0.001 + 16 , 17274.3 , 0.001 + 17 , 76626.8 , 0.001 + 18 , 136341.0 , 0.001 + 19 , -17521.7 , 0.001 + 20 , -20152.6 , 0.001 + 21 , -22257.1 , 0.001 + 22 , -24218.7 , 0.001 + 23 , -27807.6 , 0.001 + 24 , -34729.8 , 0.001 + 25 , -45730.3 , 0.001 + 26 , -60127.1 , 0.001 + 27 , -75585.0 , 0.001 + 28 , -88103.6 , 0.001 + 29 , -92454.6 , 0.001 + 30 , -83558.5 , 0.001 + 31 , -59241.6 , 0.001 + 32 , -23717.5 , 0.001 + 33 , 11922.7 , 0.001 + 34 , 38773.8 , 0.001 + 35 , 63557.6 , 0.001 + 36 , 79743.0 , 0.001 + 37 , -43384.6 , 0.001 diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref index b7df4c28157..338204fd026 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref @@ -1,4 +1,5 @@ VARIABLES="VARIABLE" , "DRAG" , "EFFICIENCY" , "FORCE_X" , "FORCE_Y" , "FORCE_Z" , "LIFT" , "MOMENT_X" , "MOMENT_Y" , "MOMENT_Z" , "SIDEFORCE" - 0 , 0.2509197975 , -106.54431 , 0.2854149208 , -1.578151901 , 0.0 , -1.584002637 , 0.0 , 0.0 , 1.183802518 , 0.0 - 1 , 0.4229063213 , -171.6950679 , 0.4757279649 , -2.416168278 , 0.0 , -2.425971246 , 0.0 , 0.0 , 1.021118266 , 0.0 - 2 , 0.5601115716 , -224.4907895 , 0.6281074099 , -3.110095039 , 0.0 , -3.123057011 , 0.0 , 0.0 , 0.613240305 , 0.0 + 0 , 0.2405003164 , -108.3397202 , 0.2752804375 , -1.591326829 , 0.0 , -1.596953347 , 0.0 , 0.0 , 1.18511582 , 0.0 + 1 , 0.4163088272 , -176.5661566 , 0.4692829784 , -2.423229574 , 0.0 , -2.432890265 , 0.0 , 0.0 , 1.020271816 , 0.0 + 2 , 0.5558397416 , -231.7769399 , 0.6239540061 , -3.115569035 , 0.0 , -3.128439099 , 0.0 , 0.0 , 0.6093229584 , 0.0 + diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index eb471eea463..e7fc9ac16e2 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -51,7 +51,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 20 - channel.test_vals = [-2.771553, 2.690545, 0.059193, 0.006637] + channel.test_vals = [-2.965605, 2.459083, 0.016007, 0.042277] test_list.append(channel) # NACA0012 @@ -59,7 +59,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-4.522791, -4.048014, 0.317968, 0.023046] + naca0012.test_vals = [-5.192142, -4.659923, 0.332424, 0.023142] test_list.append(naca0012) # Supersonic wedge @@ -67,7 +67,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-0.970990, 4.753109, -0.212841, 0.037538] + wedge.test_vals = [-1.396962, 4.262003, -0.244219, 0.043052] test_list.append(wedge) # ONERA M6 Wing @@ -83,7 +83,7 @@ def main(): fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" fixedCL_naca0012.cfg_file = "inv_NACA0012.cfg" fixedCL_naca0012.test_iter = 10 - fixedCL_naca0012.test_vals = [-3.903317, 1.629400, 0.301071, 0.019483] + fixedCL_naca0012.test_vals = [-3.905038, 1.628019, 0.301067, 0.019483] test_list.append(fixedCL_naca0012) # HYPERSONIC FLOW PAST BLUNT BODY @@ -91,7 +91,7 @@ def main(): bluntbody.cfg_dir = "euler/bluntbody" bluntbody.cfg_file = "blunt.cfg" bluntbody.test_iter = 20 - bluntbody.test_vals = [0.581952, 6.955503, 0.000020, 1.757430] + bluntbody.test_vals = [0.491773, 6.855541, 0.000298, 1.791791] test_list.append(bluntbody) ########################## @@ -185,7 +185,7 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-4.156816, -6.736063, -0.176192, 0.057478] + turb_flatplate.test_vals = [-4.156102, -6.736064, -0.176184, 0.057478] test_list.append(turb_flatplate) # ONERA M6 Wing @@ -193,7 +193,7 @@ def main(): turb_oneram6.cfg_dir = "rans/oneram6" turb_oneram6.cfg_file = "turb_ONERAM6.cfg" turb_oneram6.test_iter = 10 - turb_oneram6.test_vals = [-2.392607, -6.689653, 0.230565, 0.158760, -33786.000000] + turb_oneram6.test_vals = [-2.392878, -6.689823, 0.230746, 0.158812, -33786.000000] test_list.append(turb_oneram6) # NACA0012 (SA, FUN3D finest grid results: CL=1.0983, CD=0.01242) @@ -255,7 +255,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-12.152920, -6.612685, -9.255147, -4.541279, -2019.700000] + axi_rans_air_nozzle_restart.test_vals = [-12.155864, -6.610272, -9.238247, -4.533012, -2019.700000] test_list.append(axi_rans_air_nozzle_restart) ################################# @@ -329,7 +329,7 @@ def main(): harmonic_balance.cfg_dir = "harmonic_balance" harmonic_balance.cfg_file = "HB.cfg" harmonic_balance.test_iter = 25 - harmonic_balance.test_vals = [-1.567527, 0.815337, 0.928321, 3.947117] + harmonic_balance.test_vals = [-1.554985, 0.831796, 0.935728, 3.960209] test_list.append(harmonic_balance) # Turbulent pitching NACA 64a010 airfoil @@ -349,7 +349,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-6.827464, -5.980287, 0.531769, 0.008475] + inc_euler_naca0012.test_vals = [-7.048661, -6.285973, 0.531969, 0.008467] test_list.append(inc_euler_naca0012) # C-D nozzle with pressure inlet and mass flow outlet @@ -357,7 +357,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-5.624385, -4.988472, -0.000096, 0.137032] + inc_nozzle.test_vals = [-6.273660, -5.510215, -0.000682, 0.126552] inc_nozzle.test_vals_aarch64 = [-5.624385, -4.988472, -0.000096, 0.137032] test_list.append(inc_nozzle) @@ -395,7 +395,7 @@ def main(): inc_lam_bend.cfg_dir = "incomp_navierstokes/bend" inc_lam_bend.cfg_file = "lam_bend.cfg" inc_lam_bend.test_iter = 10 - inc_lam_bend.test_vals = [-3.465319, -3.233960, -0.015705, 0.991726] + inc_lam_bend.test_vals = [-3.427371, -3.115748, -0.020081, 1.026369] inc_lam_bend.test_vals_aarch64 = [-3.437996, -3.086188, -0.015600, 1.142213] test_list.append(inc_lam_bend) @@ -467,7 +467,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977477, 3.481821, -0.017533, -0.008638] + sine_gust.test_vals = [-1.977514, 3.481817, -0.010400, -0.008115] sine_gust.unsteady = True test_list.append(sine_gust) @@ -476,7 +476,7 @@ def main(): cosine_gust.cfg_dir = "gust" cosine_gust.cfg_file = "cosine_gust_zdir.cfg" cosine_gust.test_iter = 79 - cosine_gust.test_vals = [-2.418803, 0.003346, -0.001497, 0.000675, -0.000557] + cosine_gust.test_vals = [-2.418805, 0.002013, -0.001504, 0.000445, -0.000558] cosine_gust.unsteady = True cosine_gust.enabled_with_tsan = False test_list.append(cosine_gust) @@ -486,7 +486,7 @@ def main(): gust_mesh_defo.cfg_dir = "gust" gust_mesh_defo.cfg_file = "gust_with_mesh_deformation.cfg" gust_mesh_defo.test_iter = 6 - gust_mesh_defo.test_vals = [-1.844763, 0.003570, 0.000026] + gust_mesh_defo.test_vals = [-1.844761, 0.001116, -0.000265] gust_mesh_defo.unsteady = True gust_mesh_defo.enabled_with_tsan = False test_list.append(gust_mesh_defo) @@ -496,7 +496,7 @@ def main(): aeroelastic.cfg_dir = "aeroelastic" aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" aeroelastic.test_iter = 2 - aeroelastic.test_vals = [0.074170, 0.027590, -0.001579, -0.000160] + aeroelastic.test_vals = [0.074058, 0.027628, -0.001641, -0.000128] aeroelastic.test_vals_aarch64 = [0.074170, 0.027590, -0.001579, -0.000160] aeroelastic.unsteady = True aeroelastic.enabled_on_cpu_arch = ["x86_64"] # Requires AVX-capable architecture @@ -526,7 +526,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform.cfg" unst_deforming_naca0012.test_iter = 5 - unst_deforming_naca0012.test_vals = [-3.668047, -3.810208, -3.725488, -3.153095] + unst_deforming_naca0012.test_vals = [-3.665202, -3.793253, -3.716498, -3.148334] unst_deforming_naca0012.unsteady = True unst_deforming_naca0012.enabled_with_tsan = False test_list.append(unst_deforming_naca0012) @@ -540,7 +540,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 100 - edge_VW.test_vals = [-7.414583, -1.184125, -0.000009, 0.000000] + edge_VW.test_vals = [-7.060147, -0.888789, -0.000009, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR @@ -591,7 +591,7 @@ def main(): uniform_flow.cfg_dir = "sliding_interface/uniform_flow" uniform_flow.cfg_file = "uniform_NN.cfg" uniform_flow.test_iter = 5 - uniform_flow.test_vals = [5.000000, 0.000000, -0.194599, -10.631539] + uniform_flow.test_vals = [5.000000, 0.000000, -0.185381, -10.631535] uniform_flow.unsteady = True uniform_flow.multizone = True test_list.append(uniform_flow) @@ -601,7 +601,7 @@ def main(): channel_2D.cfg_dir = "sliding_interface/channel_2D" channel_2D.cfg_file = "channel_2D_WA.cfg" channel_2D.test_iter = 2 - channel_2D.test_vals = [2.000000, 0.000000, 0.399764, 0.352564, 0.404770] + channel_2D.test_vals = [2.000000, 0.000000, 0.419762, 0.352170, 0.404385] channel_2D.unsteady = True channel_2D.multizone = True test_list.append(channel_2D) @@ -611,7 +611,7 @@ def main(): channel_3D.cfg_dir = "sliding_interface/channel_3D" channel_3D.cfg_file = "channel_3D_WA.cfg" channel_3D.test_iter = 2 - channel_3D.test_vals = [2.000000, 0.000000, 0.620558, 0.504323, 0.412729] + channel_3D.test_vals = [2.000000, 0.000000, 0.623108, 0.505080, 0.412779] channel_3D.test_vals_aarch64 = [2.000000, 0.000000, 0.620558, 0.504323, 0.412729] channel_3D.unsteady = True channel_3D.multizone = True @@ -623,7 +623,7 @@ def main(): pipe.cfg_dir = "sliding_interface/pipe" pipe.cfg_file = "pipe_NN.cfg" pipe.test_iter = 2 - pipe.test_vals = [0.120770, 0.484697, 0.675943, 0.987258, 1.008392] + pipe.test_vals = [0.116650, 0.481386, 0.648698, 0.982997, 1.018359] pipe.unsteady = True pipe.multizone = True test_list.append(pipe) @@ -633,7 +633,7 @@ def main(): rotating_cylinders.cfg_dir = "sliding_interface/rotating_cylinders" rotating_cylinders.cfg_file = "rot_cylinders_WA.cfg" rotating_cylinders.test_iter = 3 - rotating_cylinders.test_vals = [3.000000, 0.000000, 0.718429, 1.111401, 1.155959] + rotating_cylinders.test_vals = [3.000000, 0.000000, 0.719776, 1.111045, 1.154066] rotating_cylinders.unsteady = True rotating_cylinders.multizone = True test_list.append(rotating_cylinders) @@ -643,7 +643,7 @@ def main(): supersonic_vortex_shedding.cfg_dir = "sliding_interface/supersonic_vortex_shedding" supersonic_vortex_shedding.cfg_file = "sup_vor_shed_WA.cfg" supersonic_vortex_shedding.test_iter = 5 - supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.208203, 1.034371] + supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.207949, 1.036083] supersonic_vortex_shedding.unsteady = True supersonic_vortex_shedding.multizone = True test_list.append(supersonic_vortex_shedding) @@ -694,7 +694,7 @@ def main(): fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" fsi2d.cfg_file = "configFSI.cfg" fsi2d.test_iter = 4 - fsi2d.test_vals = [4.000000, 0.000000, -3.729707, -4.151494] + fsi2d.test_vals = [4.000000, 0.000000, -3.729243, -4.153954] fsi2d.multizone= True fsi2d.unsteady = True fsi2d.enabled_with_tsan = False @@ -705,7 +705,7 @@ def main(): stat_fsi.cfg_dir = "fea_fsi/stat_fsi" stat_fsi.cfg_file = "config.cfg" stat_fsi.test_iter = 7 - stat_fsi.test_vals = [-5.397954, -5.719688, 0.000000, 10.000000] + stat_fsi.test_vals = [-5.425896, -5.797242, 0.000000, 6.000000] stat_fsi.test_vals_aarch64 = [-5.423016, -5.753459, 0.000000, 10.000000] stat_fsi.multizone = True test_list.append(stat_fsi) @@ -715,7 +715,7 @@ def main(): dyn_fsi.cfg_dir = "fea_fsi/dyn_fsi" dyn_fsi.cfg_file = "config.cfg" dyn_fsi.test_iter = 4 - dyn_fsi.test_vals = [-4.332167, -4.057742, 0.000000, 102.000000] + dyn_fsi.test_vals = [-4.330441, -4.057994, 0.000000, 103.000000] dyn_fsi.test_vals_aarch64 = [-4.332167, -4.057742, 0.000000, 102.000000] dyn_fsi.multizone = True dyn_fsi.unsteady = True @@ -726,7 +726,7 @@ def main(): stat_fsi_restart.cfg_dir = "fea_fsi/stat_fsi" stat_fsi_restart.cfg_file = "config_restart.cfg" stat_fsi_restart.test_iter = 1 - stat_fsi_restart.test_vals = [-3.442878, -4.228058, 0.000000, 37.000000] + stat_fsi_restart.test_vals = [-3.463348, -4.232710, 0.000000, 37.000000] stat_fsi_restart.test_vals_aarch64 = [-3.442878, -4.228058, 0.000000, 37.000000] stat_fsi_restart.multizone = True test_list.append(stat_fsi_restart) diff --git a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref index 74bba7bf496..38ca5a50bae 100644 --- a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref +++ b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref @@ -1,3 +1,3 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , 0.0786679 , 0.001 - 1 , -0.117253 , 0.001 + 0 , 0.0779208 , 0.001 + 1 , -0.115959 , 0.001 diff --git a/TestCases/nicf/edge/edge_PPR.cfg b/TestCases/nicf/edge/edge_PPR.cfg index 95b3c6cc969..7e184020037 100644 --- a/TestCases/nicf/edge/edge_PPR.cfg +++ b/TestCases/nicf/edge/edge_PPR.cfg @@ -50,7 +50,7 @@ MARKER_MONITORING= ( WALL1 ) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 1 +CFL_NUMBER= 5 CFL_ADAPT= YES CFL_ADAPT_PARAM= ( 0.9, 1.1, 1.0, 200.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) @@ -105,4 +105,4 @@ GRAD_OBJFUNC_FILENAME= of_grad.dat SURFACE_FILENAME= surface_flow SURFACE_ADJ_FILENAME= surface_adjoint OUTPUT_WRT_FREQ= 250 -SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, LIFT, DRAG, AVG_CFL) +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, LIFT, DRAG) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 6023ba415a1..f387cd264c2 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -93,7 +93,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 10 - channel.test_vals = [-2.559117, 2.953998, -0.072585, 0.021255] + channel.test_vals = [-2.691364, 2.781660, -0.009405, 0.011874] test_list.append(channel) # NACA0012 @@ -101,7 +101,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-4.470098, -3.976707, 0.309587, 0.022496] + naca0012.test_vals = [-5.192432, -4.660174, 0.332428, 0.023142] test_list.append(naca0012) # Supersonic wedge @@ -109,7 +109,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-0.961556, 4.764320, -0.212289, 0.037442] + wedge.test_vals = [-1.396962, 4.262003, -0.244219, 0.043052] test_list.append(wedge) # ONERA M6 Wing @@ -117,7 +117,7 @@ def main(): oneram6.cfg_dir = "euler/oneram6" oneram6.cfg_file = "inv_ONERAM6.cfg" oneram6.test_iter = 10 - oneram6.test_vals = [-10.253956, -9.716810, 0.280800, 0.008623] + oneram6.test_vals = [-11.510606, -10.980023, 0.280800, 0.008623] oneram6.timeout = 9600 test_list.append(oneram6) @@ -126,7 +126,7 @@ def main(): fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" fixedCL_naca0012.cfg_file = "inv_NACA0012.cfg" fixedCL_naca0012.test_iter = 10 - fixedCL_naca0012.test_vals = [-3.845114, 1.691548, 0.301154, 0.019489] + fixedCL_naca0012.test_vals = [-3.848561, 1.688373, 0.301145, 0.019489] test_list.append(fixedCL_naca0012) # Polar sweep of the inviscid NACA0012 @@ -135,7 +135,7 @@ def main(): polar_naca0012.cfg_file = "inv_NACA0012.cfg" polar_naca0012.polar = True polar_naca0012.test_iter = 10 - polar_naca0012.test_vals = [-1.407926, 4.024043, 0.001167, 0.004465] + polar_naca0012.test_vals = [-1.194747, 4.252825, 0.001251, 0.016473] polar_naca0012.test_vals_aarch64 = [-1.063447, 4.401847, 0.000291, 0.031696] polar_naca0012.command = TestCase.Command(exec = "compute_polar.py", param = "-n 1 -i 11") # flaky test on arm64 @@ -147,7 +147,7 @@ def main(): bluntbody.cfg_dir = "euler/bluntbody" bluntbody.cfg_file = "blunt.cfg" bluntbody.test_iter = 20 - bluntbody.test_vals = [0.581950, 6.955500, -0.000000, 1.757414] + bluntbody.test_vals = [0.493297, 6.857373, -0.000026, 1.791394] test_list.append(bluntbody) ########################## @@ -335,7 +335,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-12.151561, -6.611250, -9.182304, -4.504822, -2019.700000] + axi_rans_air_nozzle_restart.test_vals = [-12.151236, -6.605231, -9.187907, -4.514903, -2019.700000] axi_rans_air_nozzle_restart.test_vals_aarch64 = [-12.063354, -7.004772, -8.705740, -4.036824, -2019.800000] axi_rans_air_nozzle_restart.tol = 0.0001 test_list.append(axi_rans_air_nozzle_restart) @@ -371,7 +371,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-6.842195, -5.994731, 0.531783, 0.008474] + inc_euler_naca0012.test_vals = [-7.082058, -6.313934, 0.531975, 0.008467] test_list.append(inc_euler_naca0012) # C-D nozzle with pressure inlet and mass flow outlet @@ -379,7 +379,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-5.624852, -4.988399, -0.000123, 0.137031] + inc_nozzle.test_vals = [-6.252514, -5.497664, 0.005991, 0.126673] test_list.append(inc_nozzle) ############################# @@ -577,7 +577,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-11.283212, -16.846767, -1.056500, 0.019964] + contadj_naca0012.test_vals = [-11.971750, -17.482428, -1.056500, 0.019964] contadj_naca0012.tol = 0.001 test_list.append(contadj_naca0012) @@ -586,7 +586,7 @@ def main(): contadj_oneram6.cfg_dir = "cont_adj_euler/oneram6" contadj_oneram6.cfg_file = "inv_ONERAM6.cfg" contadj_oneram6.test_iter = 10 - contadj_oneram6.test_vals = [-10.847199, -11.349970, -1.086100, 0.007556] + contadj_oneram6.test_vals = [-12.034680, -12.592674, -1.086100, 0.007556] test_list.append(contadj_oneram6) # Inviscid WEDGE: tests averaged outflow total pressure adjoint @@ -594,7 +594,7 @@ def main(): contadj_wedge.cfg_dir = "cont_adj_euler/wedge" contadj_wedge.cfg_file = "inv_wedge_ROE.cfg" contadj_wedge.test_iter = 10 - contadj_wedge.test_vals = [2.872095, -2.756182, 1018000.000000, 0.000000] + contadj_wedge.test_vals = [2.872064, -2.756210, 1010800.000000, 0.000000] test_list.append(contadj_wedge) # Inviscid fixed CL NACA0012 @@ -602,7 +602,7 @@ def main(): contadj_fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" contadj_fixedCL_naca0012.cfg_file = "inv_NACA0012_ContAdj.cfg" contadj_fixedCL_naca0012.test_iter = 100 - contadj_fixedCL_naca0012.test_vals = [0.783629, -4.715066, -0.747290, 0.000364] + contadj_fixedCL_naca0012.test_vals = [0.755070, -4.794630, -0.525290, -0.000238] test_list.append(contadj_fixedCL_naca0012) ################################### @@ -1080,7 +1080,7 @@ def main(): airfoilRBF.cfg_file = "config.cfg" airfoilRBF.test_iter = 1 - airfoilRBF.test_vals = [1.000000, -2.585553, -5.058878] + airfoilRBF.test_vals = [1.000000, -2.581854, -5.085813] airfoilRBF.tol = 0.0001 airfoilRBF.multizone = True test_list.append(airfoilRBF) From 737e653c87c3998e8ae02eaf4747c94f9e3907fb Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 17 Jun 2024 13:05:59 +0200 Subject: [PATCH 132/194] small update --- TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref | 2 +- TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref | 1 - TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref | 2 +- TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref | 4 ++-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref index 7d8073f94be..21bc1b74c28 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref @@ -36,4 +36,4 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" 34 , 38773.8 , 0.001 35 , 63557.6 , 0.001 36 , 79743.0 , 0.001 - 37 , -43384.6 , 0.001 + 37 , -43384.6 , 0.001 diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref index 338204fd026..1b4c963eeac 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref @@ -2,4 +2,3 @@ VARIABLES="VARIABLE" , "DRAG" , "EFFICIENCY" , "FORCE_X" 0 , 0.2405003164 , -108.3397202 , 0.2752804375 , -1.591326829 , 0.0 , -1.596953347 , 0.0 , 0.0 , 1.18511582 , 0.0 1 , 0.4163088272 , -176.5661566 , 0.4692829784 , -2.423229574 , 0.0 , -2.432890265 , 0.0 , 0.0 , 1.020271816 , 0.0 2 , 0.5558397416 , -231.7769399 , 0.6239540061 , -3.115569035 , 0.0 , -3.128439099 , 0.0 , 0.0 , 0.6093229584 , 0.0 - diff --git a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref index 38ca5a50bae..bce05aa9bf6 100644 --- a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref +++ b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref @@ -1,3 +1,3 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" 0 , 0.0779208 , 0.001 - 1 , -0.115959 , 0.001 + 1 , -0.115959 , 0.001 diff --git a/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref b/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref index 4e63d0895fe..74adba36fa1 100644 --- a/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref +++ b/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref @@ -1,3 +1,3 @@ VARIABLES="VARIABLE" , "DRAG" , "EFFICIENCY" , "FORCE_X" , "FORCE_Y" , "FORCE_Z" , "LIFT" , "MOMENT_X" , "MOMENT_Y" , "MOMENT_Z" , "SIDEFORCE" - 0 , 0.0613099408 , -0.6388128098 , 0.05873666295 , 0.1186004687 , 0.0 , 0.1172909114 , 0.0 , 0.0 , 0.009158961247 , 0.0 - 1 , -0.08576129864 , 8.41979213 , -0.09137272102 , 0.2562322995 , 0.0 , 0.2581646086 , 0.0 , 0.0 , 0.004947438045 , 0.0 + 0 , 0.06149476303 , -0.608748249 , 0.05888315926 , 0.1203589365 , 0.0 , 0.119045765 , 0.0 , 0.0 , 0.009719951712 , 0.0 + 1 , -0.08536237383 , 8.303168487 , -0.09097907726 , 0.2564786779 , 0.0 , 0.2584023411 , 0.0 , 0.0 , 0.004460595335 , 0.0 From fd61fca876642eacb3502a1f01793c6e31356fbb Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 17 Jun 2024 13:46:33 +0200 Subject: [PATCH 133/194] small update --- TestCases/hybrid_regression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index e7fc9ac16e2..cf858e80327 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -103,7 +103,7 @@ def main(): flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" flatplate.test_iter = 100 - flatplate.test_vals = [-9.154123, -3.663185, 0.001112, 0.036277, 2.361500, -2.325300, -2.278800, -2.278800] + flatplate.test_vals = [-7.700620, -2.229886, 0.001084, 0.036235, 2.361500, -2.325300, -1.823400, -1.823400] flatplate.test_vals_aarch64 = [-9.154130, -3.663197, 0.001112, 0.036277, 2.361500, -2.325300, -2.278800, -2.278800] test_list.append(flatplate) @@ -547,7 +547,7 @@ def main(): edge_PPR = TestCase('edge_PPR') edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" - edge_PPR.test_iter = 100 + edge_PPR.test_iter = 40 edge_PPR.test_vals = [-8.573595, -2.391849, -0.000034, 0.000000] edge_PPR.test_vals_aarch64 = [-8.573595, -2.391849, -0.000034, 0.000000] test_list.append(edge_PPR) From 3e060e87421712ee569076c316be4cc01c2c1971 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 17 Jun 2024 23:57:49 +0200 Subject: [PATCH 134/194] small update --- TestCases/euler/naca0012/inv_NACA0012_Roe.cfg | 6 +- TestCases/hybrid_regression.py | 2 +- TestCases/nicf/edge/edge_PPR.cfg | 5 +- TestCases/nicf/edge/edge_VW.cfg | 10 +- TestCases/parallel_regression.py | 126 +++++++++--------- TestCases/serial_regression.py | 2 +- .../user_defined_functions/lam_flatplate.cfg | 2 +- 7 files changed, 77 insertions(+), 76 deletions(-) diff --git a/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg b/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg index e06614fb096..087bca16ebc 100644 --- a/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg +++ b/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg @@ -41,7 +41,7 @@ MARKER_MONITORING= ( airfoil ) % ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% % NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -CFL_NUMBER= 50.0 +CFL_NUMBER= 20.0 CFL_ADAPT= NO CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) @@ -57,8 +57,8 @@ MGCYCLE= W_CYCLE MG_PRE_SMOOTH= ( 1, 2, 2, 2 ) MG_POST_SMOOTH= ( 1, 1, 1, 1 ) MG_CORRECTION_SMOOTH= ( 1, 1, 1, 1 ) -MG_DAMP_RESTRICTION= 0.75 -MG_DAMP_PROLONGATION= 0.75 +MG_DAMP_RESTRICTION= 0.80 +MG_DAMP_PROLONGATION= 0.80 % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index cf858e80327..f59a3c9887d 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -548,7 +548,7 @@ def main(): edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" edge_PPR.test_iter = 40 - edge_PPR.test_vals = [-8.573595, -2.391849, -0.000034, 0.000000] + edge_PPR.test_vals = [-10.661994, -4.474297, -0.000034, 0.000000] edge_PPR.test_vals_aarch64 = [-8.573595, -2.391849, -0.000034, 0.000000] test_list.append(edge_PPR) diff --git a/TestCases/nicf/edge/edge_PPR.cfg b/TestCases/nicf/edge/edge_PPR.cfg index 7e184020037..840db81bc7a 100644 --- a/TestCases/nicf/edge/edge_PPR.cfg +++ b/TestCases/nicf/edge/edge_PPR.cfg @@ -10,7 +10,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% -% +% SOLVER= EULER MATH_PROBLEM= DIRECT RESTART_SOL= NO @@ -50,7 +50,7 @@ MARKER_MONITORING= ( WALL1 ) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 5 +CFL_NUMBER= 2.5 CFL_ADAPT= YES CFL_ADAPT_PARAM= ( 0.9, 1.1, 1.0, 200.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) @@ -83,6 +83,7 @@ JST_SENSOR_COEFF= ( 0.5, 0.02 ) TIME_DISCRE_FLOW= EULER_IMPLICIT % --------------------------- CONVERGENCE PARAMETERS --------------------------% +% CONV_RESIDUAL_MINVAL= -12 CONV_STARTITER= 10 CONV_CAUCHY_ELEMS= 100 diff --git a/TestCases/nicf/edge/edge_VW.cfg b/TestCases/nicf/edge/edge_VW.cfg index 2646c8efb40..cb36eb63ea0 100644 --- a/TestCases/nicf/edge/edge_VW.cfg +++ b/TestCases/nicf/edge/edge_VW.cfg @@ -51,9 +51,9 @@ MARKER_MONITORING= ( WALL1 ) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 10 -CFL_ADAPT= NO -CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +CFL_NUMBER= 2.5 +CFL_ADAPT= YES +CFL_ADAPT_PARAM= ( 0.9, 1.1, 1.0, 200.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) ITER= 500 @@ -66,8 +66,8 @@ LINEAR_SOLVER_ITER= 10 % -------------------------- MULTIGRID PARAMETERS -----------------------------% % -MGLEVEL= 2 -MGCYCLE= V_CYCLE +MGLEVEL= 3 +MGCYCLE= W_CYCLE MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) MG_POST_SMOOTH= ( 0, 0, 0, 0 ) MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 1614b3331ed..e442f8c8ab2 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -47,7 +47,7 @@ def main(): cfd_flamelet_ch4.cfg_dir = "flamelet/01_laminar_premixed_ch4_flame_cfd" cfd_flamelet_ch4.cfg_file = "lam_prem_ch4_cfd.cfg" cfd_flamelet_ch4.test_iter = 10 - cfd_flamelet_ch4.test_vals = [-11.296485, -10.063260, -12.148081, -5.024236, -12.791892, -15.558522] + cfd_flamelet_ch4.test_vals = [-13.665072, -12.593885, -14.249600, -6.069756, -14.816937, -17.057821] cfd_flamelet_ch4.new_output = True test_list.append(cfd_flamelet_ch4) @@ -56,7 +56,7 @@ def main(): cfd_flamelet_ch4_axi.cfg_dir = "flamelet/05_laminar_premixed_ch4_flame_cfd_axi" cfd_flamelet_ch4_axi.cfg_file = "lam_prem_ch4_cfd_axi.cfg" cfd_flamelet_ch4_axi.test_iter = 10 - cfd_flamelet_ch4_axi.test_vals = [-10.698747, -12.043414, -11.798367, -12.661449, -6.292390] + cfd_flamelet_ch4_axi.test_vals = [-10.935396, -11.476692, -11.302574, -12.734435, -6.110559] cfd_flamelet_ch4_axi.new_output = True test_list.append(cfd_flamelet_ch4_axi) @@ -74,7 +74,7 @@ def main(): cfd_flamelet_h2.cfg_dir = "flamelet/07_laminar_premixed_h2_flame_cfd" cfd_flamelet_h2.cfg_file = "laminar_premixed_h2_flame_cfd.cfg" cfd_flamelet_h2.test_iter = 5 - cfd_flamelet_h2.test_vals = [-9.980083, -9.843943, -3.290032, -11.338454] + cfd_flamelet_h2.test_vals = [-9.983442, -9.843934, -3.290032, -11.338453] cfd_flamelet_h2.new_output = True test_list.append(cfd_flamelet_h2) @@ -220,7 +220,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 20 - channel.test_vals = [-2.741060, 2.728759, 0.037973, 0.007932] + channel.test_vals = [-2.904385, 2.536048, 0.020906, 0.042348] test_list.append(channel) # NACA0012 @@ -228,7 +228,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-4.492453, -3.984774, 0.313405, 0.022911] + naca0012.test_vals = [-5.216066, -4.672690, 0.332598, 0.023160] test_list.append(naca0012) # Supersonic wedge @@ -236,7 +236,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-0.960148, 4.767710, -0.212522, 0.037479] + wedge.test_vals = [-1.406716, 4.253025, -0.244411, 0.043089] test_list.append(wedge) # ONERA M6 Wing @@ -244,7 +244,7 @@ def main(): oneram6.cfg_dir = "euler/oneram6" oneram6.cfg_file = "inv_ONERAM6.cfg" oneram6.test_iter = 10 - oneram6.test_vals = [-10.256914, -9.720987, 0.280800, 0.008623] + oneram6.test_vals = [-11.512364, -10.982009, 0.280800, 0.008623] oneram6.timeout = 3200 test_list.append(oneram6) @@ -253,7 +253,7 @@ def main(): fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" fixedCL_naca0012.cfg_file = "inv_NACA0012.cfg" fixedCL_naca0012.test_iter = 10 - fixedCL_naca0012.test_vals = [-3.770457, 1.761954, 0.299675, 0.019365] + fixedCL_naca0012.test_vals = [-3.856871, 1.676974, 0.301113, 0.019487] test_list.append(fixedCL_naca0012) # Polar sweep of the inviscid NACA0012 @@ -262,7 +262,7 @@ def main(): polar_naca0012.cfg_file = "inv_NACA0012.cfg" polar_naca0012.polar = True polar_naca0012.test_iter = 10 - polar_naca0012.test_vals = [-1.549821, 3.877926, 0.000072, 0.010125] + polar_naca0012.test_vals = [-1.086730, 4.382703, 0.001762, 0.033013] polar_naca0012.test_vals_aarch64 = [-1.083394, 4.386134, 0.001588, 0.033513] polar_naca0012.command = TestCase.Command(exec = "compute_polar.py", param = "-i 11") # flaky test on arm64 @@ -274,7 +274,7 @@ def main(): bluntbody.cfg_dir = "euler/bluntbody" bluntbody.cfg_file = "blunt.cfg" bluntbody.test_iter = 20 - bluntbody.test_vals = [0.585420, 6.959408, 0.000000, 1.790747] + bluntbody.test_vals = [0.493672, 6.857839, -0.000002, 1.791404] test_list.append(bluntbody) # Equivalent area NACA64-206 @@ -290,7 +290,7 @@ def main(): ramp.cfg_dir = "euler/ramp" ramp.cfg_file = "inv_ramp.cfg" ramp.test_iter = 10 - ramp.test_vals = [-13.652847, -8.018011, -0.076277, 0.054839] + ramp.test_vals = [-13.648478, -8.010936, -0.076277, 0.054839] ramp.test_vals_aarch64 = [-13.398422, -7.786461, -0.081064, 0.056474] test_list.append(ramp) @@ -303,7 +303,7 @@ def main(): flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" flatplate.test_iter = 100 - flatplate.test_vals = [-8.858013, -3.379631, 0.001085, 0.036280, 2.361500, -2.325300, -1.810200, -1.810200] + flatplate.test_vals = [-7.621750, -2.149876, 0.001084, 0.036232, 2.361500, -2.325300, -1.815200, -1.815200] test_list.append(flatplate) # Custom objective function @@ -311,7 +311,7 @@ def main(): flatplate_udobj.cfg_dir = "user_defined_functions" flatplate_udobj.cfg_file = "lam_flatplate.cfg" flatplate_udobj.test_iter = 20 - flatplate_udobj.test_vals = [-6.558447, -1.084109, -1.056374, 0.000656, -0.000765, 0.000425, -0.001190, 597.070000, 300.170000, 296.900000, 23.149000, 0.474530, 37.289000, 2.320400] + flatplate_udobj.test_vals = [-6.547200, -1.073825, -0.772639, 0.000656, -0.000724, 0.000462, -0.001186, 597.060000, 300.130000, 296.930000, 22.704000, 0.506230, 37.280000, 2.347800] test_list.append(flatplate_udobj) # Laminar cylinder (steady) @@ -381,7 +381,7 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-4.147644, -6.728397, -0.176245, 0.057709] + turb_flatplate.test_vals = [-4.146913, -6.728398, -0.176233, 0.057709] test_list.append(turb_flatplate) # Flat plate (compressible) with species inlet @@ -389,7 +389,7 @@ def main(): turb_flatplate_species.cfg_dir = "rans/flatplate" turb_flatplate_species.cfg_file = "turb_SA_flatplate_species.cfg" turb_flatplate_species.test_iter = 20 - turb_flatplate_species.test_vals = [-4.147644, -0.634804, -1.769053, 1.335081, -3.250274, 9.000000, -6.693588, 5.000000, -6.991149, 10.000000, -6.032957, 0.996034, 0.996034] + turb_flatplate_species.test_vals = [-4.146913, -0.634805, -1.769793, 1.335806, -3.250287, 9.000000, -6.695482, 5.000000, -6.991164, 10.000000, -6.033070, 0.996034, 0.996034] test_list.append(turb_flatplate_species) # ONERA M6 Wing @@ -397,7 +397,7 @@ def main(): turb_oneram6.cfg_dir = "rans/oneram6" turb_oneram6.cfg_file = "turb_ONERAM6.cfg" turb_oneram6.test_iter = 10 - turb_oneram6.test_vals = [-2.392609, -6.689653, 0.230566, 0.158760, -33786.000000] + turb_oneram6.test_vals = [-2.392880, -6.689822, 0.230746, 0.158811, -33786.000000] turb_oneram6.timeout = 3200 test_list.append(turb_oneram6) @@ -406,7 +406,7 @@ def main(): turb_oneram6_vc.cfg_dir = "rans/oneram6" turb_oneram6_vc.cfg_file = "turb_ONERAM6_vc.cfg" turb_oneram6_vc.test_iter = 15 - turb_oneram6_vc.test_vals = [-2.265783, -6.627835, 0.228340, 0.142009, -28396.000000] + turb_oneram6_vc.test_vals = [-2.266190, -6.628061, 0.228693, 0.142104, -28397.000000] turb_oneram6_vc.timeout = 3200 test_list.append(turb_oneram6_vc) @@ -415,7 +415,7 @@ def main(): turb_oneram6_nk.cfg_dir = "rans/oneram6" turb_oneram6_nk.cfg_file = "turb_ONERAM6_nk.cfg" turb_oneram6_nk.test_iter = 20 - turb_oneram6_nk.test_vals = [-4.816917, -4.402702, -11.500895, 0.213302, 0.049275, 5.000000, -0.548969, 13.709000] + turb_oneram6_nk.test_vals = [-4.853239, -4.457449, -11.440368, 0.220006, 0.049374, 5.000000, -0.607610, 22.806000] turb_oneram6_nk.timeout = 600 turb_oneram6_nk.tol = 0.0001 test_list.append(turb_oneram6_nk) @@ -514,7 +514,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-12.151264, -6.610825, -9.178079, -4.504737, -2019.700000] + axi_rans_air_nozzle_restart.test_vals = [-12.150457, -6.604319, -9.186421, -4.517442, -2019.700000] axi_rans_air_nozzle_restart.tol = 0.0001 test_list.append(axi_rans_air_nozzle_restart) @@ -542,7 +542,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-6.841054, -5.995001, 0.531798, 0.008474] + inc_euler_naca0012.test_vals = [-7.095661, -6.336732, 0.531986, 0.008466] test_list.append(inc_euler_naca0012) # C-D nozzle with pressure inlet and mass flow outlet @@ -550,7 +550,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-5.625156, -4.969409, -0.000001, 0.136610] + inc_nozzle.test_vals = [-6.235959, -5.472174, -0.001285, 0.126599] test_list.append(inc_nozzle) ############################# @@ -570,7 +570,7 @@ def main(): inc_lam_sphere.cfg_dir = "incomp_navierstokes/sphere" inc_lam_sphere.cfg_file = "sphere.cfg" inc_lam_sphere.test_iter = 5 - inc_lam_sphere.test_vals = [-3.275295, -2.999656, 0.001735, 0.319892] + inc_lam_sphere.test_vals = [-3.260319, -2.663880, 0.001744, 0.327888] test_list.append(inc_lam_sphere) # Buoyancy-driven cavity @@ -594,7 +594,7 @@ def main(): inc_lam_bend.cfg_dir = "incomp_navierstokes/bend" inc_lam_bend.cfg_file = "lam_bend.cfg" inc_lam_bend.test_iter = 10 - inc_lam_bend.test_vals = [-3.472790, -3.244232, -0.018861, 1.002345] + inc_lam_bend.test_vals = [-3.427806, -3.127384, -0.020946, 1.018749] test_list.append(inc_lam_bend) # 3D laminar channnel with 1 cell in flow direction, streamwise periodic @@ -610,7 +610,7 @@ def main(): inc_heatTransfer_BC.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" inc_heatTransfer_BC.cfg_file = "BC_HeatTransfer.cfg" inc_heatTransfer_BC.test_iter = 50 - inc_heatTransfer_BC.test_vals = [-8.183146, -7.600022, -8.052449, -0.092131, -1671.400000] + inc_heatTransfer_BC.test_vals = [-7.495616, -7.036510, -6.758276, 0.598181, -1672.500000] test_list.append(inc_heatTransfer_BC) ############################ @@ -761,7 +761,7 @@ def main(): schubauer_klebanoff_transition.cfg_dir = "transition/Schubauer_Klebanoff" schubauer_klebanoff_transition.cfg_file = "transitional_BC_model_ConfigFile.cfg" schubauer_klebanoff_transition.test_iter = 10 - schubauer_klebanoff_transition.test_vals = [-7.925066, -13.240352, 0.000049, 0.007982] + schubauer_klebanoff_transition.test_vals = [-8.058933, -13.242001, 0.000048, 0.007993] test_list.append(schubauer_klebanoff_transition) ##################################### @@ -773,7 +773,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-11.276936, -16.838537, -1.056500, 0.019964] + contadj_naca0012.test_vals = [-11.956929, -17.470336, -1.056500, 0.019964] test_list.append(contadj_naca0012) # Inviscid ONERA M6 @@ -781,7 +781,7 @@ def main(): contadj_oneram6.cfg_dir = "cont_adj_euler/oneram6" contadj_oneram6.cfg_file = "inv_ONERAM6.cfg" contadj_oneram6.test_iter = 10 - contadj_oneram6.test_vals = [-10.846560, -11.361108, -1.086100, 0.007556] + contadj_oneram6.test_vals = [-12.032190, -12.587083, -1.086100, 0.007556] test_list.append(contadj_oneram6) # Inviscid WEDGE: tests averaged outflow total pressure adjoint @@ -797,7 +797,7 @@ def main(): contadj_fixed_CL_naca0012.cfg_dir = "fixed_cl/naca0012" contadj_fixed_CL_naca0012.cfg_file = "inv_NACA0012_ContAdj.cfg" contadj_fixed_CL_naca0012.test_iter = 100 - contadj_fixed_CL_naca0012.test_vals = [0.748138, -4.810435, -0.520150, -0.000284] + contadj_fixed_CL_naca0012.test_vals = [0.748438, -4.810920, -0.520110, -0.000292] test_list.append(contadj_fixed_CL_naca0012) ################################### @@ -913,7 +913,7 @@ def main(): harmonic_balance.cfg_dir = "harmonic_balance" harmonic_balance.cfg_file = "HB.cfg" harmonic_balance.test_iter = 25 - harmonic_balance.test_vals = [-1.567526, 0.815337, 0.928322, 3.947118] + harmonic_balance.test_vals = [-1.554985, 0.831796, 0.935729, 3.960210] test_list.append(harmonic_balance) # Turbulent pitching NACA 64a010 airfoil @@ -934,7 +934,7 @@ def main(): rot_naca0012.cfg_dir = "rotating/naca0012" rot_naca0012.cfg_file = "rot_NACA0012.cfg" rot_naca0012.test_iter = 25 - rot_naca0012.test_vals = [-2.451409, 2.513129, -0.038116, 0.241393] + rot_naca0012.test_vals = [-2.709459, 2.836670, -0.081188, 0.002156] test_list.append(rot_naca0012) # Lid-driven cavity @@ -971,7 +971,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977477, 3.481821, -0.018110, -0.008453] + sine_gust.test_vals = [-1.977514, 3.481817, -0.010609, -0.007956] sine_gust.unsteady = True test_list.append(sine_gust) @@ -980,7 +980,7 @@ def main(): aeroelastic.cfg_dir = "aeroelastic" aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" aeroelastic.test_iter = 2 - aeroelastic.test_vals = [0.075115, 0.027461, -0.001581, -0.000159] + aeroelastic.test_vals = [0.075176, 0.027496, -0.001643, -0.000126] aeroelastic.unsteady = True test_list.append(aeroelastic) @@ -989,7 +989,7 @@ def main(): ddes_flatplate.cfg_dir = "ddes/flatplate" ddes_flatplate.cfg_file = "ddes_flatplate.cfg" ddes_flatplate.test_iter = 10 - ddes_flatplate.test_vals = [-2.714788, -5.882721, -0.215049, 0.023758, -617.450000] + ddes_flatplate.test_vals = [-2.714785, -5.882734, -0.215042, 0.023758, -617.450000] ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) @@ -1007,7 +1007,7 @@ def main(): flatplate_unsteady.cfg_dir = "navierstokes/flatplate" flatplate_unsteady.cfg_file = "lam_flatplate_unst.cfg" flatplate_unsteady.test_iter = 3 - flatplate_unsteady.test_vals = [0.000008, -8.876477, -8.249899, -6.294137, -5.468911, -3.398657, 0.002075, -0.324332] + flatplate_unsteady.test_vals = [0.000008, -8.876475, -8.249821, -6.294138, -5.468911, -3.398656, 0.002075, -0.324342] flatplate_unsteady.unsteady = True test_list.append(flatplate_unsteady) @@ -1036,7 +1036,7 @@ def main(): coolprop_fluidModel.cfg_dir = "nicf/coolprop" coolprop_fluidModel.cfg_file = "fluidModel.cfg" coolprop_fluidModel.test_iter = 5 - coolprop_fluidModel.test_vals = [-4.400283, -1.582864, 3.442204, 0.000000, 0.000000] + coolprop_fluidModel.test_vals = [-4.360609, -1.582898, 3.442423, 0.000000, 0.000000] coolprop_fluidModel.enabled_on_cpu_arch = ["x86_64"] test_list.append(coolprop_fluidModel) @@ -1045,7 +1045,7 @@ def main(): coolprop_transportModel.cfg_dir = "nicf/coolprop" coolprop_transportModel.cfg_file = "transportModel.cfg" coolprop_transportModel.test_iter = 5 - coolprop_transportModel.test_vals = [-4.403520, -1.314318, 4.630793, 0.000000, 0.000000] + coolprop_transportModel.test_vals = [-4.364142, -1.314350, 4.630876, 0.000000, 0.000000] coolprop_transportModel.enabled_on_cpu_arch = ["x86_64"] test_list.append(coolprop_transportModel) @@ -1054,7 +1054,7 @@ def main(): datadriven_fluidModel.cfg_dir = "nicf/datadriven" datadriven_fluidModel.cfg_file = "datadriven_nozzle.cfg" datadriven_fluidModel.test_iter = 50 - datadriven_fluidModel.test_vals = [-2.758908, -0.094885, 4.434958, 0.000000, 0.000000] + datadriven_fluidModel.test_vals = [-2.633095, 0.155844, 4.690841, 0.000000, 0.000000] test_list.append(datadriven_fluidModel) ###################################### @@ -1105,7 +1105,7 @@ def main(): uniform_flow.cfg_dir = "sliding_interface/uniform_flow" uniform_flow.cfg_file = "uniform_NN.cfg" uniform_flow.test_iter = 5 - uniform_flow.test_vals = [5.000000, 0.000000, -0.194598, -10.631544] + uniform_flow.test_vals = [5.000000, 0.000000, -0.185381, -10.631539] uniform_flow.unsteady = True uniform_flow.multizone = True test_list.append(uniform_flow) @@ -1115,7 +1115,7 @@ def main(): channel_2D.cfg_dir = "sliding_interface/channel_2D" channel_2D.cfg_file = "channel_2D_WA.cfg" channel_2D.test_iter = 2 - channel_2D.test_vals = [2.000000, 0.000000, 0.399787, 0.352581, 0.404785] + channel_2D.test_vals = [2.000000, 0.000000, 0.419792, 0.352177, 0.404446] channel_2D.test_vals_aarch64 = [2.000000, 0.000000, 0.398036, 0.352783, 0.405462] channel_2D.timeout = 100 channel_2D.unsteady = True @@ -1127,7 +1127,7 @@ def main(): channel_3D.cfg_dir = "sliding_interface/channel_3D" channel_3D.cfg_file = "channel_3D_WA.cfg" channel_3D.test_iter = 2 - channel_3D.test_vals = [2.000000, 0.000000, 0.620571, 0.504321, 0.412845] + channel_3D.test_vals = [2.000000, 0.000000, 0.623113, 0.505078, 0.412774] channel_3D.test_vals_aarch64 = [2.000000, 0.000000, 0.620182, 0.505302, 0.415257] channel_3D.unsteady = True channel_3D.multizone = True @@ -1138,7 +1138,7 @@ def main(): pipe.cfg_dir = "sliding_interface/pipe" pipe.cfg_file = "pipe_NN.cfg" pipe.test_iter = 2 - pipe.test_vals = [0.120768, 0.484700, 0.675941, 0.987253, 1.008382] + pipe.test_vals = [0.116649, 0.481389, 0.648696, 0.982990, 1.018349] pipe.unsteady = True pipe.multizone = True test_list.append(pipe) @@ -1148,7 +1148,7 @@ def main(): rotating_cylinders.cfg_dir = "sliding_interface/rotating_cylinders" rotating_cylinders.cfg_file = "rot_cylinders_WA.cfg" rotating_cylinders.test_iter = 3 - rotating_cylinders.test_vals = [3.000000, 0.000000, 0.718429, 1.111400, 1.155964] + rotating_cylinders.test_vals = [3.000000, 0.000000, 0.719777, 1.111044, 1.154071] rotating_cylinders.unsteady = True rotating_cylinders.multizone = True test_list.append(rotating_cylinders) @@ -1158,7 +1158,7 @@ def main(): supersonic_vortex_shedding.cfg_dir = "sliding_interface/supersonic_vortex_shedding" supersonic_vortex_shedding.cfg_file = "sup_vor_shed_WA.cfg" supersonic_vortex_shedding.test_iter = 5 - supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.208203, 1.034377] + supersonic_vortex_shedding.test_vals = [5.000000, 0.000000, 1.207949, 1.036090] supersonic_vortex_shedding.unsteady = True supersonic_vortex_shedding.multizone = True test_list.append(supersonic_vortex_shedding) @@ -1222,7 +1222,7 @@ def main(): fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" fsi2d.cfg_file = "configFSI.cfg" fsi2d.test_iter = 4 - fsi2d.test_vals = [4.000000, 0.000000, -3.729689, -4.151490] + fsi2d.test_vals = [4.000000, 0.000000, -3.729224, -4.153951] fsi2d.command = TestCase.Command(exec = "parallel_computation_fsi.py", param = "-f") fsi2d.multizone= True fsi2d.unsteady = True @@ -1233,7 +1233,7 @@ def main(): stat_fsi.cfg_dir = "fea_fsi/stat_fsi" stat_fsi.cfg_file = "config.cfg" stat_fsi.test_iter = 7 - stat_fsi.test_vals = [-3.317554, -4.965396, 0.000000, 8.000000] + stat_fsi.test_vals = [-3.311842, -4.950580, 0.000000, 8.000000] stat_fsi.multizone = True test_list.append(stat_fsi) @@ -1242,7 +1242,7 @@ def main(): dyn_fsi.cfg_dir = "fea_fsi/dyn_fsi" dyn_fsi.cfg_file = "config.cfg" dyn_fsi.test_iter = 4 - dyn_fsi.test_vals = [-4.332187, -4.057753, 0.000000, 97.000000] + dyn_fsi.test_vals = [-4.330462, -4.058005, 0.000000, 97.000000] dyn_fsi.multizone = True dyn_fsi.unsteady = True test_list.append(dyn_fsi) @@ -1252,7 +1252,7 @@ def main(): stat_fsi_restart.cfg_dir = "fea_fsi/stat_fsi" stat_fsi_restart.cfg_file = "config_restart.cfg" stat_fsi_restart.test_iter = 1 - stat_fsi_restart.test_vals = [-3.426391, -4.246974, 0.000000, 28.000000] + stat_fsi_restart.test_vals = [-3.445617, -4.243213, 0.000000, 28.000000] stat_fsi_restart.multizone = True test_list.append(stat_fsi_restart) @@ -1309,7 +1309,7 @@ def main(): sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" sp_pinArray_cht_2d_dp_hf.cfg_file = "configMaster.cfg" sp_pinArray_cht_2d_dp_hf.test_iter = 100 - sp_pinArray_cht_2d_dp_hf.test_vals = [0.083031, -0.952832, -1.045857, -0.748205, 208.023676, 352.720000, -0.000000, -0.748200, 0.748200] + sp_pinArray_cht_2d_dp_hf.test_vals = [0.125853, -0.632632, -1.068922, -0.746156, 208.023676, 340.340000, -0.000000, -0.746160, 0.746160] sp_pinArray_cht_2d_dp_hf.multizone = True test_list.append(sp_pinArray_cht_2d_dp_hf) @@ -1363,7 +1363,7 @@ def main(): pywrapper_aeroelastic.cfg_dir = "aeroelastic" pywrapper_aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" pywrapper_aeroelastic.test_iter = 2 - pywrapper_aeroelastic.test_vals = [0.075115, 0.027461, -0.001581, -0.000159] + pywrapper_aeroelastic.test_vals = [0.075176, 0.027496, -0.001643, -0.000126] pywrapper_aeroelastic.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--parallel -f") pywrapper_aeroelastic.unsteady = True test_list.append(pywrapper_aeroelastic) @@ -1383,7 +1383,7 @@ def main(): pywrapper_fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" pywrapper_fsi2d.cfg_file = "configFSI.cfg" pywrapper_fsi2d.test_iter = 4 - pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.729689, -4.151490] + pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.729224, -4.153951] pywrapper_fsi2d.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--nZone 2 --fsi True --parallel -f") pywrapper_fsi2d.unsteady = True pywrapper_fsi2d.multizone = True @@ -1394,7 +1394,7 @@ def main(): pywrapper_unsteadyFSI.cfg_dir = "py_wrapper/dyn_fsi" pywrapper_unsteadyFSI.cfg_file = "config.cfg" pywrapper_unsteadyFSI.test_iter = 4 - pywrapper_unsteadyFSI.test_vals = [0.000000, 49.000000, 5.000000, 57.000000, -0.771999, -2.968647, -2.722569, -7.592115, 0.001080] + pywrapper_unsteadyFSI.test_vals = [0.000000, 49.000000, 5.000000, 44.000000, -0.589089, -2.800967, -2.603174, -6.722478, 0.000209] pywrapper_unsteadyFSI.command = TestCase.Command("mpirun -np 2", "python", "run.py") pywrapper_unsteadyFSI.unsteady = True pywrapper_unsteadyFSI.multizone = True @@ -1425,7 +1425,7 @@ def main(): pywrapper_deformingBump.cfg_dir = "py_wrapper/deforming_bump_in_channel" pywrapper_deformingBump.cfg_file = "config.cfg" pywrapper_deformingBump.test_iter = 1 - pywrapper_deformingBump.test_vals = [ 0.500000, 0.000000, -2.630401, -1.388343, -0.705917, 2.818404, 6.686423, -0.497850] + pywrapper_deformingBump.test_vals = [0.500000, 0.000000, -2.789700, -1.400250, -0.711877, 2.672498, 7.887960, -0.478233] pywrapper_deformingBump.command = TestCase.Command("mpirun -np 2", "python", "run.py") pywrapper_deformingBump.unsteady = True test_list.append(pywrapper_deformingBump) @@ -1497,7 +1497,7 @@ def main(): species2_primitiveVenturi_mixingmodel.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel.cfg_file = "species2_primitiveVenturi_mixingmodel.cfg" species2_primitiveVenturi_mixingmodel.test_iter = 50 - species2_primitiveVenturi_mixingmodel.test_vals = [-5.253422, -4.548567, -4.669310, -5.639565, -0.056375, -5.539197, 5.000000, -2.031561, 5.000000, -4.892504, 5.000000, -1.170435, 0.000577, 0.000508, 0.000069, 0.000000] + species2_primitiveVenturi_mixingmodel.test_vals = [ -5.407755, -4.557255, -4.635502, -5.642910, -0.059627, -5.546376, 5.000000, -1.879995, 5.000000, -4.898985, 5.000000, -1.169389, 0.000551, 0.000483, 0.000068, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel) # 2 species (1 eq) primitive venturi mixing using mixing model and bounded scalar transport @@ -1505,7 +1505,7 @@ def main(): species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_boundedscalar.cfg_file = "species2_primitiveVenturi_mixingmodel_boundedscalar.cfg" species2_primitiveVenturi_mixingmodel_boundedscalar.test_iter = 50 - species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.245182, -4.484265, -4.604025, -5.755301, -0.140000, -5.677490, 5.000000, -2.041040, 5.000000, -4.805633, 5.000000, -1.697932, 0.000275, 0.000275, 0.000000, 0.000000] + species2_primitiveVenturi_mixingmodel_boundedscalar.test_vals = [-5.392378, -4.492373, -4.576491, -5.759780, -0.137797, -5.677531, 5.000000, -1.895013, 5.000000, -4.806816, 5.000000, -1.697769, 0.000275, 0.000275, 0.000000, 0.000000] test_list.append(species2_primitiveVenturi_mixingmodel_boundedscalar) # 2 species (1 eq) primitive venturi mixing using mixing model including viscosity, thermal conductivity and inlet markers for SA turbulence model @@ -1513,7 +1513,7 @@ def main(): species2_primitiveVenturi_mixingmodel_viscosity.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_viscosity.cfg_file = "species2_primitiveVenturi_mixingmodel_viscosity.cfg" species2_primitiveVenturi_mixingmodel_viscosity.test_iter = 50 - species2_primitiveVenturi_mixingmodel_viscosity.test_vals = [-4.683799, -3.605373, -3.856939, -7.596825, -5.004036, 5.000000, -1.756685, 5.000000, -3.211492, 5.000000, -2.196172, 2.475062, 0.976018, 0.609194, 0.889849] + species2_primitiveVenturi_mixingmodel_viscosity.test_vals = [-4.857397, -3.646605, -3.737462, -7.602922, -5.008846, 5.000000, -1.756226, 5.000000, -3.163353, 5.000000, -2.189723, 2.476808, 0.976999, 0.609280, 0.890529] test_list.append(species2_primitiveVenturi_mixingmodel_viscosity) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity @@ -1521,7 +1521,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.626439, -4.517831, -4.580189, -6.573548, 2.300030, -5.417622, 30.000000, -7.086028, 13.000000, -8.236048, 8.000000, -9.131349, 2.079216, 1.000000, 0.600000, 0.479216] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2.test_vals = [-5.688779, -4.556193, -4.513326, -6.563666, 2.298459, -5.423525, 30.000000, -6.903871, 13.000000, -8.224587, 8.000000, -9.119625, 2.078869, 1.000000, 0.600000, 0.478869] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2) # 2 species (1 eq) primitive venturi mixing using mixing model including heat capacity and mass diffusivity NonDimensional case @@ -1529,7 +1529,7 @@ def main(): species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg_file = "species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.cfg" species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_iter = 50 - species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.220388, -4.813965, -4.869765, -7.513357, 1.992341, -5.016403, 10.000000, -2.850321, 3.000000, -5.197045, 5.000000, -5.720050, 2.079247, 1.000000, 0.600000, 0.479247] + species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND.test_vals = [-5.287504, -4.852957, -4.798004, -7.501815, 1.991002, -5.023713, 10.000000, -2.696121, 3.000000, -5.182457, 5.000000, -5.561055, 2.078843, 1.000000, 0.600000, 0.478843] test_list.append(species2_primitiveVenturi_mixingmodel_heatcapacity_H2_ND) # 2 species (1 eq) primitive venturi mixing @@ -1537,7 +1537,7 @@ def main(): species2_primitiveVenturi.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi.cfg_file = "species2_primitiveVenturi.cfg" species2_primitiveVenturi.test_iter = 50 - species2_primitiveVenturi.test_vals = [-5.542102, -4.900688, -4.926701, -5.598524, -1.216075, -5.728735, 5.000000, -1.129509, 5.000000, -2.457650, 5.000000, -0.734335, 0.000184, 0.000182, 0.000002, 0.000000] + species2_primitiveVenturi.test_vals = [-5.643794, -4.798953, -4.858719, -5.648947, -1.195985, -5.564607, 5.000000, -0.958960, 5.000000, -2.515334, 5.000000, -0.796944, 0.000210, 0.000206, 0.000004, 0.000000] test_list.append(species2_primitiveVenturi) # 2 species (1 eq) primitive venturi mixing with bounded scalar transport @@ -1545,7 +1545,7 @@ def main(): species_primitiveVenturi_boundedscalar.cfg_dir = "species_transport/venturi_primitive_3species" species_primitiveVenturi_boundedscalar.cfg_file = "species2_primitiveVenturi_boundedscalar.cfg" species_primitiveVenturi_boundedscalar.test_iter = 50 - species_primitiveVenturi_boundedscalar.test_vals = [-5.127895, -4.405097, -4.514797, -5.665585, -0.954796, -5.619625, 5.000000, -2.144656, 5.000000, -4.019990, 5.000000, -1.751665, 0.000421, 0.000421, 0.000000, 0.000000] + species_primitiveVenturi_boundedscalar.test_vals = [-5.283533, -4.417193, -4.478360, -5.669526, -0.952767, -5.618596, 5.000000, -1.996975, 5.000000, -4.017868, 5.000000, -1.747496, 0.000423, 0.000423, 0.000000, 0.000000] test_list.append(species_primitiveVenturi_boundedscalar) # 2 species (1 eq) primitive venturi mixing using mixing model including inlet markers for turbulent intensity and viscosity ratios @@ -1553,7 +1553,7 @@ def main(): species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg_dir = "species_transport/venturi_primitive_3species" species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg_file = "species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.cfg" species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_iter = 50 - species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_vals = [-3.965189, -1.676556, -1.657427, -0.681635, 1.478277, -3.761790, 23.000000, -5.105541, 11.000000, -5.356557, 4.000000, -6.578317, 2.000000, 1.000000, 0.000000, 1.000000] + species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS.test_vals = [-4.105910, -1.680056, -1.599493, -0.672401, 1.441091, -3.759601, 23.000000, -5.201473, 11.000000, -5.312651, 4.000000, -6.525448, 2.000000, 1.000000, 0.000000, 1.000000] test_list.append(species2_primitiveVenturi_mixingmodel_TURBULENT_MARKERS) # 3 species (2 eq) primitive venturi mixing with inlet files. @@ -1562,7 +1562,7 @@ def main(): species3_primitiveVenturi_inletFile.cfg_dir = "species_transport/venturi_primitive_3species" species3_primitiveVenturi_inletFile.cfg_file = "species3_primitiveVenturi_inletFile.cfg" species3_primitiveVenturi_inletFile.test_iter = 50 - species3_primitiveVenturi_inletFile.test_vals = [-5.612731, -4.971317, -4.997330, -5.669153, -1.286704, -5.979272, -6.106585, 5.000000, -1.129509, 5.000000, -2.457651, 5.000000, -0.536029] + species3_primitiveVenturi_inletFile.test_vals = [-5.714428, -4.869589, -4.929349, -5.719577, -1.266622, -5.824037, -5.944720, 5.000000, -0.958918, 5.000000, -2.515337, 5.000000, -0.523677] test_list.append(species3_primitiveVenturi_inletFile) # rectangle passive transport validation @@ -1570,7 +1570,7 @@ def main(): species_passive_val.cfg_dir = "species_transport/passive_transport_validation" species_passive_val.cfg_file = "passive_transport.cfg" species_passive_val.test_iter = 50 - species_passive_val.test_vals = [-16.552095, -16.335843, -16.932499, -4.257599, 10.000000, -4.652087, 8.000000, -5.193350, 0.186610, 0.000000] + species_passive_val.test_vals = [-16.580418, -16.383067, -16.916872, -4.257599, 10.000000, -4.627854, 8.000000, -5.193350, 0.186610, 0.000000] species_passive_val.test_vals_aarch64 = [-16.538551, -16.312552, -16.882823, -4.257599, 10, -4.585464, 8, -5.19335, 0.18661, 0] test_list.append(species_passive_val) @@ -1579,7 +1579,7 @@ def main(): species3_multizone_restart.cfg_dir = "species_transport/multizone" species3_multizone_restart.cfg_file = "configMaster.cfg" species3_multizone_restart.test_iter = 5 - species3_multizone_restart.test_vals = [-6.235284, -5.746397] + species3_multizone_restart.test_vals = [-5.848602, -5.646854] species3_multizone_restart.multizone = True test_list.append(species3_multizone_restart) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index f387cd264c2..e85ea002f51 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -135,7 +135,7 @@ def main(): polar_naca0012.cfg_file = "inv_NACA0012.cfg" polar_naca0012.polar = True polar_naca0012.test_iter = 10 - polar_naca0012.test_vals = [-1.194747, 4.252825, 0.001251, 0.016473] + polar_naca0012.test_vals = [-1.067859, 4.397227, 0.000060, 0.031134] polar_naca0012.test_vals_aarch64 = [-1.063447, 4.401847, 0.000291, 0.031696] polar_naca0012.command = TestCase.Command(exec = "compute_polar.py", param = "-n 1 -i 11") # flaky test on arm64 diff --git a/TestCases/user_defined_functions/lam_flatplate.cfg b/TestCases/user_defined_functions/lam_flatplate.cfg index 35cdc97b9c9..ff9397e07e1 100644 --- a/TestCases/user_defined_functions/lam_flatplate.cfg +++ b/TestCases/user_defined_functions/lam_flatplate.cfg @@ -114,7 +114,7 @@ SLOPE_LIMITER_FLOW= NONE % CONV_RESIDUAL_MINVAL= -11 CONV_STARTITER= 0 -INNER_ITER= 1000 +INNER_ITER= 20 % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % From cf0d1e9ba35c413a8b593d5e2bb1f6ff8958970c Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 18 Jun 2024 23:32:25 +0200 Subject: [PATCH 135/194] small update --- .../chtPinArray_2d/of_grad_findiff.csv.ref | 2 +- TestCases/nicf/edge/edge_PPR.cfg | 2 +- TestCases/nicf/edge/edge_VW.cfg | 4 ++-- TestCases/parallel_regression.py | 8 ++++---- TestCases/user_defined_functions/lam_flatplate.cfg | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref index 4d8648efc5b..0b8cbb20943 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref @@ -1,2 +1,2 @@ "VARIABLE" , "AVG_DENSITY[0]", "AVG_ENTHALPY[0]", "AVG_NORMALVEL[0]", "DRAG[0]" , "EFFICIENCY[0]" , "FORCE_X[0]" , "FORCE_Y[0]" , "FORCE_Z[0]" , "LIFT[0]" , "MOMENT_X[0]" , "MOMENT_Y[0]" , "MOMENT_Z[0]" , "SIDEFORCE[0]" , "SURFACE_MACH[0]", "SURFACE_MASSFLOW[0]", "SURFACE_MOM_DISTORTION[0]", "SURFACE_PRESSURE_DROP[0]", "SURFACE_SECONDARY[0]", "SURFACE_SECOND_OVER_UNIFORM[0]", "SURFACE_STATIC_PRESSURE[0]", "SURFACE_STATIC_TEMPERATURE[0]", "SURFACE_TOTAL_PRESSURE[0]", "SURFACE_TOTAL_TEMPERATURE[0]", "SURFACE_UNIFORMITY[0]", "AVG_TEMPERATURE[1]", "MAXIMUM_HEATFLUX[1]", "TOTAL_HEATFLUX[1]", "FINDIFF_STEP" -+0 , 0.0 , -99999.96982514858, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.02999999970665357, 1.1099999991544242e-08, -0.8910000001693952 , 0.0 , 0.906000000022722 , 1.5900000011059845 , 449.9999988638592 , -40.000008993956726 , 347.0000002891993 , -50.00000555810402 , -0.7000000135093387 , -280.00000042993634, 0.0 , -529.999999798747, 1e-08 +0 , 0.0 , -300000.0026077032, -1.1102300000033865e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.02000000026702864, 4.440999999041655e-08, -0.9799999992066155 , 0.0 , 1.10399999975197 , 1.9200000006547313 , 389.9999967416079 , -80.00000661922968 , 396.00000008022107 , -79.99999525054591 , -0.5999999830308411 , -380.0000001774606, 0.0 , -320.0000037395512, 1e-08 diff --git a/TestCases/nicf/edge/edge_PPR.cfg b/TestCases/nicf/edge/edge_PPR.cfg index 840db81bc7a..34fdba91303 100644 --- a/TestCases/nicf/edge/edge_PPR.cfg +++ b/TestCases/nicf/edge/edge_PPR.cfg @@ -54,7 +54,7 @@ CFL_NUMBER= 2.5 CFL_ADAPT= YES CFL_ADAPT_PARAM= ( 0.9, 1.1, 1.0, 200.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) -ITER= 500 +ITER= 51 % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% % diff --git a/TestCases/nicf/edge/edge_VW.cfg b/TestCases/nicf/edge/edge_VW.cfg index cb36eb63ea0..2cfb17fb1ba 100644 --- a/TestCases/nicf/edge/edge_VW.cfg +++ b/TestCases/nicf/edge/edge_VW.cfg @@ -51,11 +51,11 @@ MARKER_MONITORING= ( WALL1 ) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 2.5 +CFL_NUMBER= 2.0 CFL_ADAPT= YES CFL_ADAPT_PARAM= ( 0.9, 1.1, 1.0, 200.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) -ITER= 500 +ITER= 51 % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% % diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index e442f8c8ab2..6befcfccdc5 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -228,7 +228,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-5.216066, -4.672690, 0.332598, 0.023160] + naca0012.test_vals = [-4.322128, -3.813578, 0.321660, 0.022547] test_list.append(naca0012) # Supersonic wedge @@ -1019,7 +1019,7 @@ def main(): edge_VW = TestCase('edge_VW') edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" - edge_VW.test_iter = 100 + edge_VW.test_iter = 50 edge_VW.test_vals = [-7.403171, -1.171612, -0.000009, 0.000000] test_list.append(edge_VW) @@ -1027,7 +1027,7 @@ def main(): edge_PPR = TestCase('edge_PPR') edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" - edge_PPR.test_iter = 100 + edge_PPR.test_iter = 50 edge_PPR.test_vals = [-8.587251, -2.404856, -0.000034, 0.000000] test_list.append(edge_PPR) @@ -1332,7 +1332,7 @@ def main(): pywrapper_naca0012.cfg_dir = "euler/naca0012" pywrapper_naca0012.cfg_file = "inv_NACA0012_Roe.cfg" pywrapper_naca0012.test_iter = 100 - pywrapper_naca0012.test_vals = [-9.456838, -8.939955, 0.335418, 0.023332] + pywrapper_naca0012.test_vals = [-9.569885, -8.966579, 0.335418, 0.023332] pywrapper_naca0012.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--parallel -f") test_list.append(pywrapper_naca0012) diff --git a/TestCases/user_defined_functions/lam_flatplate.cfg b/TestCases/user_defined_functions/lam_flatplate.cfg index ff9397e07e1..c3d55cd45c0 100644 --- a/TestCases/user_defined_functions/lam_flatplate.cfg +++ b/TestCases/user_defined_functions/lam_flatplate.cfg @@ -114,7 +114,7 @@ SLOPE_LIMITER_FLOW= NONE % CONV_RESIDUAL_MINVAL= -11 CONV_STARTITER= 0 -INNER_ITER= 20 +INNER_ITER= 21 % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % From ccdae540be7b5fba6e7fc0099cda4b029cd3546d Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 19 Jun 2024 08:16:40 +0200 Subject: [PATCH 136/194] small update --- TestCases/parallel_regression.py | 4 ++-- TestCases/serial_regression.py | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 6befcfccdc5..8ba8ce8f4b5 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1020,7 +1020,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 50 - edge_VW.test_vals = [-7.403171, -1.171612, -0.000009, 0.000000] + edge_VW.test_vals = [-8.338238, -2.159537, -0.000009, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR @@ -1028,7 +1028,7 @@ def main(): edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" edge_PPR.test_iter = 50 - edge_PPR.test_vals = [-8.587251, -2.404856, -0.000034, 0.000000] + edge_PPR.test_vals = [-8.611983, -2.441992, -0.000034, 0.000000] test_list.append(edge_PPR) # Rarefaction Q1D nozzle, include CoolProp fluid model diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index e85ea002f51..7c103074504 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -101,7 +101,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-5.192432, -4.660174, 0.332428, 0.023142] + naca0012.test_vals = [-4.444941, -3.941038, 0.318998, 0.022365] test_list.append(naca0012) # Supersonic wedge @@ -166,7 +166,7 @@ def main(): flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" flatplate.test_iter = 20 - flatplate.test_vals = [-9.239265, -3.771626, 0.001085, 0.036281, 2.361500, -2.325300, -1.810500, -1.810500] + flatplate.test_vals = [-5.122306, 0.357174, 0.001311, 0.028230, 2.361600, -2.333300, -2.629100, -2.629100] test_list.append(flatplate) # Laminar cylinder (steady) @@ -839,7 +839,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 20 - edge_VW.test_vals = [-0.852047, 5.349957, -0.001136, 0.000000] + edge_VW.test_vals = [-0.734699, 5.467289, -0.000376, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR @@ -847,7 +847,7 @@ def main(): edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" edge_PPR.test_iter = 20 - edge_PPR.test_vals = [-1.651538, 4.537499, 0.001027, 0.000000] + edge_PPR.test_vals = [-2.017812, 4.174560, 0.000019, 0.000000] test_list.append(edge_PPR) @@ -907,7 +907,7 @@ def main(): uniform_flow.cfg_dir = "sliding_interface/uniform_flow" uniform_flow.cfg_file = "uniform_NN.cfg" uniform_flow.test_iter = 2 - uniform_flow.test_vals = [2.000000, 0.000000, -0.202697, -13.246876] + uniform_flow.test_vals = [2.000000, 0.000000, -0.202697, -13.249572] uniform_flow.test_vals_aarch64 = [2.000000, 0.000000, -0.205134, -13.250720] #last 4 columns uniform_flow.tol = 0.000001 uniform_flow.unsteady = True @@ -1478,7 +1478,7 @@ def main(): opt_multiobj1surf_py.cfg_dir = "optimization_euler/multiobjective_wedge" opt_multiobj1surf_py.cfg_file = "inv_wedge_ROE_multiobj_1surf.cfg" opt_multiobj1surf_py.test_iter = 1 - opt_multiobj1surf_py.test_vals = [1.000000, 1.000000, 36.355460, 3.378262] + opt_multiobj1surf_py.test_vals = [1.000000, 1.000000, 36.117740, 4.438036] opt_multiobj1surf_py.command = TestCase.Command(exec = "shape_optimization.py", param = "-g CONTINUOUS_ADJOINT -f") opt_multiobj1surf_py.timeout = 1600 opt_multiobj1surf_py.tol = 0.00001 @@ -1508,7 +1508,7 @@ def main(): pywrapper_naca0012.cfg_dir = "euler/naca0012" pywrapper_naca0012.cfg_file = "inv_NACA0012_Roe.cfg" pywrapper_naca0012.test_iter = 20 - pywrapper_naca0012.test_vals = [-4.522897, -4.048118, 0.317967, 0.023046] + pywrapper_naca0012.test_vals = [-4.444941, -3.941038, 0.318998, 0.022365] pywrapper_naca0012.command = TestCase.Command(exec = "SU2_CFD.py", param = "-f") pywrapper_naca0012.timeout = 1600 pywrapper_naca0012.tol = 0.00001 @@ -1549,7 +1549,7 @@ def main(): pywrapper_aeroelastic.cfg_dir = "aeroelastic" pywrapper_aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" pywrapper_aeroelastic.test_iter = 2 - pywrapper_aeroelastic.test_vals = [0.074344, 0.027575, -0.001579, -0.000160] + pywrapper_aeroelastic.test_vals = [0.074291, 0.027620, -0.001641, -0.000128] pywrapper_aeroelastic.command = TestCase.Command(exec = "SU2_CFD.py", param = "-f") pywrapper_aeroelastic.timeout = 1600 pywrapper_aeroelastic.tol = 0.00001 @@ -1563,7 +1563,7 @@ def main(): pywrapper_fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" pywrapper_fsi2d.cfg_file = "configFSI.cfg" pywrapper_fsi2d.test_iter = 4 - pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.729692, -4.151488] + pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.729228, -4.153949] pywrapper_fsi2d.command = TestCase.Command(exec = "SU2_CFD.py", param = "--nZone 2 --fsi True -f") pywrapper_fsi2d.unsteady = True pywrapper_fsi2d.multizone = True @@ -1606,7 +1606,7 @@ def main(): pywrapper_custom_inlet.cfg_dir = "py_wrapper/custom_inlet" pywrapper_custom_inlet.cfg_file = "lam_flatplate.cfg" pywrapper_custom_inlet.test_iter = 20 - pywrapper_custom_inlet.test_vals = [-4.124164, -1.544359, -3.808866, 1.338411, -0.752679, 0.161436, -1.2391e-02, 5.1662e-01, -5.2901e-01] + pywrapper_custom_inlet.test_vals = [-4.121218, -1.541055, -3.439454, 1.341706, -0.747895, 0.161442, -0.013213, 0.516040, -0.529260] pywrapper_custom_inlet.command = TestCase.Command(exec = "python", param = "run.py") pywrapper_custom_inlet.timeout = 1600 pywrapper_custom_inlet.tol = 0.0001 From e53dd26cfd5a2b7a45398f85947b6ffe30204cc0 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 19 Jun 2024 22:14:04 +0200 Subject: [PATCH 137/194] small update --- TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref | 16 ++++++++-------- TestCases/hybrid_regression.py | 2 +- TestCases/nicf/edge/edge_VW.cfg | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref index ce314cec31a..4609892bc90 100644 --- a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref +++ b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref @@ -1,9 +1,9 @@ INDEX GRAD -0 -3.333351481260664e-03 -1 -1.759598795069318e-03 -2 -7.415706123961727e-04 -3 -2.415031962403668e-04 -4 -2.430854892363347e-04 -5 -7.438535736860117e-04 -6 -1.754770734917792e-03 -7 -3.306851351743173e-03 +0 -5.239274092737222e-03 +1 -2.822866221863948e-03 +2 -1.251166606082498e-03 +3 -4.746311954659543e-04 +4 -4.726421529292411e-04 +5 -1.242307190163730e-03 +6 -2.797799393332898e-03 +7 -5.181304739588740e-03 diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index f59a3c9887d..44026b09238 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -59,7 +59,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-5.192142, -4.659923, 0.332424, 0.023142] + naca0012.test_vals = [-4.444945, -3.941041, 0.318999, 0.022365] test_list.append(naca0012) # Supersonic wedge diff --git a/TestCases/nicf/edge/edge_VW.cfg b/TestCases/nicf/edge/edge_VW.cfg index 2cfb17fb1ba..d7d28ac554c 100644 --- a/TestCases/nicf/edge/edge_VW.cfg +++ b/TestCases/nicf/edge/edge_VW.cfg @@ -55,7 +55,7 @@ CFL_NUMBER= 2.0 CFL_ADAPT= YES CFL_ADAPT_PARAM= ( 0.9, 1.1, 1.0, 200.0 ) RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) -ITER= 51 +ITER= 500 % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% % @@ -71,8 +71,8 @@ MGCYCLE= W_CYCLE MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) MG_POST_SMOOTH= ( 0, 0, 0, 0 ) MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) -MG_DAMP_RESTRICTION= 0.9 -MG_DAMP_PROLONGATION= 0.9 +MG_DAMP_RESTRICTION= 0.8 +MG_DAMP_PROLONGATION= 0.8 % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % From dba4dba898c90c9c535c50dc9c7f8f80f7250ddd Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 21 Jun 2024 10:24:57 +0200 Subject: [PATCH 138/194] small update --- TestCases/hybrid_regression.py | 4 ++-- TestCases/parallel_regression_AD.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 44026b09238..92dd1bf1973 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -539,7 +539,7 @@ def main(): edge_VW = TestCase('edge_VW') edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" - edge_VW.test_iter = 100 + edge_VW.test_iter = 40 edge_VW.test_vals = [-7.060147, -0.888789, -0.000009, 0.000000] test_list.append(edge_VW) @@ -548,7 +548,7 @@ def main(): edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" edge_PPR.test_iter = 40 - edge_PPR.test_vals = [-10.661994, -4.474297, -0.000034, 0.000000] + edge_PPR.test_vals = [-6.922907, -0.757793, -0.000034, 0.000000] edge_PPR.test_vals_aarch64 = [-8.573595, -2.391849, -0.000034, 0.000000] test_list.append(edge_PPR) diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index d870ad2efe4..80fb1863db1 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -277,7 +277,7 @@ def main(): discadj_fsi2.cfg_dir = "disc_adj_fsi/Airfoil_2d" discadj_fsi2.cfg_file = "config.cfg" discadj_fsi2.test_iter = 8 - discadj_fsi2.test_vals = [-3.418240, 1.432738, -1.306071, 0.849980, 1.768100] + discadj_fsi2.test_vals = [-2.402640, 2.740268, -1.270185, -1.273900, 3.860200] discadj_fsi2.test_vals_aarch64 = [-4.349372, 0.190601, -1.303589, 0.754070, 2.324400] discadj_fsi2.tol = 0.00001 test_list.append(discadj_fsi2) From 3d136bcf9bafc77fe9515fda9fe214052e90d392 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 21 Jun 2024 18:15:46 +0200 Subject: [PATCH 139/194] disable OMP line for git regression testing --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index a607b5ca946..da67d74689c 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1159,7 +1159,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve /*--- Loop over all the vertices on this boundary marker. ---*/ - SU2_OMP_FOR_DYN(OMP_MIN_SIZE) + //SU2_OMP_FOR_DYN(OMP_MIN_SIZE) for (auto iVertex = 0ul; iVertex < geometry->nVertex[val_marker]; iVertex++) { const auto iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); @@ -1316,7 +1316,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve //nodes->SetResTruncError(iPoint, Res_TruncError); } - END_SU2_OMP_FOR + //END_SU2_OMP_FOR } From f7f455ca06ca671428bf053ed71b5a35b1bbb9a8 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 22 Jun 2024 00:27:59 +0200 Subject: [PATCH 140/194] enable OMP line for git regression testing --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index da67d74689c..a607b5ca946 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1159,7 +1159,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve /*--- Loop over all the vertices on this boundary marker. ---*/ - //SU2_OMP_FOR_DYN(OMP_MIN_SIZE) + SU2_OMP_FOR_DYN(OMP_MIN_SIZE) for (auto iVertex = 0ul; iVertex < geometry->nVertex[val_marker]; iVertex++) { const auto iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); @@ -1316,7 +1316,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve //nodes->SetResTruncError(iPoint, Res_TruncError); } - //END_SU2_OMP_FOR + END_SU2_OMP_FOR } From 48e5de107e79c1f2c85362111678cedf08809eba Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 22 Jun 2024 10:12:07 +0200 Subject: [PATCH 141/194] small update --- .../naca0012/of_grad_cd.dat.ref | 76 +++++++++---------- .../wedge/of_grad_combo.dat.ref | 8 +- TestCases/parallel_regression.py | 2 +- TestCases/serial_regression.py | 4 +- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref index 8322fc8077e..825d10e13cf 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -0.405334 , 0.0001 - 1 , -0.300634 , 0.0001 - 2 , -0.211062 , 0.0001 - 3 , -0.148746 , 0.0001 - 4 , -0.115552 , 0.0001 - 5 , -0.110114 , 0.0001 - 6 , -0.128222 , 0.0001 - 7 , -0.162634 , 0.0001 - 8 , -0.20377 , 0.0001 - 9 , -0.241877 , 0.0001 - 10 , -0.270344 , 0.0001 - 11 , -0.288742 , 0.0001 - 12 , -0.303382 , 0.0001 - 13 , -0.324065 , 0.0001 - 14 , -0.35884 , 0.0001 - 15 , -0.411905 , 0.0001 - 16 , -0.489011 , 0.0001 - 17 , -0.610158 , 0.0001 - 18 , -0.861925 , 0.0001 - 19 , 0.0455288 , 0.0001 - 20 , 0.772193 , 0.0001 - 21 , 1.2507 , 0.0001 - 22 , 1.46632 , 0.0001 - 23 , 1.45121 , 0.0001 - 24 , 1.26277 , 0.0001 - 25 , 0.969139 , 0.0001 - 26 , 0.636433 , 0.0001 - 27 , 0.319367 , 0.0001 - 28 , 0.0567211 , 0.0001 - 29 , -0.128146 , 0.0001 - 30 , -0.223501 , 0.0001 - 31 , -0.225775 , 0.0001 - 32 , -0.140749 , 0.0001 - 33 , 0.00916305 , 0.0001 - 34 , 0.180472 , 0.0001 - 35 , 0.329347 , 0.0001 - 36 , 0.462811 , 0.0001 - 37 , 0.686302 , 0.0001 + 0 , -0.3957 , 0.0001 + 1 , -0.296173 , 0.0001 + 2 , -0.213567 , 0.0001 + 3 , -0.15797 , 0.0001 + 4 , -0.129897 , 0.0001 + 5 , -0.127172 , 0.0001 + 6 , -0.145365 , 0.0001 + 7 , -0.177645 , 0.0001 + 8 , -0.215406 , 0.0001 + 9 , -0.250173 , 0.0001 + 10 , -0.276475 , 0.0001 + 11 , -0.294359 , 0.0001 + 12 , -0.309628 , 0.0001 + 13 , -0.330814 , 0.0001 + 14 , -0.364804 , 0.0001 + 15 , -0.415697 , 0.0001 + 16 , -0.490218 , 0.0001 + 17 , -0.611024 , 0.0001 + 18 , -0.874971 , 0.0001 + 19 , 0.0510475 , 0.0001 + 20 , 0.782353 , 0.0001 + 21 , 1.26329 , 0.0001 + 22 , 1.47992 , 0.0001 + 23 , 1.46463 , 0.0001 + 24 , 1.27505 , 0.0001 + 25 , 0.979585 , 0.0001 + 26 , 0.644706 , 0.0001 + 27 , 0.325487 , 0.0001 + 28 , 0.0610001 , 0.0001 + 29 , -0.125212 , 0.0001 + 30 , -0.221301 , 0.0001 + 31 , -0.223531 , 0.0001 + 32 , -0.137307 , 0.0001 + 33 , 0.0153574 , 0.0001 + 34 , 0.190118 , 0.0001 + 35 , 0.339925 , 0.0001 + 36 , 0.471371 , 0.0001 + 37 , 0.692488 , 0.0001 diff --git a/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref b/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref index 6afe0fa470c..51bda5370df 100644 --- a/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref +++ b/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref @@ -1,5 +1,5 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , 0.00736649 , 0.0001 - 1 , 0.00518066 , 0.0001 - 2 , 0.00272704 , 0.0001 - 3 , 0.0010838 , 0.0001 + 0 , 0.00767644 , 0.0001 + 1 , 0.00498358 , 0.0001 + 2 , 0.00246134 , 0.0001 + 3 , 0.000893054 , 0.0001 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 8ba8ce8f4b5..d5292b2dd76 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1020,7 +1020,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 50 - edge_VW.test_vals = [-8.338238, -2.159537, -0.000009, 0.000000] + edge_VW.test_vals = [-9.836297, -3.632881, -0.000009, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 7c103074504..4f984eacb0f 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -839,7 +839,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 20 - edge_VW.test_vals = [-0.734699, 5.467289, -0.000376, 0.000000] + edge_VW.test_vals = [-0.580474, 5.621653, -0.006098, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR @@ -1491,7 +1491,7 @@ def main(): opt_2surf1obj_py.cfg_dir = "optimization_euler/multiobjective_wedge" opt_2surf1obj_py.cfg_file = "inv_wedge_ROE_2surf_1obj.cfg" opt_2surf1obj_py.test_iter = 1 - opt_2surf1obj_py.test_vals = [1.000000, 1.000000, 2.005517, 0.000280] + opt_2surf1obj_py.test_vals = [1.000000, 1.000000, 2.005219, 0.000369] opt_2surf1obj_py.command = TestCase.Command(exec = "shape_optimization.py", param = "-g CONTINUOUS_ADJOINT -f") opt_2surf1obj_py.timeout = 1600 opt_2surf1obj_py.tol = 0.00001 From 4eb41cdd16f557586941dcfcd66c4369c9972a57 Mon Sep 17 00:00:00 2001 From: Nijso Date: Sat, 22 Jun 2024 17:29:11 +0200 Subject: [PATCH 142/194] Update SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 3933929f1c1..dfe90868555 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -60,7 +60,7 @@ namespace detail { template void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient, int idx_vel) { + size_t varEnd, GradientType& gradient, size_t idxVel) { const size_t nPointDomain = geometry.GetnPointDomain(); #ifdef HAVE_OMP From e568e0470009508372035e95ff2c1b209f6c88a8 Mon Sep 17 00:00:00 2001 From: Nijso Date: Sat, 22 Jun 2024 17:29:29 +0200 Subject: [PATCH 143/194] Update SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index dfe90868555..a179bcaa571 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -162,7 +162,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER } // iMarkers - /* --- compute the corrections for symmetry planes and Euler walls. --- */ + /*--- Compute the corrections for symmetry planes and Euler walls. ---*/ computeGradientsSymmetry(nDim, solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, varEnd, gradient, idx_vel); From 5796476d7a945edb0cd7f6cb9637822873bd75ea Mon Sep 17 00:00:00 2001 From: Nijso Date: Sat, 22 Jun 2024 17:29:46 +0200 Subject: [PATCH 144/194] Update SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp index 287b5b4580e..136f9e9432c 100644 --- a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp +++ b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp @@ -178,7 +178,7 @@ FORCEINLINE void solveLeastSquares(size_t iPoint, * \param[in] varEnd - Index of last variable for which to compute the gradient. * \param[out] gradient - Generic object implementing operator (iPoint, iVar, iDim). * \param[out] Rmatrix - Generic object implementing operator (iPoint, iDim, iDim). - * \param[in] idx_vel - index to velocity, -1 if no velocity present in solver. + * \param[in] idxVel - Index to velocity, -1 if no velocity is present in the solver. */ template void computeGradientsLeastSquares(CSolver* solver, From d5405dde198874130d750f73686f7658a564ae0b Mon Sep 17 00:00:00 2001 From: Nijso Date: Sat, 22 Jun 2024 17:29:57 +0200 Subject: [PATCH 145/194] Update SU2_CFD/include/gradients/computeGradientsSymmetry.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/gradients/computeGradientsSymmetry.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index 0c24c0fcaa8..b9fd8f5dde6 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -44,8 +44,6 @@ namespace detail { * \param[in] TensorMAp - the tensor map to map to rotated base. * \param[out] Gradients_iPoint - the gradient for the point. */ - - template inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& TensorMap, Matrix& Gradients_iPoint, int idx_vel) { From b038b3aa46ed0456d32212a9c5655d16d3cd8728 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 22 Jun 2024 23:01:50 +0200 Subject: [PATCH 146/194] change idx_vel to idxVel --- .../gradients/computeGradientsGreenGauss.hpp | 10 +++++----- .../computeGradientsLeastSquares.hpp | 10 +++++----- .../gradients/computeGradientsSymmetry.hpp | 20 +++++++++---------- .../include/solvers/CFVMFlowSolverBase.inl | 3 ++- SU2_CFD/include/solvers/CSolver.hpp | 8 ++++---- SU2_CFD/src/solvers/CSolver.cpp | 8 ++++---- 6 files changed, 29 insertions(+), 30 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index a179bcaa571..1c6efb7eaa9 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -54,7 +54,7 @@ namespace detail { * \param[in] field - Generic object implementing operator (iPoint, iVar). * \param[in] varBegin - Index of first variable for which to compute the gradient. * \param[in] varEnd - Index of last variable for which to compute the gradient. - * \param[in] idx_vel - Index of velocity, or -1 if no velocity present. + * \param[in] idxVel - Index of velocity, or -1 if no velocity present. * \param[out] gradient - Generic object implementing operator (iPoint, iVar, iDim). */ template @@ -164,7 +164,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER /*--- Compute the corrections for symmetry planes and Euler walls. ---*/ - computeGradientsSymmetry(nDim, solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, varEnd, gradient, idx_vel); + computeGradientsSymmetry(nDim, solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, varEnd, gradient, idxVel); /*--- If no solver was provided we do not communicate ---*/ @@ -193,15 +193,15 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER template void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient, int idx_vel) { + size_t varEnd, GradientType& gradient, size_t idxVel) { switch (geometry.GetnDim()) { case 2: detail::computeGradientsGreenGauss<2>(solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, - varEnd, gradient, idx_vel); + varEnd, gradient, idxVel); break; case 3: detail::computeGradientsGreenGauss<3>(solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, - varEnd, gradient, idx_vel); + varEnd, gradient, idxVel); break; default: SU2_MPI::Error("Too many dimensions to compute gradients.", CURRENT_FUNCTION); diff --git a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp index 136f9e9432c..4963f451a7b 100644 --- a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp +++ b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp @@ -192,7 +192,7 @@ void computeGradientsLeastSquares(CSolver* solver, size_t varEnd, GradientType& gradient, RMatrixType& Rmatrix, - int idx_vel) + size_t idxVel) { const bool periodic = (solver != nullptr) && (config.GetnMarker_Periodic() > 0); @@ -316,7 +316,7 @@ void computeGradientsLeastSquares(CSolver* solver, } /* --- compute the corrections for symmetry planes and Euler walls. --- */ - computeGradientsSymmetry(nDim, solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, varEnd, gradient, idx_vel); + computeGradientsSymmetry(nDim, solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, varEnd, gradient, idxVel); /*--- If no solver was provided we do not communicate ---*/ @@ -348,16 +348,16 @@ void computeGradientsLeastSquares(CSolver* solver, size_t varEnd, GradientType& gradient, RMatrixType& Rmatrix, - int idx_vel + size_t idxVel ) { switch (geometry.GetnDim()) { case 2: detail::computeGradientsLeastSquares<2>(solver, kindMpiComm, kindPeriodicComm, geometry, config, - weighted, field, varBegin, varEnd, gradient, Rmatrix, idx_vel); + weighted, field, varBegin, varEnd, gradient, Rmatrix, idxVel); break; case 3: detail::computeGradientsLeastSquares<3>(solver, kindMpiComm, kindPeriodicComm, geometry, config, - weighted, field, varBegin, varEnd, gradient, Rmatrix, idx_vel); + weighted, field, varBegin, varEnd, gradient, Rmatrix, idxVel); break; default: SU2_MPI::Error("Too many dimensions to compute gradients.", CURRENT_FUNCTION); diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index b9fd8f5dde6..7e9aba5dc81 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -35,7 +35,7 @@ namespace detail { /*! - * \brief Reflect a gradient using a tensor mapping. Used for symmetry reflection. + * \brief Correct the gradient on a symmetry by using a tensor mapping. * \ingroup FvmAlgos * \param[in] nDim - number of dimensions, 2 or 3. * \param[in] varBegin - start of the variables. @@ -45,8 +45,8 @@ namespace detail { * \param[out] Gradients_iPoint - the gradient for the point. */ template -inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& TensorMap, - Matrix& Gradients_iPoint, int idx_vel) { +inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& TensorMap, + Matrix& Gradients_iPoint, size_t idxVel) { static constexpr size_t MAXNDIM = 3; su2activematrix Gradients_Velocity(nDim, nDim); @@ -54,12 +54,11 @@ inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& su2double gradPhi[MAXNDIM] = {0.0}; su2double gradPhiReflected[MAXNDIM] = {0.0}; - if (idx_vel != -1) { + if (idxVel != -1) { /*--- Get gradients of primitives of boundary cell ---*/ for (auto iVar = 0u; iVar < nDim; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { - // todo: 1 ->idx.velocity - Gradients_Velocity[iVar][iDim] = Gradients_iPoint[idx_vel + iVar][iDim]; + Gradients_Velocity[iVar][iDim] = Gradients_iPoint[idxVel + iVar][iDim]; Gradients_Velocity_Reflected[iVar][iDim] = 0.0; } } @@ -106,15 +105,14 @@ inline void ReflectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { - // todo: 1->idx.velocity - Gradients_iPoint[iDim + idx_vel][jDim] = Gradients_Velocity[iDim][jDim]; + Gradients_iPoint[iDim + idxVel][jDim] = Gradients_Velocity[iDim][jDim]; } } } /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) { - if ((idx_vel == -1) || ((idx_vel != -1) && (iVar == 0 || iVar > nDim))) { + if ((idxVel == -1) || ((idxVel != -1) && (iVar == 0 || iVar > nDim))) { /*--- project to symmetry aligned base ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { gradPhi[iDim] = Gradients_iPoint[iVar][iDim]; @@ -203,7 +201,7 @@ inline void BaseFromNormal(Int nDim, const Scalar* UnitNormal, Matrix& TensorMap template void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient, int idx_vel) { + size_t varEnd, GradientType& gradient, size_t idxVel) { static constexpr size_t MAXNDIM = 3; static constexpr size_t MAXNSYMS = 100; @@ -298,7 +296,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI } } - detail::ReflectGradient(nDim, varBegin,varEnd, TensorMap, Gradients_iPoint, idx_vel); + detail::CorrectGradient(nDim, varBegin,varEnd, TensorMap, Gradients_iPoint, idxVel); for (auto iVar = varBegin; iVar < varEnd; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index a607b5ca946..24df184e3c9 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1137,6 +1137,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) { const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const auto iVel = prim_idx.Velocity(); + su2double* V_reflected; /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. * The components of the residual normal to the symmetry plane are then zeroed out. @@ -1215,7 +1216,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve } - su2double* V_reflected = GetCharacPrimVar(val_marker, iVertex); + V_reflected = GetCharacPrimVar(val_marker, iVertex); /*--- Grid movement ---*/ if (dynamic_grid) diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index 70fa62885b8..f11ff96597f 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -543,19 +543,19 @@ class CSolver { * \brief Compute the Green-Gauss gradient of the solution. * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. - * \param[in] idx_vel - index to velocity, or -1 when no velocity present. + * \param[in] idxVel - Index to velocity, -1 if no velocity is present in the solver. * \param[in] reconstruction - indicator that the gradient being computed is for upwind reconstruction. */ - void SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, int idx_vel, bool reconstruction = false); + void SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, size_t idxVel, bool reconstruction = false); /*! * \brief Compute the Least Squares gradient of the solution. * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. - * \param[in] idx_vel - index to velocity, or -1 when no velocity present. + * \param[in] idxVel - Index to velocity, -1 if no velocity is present in the solver. * \param[in] reconstruction - indicator that the gradient being computed is for upwind reconstruction. */ - void SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, int idx_vel, bool reconstruction = false); + void SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, size_t idxVel, bool reconstruction = false); /*! * \brief Compute the Least Squares gradient of the grid velocity. diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index ac48769f86a..669830de343 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -2110,16 +2110,16 @@ void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, const CConfig *config) weighted, solution, 0, base_nodes->GetnAuxVar(), gradient, rmatrix, -1); } -void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, int idx_vel, bool reconstruction) { +void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, size_t idxVel, bool reconstruction) { const auto& solution = base_nodes->GetSolution(); auto& gradient = reconstruction? base_nodes->GetGradient_Reconstruction() : base_nodes->GetGradient(); const auto comm = reconstruction? MPI_QUANTITIES::SOLUTION_GRAD_REC : MPI_QUANTITIES::SOLUTION_GRADIENT; const auto commPer = reconstruction? PERIODIC_SOL_GG_R : PERIODIC_SOL_GG; - computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, solution, 0, nVar, gradient, idx_vel); + computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, solution, 0, nVar, gradient, idxVel); } -void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, int idx_vel, bool reconstruction) { +void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, size_t idxVel, bool reconstruction) { /*--- Set a flag for unweighted or weighted least-squares. ---*/ bool weighted; @@ -2139,7 +2139,7 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config auto& gradient = reconstruction? base_nodes->GetGradient_Reconstruction() : base_nodes->GetGradient(); const auto comm = reconstruction? MPI_QUANTITIES::SOLUTION_GRAD_REC : MPI_QUANTITIES::SOLUTION_GRADIENT; - computeGradientsLeastSquares(this, comm, commPer, *geometry, *config, weighted, solution, 0, nVar, gradient, rmatrix, idx_vel); + computeGradientsLeastSquares(this, comm, commPer, *geometry, *config, weighted, solution, 0, nVar, gradient, rmatrix, idxVel); } void CSolver::SetUndivided_Laplacian(CGeometry *geometry, const CConfig *config) { From 7b9d53ba31245eb0f3f06e3ca40df7e606af9db0 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 23 Jun 2024 00:01:00 +0200 Subject: [PATCH 147/194] change idxVel to short --- SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp | 4 ++-- SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp | 4 ++-- SU2_CFD/include/gradients/computeGradientsSymmetry.hpp | 4 ++-- SU2_CFD/include/solvers/CSolver.hpp | 4 ++-- SU2_CFD/src/solvers/CSolver.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 1c6efb7eaa9..e14e14effef 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -60,7 +60,7 @@ namespace detail { template void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient, size_t idxVel) { + size_t varEnd, GradientType& gradient, short idxVel) { const size_t nPointDomain = geometry.GetnPointDomain(); #ifdef HAVE_OMP @@ -193,7 +193,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER template void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient, size_t idxVel) { + size_t varEnd, GradientType& gradient, short idxVel) { switch (geometry.GetnDim()) { case 2: detail::computeGradientsGreenGauss<2>(solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, diff --git a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp index 4963f451a7b..90e5eee7eb8 100644 --- a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp +++ b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp @@ -192,7 +192,7 @@ void computeGradientsLeastSquares(CSolver* solver, size_t varEnd, GradientType& gradient, RMatrixType& Rmatrix, - size_t idxVel) + short idxVel) { const bool periodic = (solver != nullptr) && (config.GetnMarker_Periodic() > 0); @@ -348,7 +348,7 @@ void computeGradientsLeastSquares(CSolver* solver, size_t varEnd, GradientType& gradient, RMatrixType& Rmatrix, - size_t idxVel + short idxVel ) { switch (geometry.GetnDim()) { case 2: diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index 7e9aba5dc81..01d5d644864 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -46,7 +46,7 @@ namespace detail { */ template inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& TensorMap, - Matrix& Gradients_iPoint, size_t idxVel) { + Matrix& Gradients_iPoint, short idxVel) { static constexpr size_t MAXNDIM = 3; su2activematrix Gradients_Velocity(nDim, nDim); @@ -201,7 +201,7 @@ inline void BaseFromNormal(Int nDim, const Scalar* UnitNormal, Matrix& TensorMap template void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient, size_t idxVel) { + size_t varEnd, GradientType& gradient, short idxVel) { static constexpr size_t MAXNDIM = 3; static constexpr size_t MAXNSYMS = 100; diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index f11ff96597f..191a61c90ea 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -546,7 +546,7 @@ class CSolver { * \param[in] idxVel - Index to velocity, -1 if no velocity is present in the solver. * \param[in] reconstruction - indicator that the gradient being computed is for upwind reconstruction. */ - void SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, size_t idxVel, bool reconstruction = false); + void SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, short idxVel, bool reconstruction = false); /*! * \brief Compute the Least Squares gradient of the solution. @@ -555,7 +555,7 @@ class CSolver { * \param[in] idxVel - Index to velocity, -1 if no velocity is present in the solver. * \param[in] reconstruction - indicator that the gradient being computed is for upwind reconstruction. */ - void SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, size_t idxVel, bool reconstruction = false); + void SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, short idxVel, bool reconstruction = false); /*! * \brief Compute the Least Squares gradient of the grid velocity. diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 669830de343..3ef2c4ba661 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -2110,7 +2110,7 @@ void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, const CConfig *config) weighted, solution, 0, base_nodes->GetnAuxVar(), gradient, rmatrix, -1); } -void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, size_t idxVel, bool reconstruction) { +void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, short idxVel, bool reconstruction) { const auto& solution = base_nodes->GetSolution(); auto& gradient = reconstruction? base_nodes->GetGradient_Reconstruction() : base_nodes->GetGradient(); @@ -2119,7 +2119,7 @@ void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, solution, 0, nVar, gradient, idxVel); } -void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, size_t idxVel, bool reconstruction) { +void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, short idxVel, bool reconstruction) { /*--- Set a flag for unweighted or weighted least-squares. ---*/ bool weighted; From 7cb3caee6a24abfbbaea629b2494ed6945561423 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 23 Jun 2024 13:30:12 +0200 Subject: [PATCH 148/194] change streamwise regression residual --- .../streamwise_periodic/chtPinArray_3d/configMaster.cfg | 2 +- TestCases/parallel_regression.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg index 7823cce2519..d7c2698fc10 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg @@ -18,7 +18,7 @@ MARKER_ZONE_INTERFACE= (fluid_bottom_interface, solid_bottom_interface, fluid_pi % MARKER_CHT_INTERFACE= (fluid_bottom_interface, solid_bottom_interface, fluid_pin1, solid_pin1, fluid_pin2, solid_pin2, fluid_pin3, solid_pin3 ) % -OUTER_ITER = 310 +OUTER_ITER = 31 % CONV_RESIDUAL_MINVAL= -26 SCREEN_OUTPUT= (OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1], TOTAL_HEATFLUX[0] ) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index d5292b2dd76..83d520cf2aa 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1318,8 +1318,8 @@ def main(): sp_pinArray_3d_cht_mf_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_3d" sp_pinArray_3d_cht_mf_hf_tp.cfg_file = "configMaster.cfg" sp_pinArray_3d_cht_mf_hf_tp.test_iter = 30 - sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-4.941475, -5.624404, -5.768771, -0.009675, 101.266576, 418.360000, 0.000000] - sp_pinArray_3d_cht_mf_hf_tp.test_vals_aarch64 = [-4.941475, -5.624404, -5.768771, -0.009675, 101.266576, 418.360000, 0.000000] + sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-1.622914, -3.081114, -4.576282, -0.009725, 104.632412, 418.370000, 0.000000] + sp_pinArray_3d_cht_mf_hf_tp.test_vals_aarch64 = [-1.622914, -3.081114, -4.576282, -0.009725, 104.632412, 418.370000, 0.000000] sp_pinArray_3d_cht_mf_hf_tp.multizone = True test_list.append(sp_pinArray_3d_cht_mf_hf_tp) From 531d237448c7603112545b0e3005a14735aa7f35 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 23 Jun 2024 14:36:06 +0200 Subject: [PATCH 149/194] pywrapper cases --- .../translating_NACA0012/forces_0.csv.ref | 400 +++++++++--------- .../forces_0.csv.ref | 400 +++++++++--------- 2 files changed, 400 insertions(+), 400 deletions(-) diff --git a/TestCases/py_wrapper/translating_NACA0012/forces_0.csv.ref b/TestCases/py_wrapper/translating_NACA0012/forces_0.csv.ref index aa9112983d0..56ad73bb9aa 100644 --- a/TestCases/py_wrapper/translating_NACA0012/forces_0.csv.ref +++ b/TestCases/py_wrapper/translating_NACA0012/forces_0.csv.ref @@ -1,200 +1,200 @@ -199, -1.01, -0.00, 0.00 -0, -2.07, 14.25, 0.00 -1, -3.62, 24.97, 0.00 -2, -4.84, 33.38, 0.00 -3, -5.85, 40.49, 0.00 -4, -6.69, 46.42, 0.00 -5, -7.36, 51.26, 0.00 -6, -7.92, 55.36, 0.00 -7, -8.34, 58.59, 0.00 -8, -8.64, 61.04, 0.00 -9, -8.83, 62.73, 0.00 -10, -8.91, 63.73, 0.00 -11, -8.90, 64.10, 0.00 -12, -8.79, 63.80, 0.00 -13, -8.59, 62.88, 0.00 -14, -8.31, 61.35, 0.00 -15, -7.95, 59.25, 0.00 -16, -7.53, 56.67, 0.00 -17, -7.05, 53.55, 0.00 -18, -6.50, 49.94, 0.00 -19, -5.90, 45.87, 0.00 -20, -5.26, 41.32, 0.00 -21, -4.57, 36.38, 0.00 -22, -3.85, 31.01, 0.00 -23, -3.09, 25.23, 0.00 -24, -2.31, 19.12, 0.00 -25, -1.51, 12.63, 0.00 -26, -0.68, 5.79, 0.00 -27, 0.16, -1.36, 0.00 -28, 1.01, -8.84, 0.00 -29, 1.86, -16.61, 0.00 -30, 2.72, -24.66, 0.00 -31, 3.58, -32.98, 0.00 -32, 4.43, -41.60, 0.00 -33, 5.28, -50.47, 0.00 -34, 6.11, -59.56, 0.00 -35, 6.93, -68.92, 0.00 -36, 7.73, -78.52, 0.00 -37, 8.50, -88.30, 0.00 -38, 9.24, -98.33, 0.00 -39, 9.95, -108.57, 0.00 -40, 10.62, -118.95, 0.00 -41, 11.24, -129.51, 0.00 -42, 11.81, -140.28, 0.00 -43, 12.33, -151.21, 0.00 -44, 12.78, -162.28, 0.00 -45, 13.15, -173.40, 0.00 -46, 13.44, -184.61, 0.00 -47, 13.64, -195.87, 0.00 -48, 13.73, -207.12, 0.00 -49, 13.72, -218.38, 0.00 -50, 13.58, -229.47, 0.00 -51, 13.30, -240.10, 0.00 -52, 12.85, -250.14, 0.00 -53, 12.31, -261.02, 0.00 -54, 11.62, -271.62, 0.00 -55, 10.32, -270.49, 0.00 -56, 8.26, -248.20, 0.00 -57, 6.94, -245.94, 0.00 -58, 7.97, -348.31, 0.00 -59, 7.61, -440.57, 0.00 -60, 5.11, -448.31, 0.00 -61, 2.28, -436.77, 0.00 -62, -0.53, -428.04, 0.00 -63, -3.36, -418.60, 0.00 -64, -6.17, -407.62, 0.00 -65, -8.93, -395.29, 0.00 -66, -11.62, -381.67, 0.00 -67, -14.20, -367.12, 0.00 -68, -16.64, -351.56, 0.00 -69, -18.92, -335.22, 0.00 -70, -21.01, -318.22, 0.00 -71, -22.89, -300.56, 0.00 -72, -24.52, -282.37, 0.00 -73, -25.88, -263.71, 0.00 -74, -26.96, -244.77, 0.00 -75, -27.72, -225.59, 0.00 -76, -28.12, -205.99, 0.00 -77, -28.13, -186.20, 0.00 -78, -27.76, -166.42, 0.00 -79, -26.92, -146.54, 0.00 -80, -25.62, -126.74, 0.00 -81, -23.79, -107.06, 0.00 -82, -21.39, -87.53, 0.00 -83, -18.36, -68.27, 0.00 -84, -14.63, -49.34, 0.00 -85, -10.10, -30.83, 0.00 -86, -4.66, -12.84, 0.00 -87, 1.82, 4.49, 0.00 -88, 9.54, 21.04, 0.00 -89, 18.64, 36.46, 0.00 -90, 29.42, 50.48, 0.00 -91, 42.11, 62.60, 0.00 -92, 56.77, 71.89, 0.00 -93, 73.41, 77.41, 0.00 -94, 91.92, 78.09, 0.00 -95, 111.10, 72.36, 0.00 -96, 128.91, 59.09, 0.00 -97, 142.62, 38.60, 0.00 -98, 108.87, 14.61, 0.00 -99, 70.25, -0.00, 0.00 -100, 103.25, -13.86, 0.00 -101, 123.24, -33.35, 0.00 -102, 98.16, -44.99, 0.00 -103, 72.48, -47.21, 0.00 -104, 48.60, -41.28, 0.00 -105, 27.56, -29.06, 0.00 -106, 9.78, -12.38, 0.00 -107, -4.77, 7.09, 0.00 -108, -16.59, 28.46, 0.00 -109, -26.11, 51.06, 0.00 -110, -33.64, 74.25, 0.00 -111, -39.61, 97.94, 0.00 -112, -44.31, 122.01, 0.00 -113, -47.92, 146.26, 0.00 -114, -50.63, 170.78, 0.00 -115, -52.57, 195.45, 0.00 -116, -53.80, 220.12, 0.00 -117, -54.43, 244.90, 0.00 -118, -54.50, 269.61, 0.00 -119, -54.06, 294.24, 0.00 -120, -53.18, 318.89, 0.00 -121, -51.86, 343.20, 0.00 -122, -50.17, 367.52, 0.00 -123, -48.12, 391.59, 0.00 -124, -45.70, 414.97, 0.00 -125, -43.01, 438.21, 0.00 -126, -40.06, 461.35, 0.00 -127, -36.86, 484.02, 0.00 -128, -33.42, 506.10, 0.00 -129, -29.77, 527.50, 0.00 -130, -25.96, 548.39, 0.00 -131, -22.00, 568.76, 0.00 -132, -17.91, 588.36, 0.00 -133, -13.73, 607.39, 0.00 -134, -9.47, 625.38, 0.00 -135, -5.15, 642.54, 0.00 -136, -0.81, 659.27, 0.00 -137, 3.53, 674.87, 0.00 -138, 7.85, 689.30, 0.00 -139, 12.15, 703.23, 0.00 -140, 16.38, 716.18, 0.00 -141, 20.53, 727.67, 0.00 -142, 24.59, 738.40, 0.00 -143, 28.55, 748.36, 0.00 -144, 32.38, 757.04, 0.00 -145, 36.06, 764.43, 0.00 -146, 39.61, 771.02, 0.00 -147, 43.00, 776.59, 0.00 -148, 46.22, 780.89, 0.00 -149, 49.29, 784.46, 0.00 -150, 52.17, 786.78, 0.00 -151, 54.87, 788.13, 0.00 -152, 57.40, 788.54, 0.00 -153, 59.77, 788.13, 0.00 -154, 61.95, 786.74, 0.00 -155, 63.49, 778.73, 0.00 -156, 67.16, 797.62, 0.00 -157, 62.16, 716.24, 0.00 -158, 1.28, 14.32, 0.00 -159, -2.99, -32.64, 0.00 -160, 0.35, 3.75, 0.00 -161, -0.04, -0.41, 0.00 -162, 0.11, 1.11, 0.00 -163, 0.13, 1.27, 0.00 -164, 0.00, 0.00, 0.00 -165, -0.22, -2.15, 0.00 -166, -0.53, -5.01, 0.00 -167, -0.91, -8.41, 0.00 -168, -1.35, -12.19, 0.00 -169, -1.83, -16.27, 0.00 -170, -2.34, -20.53, 0.00 -171, -2.88, -24.89, 0.00 -172, -3.44, -29.28, 0.00 -173, -4.01, -33.68, 0.00 -174, -4.59, -37.96, 0.00 -175, -5.16, -42.10, 0.00 -176, -5.72, -46.12, 0.00 -177, -6.27, -49.88, 0.00 -178, -6.79, -53.37, 0.00 -179, -7.28, -56.59, 0.00 -180, -7.74, -59.45, 0.00 -181, -8.15, -61.97, 0.00 -182, -8.52, -64.08, 0.00 -183, -8.82, -65.74, 0.00 -184, -9.08, -67.01, 0.00 -185, -9.26, -67.76, 0.00 -186, -9.37, -67.96, 0.00 -187, -9.39, -67.62, 0.00 -188, -9.32, -66.63, 0.00 -189, -9.16, -65.08, 0.00 -190, -8.90, -62.89, 0.00 -191, -8.54, -59.98, 0.00 -192, -8.06, -56.33, 0.00 -193, -7.45, -51.85, 0.00 -194, -6.73, -46.69, 0.00 -195, -5.85, -40.49, 0.00 -196, -4.79, -33.08, 0.00 -197, -3.55, -24.47, 0.00 -198, -1.91, -13.14, 0.00 +199, -0.85, -0.00, 0.00 +0, -2.66, 18.33, 0.00 +1, -3.73, 25.70, 0.00 +2, -4.53, 31.27, 0.00 +3, -5.24, 36.23, 0.00 +4, -5.81, 40.33, 0.00 +5, -6.25, 43.55, 0.00 +6, -6.60, 46.13, 0.00 +7, -6.83, 47.96, 0.00 +8, -6.95, 49.09, 0.00 +9, -6.97, 49.54, 0.00 +10, -6.90, 49.35, 0.00 +11, -6.74, 48.57, 0.00 +12, -6.50, 47.14, 0.00 +13, -6.17, 45.13, 0.00 +14, -5.76, 42.53, 0.00 +15, -5.29, 39.38, 0.00 +16, -4.75, 35.75, 0.00 +17, -4.16, 31.65, 0.00 +18, -3.53, 27.09, 0.00 +19, -2.85, 22.14, 0.00 +20, -2.14, 16.79, 0.00 +21, -1.39, 11.10, 0.00 +22, -0.63, 5.06, 0.00 +23, 0.16, -1.33, 0.00 +24, 0.98, -8.10, 0.00 +25, 1.82, -15.27, 0.00 +26, 2.68, -22.82, 0.00 +27, 3.56, -30.76, 0.00 +28, 4.45, -39.00, 0.00 +29, 5.32, -47.44, 0.00 +30, 6.19, -56.07, 0.00 +31, 7.05, -64.97, 0.00 +32, 7.91, -74.28, 0.00 +33, 8.78, -83.97, 0.00 +34, 9.63, -93.91, 0.00 +35, 10.46, -104.09, 0.00 +36, 11.25, -114.37, 0.00 +37, 12.00, -124.73, 0.00 +38, 12.71, -135.28, 0.00 +39, 13.38, -145.98, 0.00 +40, 13.99, -156.79, 0.00 +41, 14.55, -167.72, 0.00 +42, 15.06, -178.80, 0.00 +43, 15.48, -189.92, 0.00 +44, 15.83, -201.03, 0.00 +45, 16.07, -211.97, 0.00 +46, 16.22, -222.82, 0.00 +47, 16.27, -233.68, 0.00 +48, 16.23, -244.83, 0.00 +49, 16.13, -256.65, 0.00 +50, 15.93, -269.12, 0.00 +51, 15.62, -282.01, 0.00 +52, 15.14, -294.70, 0.00 +53, 14.49, -307.24, 0.00 +54, 13.68, -319.91, 0.00 +55, 12.67, -332.16, 0.00 +56, 11.42, -342.95, 0.00 +57, 9.91, -351.31, 0.00 +58, 8.15, -356.48, 0.00 +59, 6.19, -358.24, 0.00 +60, 4.07, -357.17, 0.00 +61, 1.85, -353.80, 0.00 +62, -0.43, -348.10, 0.00 +63, -2.73, -340.32, 0.00 +64, -5.01, -331.03, 0.00 +65, -7.24, -320.26, 0.00 +66, -9.38, -308.18, 0.00 +67, -11.42, -295.32, 0.00 +68, -13.34, -281.72, 0.00 +69, -15.11, -267.62, 0.00 +70, -16.72, -253.15, 0.00 +71, -18.14, -238.20, 0.00 +72, -19.34, -222.69, 0.00 +73, -20.27, -206.50, 0.00 +74, -20.91, -189.85, 0.00 +75, -21.24, -172.83, 0.00 +76, -21.19, -155.22, 0.00 +77, -20.73, -137.21, 0.00 +78, -19.84, -118.97, 0.00 +79, -18.47, -100.51, 0.00 +80, -16.59, -82.08, 0.00 +81, -14.17, -63.76, 0.00 +82, -11.16, -45.67, 0.00 +83, -7.51, -27.92, 0.00 +84, -3.16, -10.66, 0.00 +85, 1.96, 5.99, 0.00 +86, 7.98, 21.97, 0.00 +87, 15.01, 37.12, 0.00 +88, 23.22, 51.25, 0.00 +89, 32.70, 63.95, 0.00 +90, 43.60, 74.81, 0.00 +91, 56.10, 83.39, 0.00 +92, 70.04, 88.70, 0.00 +93, 85.41, 90.05, 0.00 +94, 101.82, 86.49, 0.00 +95, 118.17, 76.97, 0.00 +96, 133.74, 61.30, 0.00 +97, 147.39, 39.89, 0.00 +98, 111.90, 15.02, 0.00 +99, 71.22, -0.00, 0.00 +100, 109.26, -14.66, 0.00 +101, 137.60, -37.24, 0.00 +102, 115.95, -53.15, 0.00 +103, 93.75, -61.06, 0.00 +104, 72.27, -61.39, 0.00 +105, 52.36, -55.20, 0.00 +106, 34.79, -44.05, 0.00 +107, 19.66, -29.23, 0.00 +108, 6.81, -11.68, 0.00 +109, -3.93, 7.68, 0.00 +110, -12.86, 28.37, 0.00 +111, -20.21, 49.96, 0.00 +112, -26.23, 72.22, 0.00 +113, -31.05, 94.79, 0.00 +114, -34.88, 117.65, 0.00 +115, -37.90, 140.89, 0.00 +116, -40.20, 164.49, 0.00 +117, -41.88, 188.42, 0.00 +118, -43.00, 212.71, 0.00 +119, -43.62, 237.42, 0.00 +120, -43.64, 261.69, 0.00 +121, -43.10, 285.24, 0.00 +122, -42.11, 308.46, 0.00 +123, -40.72, 331.35, 0.00 +124, -38.94, 353.54, 0.00 +125, -36.84, 375.42, 0.00 +126, -34.48, 397.10, 0.00 +127, -31.85, 418.29, 0.00 +128, -28.97, 438.71, 0.00 +129, -25.85, 458.00, 0.00 +130, -22.55, 476.33, 0.00 +131, -19.10, 493.80, 0.00 +132, -15.54, 510.37, 0.00 +133, -11.90, 526.39, 0.00 +134, -8.20, 541.54, 0.00 +135, -4.46, 556.04, 0.00 +136, -0.70, 570.26, 0.00 +137, 3.05, 583.60, 0.00 +138, 6.79, 596.04, 0.00 +139, 10.50, 608.18, 0.00 +140, 14.17, 619.60, 0.00 +141, 17.77, 629.84, 0.00 +142, 21.29, 639.37, 0.00 +143, 24.72, 648.06, 0.00 +144, 28.03, 655.33, 0.00 +145, 31.19, 661.08, 0.00 +146, 34.20, 665.74, 0.00 +147, 37.05, 669.08, 0.00 +148, 39.71, 670.85, 0.00 +149, 42.17, 671.22, 0.00 +150, 44.38, 669.34, 0.00 +151, 46.26, 664.42, 0.00 +152, 47.51, 652.70, 0.00 +153, 46.78, 616.94, 0.00 +154, 39.70, 504.23, 0.00 +155, 24.94, 305.93, 0.00 +156, 16.44, 195.28, 0.00 +157, 13.94, 160.59, 0.00 +158, 13.18, 147.63, 0.00 +159, 12.74, 138.97, 0.00 +160, 12.29, 130.81, 0.00 +161, 11.80, 122.63, 0.00 +162, 11.26, 114.42, 0.00 +163, 10.66, 106.07, 0.00 +164, 10.01, 97.60, 0.00 +165, 9.32, 89.11, 0.00 +166, 8.57, 80.48, 0.00 +167, 7.78, 71.77, 0.00 +168, 6.96, 63.07, 0.00 +169, 6.10, 54.40, 0.00 +170, 5.22, 45.80, 0.00 +171, 4.33, 37.37, 0.00 +172, 3.44, 29.24, 0.00 +173, 2.56, 21.44, 0.00 +174, 1.69, 13.95, 0.00 +175, 0.83, 6.81, 0.00 +176, 0.01, 0.05, 0.00 +177, -0.80, -6.35, 0.00 +178, -1.58, -12.38, 0.00 +179, -2.32, -18.05, 0.00 +180, -3.04, -23.33, 0.00 +181, -3.71, -28.22, 0.00 +182, -4.34, -32.66, 0.00 +183, -4.92, -36.62, 0.00 +184, -5.43, -40.09, 0.00 +185, -5.87, -42.98, 0.00 +186, -6.24, -45.27, 0.00 +187, -6.52, -46.94, 0.00 +188, -6.70, -47.94, 0.00 +189, -6.80, -48.33, 0.00 +190, -6.80, -48.04, 0.00 +191, -6.70, -47.05, 0.00 +192, -6.48, -45.33, 0.00 +193, -6.15, -42.84, 0.00 +194, -5.72, -39.70, 0.00 +195, -5.15, -35.65, 0.00 +196, -4.45, -30.72, 0.00 +197, -3.65, -25.15, 0.00 +198, -2.59, -17.80, 0.00 diff --git a/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref b/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref index de783b9af84..e9571f63c89 100644 --- a/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref +++ b/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref @@ -1,200 +1,200 @@ -199, -1.02, -0.00, 0.00 -0, -2.05, 14.11, 0.00 -1, -3.63, 25.02, 0.00 -2, -4.85, 33.50, 0.00 -3, -5.88, 40.69, 0.00 -4, -6.73, 46.67, 0.00 -5, -7.41, 51.56, 0.00 -6, -7.97, 55.71, 0.00 -7, -8.40, 58.99, 0.00 -8, -8.71, 61.49, 0.00 -9, -8.90, 63.22, 0.00 -10, -8.98, 64.25, 0.00 -11, -8.98, 64.66, 0.00 -12, -8.87, 64.38, 0.00 -13, -8.68, 63.48, 0.00 -14, -8.39, 61.96, 0.00 -15, -8.03, 59.85, 0.00 -16, -7.61, 57.27, 0.00 -17, -7.12, 54.13, 0.00 -18, -6.57, 50.50, 0.00 -19, -5.97, 46.39, 0.00 -20, -5.32, 41.81, 0.00 -21, -4.63, 36.81, 0.00 -22, -3.90, 31.39, 0.00 -23, -3.13, 25.55, 0.00 -24, -2.34, 19.36, 0.00 -25, -1.53, 12.80, 0.00 -26, -0.69, 5.88, 0.00 -27, 0.16, -1.35, 0.00 -28, 1.02, -8.91, 0.00 -29, 1.88, -16.75, 0.00 -30, 2.74, -24.86, 0.00 -31, 3.61, -33.24, 0.00 -32, 4.46, -41.89, 0.00 -33, 5.31, -50.77, 0.00 -34, 6.14, -59.83, 0.00 -35, 6.95, -69.11, 0.00 -36, 7.73, -78.56, 0.00 -37, 8.48, -88.13, 0.00 -38, 9.19, -97.82, 0.00 -39, 9.86, -107.57, 0.00 -40, 10.47, -117.28, 0.00 -41, 11.01, -126.92, 0.00 -42, 11.49, -136.42, 0.00 -43, 11.87, -145.62, 0.00 -44, 12.15, -154.31, 0.00 -45, 12.30, -162.22, 0.00 -46, 12.31, -169.04, 0.00 -47, 12.11, -173.89, 0.00 -48, 11.66, -175.88, 0.00 -49, 11.13, -177.08, 0.00 -50, 10.20, -172.29, 0.00 -51, 6.86, -123.94, 0.00 -52, 5.97, -116.29, 0.00 -53, 21.77, -461.42, 0.00 -54, 26.12, -610.78, 0.00 -55, 21.89, -573.85, 0.00 -56, 18.71, -561.76, 0.00 -57, 15.72, -557.10, 0.00 -58, 12.57, -549.52, 0.00 -59, 9.33, -540.36, 0.00 -60, 6.04, -530.05, 0.00 -61, 2.71, -518.89, 0.00 -62, -0.62, -506.43, 0.00 -63, -3.95, -492.74, 0.00 -64, -7.24, -478.42, 0.00 -65, -10.47, -463.16, 0.00 -66, -13.60, -446.83, 0.00 -67, -16.63, -429.81, 0.00 -68, -19.50, -411.99, 0.00 -69, -22.22, -393.60, 0.00 -70, -24.75, -374.77, 0.00 -71, -27.06, -355.42, 0.00 -72, -29.14, -335.60, 0.00 -73, -30.94, -315.27, 0.00 -74, -32.45, -294.65, 0.00 -75, -33.65, -273.85, 0.00 -76, -34.49, -252.64, 0.00 -77, -34.95, -231.28, 0.00 -78, -35.02, -209.98, 0.00 -79, -34.64, -188.53, 0.00 -80, -33.79, -167.17, 0.00 -81, -32.42, -145.88, 0.00 -82, -30.48, -124.69, 0.00 -83, -27.91, -103.76, 0.00 -84, -24.63, -83.06, 0.00 -85, -20.55, -62.73, 0.00 -86, -15.56, -42.84, 0.00 -87, -9.50, -23.48, 0.00 -88, -2.17, -4.79, 0.00 -89, 6.62, 12.94, 0.00 -90, 17.16, 29.44, 0.00 -91, 29.73, 44.19, 0.00 -92, 44.58, 56.46, 0.00 -93, 61.71, 65.06, 0.00 -94, 81.10, 68.89, 0.00 -95, 101.88, 66.36, 0.00 -96, 122.09, 55.96, 0.00 -97, 139.13, 37.65, 0.00 -98, 108.84, 14.60, 0.00 -99, 71.28, -0.00, 0.00 -100, 106.29, -14.26, 0.00 -101, 130.33, -35.27, 0.00 -102, 108.14, -49.57, 0.00 -103, 84.37, -54.95, 0.00 -104, 61.43, -52.19, 0.00 -105, 40.94, -43.16, 0.00 -106, 23.22, -29.41, 0.00 -107, 8.42, -12.52, 0.00 -108, -3.78, 6.48, 0.00 -109, -13.76, 26.90, 0.00 -110, -21.85, 48.23, 0.00 -111, -28.39, 70.19, 0.00 -112, -33.65, 92.65, 0.00 -113, -37.82, 115.44, 0.00 -114, -41.08, 138.55, 0.00 -115, -43.55, 161.90, 0.00 -116, -45.31, 185.37, 0.00 -117, -46.46, 209.03, 0.00 -118, -47.03, 232.69, 0.00 -119, -47.10, 256.34, 0.00 -120, -46.71, 280.06, 0.00 -121, -45.86, 303.51, 0.00 -122, -44.63, 326.98, 0.00 -123, -43.04, 350.21, 0.00 -124, -41.06, 372.86, 0.00 -125, -38.81, 395.46, 0.00 -126, -36.30, 418.02, 0.00 -127, -33.51, 440.10, 0.00 -128, -30.48, 461.60, 0.00 -129, -27.23, 482.42, 0.00 -130, -23.80, 502.74, 0.00 -131, -20.21, 522.54, 0.00 -132, -16.49, 541.62, 0.00 -133, -12.66, 560.14, 0.00 -134, -8.74, 577.66, 0.00 -135, -4.77, 594.37, 0.00 -136, -0.75, 610.64, 0.00 -137, 3.27, 625.80, 0.00 -138, 7.29, 639.80, 0.00 -139, 11.28, 653.28, 0.00 -140, 15.23, 665.78, 0.00 -141, 19.09, 676.85, 0.00 -142, 22.88, 687.16, 0.00 -143, 26.58, 696.67, 0.00 -144, 30.15, 704.91, 0.00 -145, 33.58, 711.87, 0.00 -146, 36.88, 717.99, 0.00 -147, 40.04, 723.07, 0.00 -148, 43.03, 726.92, 0.00 -149, 45.86, 729.95, 0.00 -150, 48.47, 730.99, 0.00 -151, 50.57, 726.34, 0.00 -152, 54.71, 751.52, 0.00 -153, 52.81, 696.43, 0.00 -154, 5.64, 71.68, 0.00 -155, -0.65, -7.95, 0.00 -156, 3.46, 41.08, 0.00 -157, 3.63, 41.77, 0.00 -158, 4.01, 44.95, 0.00 -159, 4.28, 46.74, 0.00 -160, 4.32, 46.00, 0.00 -161, 4.21, 43.77, 0.00 -162, 3.98, 40.43, 0.00 -163, 3.64, 36.21, 0.00 -164, 3.22, 31.35, 0.00 -165, 2.72, 26.01, 0.00 -166, 2.16, 20.31, 0.00 -167, 1.56, 14.37, 0.00 -168, 0.92, 8.30, 0.00 -169, 0.24, 2.16, 0.00 -170, -0.45, -3.98, 0.00 -171, -1.16, -10.05, 0.00 -172, -1.88, -15.99, 0.00 -173, -2.60, -21.79, 0.00 -174, -3.31, -27.36, 0.00 -175, -4.00, -32.68, 0.00 -176, -4.69, -37.76, 0.00 -177, -5.34, -42.49, 0.00 -178, -5.96, -46.87, 0.00 -179, -6.55, -50.90, 0.00 -180, -7.09, -54.49, 0.00 -181, -7.59, -57.67, 0.00 -182, -8.03, -60.38, 0.00 -183, -8.40, -62.58, 0.00 -184, -8.72, -64.34, 0.00 -185, -8.96, -65.53, 0.00 -186, -9.11, -66.13, 0.00 -187, -9.18, -66.13, 0.00 -188, -9.15, -65.46, 0.00 -189, -9.04, -64.19, 0.00 -190, -8.81, -62.24, 0.00 -191, -8.48, -59.55, 0.00 -192, -8.02, -56.09, 0.00 -193, -7.44, -51.78, 0.00 -194, -6.74, -46.74, 0.00 -195, -5.87, -40.64, 0.00 -196, -4.83, -33.31, 0.00 -197, -3.59, -24.74, 0.00 -198, -1.96, -13.51, 0.00 +199, -1.01, -0.00, 0.00 +0, -2.98, 20.50, 0.00 +1, -3.99, 27.46, 0.00 +2, -5.22, 36.06, 0.00 +3, -6.10, 42.20, 0.00 +4, -6.90, 47.88, 0.00 +5, -7.54, 52.52, 0.00 +6, -8.08, 56.52, 0.00 +7, -8.50, 59.69, 0.00 +8, -8.79, 62.11, 0.00 +9, -8.98, 63.80, 0.00 +10, -9.06, 64.81, 0.00 +11, -9.06, 65.22, 0.00 +12, -8.95, 64.94, 0.00 +13, -8.75, 64.06, 0.00 +14, -8.48, 62.56, 0.00 +15, -8.12, 60.48, 0.00 +16, -7.70, 57.92, 0.00 +17, -7.21, 54.81, 0.00 +18, -6.66, 51.20, 0.00 +19, -6.07, 47.12, 0.00 +20, -5.42, 42.57, 0.00 +21, -4.73, 37.59, 0.00 +22, -4.00, 32.19, 0.00 +23, -3.23, 26.37, 0.00 +24, -2.44, 20.21, 0.00 +25, -1.63, 13.66, 0.00 +26, -0.79, 6.76, 0.00 +27, 0.05, -0.45, 0.00 +28, 0.91, -7.99, 0.00 +29, 1.77, -15.81, 0.00 +30, 2.64, -23.91, 0.00 +31, 3.50, -32.27, 0.00 +32, 4.36, -40.90, 0.00 +33, 5.20, -49.76, 0.00 +34, 6.03, -58.80, 0.00 +35, 6.84, -68.06, 0.00 +36, 7.63, -77.50, 0.00 +37, 8.37, -87.04, 0.00 +38, 9.09, -96.70, 0.00 +39, 9.76, -106.43, 0.00 +40, 10.37, -116.12, 0.00 +41, 10.91, -125.73, 0.00 +42, 11.39, -135.21, 0.00 +43, 11.77, -144.39, 0.00 +44, 12.05, -153.08, 0.00 +45, 12.21, -161.05, 0.00 +46, 12.22, -167.88, 0.00 +47, 12.01, -172.51, 0.00 +48, 11.61, -175.12, 0.00 +49, 11.25, -179.01, 0.00 +50, 10.12, -170.90, 0.00 +51, 6.24, -112.75, 0.00 +52, 6.61, -128.63, 0.00 +53, 20.84, -441.83, 0.00 +54, 25.65, -599.65, 0.00 +55, 21.77, -570.80, 0.00 +56, 18.66, -560.26, 0.00 +57, 15.64, -554.49, 0.00 +58, 12.51, -546.85, 0.00 +59, 9.28, -537.57, 0.00 +60, 6.01, -527.15, 0.00 +61, 2.70, -515.89, 0.00 +62, -0.62, -503.33, 0.00 +63, -3.92, -489.55, 0.00 +64, -7.19, -475.11, 0.00 +65, -10.39, -459.75, 0.00 +66, -13.50, -443.31, 0.00 +67, -16.49, -426.20, 0.00 +68, -19.33, -408.27, 0.00 +69, -22.00, -389.78, 0.00 +70, -24.49, -370.85, 0.00 +71, -26.76, -351.39, 0.00 +72, -28.78, -331.47, 0.00 +73, -30.52, -311.04, 0.00 +74, -31.97, -290.33, 0.00 +75, -33.11, -269.42, 0.00 +76, -33.86, -248.08, 0.00 +77, -34.24, -226.61, 0.00 +78, -34.22, -205.20, 0.00 +79, -33.74, -183.64, 0.00 +80, -32.78, -162.19, 0.00 +81, -31.29, -140.79, 0.00 +82, -29.21, -119.49, 0.00 +83, -26.48, -98.43, 0.00 +84, -23.02, -77.63, 0.00 +85, -18.75, -57.22, 0.00 +86, -13.54, -37.28, 0.00 +87, -7.23, -17.89, 0.00 +88, 0.32, 0.71, 0.00 +89, 9.35, 18.28, 0.00 +90, 20.02, 34.35, 0.00 +91, 32.65, 48.54, 0.00 +92, 47.34, 59.96, 0.00 +93, 64.24, 67.74, 0.00 +94, 83.11, 70.60, 0.00 +95, 102.71, 66.90, 0.00 +96, 121.38, 55.64, 0.00 +97, 137.08, 37.10, 0.00 +98, 106.89, 14.34, 0.00 +99, 69.93, -0.00, 0.00 +100, 104.81, -14.06, 0.00 +101, 129.39, -35.02, 0.00 +102, 108.98, -49.95, 0.00 +103, 86.90, -56.60, 0.00 +104, 64.97, -55.19, 0.00 +105, 44.71, -47.14, 0.00 +106, 27.08, -34.30, 0.00 +107, 12.21, -18.16, 0.00 +108, -0.23, 0.39, 0.00 +109, -10.50, 20.54, 0.00 +110, -18.96, 41.85, 0.00 +111, -25.82, 63.84, 0.00 +112, -31.39, 86.44, 0.00 +113, -35.84, 109.39, 0.00 +114, -39.33, 132.66, 0.00 +115, -42.01, 156.16, 0.00 +116, -43.95, 179.80, 0.00 +117, -45.26, 203.64, 0.00 +118, -45.98, 227.47, 0.00 +119, -46.16, 251.27, 0.00 +120, -45.89, 275.14, 0.00 +121, -45.14, 298.74, 0.00 +122, -44.00, 322.34, 0.00 +123, -42.49, 345.71, 0.00 +124, -40.58, 368.50, 0.00 +125, -38.39, 391.21, 0.00 +126, -35.94, 413.88, 0.00 +127, -33.21, 436.09, 0.00 +128, -30.22, 457.70, 0.00 +129, -27.02, 478.65, 0.00 +130, -23.62, 499.09, 0.00 +131, -20.08, 519.03, 0.00 +132, -16.39, 538.22, 0.00 +133, -12.59, 556.86, 0.00 +134, -8.70, 574.51, 0.00 +135, -4.74, 591.34, 0.00 +136, -0.75, 607.73, 0.00 +137, 3.26, 623.00, 0.00 +138, 7.26, 637.13, 0.00 +139, 11.24, 650.73, 0.00 +140, 15.17, 663.34, 0.00 +141, 19.03, 674.54, 0.00 +142, 22.81, 684.95, 0.00 +143, 26.50, 694.58, 0.00 +144, 30.06, 702.94, 0.00 +145, 33.49, 710.01, 0.00 +146, 36.79, 716.23, 0.00 +147, 39.95, 721.39, 0.00 +148, 42.93, 725.31, 0.00 +149, 45.77, 728.51, 0.00 +150, 48.44, 730.59, 0.00 +151, 50.61, 726.85, 0.00 +152, 53.86, 739.83, 0.00 +153, 53.31, 702.96, 0.00 +154, 8.15, 103.49, 0.00 +155, -2.34, -28.69, 0.00 +156, 3.11, 36.88, 0.00 +157, 3.81, 43.93, 0.00 +158, 3.88, 43.46, 0.00 +159, 4.18, 45.56, 0.00 +160, 4.24, 45.15, 0.00 +161, 4.13, 42.94, 0.00 +162, 3.90, 39.62, 0.00 +163, 3.56, 35.42, 0.00 +164, 3.14, 30.58, 0.00 +165, 2.64, 25.27, 0.00 +166, 2.09, 19.60, 0.00 +167, 1.48, 13.68, 0.00 +168, 0.84, 7.64, 0.00 +169, 0.17, 1.53, 0.00 +170, -0.52, -4.58, 0.00 +171, -1.23, -10.62, 0.00 +172, -1.94, -16.53, 0.00 +173, -2.66, -22.30, 0.00 +174, -3.37, -27.85, 0.00 +175, -4.06, -33.13, 0.00 +176, -4.74, -38.17, 0.00 +177, -5.39, -42.87, 0.00 +178, -6.01, -47.21, 0.00 +179, -6.59, -51.20, 0.00 +180, -7.13, -54.76, 0.00 +181, -7.62, -57.90, 0.00 +182, -8.05, -60.58, 0.00 +183, -8.42, -62.75, 0.00 +184, -8.74, -64.48, 0.00 +185, -8.97, -65.65, 0.00 +186, -9.13, -66.23, 0.00 +187, -9.20, -66.23, 0.00 +188, -9.17, -65.58, 0.00 +189, -9.06, -64.33, 0.00 +190, -8.84, -62.44, 0.00 +191, -8.52, -59.84, 0.00 +192, -8.08, -56.51, 0.00 +193, -7.52, -52.37, 0.00 +194, -6.86, -47.60, 0.00 +195, -6.05, -41.82, 0.00 +196, -5.16, -35.60, 0.00 +197, -3.91, -26.94, 0.00 +198, -2.89, -19.92, 0.00 From eadcfcce2ee75da38b542eeec475f3fd37c8e0fe Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 24 Jun 2024 21:47:29 +0200 Subject: [PATCH 150/194] fix edge_VW --- TestCases/nicf/edge/edge_VW.cfg | 2 +- .../py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/nicf/edge/edge_VW.cfg b/TestCases/nicf/edge/edge_VW.cfg index d7d28ac554c..9c458b706fc 100644 --- a/TestCases/nicf/edge/edge_VW.cfg +++ b/TestCases/nicf/edge/edge_VW.cfg @@ -71,7 +71,7 @@ MGCYCLE= W_CYCLE MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) MG_POST_SMOOTH= ( 0, 0, 0, 0 ) MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) -MG_DAMP_RESTRICTION= 0.8 +MG_DAMP_RESTRICTION= 0.4 MG_DAMP_PROLONGATION= 0.8 % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% diff --git a/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref b/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref index e9571f63c89..2e4f90bda43 100644 --- a/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref +++ b/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref @@ -155,7 +155,7 @@ 153, 53.31, 702.96, 0.00 154, 8.15, 103.49, 0.00 155, -2.34, -28.69, 0.00 -156, 3.11, 36.88, 0.00 +156, 3.10, 36.88, 0.00 157, 3.81, 43.93, 0.00 158, 3.88, 43.46, 0.00 159, 4.18, 45.56, 0.00 From f91aeb3606c2a536a66169366dbb9c86b828bee1 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 24 Jun 2024 22:34:15 +0200 Subject: [PATCH 151/194] fix edge_VW --- TestCases/nicf/edge/edge_VW.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TestCases/nicf/edge/edge_VW.cfg b/TestCases/nicf/edge/edge_VW.cfg index 9c458b706fc..add439803e6 100644 --- a/TestCases/nicf/edge/edge_VW.cfg +++ b/TestCases/nicf/edge/edge_VW.cfg @@ -69,10 +69,10 @@ LINEAR_SOLVER_ITER= 10 MGLEVEL= 3 MGCYCLE= W_CYCLE MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) -MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +MG_POST_SMOOTH= ( 1, 1, 1, 1 ) MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) -MG_DAMP_RESTRICTION= 0.4 -MG_DAMP_PROLONGATION= 0.8 +MG_DAMP_RESTRICTION= 0.85 +MG_DAMP_PROLONGATION= 0.85 % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % From 2d26e6b6bb5052504027a3eabc7ef909f51197c1 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 25 Jun 2024 07:06:41 +0200 Subject: [PATCH 152/194] fix edge_VW --- TestCases/hybrid_regression.py | 2 +- TestCases/parallel_regression.py | 2 +- TestCases/serial_regression.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 92dd1bf1973..9954c7987d5 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -540,7 +540,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 40 - edge_VW.test_vals = [-7.060147, -0.888789, -0.000009, 0.000000] + edge_VW.test_vals = [-5.759815, 0.398128, -0.000009, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 83d520cf2aa..5840d2f8056 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1020,7 +1020,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 50 - edge_VW.test_vals = [-9.836297, -3.632881, -0.000009, 0.000000] + edge_VW.test_vals = [-8.107432, -1.914195, -0.000009, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 4f984eacb0f..f4baf5cee11 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -839,7 +839,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 20 - edge_VW.test_vals = [-0.580474, 5.621653, -0.006098, 0.000000] + edge_VW.test_vals = [-0.768929, 5.433202, -0.000628, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR From 9955a4ac4682f2f1447901f0a9c6d3c28a800358 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 27 Jun 2024 00:00:01 +0200 Subject: [PATCH 153/194] move normal correction for shared symmetry-nodes --- Common/src/geometry/CPhysicalGeometry.cpp | 76 +++++++++++++++ .../include/solvers/CFVMFlowSolverBase.inl | 96 +++++++++---------- 2 files changed, 124 insertions(+), 48 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 8d21c4a3831..3ad0c3051df 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7283,6 +7283,82 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } } END_SU2_OMP_FOR + + + + /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against + All nodes that are shared by multiple symmetries have to get a corrected normal. */ + static constexpr size_t MAXNSYMS = 100; + unsigned short Syms[MAXNSYMS] = {0}; + + unsigned short nSym = 0; + for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { + if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + /*--- Note that Syms is a sorted list, so val(Syms[i]) > val[Syms[i-1]] ---*/ + Syms[nSym] = iMarker; + nSym++; + } + } + + /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ + for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { + + for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { + const auto iPoint = vertex[val_marker][iVertex]->GetNode(); + + /*--- Halo points do not need to be considered. ---*/ + if (!nodes->GetDomain(iPoint)) continue; + + /*--- Get the normal of the current symmetry ---*/ + su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; + vertex[val_marker][iVertex]->GetNormal(Normal); + const su2double Area = GeometryToolbox::Norm(nDim, Normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; + + /*--- At this point we find out if the node is shared with another symmetry. ---*/ + /*--- We then apply a Gram-Schmidt process to compute the orthonormal basis from all + normal vectors of the shared symmetries at the node. ---*/ + /*--- Step 1: do we have other symmetries? ---*/ + if (nSym>1) { + /*--- Normal of the primary symmetry plane ---*/ + su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; + /*--- Step 2: are we on a shared node? ---*/ + for (auto iMarker=0;iMarkerGetNode(); + if (!nodes->GetDomain(jPoint)) continue; + /*--- We are on a shared node. ---*/ + if (iPoint==jPoint) { + /*--- So we have to get the normal of that other marker ---*/ + vertex[Syms[iMarker]][jVertex]->GetNormal(NormalPrim); + su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); + for(unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; + } + /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ + su2double ProjNorm = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + /*--- We check if the normal of the 2 planes coincide. + * We only update the normal if the normals of the symmetry planes are different. ---*/ + if (fabs(1.0-ProjNorm)>EPS) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; + /*--- Make normalized vector ---*/ + su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; + vertex[val_marker][iVertex]->SetNormal(UnitNormal); + } + } + } + } + } + } + } + } + } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 24df184e3c9..75ff92685c5 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1146,17 +1146,17 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against - static constexpr size_t MAXNSYMS = 100; - - unsigned short Syms[MAXNSYMS] = {0}; - unsigned short nSym = 0; - for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { - if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - Syms[nSym] = iMarker; - nSym++; - } - } + // static constexpr size_t MAXNSYMS = 100; + + // unsigned short Syms[MAXNSYMS] = {0}; + // unsigned short nSym = 0; + // for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { + // if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + // (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + // Syms[nSym] = iMarker; + // nSym++; + // } + // } /*--- Loop over all the vertices on this boundary marker. ---*/ @@ -1177,43 +1177,43 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve /*--- At this point we find out if the node is shared with another symmetry. ---*/ /*--- Step 1: do we have other symmetries? ---*/ - if (nSym>1) { - /*--- Normal of the primary symmetry plane ---*/ - su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - /*--- Step 2: are we on a shared node? ---*/ - for (auto iMarker=0;iMarkernVertex[Syms[iMarker]]; jVertex++) { - const auto jPoint = geometry->vertex[Syms[iMarker]][jVertex]->GetNode(); - if (!geometry->nodes->GetDomain(jPoint)) continue; - if (iPoint==jPoint) { - /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ - if (Syms[iMarker]vertex[Syms[iMarker]][jVertex]->GetNormal(NormalPrim); - su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - for(unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - } - /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ - su2double ProjNorm = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - /*--- We check if the normal of the 2 planes coincide. - * We only update the normal if the normals of the symmetry planes are different. ---*/ - if (fabs(1.0-ProjNorm)>EPS) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - /*--- Make normalized vector ---*/ - su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; - } - } - } - } - } - } - } + // if (nSym>1) { + // /*--- Normal of the primary symmetry plane ---*/ + // su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; + // /*--- Step 2: are we on a shared node? ---*/ + // for (auto iMarker=0;iMarkernVertex[Syms[iMarker]]; jVertex++) { + // const auto jPoint = geometry->vertex[Syms[iMarker]][jVertex]->GetNode(); + // if (!geometry->nodes->GetDomain(jPoint)) continue; + // if (iPoint==jPoint) { + // /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ + // if (Syms[iMarker]vertex[Syms[iMarker]][jVertex]->GetNormal(NormalPrim); + // su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); + // for(unsigned short iDim = 0; iDim < nDim; iDim++) { + // UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; + // } + // /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ + // su2double ProjNorm = 0.0; + // for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + // /*--- We check if the normal of the 2 planes coincide. + // * We only update the normal if the normals of the symmetry planes are different. ---*/ + // if (fabs(1.0-ProjNorm)>EPS) { + // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; + // /*--- Make normalized vector ---*/ + // su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); + // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; + // } + // } + // } + // } + // } + // } + // } V_reflected = GetCharacPrimVar(val_marker, iVertex); From a3c268b1272d53b4c9c36416622f2b6257e73ef1 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 27 Jun 2024 08:12:22 +0200 Subject: [PATCH 154/194] move normal correction for shared symmetry-nodes --- Common/src/geometry/CPhysicalGeometry.cpp | 54 +++++++++++------------ 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 3ad0c3051df..8a4702b412f 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7284,8 +7284,6 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } END_SU2_OMP_FOR - - /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against All nodes that are shared by multiple symmetries have to get a corrected normal. */ static constexpr size_t MAXNSYMS = 100; @@ -7295,15 +7293,14 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - /*--- Note that Syms is a sorted list, so val(Syms[i]) > val[Syms[i-1]] ---*/ - Syms[nSym] = iMarker; - nSym++; + /*--- Note that Syms is a sorted list, so val(Syms[i]) > val[Syms[i-1]] ---*/ + Syms[nSym] = iMarker; + nSym++; } } /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { - for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { const auto iPoint = vertex[val_marker][iVertex]->GetNode(); @@ -7320,37 +7317,37 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh /*--- We then apply a Gram-Schmidt process to compute the orthonormal basis from all normal vectors of the shared symmetries at the node. ---*/ /*--- Step 1: do we have other symmetries? ---*/ - if (nSym>1) { + if (nSym > 1) { /*--- Normal of the primary symmetry plane ---*/ su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; /*--- Step 2: are we on a shared node? ---*/ - for (auto iMarker=0;iMarkerGetNode(); if (!nodes->GetDomain(jPoint)) continue; /*--- We are on a shared node. ---*/ - if (iPoint==jPoint) { - /*--- So we have to get the normal of that other marker ---*/ - vertex[Syms[iMarker]][jVertex]->GetNormal(NormalPrim); - su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - for(unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - } - /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ - su2double ProjNorm = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - /*--- We check if the normal of the 2 planes coincide. - * We only update the normal if the normals of the symmetry planes are different. ---*/ - if (fabs(1.0-ProjNorm)>EPS) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - /*--- Make normalized vector ---*/ - su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; - vertex[val_marker][iVertex]->SetNormal(UnitNormal); - } + if (iPoint == jPoint) { + /*--- So we have to get the normal of that other marker ---*/ + vertex[Syms[iMarker]][jVertex]->GetNormal(NormalPrim); + su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; + } + /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ + su2double ProjNorm = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + /*--- We check if the normal of the 2 planes coincide. + * We only update the normal if the normals of the symmetry planes are different. ---*/ + if (fabs(1.0 - ProjNorm) > EPS) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; + /*--- Make normalized vector ---*/ + su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea; + vertex[val_marker][iVertex]->SetNormal(UnitNormal); + } } } } @@ -7358,7 +7355,6 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } } } - } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { From ea125235860ee5e2ca09825aa4cb72b3d9e8c60f Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 27 Jun 2024 23:32:08 +0200 Subject: [PATCH 155/194] move normal correction for shared symmetry-nodes --- Common/src/geometry/CPhysicalGeometry.cpp | 42 +++++++++++-------- .../include/solvers/CFVMFlowSolverBase.inl | 18 ++++++++ 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 8a4702b412f..633f822274c 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7301,6 +7301,8 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { + if ((config->GetMarker_All_KindBC(val_marker) != SYMMETRY_PLANE) && + (config->GetMarker_All_KindBC(val_marker) != EULER_WALL)) continue; for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { const auto iPoint = vertex[val_marker][iVertex]->GetNode(); @@ -7330,23 +7332,26 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh if (!nodes->GetDomain(jPoint)) continue; /*--- We are on a shared node. ---*/ if (iPoint == jPoint) { - /*--- So we have to get the normal of that other marker ---*/ - vertex[Syms[iMarker]][jVertex]->GetNormal(NormalPrim); - su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - } - /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ - su2double ProjNorm = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - /*--- We check if the normal of the 2 planes coincide. - * We only update the normal if the normals of the symmetry planes are different. ---*/ - if (fabs(1.0 - ProjNorm) > EPS) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - /*--- Make normalized vector ---*/ - su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal); - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea; - vertex[val_marker][iVertex]->SetNormal(UnitNormal); + /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ + if (Syms[iMarker]GetNormal(NormalPrim); + su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; + } + /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ + su2double ProjNorm = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + /*--- We check if the normal of the 2 planes coincide. + * We only update the normal if the normals of the symmetry planes are different. ---*/ + if (fabs(1.0 - ProjNorm) > EPS) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; + /*--- Make normalized vector ---*/ + su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea; + vertex[val_marker][iVertex]->SetNormal(UnitNormal); + } } } } @@ -7355,6 +7360,9 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } } } + + + } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 75ff92685c5..414f95c45ba 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1146,6 +1146,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against + // static constexpr size_t MAXNSYMS = 100; // unsigned short Syms[MAXNSYMS] = {0}; @@ -1184,19 +1185,29 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve // for (auto iMarker=0;iMarkernVertex[Syms[iMarker]]; jVertex++) { // const auto jPoint = geometry->vertex[Syms[iMarker]][jVertex]->GetNode(); // if (!geometry->nodes->GetDomain(jPoint)) continue; // if (iPoint==jPoint) { + // //cout << "marker = " << val_marker<< ", other Marker =" << Syms[iMarker] << endl; + // /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ // if (Syms[iMarker]vertex[Syms[iMarker]][jVertex]->GetNormal(NormalPrim); + // su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); // for(unsigned short iDim = 0; iDim < nDim; iDim++) { // UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; // } + + // if (iPoint>1500) { + // cout << "normal of the primary: "<::BC_Sym_Plane(CGeometry* geometry, CSolve // /*--- Make normalized vector ---*/ // su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; + // if (iPoint>1500) + // cout << " ipoint=" <nodes->GetCoord(iPoint, 0) << " " << + // geometry->nodes->GetCoord(iPoint, 1) << " " << + // geometry->nodes->GetCoord(iPoint, 2) << " , n=" + // << UnitNormal[0] << " " + // << UnitNormal[1] << " " + // << UnitNormal[2] << endl; // } // } // } From d232ab8ef3e349bf346e30b9439d8a9ffd9699a1 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 1 Jul 2024 22:53:13 +0200 Subject: [PATCH 156/194] move normal correction for shared symmetry-nodes --- Common/include/geometry/CGeometry.hpp | 27 ++++++ Common/src/geometry/CPhysicalGeometry.cpp | 17 +++- .../gradients/computeGradientsSymmetry.hpp | 86 +++++++++++-------- .../include/solvers/CFVMFlowSolverBase.inl | 44 +++++++++- 4 files changed, 136 insertions(+), 38 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index 96f7ea115ed..511516692dd 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -66,6 +66,21 @@ extern "C" { using namespace std; +struct symNormal { + //static unsigned int nSym=0; + long unsigned int index; + su2double normal[3]; + symNormal(long unsigned int index) : index(index) {}; +}; + +struct findSymNormalIndex : std::unary_function { + unsigned long int index; + findSymNormalIndex(unsigned long int index):index(index) { } + bool operator()(symNormal const& m) const { + return m.index == index; + } +}; + /*! * \class CGeometry * \brief Parent class for defining the geometry of the problem (complete geometry, @@ -230,6 +245,18 @@ class CGeometry { public: /*--- Main geometric elements of the grid. ---*/ + //bool operator==(const symNormal& left, const symNormal right) const{ + // return left.index == right.index; + //} + //bool operator==(const symNormal right) const{ + // return index == right.index; + //} + //symNormal(const long unsigned int index) : index(index) {}; + //bool + //}; + + vector > symmetryNormals; /*!< \brief Corrected normals on nodes with shared symmetry markers */ + CPrimalGrid** elem{nullptr}; /*!< \brief Element vector (primal grid information). */ CPrimalGrid*** bound{nullptr}; /*!< \brief Boundary vector (primal grid information). */ CPoint* nodes{nullptr}; /*!< \brief Node vector (dual grid information). */ diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 633f822274c..f1533569ece 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7291,6 +7291,9 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh unsigned short nSym = 0; for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { + /*--- create the list with all corrected normals for all markers ---*/ + symmetryNormals.push_back({}); + if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { /*--- Note that Syms is a sorted list, so val(Syms[i]) > val[Syms[i-1]] ---*/ @@ -7326,6 +7329,7 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh for (auto iMarker = 0; iMarker < nSym; iMarker++) { /*--- We do not want the current symmetry ---*/ if (val_marker != Syms[iMarker]) { + /*--- Loop over all points on the other symmetry and check if current iPoint is on the symmetry ---*/ for (auto jVertex = 0ul; jVertex < nVertex[Syms[iMarker]]; jVertex++) { const auto jPoint = vertex[Syms[iMarker]][jVertex]->GetNode(); @@ -7350,7 +7354,18 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh /*--- Make normalized vector ---*/ su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal); for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea; - vertex[val_marker][iVertex]->SetNormal(UnitNormal); + //vertex[val_marker][iVertex]->SetNormal(UnitNormal); + //symmetryNormals[iMarker].push_back({iPoint,UnitNormal}); + symNormal sn = {iPoint}; + for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; + cout << "val_marker = " << val_marker << endl; + cout << "vector size " << symmetryNormals[iMarker].size() << endl; + + symmetryNormals[val_marker].push_back(sn); + cout << " vector=" << symmetryNormals[val_marker][0].index << " " + << symmetryNormals[val_marker][0].normal[0] << endl; + + } } } diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index 01d5d644864..931adad42fa 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -212,6 +212,8 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI * 3. t.grad(v.n) = 0 */ /*--- Check how many symmetry planes there are ---*/ + + unsigned short Syms[MAXNSYMS] = {0}; unsigned short nSym = 0; for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { @@ -222,6 +224,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI } } + /*--- No symmetry or Euler walls are present. ---*/ if (nSym==0) return; for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { @@ -246,41 +249,54 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI /*--- At this point we can find out if the node is shared with another symmetry. * Step 1: do we have other symmetries? ---*/ - if (nSym>1) { - /*--- Step 2: are we on a shared node? ---*/ - for (auto jMarker=0;jMarkerGetNode(); - if (iPoint==jPoint) { - /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ - if (Syms[jMarker]GetNormal(NormalPrim); - su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - for(unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - } - - /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ - su2double ProjNorm = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - /*--- We check if the normal of the 2 planes coincide. - * We only update the normal if the normals of the symmetry planes are different. ---*/ - if (fabs(1.0-ProjNorm)>EPS) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - /* Make normalized vector ---*/ - su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; - } - } - } - } - } - } - } + // if (nSym>1) { + // /*--- Step 2: are we on a shared node? ---*/ + // for (auto jMarker=0;jMarkerGetNode(); + // if (iPoint==jPoint) { + // /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ + // if (Syms[jMarker]GetNormal(NormalPrim); + // su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); + // for(unsigned short iDim = 0; iDim < nDim; iDim++) { + // UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; + // } + + // /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ + // su2double ProjNorm = 0.0; + // for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + // /*--- We check if the normal of the 2 planes coincide. + // * We only update the normal if the normals of the symmetry planes are different. ---*/ + // if (fabs(1.0-ProjNorm)>EPS) { + // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; + // /* Make normalized vector ---*/ + // su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); + // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; + // } + // } + // } + // } + // } + // } + // } + + + auto it = std::find_if( + geometry.symmetryNormals[iMarker].begin(), + geometry.symmetryNormals[iMarker].end(), + findSymNormalIndex(iPoint)); + if (it != geometry.symmetryNormals[iMarker].end()) { + //cout << "grad::element found" << endl; + //cout << it->index << endl; + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; + + } + //else {cout << "grad::empty" << endl;} /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ su2activematrix TensorMap(nDim,nDim); diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 414f95c45ba..deb8f6d46bc 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1139,6 +1139,20 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve const auto iVel = prim_idx.Velocity(); su2double* V_reflected; + +// struct symNormal { +// long unsigned int index; +// su2double normal[3]; +// //bool operator==(const symNormal& left, const symNormal right) const{ +// // return left.index == right.index; +// //} +// bool operator==(const symNormal right) const{ +// return index == right.index; +// } +// //symNormal(const long unsigned int index) : index(index) {}; +// //bool +// }; + /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. * The components of the residual normal to the symmetry plane are then zeroed out. * It is also necessary to correct normal vectors of those faces of the control volume, which @@ -1152,6 +1166,8 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve // unsigned short Syms[MAXNSYMS] = {0}; // unsigned short nSym = 0; // for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { + // cout << "1. val_marker = " << iMarker << endl; + // cout << "1. vector size " << geometry->symmetryNormals[iMarker].size() << endl; // if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || // (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { // Syms[nSym] = iMarker; @@ -1186,7 +1202,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve // /*--- We do not want the current symmetry ---*/ // if (val_marker!= Syms[iMarker]) { - // /*--- Loop over all points on the other symmetry and check if current iPoint is on the symmetry ---*/ // for (auto jVertex = 0ul; jVertex < geometry->nVertex[Syms[iMarker]]; jVertex++) { // const auto jPoint = geometry->vertex[Syms[iMarker]][jVertex]->GetNode(); @@ -1218,13 +1233,27 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve // /*--- Make normalized vector ---*/ // su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; - // if (iPoint>1500) + // if (iPoint>1500) { // cout << " ipoint=" <nodes->GetCoord(iPoint, 0) << " " << // geometry->nodes->GetCoord(iPoint, 1) << " " << // geometry->nodes->GetCoord(iPoint, 2) << " , n=" // << UnitNormal[0] << " " // << UnitNormal[1] << " " // << UnitNormal[2] << endl; + // cout << "val_marker = " << val_marker << endl; + // cout << "vector size " << geometry->symmetryNormals[val_marker].size() << endl; + // cout << " vector=" << geometry->symmetryNormals[val_marker][0].index << " " << geometry->symmetryNormals[val_marker][0].normal[0] << endl; + // auto it = std::find_if( + // geometry->symmetryNormals[val_marker].begin(), + // geometry->symmetryNormals[val_marker].end(), + // findSymNormalIndex(iPoint)); + // if (it != geometry->symmetryNormals[val_marker].end()) { + // cout << "element found" << endl; + // cout << it->index << endl; + // } + + // } + // } // } // } @@ -1234,6 +1263,17 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve // } + auto it = std::find_if( + geometry->symmetryNormals[val_marker].begin(), + geometry->symmetryNormals[val_marker].end(), + findSymNormalIndex(iPoint)); + if (it != geometry->symmetryNormals[val_marker].end()) { + //cout << "element found" << endl; + //cout << it->index << endl; + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; + + } + V_reflected = GetCharacPrimVar(val_marker, iVertex); /*--- Grid movement ---*/ From 0854bb258ea8ef496e4c6e040146d5f7f79612a6 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 1 Jul 2024 23:24:11 +0200 Subject: [PATCH 157/194] clang-format --- Common/include/geometry/CGeometry.hpp | 34 +++++++++++------------ Common/src/geometry/CPhysicalGeometry.cpp | 21 ++++++-------- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index 511516692dd..ac240f4e1b4 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -67,18 +67,16 @@ extern "C" { using namespace std; struct symNormal { - //static unsigned int nSym=0; - long unsigned int index; - su2double normal[3]; - symNormal(long unsigned int index) : index(index) {}; + // static unsigned int nSym=0; + long unsigned int index; + su2double normal[3]; + symNormal(long unsigned int index) : index(index){}; }; struct findSymNormalIndex : std::unary_function { - unsigned long int index; - findSymNormalIndex(unsigned long int index):index(index) { } - bool operator()(symNormal const& m) const { - return m.index == index; - } + unsigned long int index; + findSymNormalIndex(unsigned long int index) : index(index) {} + bool operator()(symNormal const& m) const { return m.index == index; } }; /*! @@ -245,17 +243,17 @@ class CGeometry { public: /*--- Main geometric elements of the grid. ---*/ - //bool operator==(const symNormal& left, const symNormal right) const{ - // return left.index == right.index; - //} - //bool operator==(const symNormal right) const{ - // return index == right.index; - //} - //symNormal(const long unsigned int index) : index(index) {}; - //bool + // bool operator==(const symNormal& left, const symNormal right) const{ + // return left.index == right.index; + // } + // bool operator==(const symNormal right) const{ + // return index == right.index; + // } + // symNormal(const long unsigned int index) : index(index) {}; + // bool //}; - vector > symmetryNormals; /*!< \brief Corrected normals on nodes with shared symmetry markers */ + vector> symmetryNormals; /*!< \brief Corrected normals on nodes with shared symmetry markers */ CPrimalGrid** elem{nullptr}; /*!< \brief Element vector (primal grid information). */ CPrimalGrid*** bound{nullptr}; /*!< \brief Boundary vector (primal grid information). */ diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index f1533569ece..82c9021c3bd 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7305,7 +7305,8 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { if ((config->GetMarker_All_KindBC(val_marker) != SYMMETRY_PLANE) && - (config->GetMarker_All_KindBC(val_marker) != EULER_WALL)) continue; + (config->GetMarker_All_KindBC(val_marker) != EULER_WALL)) + continue; for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { const auto iPoint = vertex[val_marker][iVertex]->GetNode(); @@ -7329,7 +7330,6 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh for (auto iMarker = 0; iMarker < nSym; iMarker++) { /*--- We do not want the current symmetry ---*/ if (val_marker != Syms[iMarker]) { - /*--- Loop over all points on the other symmetry and check if current iPoint is on the symmetry ---*/ for (auto jVertex = 0ul; jVertex < nVertex[Syms[iMarker]]; jVertex++) { const auto jPoint = vertex[Syms[iMarker]][jVertex]->GetNode(); @@ -7337,7 +7337,7 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh /*--- We are on a shared node. ---*/ if (iPoint == jPoint) { /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ - if (Syms[iMarker]GetNormal(NormalPrim); su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); @@ -7354,18 +7354,16 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh /*--- Make normalized vector ---*/ su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal); for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea; - //vertex[val_marker][iVertex]->SetNormal(UnitNormal); - //symmetryNormals[iMarker].push_back({iPoint,UnitNormal}); + // vertex[val_marker][iVertex]->SetNormal(UnitNormal); + // symmetryNormals[iMarker].push_back({iPoint,UnitNormal}); symNormal sn = {iPoint}; for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; cout << "val_marker = " << val_marker << endl; - cout << "vector size " << symmetryNormals[iMarker].size() << endl; + cout << "vector size " << symmetryNormals[iMarker].size() << endl; symmetryNormals[val_marker].push_back(sn); - cout << " vector=" << symmetryNormals[val_marker][0].index << " " - << symmetryNormals[val_marker][0].normal[0] << endl; - - + cout << " vector=" << symmetryNormals[val_marker][0].index << " " + << symmetryNormals[val_marker][0].normal[0] << endl; } } } @@ -7375,9 +7373,6 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } } } - - - } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { From 81ef8670599c52a8285f2846e7672926ac4cf097 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 2 Jul 2024 23:35:54 +0200 Subject: [PATCH 158/194] remove unused variables --- SU2_CFD/include/gradients/computeGradientsSymmetry.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index 931adad42fa..4cbc451807b 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -204,7 +204,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI size_t varEnd, GradientType& gradient, short idxVel) { static constexpr size_t MAXNDIM = 3; - static constexpr size_t MAXNSYMS = 100; + //static constexpr size_t MAXNSYMS = 100; /* For symmetry planes, we need to impose the conditions (Blazek eq. 8.40): * 1. n.grad(phi) = 0 @@ -214,12 +214,12 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI /*--- Check how many symmetry planes there are ---*/ - unsigned short Syms[MAXNSYMS] = {0}; +// unsigned short Syms[MAXNSYMS] = {0}; unsigned short nSym = 0; for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - Syms[nSym] = iMarker; + //Syms[nSym] = iMarker; nSym++; } } @@ -245,7 +245,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI UnitNormal[iDim] = VertexNormal[iDim] / NormArea; /*--- Normal of the primary symmetry plane ---*/ - su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; + //su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; /*--- At this point we can find out if the node is shared with another symmetry. * Step 1: do we have other symmetries? ---*/ From 70154d56b045806df33df34797c690e210ce93a7 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 4 Jul 2024 00:22:32 +0200 Subject: [PATCH 159/194] do not use find when vector size zero, remove comment blocks --- Common/src/geometry/CPhysicalGeometry.cpp | 6 +- .../gradients/computeGradientsSymmetry.hpp | 65 ++-------- .../include/solvers/CFVMFlowSolverBase.inl | 122 +++--------------- 3 files changed, 28 insertions(+), 165 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 82c9021c3bd..d670ed1acb3 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7302,11 +7302,14 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } } + /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { if ((config->GetMarker_All_KindBC(val_marker) != SYMMETRY_PLANE) && (config->GetMarker_All_KindBC(val_marker) != EULER_WALL)) continue; + + for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { const auto iPoint = vertex[val_marker][iVertex]->GetNode(); @@ -7358,11 +7361,8 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh // symmetryNormals[iMarker].push_back({iPoint,UnitNormal}); symNormal sn = {iPoint}; for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; - cout << "val_marker = " << val_marker << endl; - cout << "vector size " << symmetryNormals[iMarker].size() << endl; symmetryNormals[val_marker].push_back(sn); - cout << " vector=" << symmetryNormals[val_marker][0].index << " " << symmetryNormals[val_marker][0].normal[0] << endl; } } diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index 4cbc451807b..81eb21a090f 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -204,22 +204,19 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI size_t varEnd, GradientType& gradient, short idxVel) { static constexpr size_t MAXNDIM = 3; - //static constexpr size_t MAXNSYMS = 100; /* For symmetry planes, we need to impose the conditions (Blazek eq. 8.40): * 1. n.grad(phi) = 0 * 2. n.grad(v.t) = 0 * 3. t.grad(v.n) = 0 */ - /*--- Check how many symmetry planes there are ---*/ + /*--- Check how many symmetry planes there are ---*/ -// unsigned short Syms[MAXNSYMS] = {0}; unsigned short nSym = 0; for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - //Syms[nSym] = iMarker; nSym++; } } @@ -244,59 +241,15 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - /*--- Normal of the primary symmetry plane ---*/ - //su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - - /*--- At this point we can find out if the node is shared with another symmetry. - * Step 1: do we have other symmetries? ---*/ - // if (nSym>1) { - // /*--- Step 2: are we on a shared node? ---*/ - // for (auto jMarker=0;jMarkerGetNode(); - // if (iPoint==jPoint) { - // /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ - // if (Syms[jMarker]GetNormal(NormalPrim); - // su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - // for(unsigned short iDim = 0; iDim < nDim; iDim++) { - // UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - // } - - // /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ - // su2double ProjNorm = 0.0; - // for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - // /*--- We check if the normal of the 2 planes coincide. - // * We only update the normal if the normals of the symmetry planes are different. ---*/ - // if (fabs(1.0-ProjNorm)>EPS) { - // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - // /* Make normalized vector ---*/ - // su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); - // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; - // } - // } - // } - // } - // } - // } - // } - - - auto it = std::find_if( - geometry.symmetryNormals[iMarker].begin(), - geometry.symmetryNormals[iMarker].end(), - findSymNormalIndex(iPoint)); - if (it != geometry.symmetryNormals[iMarker].end()) { - //cout << "grad::element found" << endl; - //cout << it->index << endl; - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; - } - //else {cout << "grad::empty" << endl;} + auto it = std::find_if( + geometry.symmetryNormals[iMarker].begin(), + geometry.symmetryNormals[iMarker].end(), + findSymNormalIndex(iPoint) + ); + if (it != geometry.symmetryNormals[iMarker].end()) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; + } /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ su2activematrix TensorMap(nDim,nDim); diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index deb8f6d46bc..abc3e5026e6 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1139,20 +1139,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve const auto iVel = prim_idx.Velocity(); su2double* V_reflected; - -// struct symNormal { -// long unsigned int index; -// su2double normal[3]; -// //bool operator==(const symNormal& left, const symNormal right) const{ -// // return left.index == right.index; -// //} -// bool operator==(const symNormal right) const{ -// return index == right.index; -// } -// //symNormal(const long unsigned int index) : index(index) {}; -// //bool -// }; - /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. * The components of the residual normal to the symmetry plane are then zeroed out. * It is also necessary to correct normal vectors of those faces of the control volume, which @@ -1161,19 +1147,13 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against - // static constexpr size_t MAXNSYMS = 100; - - // unsigned short Syms[MAXNSYMS] = {0}; - // unsigned short nSym = 0; - // for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { - // cout << "1. val_marker = " << iMarker << endl; - // cout << "1. vector size " << geometry->symmetryNormals[iMarker].size() << endl; - // if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - // (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - // Syms[nSym] = iMarker; - // nSym++; - // } - // } + unsigned short nSym = 0; + for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { + if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + nSym++; + } + } /*--- Loop over all the vertices on this boundary marker. ---*/ @@ -1192,86 +1172,16 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; - /*--- At this point we find out if the node is shared with another symmetry. ---*/ - /*--- Step 1: do we have other symmetries? ---*/ - // if (nSym>1) { - // /*--- Normal of the primary symmetry plane ---*/ - // su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - // /*--- Step 2: are we on a shared node? ---*/ - // for (auto iMarker=0;iMarkernVertex[Syms[iMarker]]; jVertex++) { - // const auto jPoint = geometry->vertex[Syms[iMarker]][jVertex]->GetNode(); - // if (!geometry->nodes->GetDomain(jPoint)) continue; - // if (iPoint==jPoint) { - // //cout << "marker = " << val_marker<< ", other Marker =" << Syms[iMarker] << endl; - - // /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ - // if (Syms[iMarker]vertex[Syms[iMarker]][jVertex]->GetNormal(NormalPrim); - - // su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - // for(unsigned short iDim = 0; iDim < nDim; iDim++) { - // UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - // } - - // if (iPoint>1500) { - // cout << "normal of the primary: "<EPS) { - // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - // /*--- Make normalized vector ---*/ - // su2double newarea=GeometryToolbox::Norm(nDim, UnitNormal); - // for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim]/newarea; - // if (iPoint>1500) { - // cout << " ipoint=" <nodes->GetCoord(iPoint, 0) << " " << - // geometry->nodes->GetCoord(iPoint, 1) << " " << - // geometry->nodes->GetCoord(iPoint, 2) << " , n=" - // << UnitNormal[0] << " " - // << UnitNormal[1] << " " - // << UnitNormal[2] << endl; - // cout << "val_marker = " << val_marker << endl; - // cout << "vector size " << geometry->symmetryNormals[val_marker].size() << endl; - // cout << " vector=" << geometry->symmetryNormals[val_marker][0].index << " " << geometry->symmetryNormals[val_marker][0].normal[0] << endl; - // auto it = std::find_if( - // geometry->symmetryNormals[val_marker].begin(), - // geometry->symmetryNormals[val_marker].end(), - // findSymNormalIndex(iPoint)); - // if (it != geometry->symmetryNormals[val_marker].end()) { - // cout << "element found" << endl; - // cout << it->index << endl; - // } - - // } - - // } - // } - // } - // } - // } - // } - // } - - - auto it = std::find_if( - geometry->symmetryNormals[val_marker].begin(), - geometry->symmetryNormals[val_marker].end(), - findSymNormalIndex(iPoint)); - if (it != geometry->symmetryNormals[val_marker].end()) { - //cout << "element found" << endl; - //cout << it->index << endl; - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; + if (geometry->symmetryNormals.size() > 0) { + if (geometry->symmetryNormals[val_marker].size() > 0) + auto it = std::find_if( + geometry->symmetryNormals[val_marker].begin(), + geometry->symmetryNormals[val_marker].end(), + findSymNormalIndex(iPoint)); + if (it != geometry->symmetryNormals[val_marker].end()) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; + } } V_reflected = GetCharacPrimVar(val_marker, iVertex); From 1615bddafadab2d76440d56c5b62c0b130f0f3e0 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 4 Jul 2024 08:19:13 +0200 Subject: [PATCH 160/194] clang-format --- Common/src/geometry/CPhysicalGeometry.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index d670ed1acb3..20a9f37cd16 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7302,14 +7302,12 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } } - /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { if ((config->GetMarker_All_KindBC(val_marker) != SYMMETRY_PLANE) && (config->GetMarker_All_KindBC(val_marker) != EULER_WALL)) continue; - for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { const auto iPoint = vertex[val_marker][iVertex]->GetNode(); @@ -7363,7 +7361,7 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; symmetryNormals[val_marker].push_back(sn); - << symmetryNormals[val_marker][0].normal[0] << endl; + << symmetryNormals[val_marker][0].normal[0] << endl; } } } From e008c3a456dbadab45d66e10b16080d33f2cbea2 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 4 Jul 2024 21:28:14 +0200 Subject: [PATCH 161/194] clang-format --- Common/src/geometry/CPhysicalGeometry.cpp | 1 - SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 20a9f37cd16..9ee0403dd10 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7361,7 +7361,6 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; symmetryNormals[val_marker].push_back(sn); - << symmetryNormals[val_marker][0].normal[0] << endl; } } } diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index abc3e5026e6..9111e7a7f17 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1139,6 +1139,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve const auto iVel = prim_idx.Velocity(); su2double* V_reflected; + /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. * The components of the residual normal to the symmetry plane are then zeroed out. * It is also necessary to correct normal vectors of those faces of the control volume, which @@ -1173,8 +1174,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; if (geometry->symmetryNormals.size() > 0) { - if (geometry->symmetryNormals[val_marker].size() > 0) - auto it = std::find_if( geometry->symmetryNormals[val_marker].begin(), geometry->symmetryNormals[val_marker].end(), From 980c2e52c4a2f45ebd6527180607775a5dc177ea Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 7 Jul 2024 11:03:22 +0200 Subject: [PATCH 162/194] correct normals for multigrid --- Common/include/geometry/CGeometry.hpp | 12 --- Common/src/geometry/CMultiGridGeometry.cpp | 82 +++++++++++++++++++ Common/src/geometry/CPhysicalGeometry.cpp | 17 ++-- .../gradients/computeGradientsSymmetry.hpp | 21 +++-- .../include/solvers/CFVMFlowSolverBase.inl | 20 ++--- 5 files changed, 111 insertions(+), 41 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index ac240f4e1b4..667d9a826f1 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -67,7 +67,6 @@ extern "C" { using namespace std; struct symNormal { - // static unsigned int nSym=0; long unsigned int index; su2double normal[3]; symNormal(long unsigned int index) : index(index){}; @@ -242,17 +241,6 @@ class CGeometry { public: /*--- Main geometric elements of the grid. ---*/ - - // bool operator==(const symNormal& left, const symNormal right) const{ - // return left.index == right.index; - // } - // bool operator==(const symNormal right) const{ - // return index == right.index; - // } - // symNormal(const long unsigned int index) : index(index) {}; - // bool - //}; - vector> symmetryNormals; /*!< \brief Corrected normals on nodes with shared symmetry markers */ CPrimalGrid** elem{nullptr}; /*!< \brief Element vector (primal grid information). */ diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 9ecfad16bfa..2e93711186e 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -960,6 +960,88 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig if (Area == 0.0) for (iDim = 0; iDim < nDim; iDim++) NormalFace[iDim] = EPS * EPS; } + + /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against. + All nodes that are shared by multiple symmetries have to get a corrected normal. */ + static constexpr size_t MAXNSYMS = 100; + bool Syms[MAXNSYMS] = {false}; + + unsigned short nSym = 0; + for (iMarker = 0; iMarker < nMarker; ++iMarker) { + /*--- create the list with all corrected normals for all markers ---*/ + symmetryNormals.push_back({}); + + /*--- Note that Syms is a sorted list, so val(Syms[i]) > val[Syms[i-1]] ---*/ + if (fine_grid->symmetryNormals[iMarker].size() > 0) { + Syms[iMarker] = true; + nSym++; + } + } + + // /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ + for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { + if (Syms[val_marker] == false) continue; + for (iVertex = 0; iVertex < nVertex[val_marker]; iVertex++) { + iCoarsePoint = vertex[val_marker][iVertex]->GetNode(); + + /*--- Halo points do not need to be considered. ---*/ + if (!nodes->GetDomain(iCoarsePoint)) continue; + + /*--- Get the normal of the current symmetry ---*/ + su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; + vertex[val_marker][iVertex]->GetNormal(Normal); + const su2double Area = GeometryToolbox::Norm(nDim, Normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; + + /*--- At this point we find out if the node is shared with another symmetry. ---*/ + /*--- We then apply a Gram-Schmidt process to compute the orthonormal basis from all + normal vectors of the shared symmetries at the node. ---*/ + /*--- Step 1: do we have other symmetries? ---*/ + if (nSym > 0) { + /*--- Normal of the primary symmetry plane ---*/ + su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; + /*--- Step 2: are we on a shared node? ---*/ + for (auto iMarker = 0; iMarker < nMarker; iMarker++) { + if (Syms[iMarker] == false) continue; // not on a symmetry + /*--- We do not want the current symmetry ---*/ + if (val_marker != iMarker) { + /*--- Loop over all points on the other symmetry and check if current iPoint is on the symmetry ---*/ + for (auto jVertex = 0ul; jVertex < nVertex[iMarker]; jVertex++) { + const auto jPoint = vertex[iMarker][jVertex]->GetNode(); + if (!nodes->GetDomain(jPoint)) continue; + /*--- We are on a shared node. ---*/ + if (iCoarsePoint == jPoint) { + /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ + if (iMarker < val_marker) { + /*--- So we have to get the normal of that other marker ---*/ + vertex[iMarker][jVertex]->GetNormal(NormalPrim); + su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; + } + /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ + su2double ProjNorm = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + symNormal sn = {iCoarsePoint}; + + /*--- We check if the normal of the 2 planes coincide. + * We only update the normal if the normals of the symmetry planes are different. ---*/ + if (fabs(1.0 - ProjNorm) > EPS) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; + /*--- Make normalized vector ---*/ + su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea; + } + for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; + symmetryNormals[val_marker].push_back(sn); + } + } + } + } + } + } + } + } } END_SU2_OMP_SAFE_GLOBAL_ACCESS } diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 9ee0403dd10..98792503e27 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7284,7 +7284,7 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } END_SU2_OMP_FOR - /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against + /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against. All nodes that are shared by multiple symmetries have to get a corrected normal. */ static constexpr size_t MAXNSYMS = 100; unsigned short Syms[MAXNSYMS] = {0}; @@ -7337,6 +7337,8 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh if (!nodes->GetDomain(jPoint)) continue; /*--- We are on a shared node. ---*/ if (iPoint == jPoint) { + symNormal sn = {iPoint}; + /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ if (Syms[iMarker] < val_marker) { /*--- So we have to get the normal of that other marker ---*/ @@ -7348,6 +7350,7 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ su2double ProjNorm = 0.0; for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + /*--- We check if the normal of the 2 planes coincide. * We only update the normal if the normals of the symmetry planes are different. ---*/ if (fabs(1.0 - ProjNorm) > EPS) { @@ -7355,15 +7358,11 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh /*--- Make normalized vector ---*/ su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal); for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea; - // vertex[val_marker][iVertex]->SetNormal(UnitNormal); - // symmetryNormals[iMarker].push_back({iPoint,UnitNormal}); - symNormal sn = {iPoint}; - for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; - - symmetryNormals[val_marker].push_back(sn); } - } - } + } // + for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; + symmetryNormals[val_marker].push_back(sn); + } // ipoint==jpoint } } } diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index 81eb21a090f..b882d69dc83 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -212,7 +212,6 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI */ /*--- Check how many symmetry planes there are ---*/ - unsigned short nSym = 0; for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || @@ -241,14 +240,18 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI for (size_t iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - - auto it = std::find_if( - geometry.symmetryNormals[iMarker].begin(), - geometry.symmetryNormals[iMarker].end(), - findSymNormalIndex(iPoint) - ); - if (it != geometry.symmetryNormals[iMarker].end()) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; + /*--- When we have more than 1 symmetry or Euler wall, check if there are shared nodes. + Then correct the normal at those node ---*/ + if (nSym>1) { + if (geometry.symmetryNormals.size() > 0) { + auto it = std::find_if( + geometry.symmetryNormals[iMarker].begin(), + geometry.symmetryNormals[iMarker].end(), + findSymNormalIndex(iPoint)); + if (it != geometry.symmetryNormals[iMarker].end()) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; + } + } } /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 9111e7a7f17..0f92924b31f 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1139,7 +1139,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve const auto iVel = prim_idx.Velocity(); su2double* V_reflected; - /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. * The components of the residual normal to the symmetry plane are then zeroed out. * It is also necessary to correct normal vectors of those faces of the control volume, which @@ -1173,13 +1172,15 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; - if (geometry->symmetryNormals.size() > 0) { - auto it = std::find_if( - geometry->symmetryNormals[val_marker].begin(), - geometry->symmetryNormals[val_marker].end(), - findSymNormalIndex(iPoint)); - if (it != geometry->symmetryNormals[val_marker].end()) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; + if (nSym>1) { + if (geometry->symmetryNormals.size() > 0) { + auto it = std::find_if( + geometry->symmetryNormals[val_marker].begin(), + geometry->symmetryNormals[val_marker].end(), + findSymNormalIndex(iPoint)); + if (it != geometry->symmetryNormals[val_marker].end()) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; + } } } @@ -1195,7 +1196,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve Normal[iDim] = -Normal[iDim]; conv_numerics->SetNormal(Normal); - for (auto iVar = 0u; iVar < nPrimVar; iVar++) V_reflected[iVar] = nodes->GetPrimitive(iPoint, iVar); @@ -1222,8 +1222,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve if ((iVar= iVel+nDim)) LinSysRes(iPoint, iVar) += residual.residual[iVar]; } - ///LinSysRes(iPoint, nDim+1) += residual.residual[nDim+1]; - ///LinSysRes.AddBlock(iPoint, residual); /*--- Explicitly set the velocity components normal to the symmetry plane to zero. * This is necessary because the modification of the residual leaves the problem From 8e06ba3e9a22a1ae70fc7ef3bbce46fce305a5d9 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 7 Jul 2024 15:47:07 +0200 Subject: [PATCH 163/194] add some omp statements --- Common/src/geometry/CPhysicalGeometry.cpp | 6 ++++++ .../gradients/computeGradientsSymmetry.hpp | 18 +++++++++--------- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 7 +------ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 98792503e27..19d9e93905a 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7290,6 +7290,7 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh unsigned short Syms[MAXNSYMS] = {0}; unsigned short nSym = 0; + SU2_OMP_FOR_DYN(1) for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { /*--- create the list with all corrected normals for all markers ---*/ symmetryNormals.push_back({}); @@ -7301,8 +7302,11 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh nSym++; } } + END_SU2_OMP_FOR + /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ + SU2_OMP_FOR_DYN(1) for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { if ((config->GetMarker_All_KindBC(val_marker) != SYMMETRY_PLANE) && (config->GetMarker_All_KindBC(val_marker) != EULER_WALL)) @@ -7369,6 +7373,8 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } } } + END_SU2_OMP_FOR + } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index b882d69dc83..f6ef2ac1c0a 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -54,6 +54,7 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& su2double gradPhi[MAXNDIM] = {0.0}; su2double gradPhiReflected[MAXNDIM] = {0.0}; + /*--- First we correct the part that involves velocities ---*/ if (idxVel != -1) { /*--- Get gradients of primitives of boundary cell ---*/ for (auto iVar = 0u; iVar < nDim; iVar++) { @@ -63,7 +64,7 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& } } - /*--- Q' = L^T*Q*T ---*/ + /*--- Q = L^T * Q * T ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto kDim = 0u; kDim < nDim; kDim++) { @@ -91,7 +92,7 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& } /*--- now transform back the corrected velocity gradients by taking the inverse again - * T = (L^-1)*T' ---*/ + * T = (L^-1) * T' ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto kDim = 0u; kDim < nDim; kDim++) { @@ -183,7 +184,7 @@ inline void BaseFromNormal(Int nDim, const Scalar* UnitNormal, Matrix& TensorMap /*--- Compute 3rd direction of the base using cross product ---*/ GeometryToolbox::CrossProduct(UnitNormal, Tangential, Orthogonal); - // now we construct the tensor mapping T, note that its inverse is the transpose of T + /*--- now we construct the tensor mapping T, note that its inverse is the transpose of T ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { TensorMap[0][iDim] = UnitNormal[iDim]; TensorMap[1][iDim] = Tangential[iDim]; @@ -194,7 +195,6 @@ inline void BaseFromNormal(Int nDim, const Scalar* UnitNormal, Matrix& TensorMap } // switch } - } @@ -205,7 +205,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI static constexpr size_t MAXNDIM = 3; - /* For symmetry planes, we need to impose the conditions (Blazek eq. 8.40): + /* For symmetry planes (and Euler walls), we need to impose the conditions (Blazek eq. 8.40): * 1. n.grad(phi) = 0 * 2. n.grad(v.t) = 0 * 3. t.grad(v.n) = 0 @@ -221,7 +221,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI } /*--- No symmetry or Euler walls are present. ---*/ - if (nSym==0) return; + if (nSym == 0) return; for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { @@ -242,7 +242,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI /*--- When we have more than 1 symmetry or Euler wall, check if there are shared nodes. Then correct the normal at those node ---*/ - if (nSym>1) { + if (nSym > 1) { if (geometry.symmetryNormals.size() > 0) { auto it = std::find_if( geometry.symmetryNormals[iMarker].begin(), @@ -262,6 +262,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI su2activematrix Gradients_iPoint(varEnd-varBegin,nDim); + /*--- Fill the local gradient tensor ---*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { Gradients_iPoint[iVar][iDim] = gradient(iPoint, iVar, iDim); @@ -270,6 +271,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI detail::CorrectGradient(nDim, varBegin,varEnd, TensorMap, Gradients_iPoint, idxVel); + /*--- Write the corrected gradient tensor ---*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { gradient(iPoint, iVar, iDim) = Gradients_iPoint[iVar][iDim]; @@ -281,7 +283,5 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI } // symmetry } // markers - - } diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 0f92924b31f..85b12207e31 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1172,7 +1172,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; - if (nSym>1) { + if (nSym > 1) { if (geometry->symmetryNormals.size() > 0) { auto it = std::find_if( geometry->symmetryNormals[val_marker].begin(), @@ -1263,9 +1263,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; } - - - /*--- Jacobian contribution for implicit integration. ---*/ if (implicit) { Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); @@ -1278,8 +1275,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve NormalProduct += Res_TruncError[iVel + iDim] * UnitNormal[iDim]; for (unsigned short iDim = 0; iDim < nDim; iDim++) Res_TruncError[iVel + iDim] -= NormalProduct * UnitNormal[iDim]; - // not necessary - //nodes->SetResTruncError(iPoint, Res_TruncError); } END_SU2_OMP_FOR From 67b3d0ab4ad0ffc65f5f7465b4c6ed79482a37a6 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 7 Jul 2024 20:01:20 +0200 Subject: [PATCH 164/194] clang-format --- Common/src/geometry/CPhysicalGeometry.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 19d9e93905a..a8bacef741b 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7304,7 +7304,6 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } END_SU2_OMP_FOR - /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ SU2_OMP_FOR_DYN(1) for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { @@ -7374,7 +7373,6 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } } END_SU2_OMP_FOR - } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { From 37feae60f37f0cc7145ee5465f8dcacb089303e3 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 8 Jul 2024 00:05:46 +0200 Subject: [PATCH 165/194] change resize --- Common/src/geometry/CMultiGridGeometry.cpp | 3 ++- Common/src/geometry/CPhysicalGeometry.cpp | 3 +-- SU2_CFD/include/gradients/computeGradientsSymmetry.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 2e93711186e..ea9695c5463 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -965,11 +965,12 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig All nodes that are shared by multiple symmetries have to get a corrected normal. */ static constexpr size_t MAXNSYMS = 100; bool Syms[MAXNSYMS] = {false}; + symmetryNormals.resize(nMarker); unsigned short nSym = 0; for (iMarker = 0; iMarker < nMarker; ++iMarker) { /*--- create the list with all corrected normals for all markers ---*/ - symmetryNormals.push_back({}); + // symmetryNormals.push_back({}); /*--- Note that Syms is a sorted list, so val(Syms[i]) > val[Syms[i-1]] ---*/ if (fine_grid->symmetryNormals[iMarker].size() > 0) { diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index a8bacef741b..1e36cc10e95 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7288,12 +7288,11 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh All nodes that are shared by multiple symmetries have to get a corrected normal. */ static constexpr size_t MAXNSYMS = 100; unsigned short Syms[MAXNSYMS] = {0}; - + symmetryNormals.resize(nMarker); unsigned short nSym = 0; SU2_OMP_FOR_DYN(1) for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { /*--- create the list with all corrected normals for all markers ---*/ - symmetryNormals.push_back({}); if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index f6ef2ac1c0a..3c693f2f2aa 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -205,7 +205,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI static constexpr size_t MAXNDIM = 3; - /* For symmetry planes (and Euler walls), we need to impose the conditions (Blazek eq. 8.40): + /* For symmetry planes (and Euler walls), we need to impose the conditions (Blazek eq. 8.40): * 1. n.grad(phi) = 0 * 2. n.grad(v.t) = 0 * 3. t.grad(v.n) = 0 From a7ecc764cc6bd6e780ba623ff95789c8f1fd80da Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 8 Jul 2024 18:50:17 +0200 Subject: [PATCH 166/194] change resize --- Common/src/geometry/CPhysicalGeometry.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 1e36cc10e95..ef8b1e019b6 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -4707,6 +4707,9 @@ void CPhysicalGeometry::SetVertex(const CConfig* config) { } } + /*--- Correction of normals on nodes with more than one symmetry/Euler wall ---*/ + symmetryNormals.resize(nMarker); + /*--- Initialize the Vertex vector for each node, the previous result is deleted ---*/ for (iPoint = 0; iPoint < nPoint; iPoint++) @@ -7288,7 +7291,6 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh All nodes that are shared by multiple symmetries have to get a corrected normal. */ static constexpr size_t MAXNSYMS = 100; unsigned short Syms[MAXNSYMS] = {0}; - symmetryNormals.resize(nMarker); unsigned short nSym = 0; SU2_OMP_FOR_DYN(1) for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { From 0045c9c8eaa66b05b00b20bf32216b55d7914495 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 8 Jul 2024 18:53:23 +0200 Subject: [PATCH 167/194] change idim --- Common/src/geometry/CMultiGridGeometry.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index ea9695c5463..04135cb3b13 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -927,7 +927,7 @@ void CMultiGridGeometry::SetControlVolume(const CGeometry* fine_grid, unsigned s void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) { BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { unsigned long iCoarsePoint, iFinePoint, FineVertex, iVertex; - unsigned short iMarker, iChildren, iDim; + unsigned short iMarker, iChildren; su2double *Normal, Area, *NormalFace = nullptr; Normal = new su2double[nDim]; @@ -958,7 +958,7 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig NormalFace = vertex[iMarker][iVertex]->GetNormal(); Area = GeometryToolbox::Norm(nDim, NormalFace); if (Area == 0.0) - for (iDim = 0; iDim < nDim; iDim++) NormalFace[iDim] = EPS * EPS; + for (auto iDim = 0; iDim < nDim; iDim++) NormalFace[iDim] = EPS * EPS; } /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against. @@ -992,7 +992,7 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; vertex[val_marker][iVertex]->GetNormal(Normal); const su2double Area = GeometryToolbox::Norm(nDim, Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; + for (auto iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; /*--- At this point we find out if the node is shared with another symmetry. ---*/ /*--- We then apply a Gram-Schmidt process to compute the orthonormal basis from all From 47ce8e64d16b849c89740f6f07f33dba8609e04b Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 8 Jul 2024 21:24:46 +0200 Subject: [PATCH 168/194] fix regressions again --- Common/src/geometry/CMultiGridGeometry.cpp | 2 +- TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref | 16 ++++++++-------- TestCases/hybrid_regression.py | 2 +- TestCases/hybrid_regression_AD.py | 2 +- TestCases/parallel_regression.py | 2 +- TestCases/parallel_regression_AD.py | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 04135cb3b13..cc78e19156a 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -991,7 +991,7 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig /*--- Get the normal of the current symmetry ---*/ su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; vertex[val_marker][iVertex]->GetNormal(Normal); - const su2double Area = GeometryToolbox::Norm(nDim, Normal); + Area = GeometryToolbox::Norm(nDim, Normal); for (auto iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; /*--- At this point we find out if the node is shared with another symmetry. ---*/ diff --git a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref index 4609892bc90..c1aff90950a 100644 --- a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref +++ b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref @@ -1,9 +1,9 @@ INDEX GRAD -0 -5.239274092737222e-03 -1 -2.822866221863948e-03 -2 -1.251166606082498e-03 -3 -4.746311954659543e-04 -4 -4.726421529292411e-04 -5 -1.242307190163730e-03 -6 -2.797799393332898e-03 -7 -5.181304739588740e-03 +0 -5.381067336954367e-03 +1 -2.900518184471754e-03 +2 -1.286923279803124e-03 +3 -4.900398751994363e-04 +4 -4.890878571990538e-04 +5 -1.280773697154056e-03 +6 -2.879419674440936e-03 +7 -5.327422795820885e-03 diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 9954c7987d5..0d83e910d00 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -75,7 +75,7 @@ def main(): oneram6.cfg_dir = "euler/oneram6" oneram6.cfg_file = "inv_ONERAM6.cfg" oneram6.test_iter = 10 - oneram6.test_vals = [0.280800, 0.008623] + oneram6.test_vals = [0.280737, 0.008725] test_list.append(oneram6) # Fixed CL NACA0012 diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index 903e9c06554..e562fe4f0bb 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -58,7 +58,7 @@ def main(): discadj_cylinder3D.cfg_dir = "disc_adj_euler/cylinder3D" discadj_cylinder3D.cfg_file = "inv_cylinder3D.cfg" discadj_cylinder3D.test_iter = 5 - discadj_cylinder3D.test_vals = [-3.764562, -3.719982, -0.000000, 0.000000] + discadj_cylinder3D.test_vals = [-3.773582, -3.736536, -0.000000, 0.000000] test_list.append(discadj_cylinder3D) # Arina nozzle 2D diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 673cd6e1b46..dbe6470c77e 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1425,7 +1425,7 @@ def main(): pywrapper_deformingBump.cfg_dir = "py_wrapper/deforming_bump_in_channel" pywrapper_deformingBump.cfg_file = "config.cfg" pywrapper_deformingBump.test_iter = 1 - pywrapper_deformingBump.test_vals = [0.500000, 0.000000, -2.789700, -1.400250, -0.711877, 2.672498, 7.887960, -0.478233] + pywrapper_deformingBump.test_vals = [0.500000, 0.000000, -2.359718, -0.424610, -0.285358, 3.102752, 6.943751, -1.049871] pywrapper_deformingBump.command = TestCase.Command("mpirun -np 2", "python", "run.py") pywrapper_deformingBump.unsteady = True test_list.append(pywrapper_deformingBump) diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 80fb1863db1..9f8fab0c071 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -277,7 +277,7 @@ def main(): discadj_fsi2.cfg_dir = "disc_adj_fsi/Airfoil_2d" discadj_fsi2.cfg_file = "config.cfg" discadj_fsi2.test_iter = 8 - discadj_fsi2.test_vals = [-2.402640, 2.740268, -1.270185, -1.273900, 3.860200] + discadj_fsi2.test_vals = [-2.560432, 2.314360, -1.272250, -1.242500, 3.266800] discadj_fsi2.test_vals_aarch64 = [-4.349372, 0.190601, -1.303589, 0.754070, 2.324400] discadj_fsi2.tol = 0.00001 test_list.append(discadj_fsi2) From 5aa4ae8009e8caf545f3abe0cdb218cd0f7a0e5e Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 12 Jul 2024 00:16:56 +0200 Subject: [PATCH 169/194] simplify gradphi --- Common/src/geometry/CMultiGridGeometry.cpp | 23 +++----- Common/src/geometry/CPhysicalGeometry.cpp | 3 - .../gradients/computeGradientsSymmetry.hpp | 55 +++++++++++-------- 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index cc78e19156a..1a508c8e2ce 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -927,20 +927,17 @@ void CMultiGridGeometry::SetControlVolume(const CGeometry* fine_grid, unsigned s void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) { BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { unsigned long iCoarsePoint, iFinePoint, FineVertex, iVertex; - unsigned short iMarker, iChildren; - su2double *Normal, Area, *NormalFace = nullptr; - - Normal = new su2double[nDim]; + su2double Normal[MAXNDIM] = {0.0}, Area, *NormalFace = nullptr; if (action != ALLOCATE) { - for (iMarker = 0; iMarker < nMarker; iMarker++) + for (auto iMarker = 0; iMarker < nMarker; iMarker++) for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) vertex[iMarker][iVertex]->SetZeroValues(); } - for (iMarker = 0; iMarker < nMarker; iMarker++) + for (auto iMarker = 0; iMarker < nMarker; iMarker++) for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { iCoarsePoint = vertex[iMarker][iVertex]->GetNode(); - for (iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren++) { + for (auto iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren++) { iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren); if (fine_grid->nodes->GetVertex(iFinePoint, iMarker) != -1) { FineVertex = fine_grid->nodes->GetVertex(iFinePoint, iMarker); @@ -950,10 +947,8 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig } } - delete[] Normal; - /*--- Check if there is a normal with null area ---*/ - for (iMarker = 0; iMarker < nMarker; iMarker++) + for (auto iMarker = 0; iMarker < nMarker; iMarker++) for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { NormalFace = vertex[iMarker][iVertex]->GetNormal(); Area = GeometryToolbox::Norm(nDim, NormalFace); @@ -968,11 +963,7 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig symmetryNormals.resize(nMarker); unsigned short nSym = 0; - for (iMarker = 0; iMarker < nMarker; ++iMarker) { - /*--- create the list with all corrected normals for all markers ---*/ - // symmetryNormals.push_back({}); - - /*--- Note that Syms is a sorted list, so val(Syms[i]) > val[Syms[i-1]] ---*/ + for (auto iMarker = 0; iMarker < nMarker; ++iMarker) { if (fine_grid->symmetryNormals[iMarker].size() > 0) { Syms[iMarker] = true; nSym++; @@ -989,7 +980,7 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig if (!nodes->GetDomain(iCoarsePoint)) continue; /*--- Get the normal of the current symmetry ---*/ - su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; + su2double UnitNormal[MAXNDIM] = {0.0}; vertex[val_marker][iVertex]->GetNormal(Normal); Area = GeometryToolbox::Norm(nDim, Normal); for (auto iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index ef8b1e019b6..1ca5bd51f98 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -7294,11 +7294,8 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh unsigned short nSym = 0; SU2_OMP_FOR_DYN(1) for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { - /*--- create the list with all corrected normals for all markers ---*/ - if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - /*--- Note that Syms is a sorted list, so val(Syms[i]) > val[Syms[i-1]] ---*/ Syms[nSym] = iMarker; nSym++; } diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index 3c693f2f2aa..c30e69744ce 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -52,7 +52,7 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& su2activematrix Gradients_Velocity(nDim, nDim); su2activematrix Gradients_Velocity_Reflected(nDim, nDim); su2double gradPhi[MAXNDIM] = {0.0}; - su2double gradPhiReflected[MAXNDIM] = {0.0}; + //su2double gradPhiReflected[MAXNDIM] = {0.0}; /*--- First we correct the part that involves velocities ---*/ if (idxVel != -1) { @@ -114,32 +114,41 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) { if ((idxVel == -1) || ((idxVel != -1) && (iVar == 0 || iVar > nDim))) { - /*--- project to symmetry aligned base ---*/ - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradPhi[iDim] = Gradients_iPoint[iVar][iDim]; - gradPhiReflected[iDim] = 0.0; - } - - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - /*--- map transpose T' * grad(phi) ---*/ - gradPhiReflected[jDim] += TensorMap[jDim][iDim] * Gradients_iPoint[iVar][iDim]; - } - } - - for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; - - /*--- gradient in direction normal to symmetry is cancelled ---*/ - gradPhiReflected[0] = 0.0; + // /*--- project to symmetry aligned base ---*/ + for (auto iDim = 0u; iDim < nDim; iDim++) { + gradPhi[iDim] = Gradients_iPoint[iVar][iDim]; + // gradPhiReflected[iDim] = 0.0; + } + + // for (auto jDim = 0u; jDim < nDim; jDim++) { + // for (auto iDim = 0u; iDim < nDim; iDim++) { + // /*--- map transpose T' * grad(phi) ---*/ + // //gradPhiReflected[jDim] += TensorMap[jDim][iDim] * Gradients_iPoint[iVar][iDim]; + // gradPhiReflected[jDim] += TensorMap[jDim][iDim] * gradPhi[iDim]; + // } + // } + + // for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; + + // /*--- gradient in direction normal to symmetry is cancelled ---*/ + // gradPhiReflected[0] = 0.0; + + // /*--- Now transform back ---*/ + // for (auto jDim = 0u; jDim < nDim; jDim++) { + // for (auto iDim = 0u; iDim < nDim; iDim++) { + // gradPhi[jDim] += TensorMap[iDim][jDim] * gradPhiReflected[iDim]; + // } + // } + + // I - n'.n.grad - /*--- Now transform back ---*/ - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradPhi[jDim] += TensorMap[iDim][jDim] * gradPhiReflected[iDim]; + for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto jDim = 0u; jDim < nDim; jDim++) { + Gradients_iPoint[iVar][iDim] -= TensorMap[0][iDim] * TensorMap[0][jDim] * gradPhi[jDim]; } } - for (auto iDim = 0u; iDim < nDim; iDim++) Gradients_iPoint[iVar][iDim] = gradPhi[iDim]; + //for (auto iDim = 0u; iDim < nDim; iDim++) Gradients_iPoint[iVar][iDim] = gradPhi[iDim]; } } } From b6d2bddf8c1116ea6887cfe40bbefb3915609934 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sat, 20 Jul 2024 23:22:34 +0200 Subject: [PATCH 170/194] simplify gradvel --- .../gradients/computeGradientsSymmetry.hpp | 98 ++++++++----------- .../include/solvers/CFVMFlowSolverBase.inl | 1 - TestCases/parallel_regression.py | 8 +- TestCases/serial_regression.py | 4 +- 4 files changed, 46 insertions(+), 65 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index c30e69744ce..dfea6fe47b8 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -52,7 +52,25 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& su2activematrix Gradients_Velocity(nDim, nDim); su2activematrix Gradients_Velocity_Reflected(nDim, nDim); su2double gradPhi[MAXNDIM] = {0.0}; - //su2double gradPhiReflected[MAXNDIM] = {0.0}; + + /*--- normal vector---*/ + su2double n[MAXNDIM] = {0.0}; + /*--- n.n^T ---*/ + su2activematrix nn(nDim, nDim); + su2activematrix Vnn(nDim, nDim); + su2activematrix nnV(nDim, nDim); + //su2activematrix nnVnn(nDim, nDim); + + // get the normal vector of the symmetry/Euler + for (auto iDim = 0u; iDim < nDim; iDim++) { + n[iDim] = TensorMap[0][iDim]; + } + /*--- n.n^T ---*/ + for (auto jDim = 0u; jDim < nDim; jDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + nn[iDim][jDim] = n[iDim]*n[jDim]; + } + } /*--- First we correct the part that involves velocities ---*/ if (idxVel != -1) { @@ -60,49 +78,36 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& for (auto iVar = 0u; iVar < nDim; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { Gradients_Velocity[iVar][iDim] = Gradients_iPoint[idxVel + iVar][iDim]; - Gradients_Velocity_Reflected[iVar][iDim] = 0.0; + //Gradients_Velocity_Reflected[iVar][iDim] = 0.0; + nn[iVar][iDim] = 0.0; + Vnn[iVar][iDim] = 0.0; + nnV[iVar][iDim] = 0.0; } } - /*--- Q = L^T * Q * T ---*/ - for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto kDim = 0u; kDim < nDim; kDim++) { - for (auto mDim = 0u; mDim < nDim; mDim++) { - Gradients_Velocity_Reflected[iDim][jDim] += - TensorMap[iDim][mDim] * TensorMap[jDim][kDim] * Gradients_Velocity[mDim][kDim]; - } + Vnn[iDim][jDim] += Gradients_Velocity[iDim][kDim]*nn[kDim][jDim]; + nnV[iDim][jDim] += nn[iDim][kDim]*Gradients_Velocity[kDim][jDim]; } } - } - - /*--- we have aligned such that U is the direction of the normal - * in 2D: dU/dy = dV/dx = 0 - * in 3D: dU/dy = dV/dx = 0 - * dU/dz = dW/dx = 0 ---*/ - for (auto iDim = 1u; iDim < nDim; iDim++) { - Gradients_Velocity_Reflected[0][iDim] = 0.0; - Gradients_Velocity_Reflected[iDim][0] = 0.0; - } - - for (auto iDim = 0u; iDim < nDim; iDim++) { + } + for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { - Gradients_Velocity[iDim][jDim] = 0.0; + for (auto kDim = 0u; kDim < nDim; kDim++) { + Gradients_Velocity[iDim][jDim] += 2.0*nnV[iDim][kDim]*nn[kDim][jDim]; + } } - } + } - /*--- now transform back the corrected velocity gradients by taking the inverse again - * T = (L^-1) * T' ---*/ - for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto kDim = 0u; kDim < nDim; kDim++) { - for (auto mDim = 0u; mDim < nDim; mDim++) { - Gradients_Velocity[iDim][jDim] += - TensorMap[mDim][iDim] * TensorMap[kDim][jDim] * Gradients_Velocity_Reflected[mDim][kDim]; - } - } + Gradients_Velocity[iDim][jDim] -= Vnn[iDim][jDim] - nnV[iDim][jDim]; } - } + } + + for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { @@ -111,44 +116,21 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& } } + /*-------------------------------------------------------------------*/ /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) { if ((idxVel == -1) || ((idxVel != -1) && (iVar == 0 || iVar > nDim))) { - // /*--- project to symmetry aligned base ---*/ for (auto iDim = 0u; iDim < nDim; iDim++) { gradPhi[iDim] = Gradients_iPoint[iVar][iDim]; - // gradPhiReflected[iDim] = 0.0; } - // for (auto jDim = 0u; jDim < nDim; jDim++) { - // for (auto iDim = 0u; iDim < nDim; iDim++) { - // /*--- map transpose T' * grad(phi) ---*/ - // //gradPhiReflected[jDim] += TensorMap[jDim][iDim] * Gradients_iPoint[iVar][iDim]; - // gradPhiReflected[jDim] += TensorMap[jDim][iDim] * gradPhi[iDim]; - // } - // } - - // for (auto iDim = 0u; iDim < nDim; iDim++) gradPhi[iDim] = 0.0; - - // /*--- gradient in direction normal to symmetry is cancelled ---*/ - // gradPhiReflected[0] = 0.0; - - // /*--- Now transform back ---*/ - // for (auto jDim = 0u; jDim < nDim; jDim++) { - // for (auto iDim = 0u; iDim < nDim; iDim++) { - // gradPhi[jDim] += TensorMap[iDim][jDim] * gradPhiReflected[iDim]; - // } - // } - - // I - n'.n.grad - + // I - n'.n.gradphi for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { Gradients_iPoint[iVar][iDim] -= TensorMap[0][iDim] * TensorMap[0][jDim] * gradPhi[jDim]; } } - //for (auto iDim = 0u; iDim < nDim; iDim++) Gradients_iPoint[iVar][iDim] = gradPhi[iDim]; } } } @@ -239,7 +221,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - +//cout << "ipoint="<GetNormal(); diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 85b12207e31..49a408352cf 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1146,7 +1146,6 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against - unsigned short nSym = 0; for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 060b28e132e..d4a44012e5b 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -139,7 +139,7 @@ def main(): invwedge_roe.cfg_dir = "nonequilibrium/invwedge" invwedge_roe.cfg_file = "invwedge_roe.cfg" invwedge_roe.test_iter = 10 - invwedge_roe.test_vals = [-1.076208, -1.601054, -17.208284, -17.538036, -17.481414, 2.242618, 1.826124, 5.278939, 0.877576] + invwedge_roe.test_vals = [-1.075966, -1.600814, -17.208192, -17.537944, -17.481322, 2.242877, 1.826787, 5.279178, 0.877871] invwedge_roe.test_vals_aarch64 = [-1.069128, -1.593891, -17.208222, -17.537969, -17.481352, 2.249020, 1.852904, 5.287143, 0.879852] test_list.append(invwedge_roe) @@ -290,7 +290,7 @@ def main(): ramp.cfg_dir = "euler/ramp" ramp.cfg_file = "inv_ramp.cfg" ramp.test_iter = 10 - ramp.test_vals = [-13.648478, -8.010936, -0.076277, 0.054839] + ramp.test_vals = [-13.648531, -8.010449, -0.076277, 0.054839] ramp.test_vals_aarch64 = [-13.398422, -7.786461, -0.081064, 0.056474] test_list.append(ramp) @@ -415,7 +415,7 @@ def main(): turb_oneram6_nk.cfg_dir = "rans/oneram6" turb_oneram6_nk.cfg_file = "turb_ONERAM6_nk.cfg" turb_oneram6_nk.test_iter = 20 - turb_oneram6_nk.test_vals = [-4.853239, -4.457449, -11.440368, 0.220006, 0.049374, 5.000000, -0.607610, 22.806000] + turb_oneram6_nk.test_vals = [-4.856121, -4.461374, -11.442087, 0.220152, 0.049413, 4.000000, -0.649648, 22.806000] turb_oneram6_nk.timeout = 600 turb_oneram6_nk.tol = 0.0001 test_list.append(turb_oneram6_nk) @@ -773,7 +773,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-11.956929, -17.470336, -1.056500, 0.019964] + contadj_naca0012.test_vals = [-11.956261, -17.486277, -1.056500, 0.019964] test_list.append(contadj_naca0012) # Inviscid ONERA M6 diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 0423db171da..d0a393d5c52 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -577,7 +577,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-11.971750, -17.482428, -1.056500, 0.019964] + contadj_naca0012.test_vals = [-11.967646, -17.480367, -1.056500, 0.019964] contadj_naca0012.tol = 0.001 test_list.append(contadj_naca0012) @@ -1079,7 +1079,7 @@ def main(): airfoilRBF.cfg_file = "config.cfg" airfoilRBF.test_iter = 1 - airfoilRBF.test_vals = [1.000000, -2.581854, -5.085813] + airfoilRBF.test_vals = [1.000000, -0.904551, -3.224510] airfoilRBF.tol = 0.0001 airfoilRBF.multizone = True test_list.append(airfoilRBF) From 1120fc5cc3d60ce4a426b60ff436b3e956e52507 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 21 Jul 2024 22:01:08 +0200 Subject: [PATCH 171/194] fix segfault --- .../gradients/computeGradientsSymmetry.hpp | 36 +++++++++---------- .../include/solvers/CFVMFlowSolverBase.inl | 1 + 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index dfea6fe47b8..67b8c2c9b7a 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -59,12 +59,12 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& su2activematrix nn(nDim, nDim); su2activematrix Vnn(nDim, nDim); su2activematrix nnV(nDim, nDim); - //su2activematrix nnVnn(nDim, nDim); - // get the normal vector of the symmetry/Euler + // get the normal vector n of the symmetry/Euler edge for (auto iDim = 0u; iDim < nDim; iDim++) { n[iDim] = TensorMap[0][iDim]; } + /*--- n.n^T ---*/ for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto iDim = 0u; iDim < nDim; iDim++) { @@ -78,8 +78,6 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& for (auto iVar = 0u; iVar < nDim; iVar++) { for (auto iDim = 0u; iDim < nDim; iDim++) { Gradients_Velocity[iVar][iDim] = Gradients_iPoint[idxVel + iVar][iDim]; - //Gradients_Velocity_Reflected[iVar][iDim] = 0.0; - nn[iVar][iDim] = 0.0; Vnn[iVar][iDim] = 0.0; nnV[iVar][iDim] = 0.0; } @@ -93,33 +91,35 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& } } } + for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { + Gradients_iPoint[iDim + idxVel][jDim] -= (Vnn[iDim][jDim] + nnV[iDim][jDim]); for (auto kDim = 0u; kDim < nDim; kDim++) { - Gradients_Velocity[iDim][jDim] += 2.0*nnV[iDim][kDim]*nn[kDim][jDim]; + Gradients_iPoint[iDim + idxVel][jDim] += 2.0*nnV[iDim][kDim]*nn[kDim][jDim]; } } } - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - Gradients_Velocity[iDim][jDim] -= Vnn[iDim][jDim] - nnV[iDim][jDim]; - } - } - +// for (auto iDim = 0u; iDim < nDim; iDim++) { +// for (auto jDim = 0u; jDim < nDim; jDim++) { +// Gradients_iPoint[iDim + idxVel][jDim] -= (Vnn[iDim][jDim] + nnV[iDim][jDim]); +// } +// } +// for (auto iDim = 0u; iDim < nDim; iDim++) { +// for (auto jDim = 0u; jDim < nDim; jDim++) { +// Gradients_iPoint[iDim + idxVel][jDim] = Gradients_Velocity[iDim][jDim]; +// } +// } - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - Gradients_iPoint[iDim + idxVel][jDim] = Gradients_Velocity[iDim][jDim]; - } - } } /*-------------------------------------------------------------------*/ /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) { if ((idxVel == -1) || ((idxVel != -1) && (iVar == 0 || iVar > nDim))) { + for (auto iDim = 0u; iDim < nDim; iDim++) { gradPhi[iDim] = Gradients_iPoint[iVar][iDim]; } @@ -127,7 +127,7 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& // I - n'.n.gradphi for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { - Gradients_iPoint[iVar][iDim] -= TensorMap[0][iDim] * TensorMap[0][jDim] * gradPhi[jDim]; + Gradients_iPoint[iVar][iDim] -= nn[iDim][jDim] * gradPhi[jDim]; } } @@ -221,7 +221,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); -//cout << "ipoint="<GetNormal(); diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 49a408352cf..85b12207e31 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1146,6 +1146,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against + unsigned short nSym = 0; for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || From 2cf8ee07ee9818e37a8655092d0606f44f106057 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 22 Jul 2024 22:55:09 +0200 Subject: [PATCH 172/194] cleanup simplification --- .../gradients/computeGradientsSymmetry.hpp | 91 ++----------------- TestCases/hybrid_regression_AD.py | 2 +- .../multiple_ffd/naca0012/of_grad_cd.dat.ref | 2 +- .../naca0012/of_grad_directdiff.dat.ref | 4 +- TestCases/parallel_regression.py | 10 +- 5 files changed, 17 insertions(+), 92 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index 67b8c2c9b7a..2480c246d2c 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -44,8 +44,8 @@ namespace detail { * \param[in] TensorMAp - the tensor map to map to rotated base. * \param[out] Gradients_iPoint - the gradient for the point. */ -template -inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& TensorMap, +template +inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, const Scalar* n, Matrix& Gradients_iPoint, short idxVel) { static constexpr size_t MAXNDIM = 3; @@ -53,17 +53,12 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& su2activematrix Gradients_Velocity_Reflected(nDim, nDim); su2double gradPhi[MAXNDIM] = {0.0}; - /*--- normal vector---*/ - su2double n[MAXNDIM] = {0.0}; /*--- n.n^T ---*/ su2activematrix nn(nDim, nDim); su2activematrix Vnn(nDim, nDim); su2activematrix nnV(nDim, nDim); - // get the normal vector n of the symmetry/Euler edge - for (auto iDim = 0u; iDim < nDim; iDim++) { - n[iDim] = TensorMap[0][iDim]; - } + /*--- n.n^T ---*/ for (auto jDim = 0u; jDim < nDim; jDim++) { @@ -83,36 +78,23 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& } } - for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { for (auto kDim = 0u; kDim < nDim; kDim++) { Vnn[iDim][jDim] += Gradients_Velocity[iDim][kDim]*nn[kDim][jDim]; nnV[iDim][jDim] += nn[iDim][kDim]*Gradients_Velocity[kDim][jDim]; } } - } + } - for (auto iDim = 0u; iDim < nDim; iDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { for (auto jDim = 0u; jDim < nDim; jDim++) { Gradients_iPoint[iDim + idxVel][jDim] -= (Vnn[iDim][jDim] + nnV[iDim][jDim]); for (auto kDim = 0u; kDim < nDim; kDim++) { Gradients_iPoint[iDim + idxVel][jDim] += 2.0*nnV[iDim][kDim]*nn[kDim][jDim]; } } - } - -// for (auto iDim = 0u; iDim < nDim; iDim++) { -// for (auto jDim = 0u; jDim < nDim; jDim++) { -// Gradients_iPoint[iDim + idxVel][jDim] -= (Vnn[iDim][jDim] + nnV[iDim][jDim]); -// } -// } - -// for (auto iDim = 0u; iDim < nDim; iDim++) { -// for (auto jDim = 0u; jDim < nDim; jDim++) { -// Gradients_iPoint[iDim + idxVel][jDim] = Gradients_Velocity[iDim][jDim]; -// } -// } - + } } /*-------------------------------------------------------------------*/ @@ -135,57 +117,6 @@ inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, Matrix& } } -/*! \brief Construct a 2D or 3D base given a normal vector. - Constructs 1 (2D) or 2 (3D) additional vectors orthogonal to the normal to form a base. */ -template -inline void BaseFromNormal(Int nDim, const Scalar* UnitNormal, Matrix& TensorMap) { - /*--- Preprocessing: Compute unit tangential, the direction is arbitrary as long as - t*n=0 && |t|_2 = 1 ---*/ - Scalar Tangential[3] = {0.0}; - Scalar Orthogonal[3] = {0.0}; - switch (nDim) { - case 2: { - Tangential[0] = -UnitNormal[1]; - Tangential[1] = UnitNormal[0]; - for (auto iDim = 0u; iDim < nDim; iDim++) { - TensorMap[0][iDim] = UnitNormal[iDim]; - TensorMap[1][iDim] = Tangential[iDim]; - } - break; - } - case 3: { - /*--- n = ai + bj + ck, if |b| > |c| ---*/ - if (abs(UnitNormal[1]) > abs(UnitNormal[2])) { - /*--- t = bi + (c-a)j - bk ---*/ - Tangential[0] = UnitNormal[1]; - Tangential[1] = UnitNormal[2] - UnitNormal[0]; - Tangential[2] = -UnitNormal[1]; - } else { - /*--- t = ci - cj + (b-a)k ---*/ - Tangential[0] = UnitNormal[2]; - Tangential[1] = -UnitNormal[2]; - Tangential[2] = UnitNormal[1] - UnitNormal[0]; - } - /*--- Make it a unit vector. ---*/ - Scalar TangentialNorm = GeometryToolbox::Norm(3, Tangential); - Tangential[0] = Tangential[0] / TangentialNorm; - Tangential[1] = Tangential[1] / TangentialNorm; - Tangential[2] = Tangential[2] / TangentialNorm; - - /*--- Compute 3rd direction of the base using cross product ---*/ - GeometryToolbox::CrossProduct(UnitNormal, Tangential, Orthogonal); - - /*--- now we construct the tensor mapping T, note that its inverse is the transpose of T ---*/ - for (auto iDim = 0u; iDim < nDim; iDim++) { - TensorMap[0][iDim] = UnitNormal[iDim]; - TensorMap[1][iDim] = Tangential[iDim]; - TensorMap[2][iDim] = Orthogonal[iDim]; - } - break; - } - } // switch -} - } @@ -245,12 +176,6 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI } } - /*--- Tensor mapping from global Cartesian to local Cartesian aligned with symmetry plane ---*/ - su2activematrix TensorMap(nDim,nDim); - - /*--- Compute a new base for TensorMap aligned with the unit normal ---*/ - detail::BaseFromNormal(nDim,UnitNormal,TensorMap); - su2activematrix Gradients_iPoint(varEnd-varBegin,nDim); /*--- Fill the local gradient tensor ---*/ @@ -260,7 +185,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI } } - detail::CorrectGradient(nDim, varBegin,varEnd, TensorMap, Gradients_iPoint, idxVel); + detail::CorrectGradient(nDim, varBegin,varEnd, UnitNormal, Gradients_iPoint, idxVel); /*--- Write the corrected gradient tensor ---*/ for (auto iVar = varBegin; iVar < varEnd; iVar++) { diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index e562fe4f0bb..2522b651afb 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -58,7 +58,7 @@ def main(): discadj_cylinder3D.cfg_dir = "disc_adj_euler/cylinder3D" discadj_cylinder3D.cfg_file = "inv_cylinder3D.cfg" discadj_cylinder3D.test_iter = 5 - discadj_cylinder3D.test_vals = [-3.773582, -3.736536, -0.000000, 0.000000] + discadj_cylinder3D.test_vals = [-3.764562, -3.719981, -0.000000, 0.000000] test_list.append(discadj_cylinder3D) # Arina nozzle 2D diff --git a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref index bce05aa9bf6..5125e8611f4 100644 --- a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref +++ b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref @@ -1,3 +1,3 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , 0.0779208 , 0.001 + 0 , 0.0779175 , 0.001 1 , -0.115959 , 0.001 diff --git a/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref b/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref index 74adba36fa1..f2dde38cdf7 100644 --- a/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref +++ b/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref @@ -1,3 +1,3 @@ VARIABLES="VARIABLE" , "DRAG" , "EFFICIENCY" , "FORCE_X" , "FORCE_Y" , "FORCE_Z" , "LIFT" , "MOMENT_X" , "MOMENT_Y" , "MOMENT_Z" , "SIDEFORCE" - 0 , 0.06149476303 , -0.608748249 , 0.05888315926 , 0.1203589365 , 0.0 , 0.119045765 , 0.0 , 0.0 , 0.009719951712 , 0.0 - 1 , -0.08536237383 , 8.303168487 , -0.09097907726 , 0.2564786779 , 0.0 , 0.2584023411 , 0.0 , 0.0 , 0.004460595335 , 0.0 + 0 , 0.06150627044 , -0.6117158351 , 0.05889496613 , 0.1203453382 , 0.0 , 0.1190319124 , 0.0 , 0.0 , 0.009707441327 , 0.0 + 1 , -0.08534352188 , 8.301261675 , -0.09095957455 , 0.2564490596 , 0.0 , 0.2583723043 , 0.0 , 0.0 , 0.004447312573 , 0.0 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index bc126b8b4b6..0d2ec8afc7d 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -290,7 +290,7 @@ def main(): ramp.cfg_dir = "euler/ramp" ramp.cfg_file = "inv_ramp.cfg" ramp.test_iter = 10 - ramp.test_vals = [-13.648531, -8.010449, -0.076277, 0.054839] + ramp.test_vals = [-13.648891, -8.011653, -0.076277, 0.054839] ramp.test_vals_aarch64 = [-13.398422, -7.786461, -0.081064, 0.056474] test_list.append(ramp) @@ -397,7 +397,7 @@ def main(): turb_flatplate_CC_Wilcox.cfg_dir = "rans/flatplate" turb_flatplate_CC_Wilcox.cfg_file = "turb_SST_flatplate_compressibility_Wilcox.cfg" turb_flatplate_CC_Wilcox.test_iter = 20 - turb_flatplate_CC_Wilcox.test_vals = [-1.280847, 1.974242, 1.440510, 5.038429, -4.051126, 8.520857] + turb_flatplate_CC_Wilcox.test_vals = [-1.280875, 1.974212, 1.440458, 5.038402, -4.051125, 8.521136] test_list.append(turb_flatplate_CC_Wilcox) # Flat plate SST compressibility correction Sarkar @@ -405,7 +405,7 @@ def main(): turb_flatplate_CC_Sarkar.cfg_dir = "rans/flatplate" turb_flatplate_CC_Sarkar.cfg_file = "turb_SST_flatplate_compressibility_Sarkar.cfg" turb_flatplate_CC_Sarkar.test_iter = 20 - turb_flatplate_CC_Sarkar.test_vals = [-1.280847, 1.974242, 1.440510, 5.038429, -4.051129, 8.520857] + turb_flatplate_CC_Sarkar.test_vals = [-1.280875, 1.974212, 1.440458, 5.038402, -4.051128, 8.521136] test_list.append(turb_flatplate_CC_Sarkar) # ONERA M6 Wing @@ -431,7 +431,7 @@ def main(): turb_oneram6_nk.cfg_dir = "rans/oneram6" turb_oneram6_nk.cfg_file = "turb_ONERAM6_nk.cfg" turb_oneram6_nk.test_iter = 20 - turb_oneram6_nk.test_vals = [-4.856121, -4.461374, -11.442087, 0.220152, 0.049413, 4.000000, -0.649648, 22.806000] + turb_oneram6_nk.test_vals = [-4.853515, -4.457529, -11.453617, 0.219949, 0.049372, 5.000000, -0.566595, 22.806000] turb_oneram6_nk.timeout = 600 turb_oneram6_nk.tol = 0.0001 test_list.append(turb_oneram6_nk) @@ -789,7 +789,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-11.956261, -17.486277, -1.056500, 0.019964] + contadj_naca0012.test_vals = [-11.956426, -17.476600, -1.056500, 0.019964] test_list.append(contadj_naca0012) # Inviscid ONERA M6 From d63e182ccbdfdb1e15424169d022a46195f02c28 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 22 Jul 2024 23:30:06 +0200 Subject: [PATCH 173/194] fix final regression --- TestCases/hybrid_regression_AD.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index 2522b651afb..e562fe4f0bb 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -58,7 +58,7 @@ def main(): discadj_cylinder3D.cfg_dir = "disc_adj_euler/cylinder3D" discadj_cylinder3D.cfg_file = "inv_cylinder3D.cfg" discadj_cylinder3D.test_iter = 5 - discadj_cylinder3D.test_vals = [-3.764562, -3.719981, -0.000000, 0.000000] + discadj_cylinder3D.test_vals = [-3.773582, -3.736536, -0.000000, 0.000000] test_list.append(discadj_cylinder3D) # Arina nozzle 2D From 80cd7460e7163c6d0fb7ae1a6510329b1571c26d Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 23 Jul 2024 08:44:43 +0200 Subject: [PATCH 174/194] omp for multigrid --- Common/src/geometry/CMultiGridGeometry.cpp | 199 +++++++++++---------- 1 file changed, 104 insertions(+), 95 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 1a508c8e2ce..566552c61ac 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -925,108 +925,117 @@ void CMultiGridGeometry::SetControlVolume(const CGeometry* fine_grid, unsigned s } void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) { - BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { - unsigned long iCoarsePoint, iFinePoint, FineVertex, iVertex; - su2double Normal[MAXNDIM] = {0.0}, Area, *NormalFace = nullptr; - - if (action != ALLOCATE) { - for (auto iMarker = 0; iMarker < nMarker; iMarker++) - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) vertex[iMarker][iVertex]->SetZeroValues(); - } + unsigned long iCoarsePoint, iFinePoint, FineVertex, iVertex; + su2double Normal[MAXNDIM] = {0.0}, Area, *NormalFace = nullptr; + if (action != ALLOCATE) { + SU2_OMP_FOR_DYN(1) for (auto iMarker = 0; iMarker < nMarker; iMarker++) - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { - iCoarsePoint = vertex[iMarker][iVertex]->GetNode(); - for (auto iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren++) { - iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren); - if (fine_grid->nodes->GetVertex(iFinePoint, iMarker) != -1) { - FineVertex = fine_grid->nodes->GetVertex(iFinePoint, iMarker); - fine_grid->vertex[iMarker][FineVertex]->GetNormal(Normal); - vertex[iMarker][iVertex]->AddNormal(Normal); - } - } - } + for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) vertex[iMarker][iVertex]->SetZeroValues(); + END_SU2_OMP_FOR + } - /*--- Check if there is a normal with null area ---*/ - for (auto iMarker = 0; iMarker < nMarker; iMarker++) - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { - NormalFace = vertex[iMarker][iVertex]->GetNormal(); - Area = GeometryToolbox::Norm(nDim, NormalFace); - if (Area == 0.0) - for (auto iDim = 0; iDim < nDim; iDim++) NormalFace[iDim] = EPS * EPS; + SU2_OMP_FOR_DYN(1) + for (auto iMarker = 0; iMarker < nMarker; iMarker++) { + for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { + iCoarsePoint = vertex[iMarker][iVertex]->GetNode(); + for (auto iChildren = 0; iChildren < nodes->GetnChildren_CV(iCoarsePoint); iChildren++) { + iFinePoint = nodes->GetChildren_CV(iCoarsePoint, iChildren); + if (fine_grid->nodes->GetVertex(iFinePoint, iMarker) != -1) { + FineVertex = fine_grid->nodes->GetVertex(iFinePoint, iMarker); + fine_grid->vertex[iMarker][FineVertex]->GetNormal(Normal); + vertex[iMarker][iVertex]->AddNormal(Normal); + } } + } + } + END_SU2_OMP_FOR - /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against. - All nodes that are shared by multiple symmetries have to get a corrected normal. */ - static constexpr size_t MAXNSYMS = 100; - bool Syms[MAXNSYMS] = {false}; - symmetryNormals.resize(nMarker); - - unsigned short nSym = 0; - for (auto iMarker = 0; iMarker < nMarker; ++iMarker) { - if (fine_grid->symmetryNormals[iMarker].size() > 0) { - Syms[iMarker] = true; - nSym++; - } + /*--- Check if there is a normal with null area ---*/ + SU2_OMP_FOR_DYN(1) + for (auto iMarker = 0; iMarker < nMarker; iMarker++) + for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { + NormalFace = vertex[iMarker][iVertex]->GetNormal(); + Area = GeometryToolbox::Norm(nDim, NormalFace); + if (Area == 0.0) + for (auto iDim = 0; iDim < nDim; iDim++) NormalFace[iDim] = EPS * EPS; } + END_SU2_OMP_FOR - // /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ - for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { - if (Syms[val_marker] == false) continue; - for (iVertex = 0; iVertex < nVertex[val_marker]; iVertex++) { - iCoarsePoint = vertex[val_marker][iVertex]->GetNode(); - - /*--- Halo points do not need to be considered. ---*/ - if (!nodes->GetDomain(iCoarsePoint)) continue; - - /*--- Get the normal of the current symmetry ---*/ - su2double UnitNormal[MAXNDIM] = {0.0}; - vertex[val_marker][iVertex]->GetNormal(Normal); - Area = GeometryToolbox::Norm(nDim, Normal); - for (auto iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; - - /*--- At this point we find out if the node is shared with another symmetry. ---*/ - /*--- We then apply a Gram-Schmidt process to compute the orthonormal basis from all - normal vectors of the shared symmetries at the node. ---*/ - /*--- Step 1: do we have other symmetries? ---*/ - if (nSym > 0) { - /*--- Normal of the primary symmetry plane ---*/ - su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - /*--- Step 2: are we on a shared node? ---*/ - for (auto iMarker = 0; iMarker < nMarker; iMarker++) { - if (Syms[iMarker] == false) continue; // not on a symmetry - /*--- We do not want the current symmetry ---*/ - if (val_marker != iMarker) { - /*--- Loop over all points on the other symmetry and check if current iPoint is on the symmetry ---*/ - for (auto jVertex = 0ul; jVertex < nVertex[iMarker]; jVertex++) { - const auto jPoint = vertex[iMarker][jVertex]->GetNode(); - if (!nodes->GetDomain(jPoint)) continue; - /*--- We are on a shared node. ---*/ - if (iCoarsePoint == jPoint) { - /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ - if (iMarker < val_marker) { - /*--- So we have to get the normal of that other marker ---*/ - vertex[iMarker][jVertex]->GetNormal(NormalPrim); - su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - } - /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ - su2double ProjNorm = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - symNormal sn = {iCoarsePoint}; - - /*--- We check if the normal of the 2 planes coincide. - * We only update the normal if the normals of the symmetry planes are different. ---*/ - if (fabs(1.0 - ProjNorm) > EPS) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - /*--- Make normalized vector ---*/ - su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal); - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea; - } - for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; - symmetryNormals[val_marker].push_back(sn); + /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against. + All nodes that are shared by multiple symmetries have to get a corrected normal. */ + static constexpr size_t MAXNSYMS = 100; + bool Syms[MAXNSYMS] = {false}; + symmetryNormals.resize(nMarker); + + unsigned short nSym = 0; + SU2_OMP_FOR_DYN(1) + for (auto iMarker = 0; iMarker < nMarker; ++iMarker) { + if (fine_grid->symmetryNormals[iMarker].size() > 0) { + Syms[iMarker] = true; + nSym++; + } + } + SU2_OMP_FOR_DYN(1) + + + // /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ + SU2_OMP_FOR_DYN(1) + for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { + if (Syms[val_marker] == false) continue; + for (iVertex = 0; iVertex < nVertex[val_marker]; iVertex++) { + iCoarsePoint = vertex[val_marker][iVertex]->GetNode(); + + /*--- Halo points do not need to be considered. ---*/ + if (!nodes->GetDomain(iCoarsePoint)) continue; + + /*--- Get the normal of the current symmetry ---*/ + su2double UnitNormal[MAXNDIM] = {0.0}; + vertex[val_marker][iVertex]->GetNormal(Normal); + Area = GeometryToolbox::Norm(nDim, Normal); + for (auto iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; + + /*--- At this point we find out if the node is shared with another symmetry. ---*/ + /*--- We then apply a Gram-Schmidt process to compute the orthonormal basis from all + normal vectors of the shared symmetries at the node. ---*/ + /*--- Step 1: do we have other symmetries? ---*/ + if (nSym > 0) { + /*--- Normal of the primary symmetry plane ---*/ + su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; + /*--- Step 2: are we on a shared node? ---*/ + for (auto iMarker = 0; iMarker < nMarker; iMarker++) { + if (Syms[iMarker] == false) continue; // not on a symmetry + /*--- We do not want the current symmetry ---*/ + if (val_marker != iMarker) { + /*--- Loop over all points on the other symmetry and check if current iPoint is on the symmetry ---*/ + for (auto jVertex = 0ul; jVertex < nVertex[iMarker]; jVertex++) { + const auto jPoint = vertex[iMarker][jVertex]->GetNode(); + if (!nodes->GetDomain(jPoint)) continue; + /*--- We are on a shared node. ---*/ + if (iCoarsePoint == jPoint) { + /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ + if (iMarker < val_marker) { + /*--- So we have to get the normal of that other marker ---*/ + vertex[iMarker][jVertex]->GetNormal(NormalPrim); + su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; } + /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ + su2double ProjNorm = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; + symNormal sn = {iCoarsePoint}; + + /*--- We check if the normal of the 2 planes coincide. + * We only update the normal if the normals of the symmetry planes are different. ---*/ + if (fabs(1.0 - ProjNorm) > EPS) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; + /*--- Make normalized vector ---*/ + su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea; + } + for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; + symmetryNormals[val_marker].push_back(sn); } } } @@ -1035,7 +1044,7 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig } } } - END_SU2_OMP_SAFE_GLOBAL_ACCESS + END_SU2_OMP_FOR } void CMultiGridGeometry::SetCoord(const CGeometry* fine_grid) { From f0d8f6a7abb2cdd3c0902ff15d172fafcab5be68 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 23 Jul 2024 10:14:18 +0200 Subject: [PATCH 175/194] clang-format --- Common/src/geometry/CMultiGridGeometry.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 566552c61ac..3421c968c05 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -978,7 +978,6 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig } SU2_OMP_FOR_DYN(1) - // /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ SU2_OMP_FOR_DYN(1) for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { @@ -1027,7 +1026,7 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig symNormal sn = {iCoarsePoint}; /*--- We check if the normal of the 2 planes coincide. - * We only update the normal if the normals of the symmetry planes are different. ---*/ + * We only update the normal if the normals of the symmetry planes are different. ---*/ if (fabs(1.0 - ProjNorm) > EPS) { for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; /*--- Make normalized vector ---*/ From 7b4174aec51ec2563c621f5213b8060e07eb72ed Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 23 Jul 2024 10:15:43 +0200 Subject: [PATCH 176/194] clang-format --- Common/src/geometry/CMultiGridGeometry.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 3421c968c05..fda067a7ccf 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -976,7 +976,8 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig nSym++; } } - SU2_OMP_FOR_DYN(1) + END_SU2_OMP_FOR + // /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ SU2_OMP_FOR_DYN(1) From 2040805f12825e9c45372a5e82cd9a011d2afdda Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 23 Jul 2024 10:16:18 +0200 Subject: [PATCH 177/194] fix omp line --- Common/src/geometry/CMultiGridGeometry.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index fda067a7ccf..4ff85fa1b1c 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -978,7 +978,6 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig } END_SU2_OMP_FOR - // /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ SU2_OMP_FOR_DYN(1) for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { From fc98ba959b3b521940ae81c590c404d50dee913a Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 25 Jul 2024 00:17:45 +0200 Subject: [PATCH 178/194] update laminar sphere regression --- .../incomp_navierstokes/sphere/sphere.cfg | 40 ++++++++++++------- TestCases/parallel_regression.py | 2 +- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/TestCases/incomp_navierstokes/sphere/sphere.cfg b/TestCases/incomp_navierstokes/sphere/sphere.cfg index 45237ad8429..7f5ed6dd2fc 100644 --- a/TestCases/incomp_navierstokes/sphere/sphere.cfg +++ b/TestCases/incomp_navierstokes/sphere/sphere.cfg @@ -13,27 +13,32 @@ % SOLVER= INC_NAVIER_STOKES KIND_TURB_MODEL= NONE -MATH_PROBLEM= DIRECT RESTART_SOL= YES INC_NONDIM= DIMENSIONAL % ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% -% Re = rho*V*D/mu = 0.01*20*1.0/0.01 = 20 -INC_DENSITY_INIT= 0.01 -INC_VELOCITY_INIT= ( 20., 0.0, 0.0 ) +% Re = rho*V*D/mu = 1*1*2.0/2.0 = 1.0 +INC_DENSITY_MODEL= CONSTANT +INC_ENERGY_EQUATION= NO +INC_DENSITY_INIT= 1.0 + +INC_VELOCITY_INIT= (1.0, 0.0, 0.0 ) +INC_VELOCITY_REF = 1 +INC_DENSITY_REF = 1.0 % --------------------------- VISCOSITY MODEL ---------------------------------% % VISCOSITY_MODEL= CONSTANT_VISCOSITY -MU_CONSTANT= 0.01 - +MU_CONSTANT= 2.0 % ---------------------- REFERENCE VALUE DEFINITION ---------------------------% % REF_ORIGIN_MOMENT_X = 0.25 REF_ORIGIN_MOMENT_Y = 0.00 REF_ORIGIN_MOMENT_Z = 0.00 -REF_LENGTH= 1.0 -REF_AREA= 1.0 +% sphere is 1/40 of a complete sphere +% area = pi*r^2 = 3.14159 +% 1/40 slice = 0.07854 +REF_AREA= 0.07854 % -------------------- BOUNDARY CONDITION DEFINITION --------------------------% % @@ -45,11 +50,10 @@ MARKER_MONITORING= ( wall ) % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % -NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 5.0 +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 10.0 CFL_ADAPT= NO -CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) -ITER=1000 +ITER=50000 VENKAT_LIMITER_COEFF= 0.01 % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% @@ -61,12 +65,18 @@ LINEAR_SOLVER_ITER= 5 % -------------------------- MULTIGRID PARAMETERS -----------------------------% % -MGLEVEL= 0 +MGLEVEL= 1 +MGCYCLE= V_CYCLE +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +MG_POST_SMOOTH= ( 1, 1, 1, 1 ) +MG_CORRECTION_SMOOTH= ( 1, 1, 1, 1 ) +MG_DAMP_RESTRICTION= 0.6 +MG_DAMP_PROLONGATION= 0.6 % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % CONV_NUM_METHOD_FLOW= FDS -MUSCL_FLOW= NO +MUSCL_FLOW= YES SLOPE_LIMITER_FLOW= NONE JST_SENSOR_COEFF= ( 0.5, 0.04 ) TIME_DISCRE_FLOW= EULER_IMPLICIT @@ -90,5 +100,5 @@ VOLUME_FILENAME= flow SURFACE_FILENAME= surface_flow OUTPUT_WRT_FREQ= 100 WRT_VOLUME_OVERWRITE= YES -SCREEN_OUTPUT= ( INNER_ITER, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_VELOCITY-Z, LIFT, DRAG ) +SCREEN_OUTPUT= ( INNER_ITER, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_VELOCITY-Z, LIFT, DRAG) VOLUME_OUTPUT= ( SOLUTION,PRIMITIVE,RESIDUAL,MULTIGRID, RANK ) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 0d2ec8afc7d..02a43b3794a 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -581,7 +581,7 @@ def main(): inc_lam_cylinder.test_vals = [-4.004072, -3.194881, -0.076553, 7.780048] test_list.append(inc_lam_cylinder) - # Laminar sphere with restart + # Laminar sphere with restart (3D slice) inc_lam_sphere = TestCase('inc_lam_sphere') inc_lam_sphere.cfg_dir = "incomp_navierstokes/sphere" inc_lam_sphere.cfg_file = "sphere.cfg" From f25221b037a9a3c22061ed263f69407ac20471c6 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 25 Jul 2024 08:43:05 +0200 Subject: [PATCH 179/194] update laminar sphere regression --- TestCases/parallel_regression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 02a43b3794a..ce2097049ea 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -581,12 +581,12 @@ def main(): inc_lam_cylinder.test_vals = [-4.004072, -3.194881, -0.076553, 7.780048] test_list.append(inc_lam_cylinder) - # Laminar sphere with restart (3D slice) + # Laminar sphere, Re=1. Last column: Cd=24/Re inc_lam_sphere = TestCase('inc_lam_sphere') inc_lam_sphere.cfg_dir = "incomp_navierstokes/sphere" inc_lam_sphere.cfg_file = "sphere.cfg" inc_lam_sphere.test_iter = 5 - inc_lam_sphere.test_vals = [-3.260319, -2.663880, 0.001744, 0.327888] + inc_lam_sphere.test_vals = [-8.343599, -7.902946, 0.121003, 25.782687] test_list.append(inc_lam_sphere) # Buoyancy-driven cavity From 500b96f8c7aee2d40860d30796c5356aea1fc395 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 27 Jul 2024 15:02:10 -0700 Subject: [PATCH 180/194] avoid heap allocations --- .../gradients/computeGradientsSymmetry.hpp | 118 ++++++------------ 1 file changed, 38 insertions(+), 80 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp index 2480c246d2c..38d91133a05 100644 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp @@ -32,87 +32,61 @@ #include "../../../Common/include/parallelization/omp_structure.hpp" #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" -namespace detail { +namespace detail { /*! - * \brief Correct the gradient on a symmetry by using a tensor mapping. + * \brief Correct the gradient on a symmetry plane. * \ingroup FvmAlgos - * \param[in] nDim - number of dimensions, 2 or 3. - * \param[in] varBegin - start of the variables. - * \param[in] varEnd - end of the variables. - * \param[in] isFlowSolver - are we using the flow solver. - * \param[in] TensorMAp - the tensor map to map to rotated base. - * \param[out] Gradients_iPoint - the gradient for the point. + * \param[in] nDim - Number of dimensions, 2 or 3. + * \param[in] varBegin - Start of the variables. + * \param[in] varEnd - End of the variables. + * \param[in] n - Normal direction. + * \param[in] idxVel - Variable index where velocity gradients start (-1 if all variables are scalars). + * \param[in, out] gradients - The gradients to be modified. */ -template -inline void CorrectGradient(Int nDim, size_t& varBegin, size_t& varEnd, const Scalar* n, - Matrix& Gradients_iPoint, short idxVel) { +template +inline void CorrectGradient(const int nDim_, const int varBegin, const int varEnd, const Scalar* n, + const int idxVel, Matrix&& gradients) { static constexpr size_t MAXNDIM = 3; + const int nDim = nDim_ == 2 ? 2 : 3; - su2activematrix Gradients_Velocity(nDim, nDim); - su2activematrix Gradients_Velocity_Reflected(nDim, nDim); - su2double gradPhi[MAXNDIM] = {0.0}; - - /*--- n.n^T ---*/ - su2activematrix nn(nDim, nDim); - su2activematrix Vnn(nDim, nDim); - su2activematrix nnV(nDim, nDim); - + /*--- First we correct the part that involves velocities. ---*/ + if (idxVel != -1) { + /*--- Normal gradient of velocity components and gradient of normal velocity. ---*/ + su2double normalGrad[MAXNDIM] = {}, gradNormalVel[MAXNDIM] = {}; - /*--- n.n^T ---*/ - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - nn[iDim][jDim] = n[iDim]*n[jDim]; - } - } + for (auto iDim = 0; iDim < nDim; iDim++) { + normalGrad[iDim] = GeometryToolbox::DotProduct(nDim, gradients[idxVel + iDim], n); - /*--- First we correct the part that involves velocities ---*/ - if (idxVel != -1) { - /*--- Get gradients of primitives of boundary cell ---*/ - for (auto iVar = 0u; iVar < nDim; iVar++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - Gradients_Velocity[iVar][iDim] = Gradients_iPoint[idxVel + iVar][iDim]; - Vnn[iVar][iDim] = 0.0; - nnV[iVar][iDim] = 0.0; + for (auto jDim = 0; jDim < nDim; jDim++) { + gradNormalVel[jDim] += n[iDim] * gradients[idxVel + iDim][jDim]; } } - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - for (auto kDim = 0u; kDim < nDim; kDim++) { - Vnn[iDim][jDim] += Gradients_Velocity[iDim][kDim]*nn[kDim][jDim]; - nnV[iDim][jDim] += nn[iDim][kDim]*Gradients_Velocity[kDim][jDim]; - } - } - } + /*--- Normal gradient of the normal velocity. ---*/ + const su2double normalGradNormalVel = GeometryToolbox::DotProduct(nDim, n, gradNormalVel); - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - Gradients_iPoint[iDim + idxVel][jDim] -= (Vnn[iDim][jDim] + nnV[iDim][jDim]); - for (auto kDim = 0u; kDim < nDim; kDim++) { - Gradients_iPoint[iDim + idxVel][jDim] += 2.0*nnV[iDim][kDim]*nn[kDim][jDim]; - } + /*--- Remove the tangential projection (I - n.n^T) of the normal gradients. + * And the normal projection (n.n^T) of the tangential gradients. + * dV = dV - n.n^T dV (I - n.n^T) - (I - n.n^T) dV n.n^T ---*/ + + for (auto iDim = 0; iDim < nDim; iDim++) { + for (auto jDim = 0; jDim < nDim; jDim++) { + gradients[idxVel + iDim][jDim] -= normalGrad[iDim] * n[jDim] + n[iDim] * gradNormalVel[jDim]; + gradients[idxVel + iDim][jDim] += 2 * n[iDim] * normalGradNormalVel * n[jDim]; } } } - /*-------------------------------------------------------------------*/ - /*--- Reflect the gradients for all scalars (we exclude velocity). --*/ - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - if ((idxVel == -1) || ((idxVel != -1) && (iVar == 0 || iVar > nDim))) { - - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradPhi[iDim] = Gradients_iPoint[iVar][iDim]; - } + /*--- Remove the normal component for all scalars (excluding velocities). ---*/ - // I - n'.n.gradphi - for (auto iDim = 0u; iDim < nDim; iDim++) { - for (auto jDim = 0u; jDim < nDim; jDim++) { - Gradients_iPoint[iVar][iDim] -= nn[iDim][jDim] * gradPhi[jDim]; - } - } + for (auto iVar = varBegin; iVar < varEnd; iVar++) { + if (idxVel != -1 && iVar >= idxVel && iVar < idxVel + nDim) continue; + const su2double normalGrad = GeometryToolbox::DotProduct(nDim, n, gradients[iVar]); + for (auto iDim = 0; iDim < nDim; iDim++) { + gradients[iVar][iDim] -= normalGrad * n[iDim]; } } } @@ -138,7 +112,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - nSym++; + nSym++; } } @@ -176,23 +150,7 @@ void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITI } } - su2activematrix Gradients_iPoint(varEnd-varBegin,nDim); - - /*--- Fill the local gradient tensor ---*/ - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - Gradients_iPoint[iVar][iDim] = gradient(iPoint, iVar, iDim); - } - } - - detail::CorrectGradient(nDim, varBegin,varEnd, UnitNormal, Gradients_iPoint, idxVel); - - /*--- Write the corrected gradient tensor ---*/ - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - for (auto iDim = 0u; iDim < nDim; iDim++) { - gradient(iPoint, iVar, iDim) = Gradients_iPoint[iVar][iDim]; - } - } + detail::CorrectGradient(nDim, varBegin, varEnd, UnitNormal, idxVel, gradient[iPoint]); } // loop over vertices END_SU2_OMP_FOR From 1ad2568f7cecc63dbb89056e3cd7d1f5989b3c53 Mon Sep 17 00:00:00 2001 From: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:01:43 -0700 Subject: [PATCH 181/194] Update SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp --- SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index e14e14effef..a119f8e56fb 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -129,10 +129,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { if ((config.GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && (config.GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) && - (config.GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && - (config.GetMarker_All_KindBC(iMarker) != EULER_WALL) && (config.GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { - /*--- Work is shared in inner loop as two markers * may try to update the same point. ---*/ From 6707c7f9245d50120fb6c570d1371f8525bc93bf Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 28 Jul 2024 11:05:42 -0700 Subject: [PATCH 182/194] fix order of arguments and use template nDim --- .../gradients/computeGradientsGreenGauss.hpp | 16 +- .../computeGradientsLeastSquares.hpp | 27 ++- .../gradients/computeGradientsSymmetry.hpp | 161 ------------------ .../gradients/correctGradientsSymmetry.hpp | 152 +++++++++++++++++ .../include/solvers/CFVMFlowSolverBase.inl | 4 +- SU2_CFD/src/solvers/CNEMONSSolver.cpp | 2 +- SU2_CFD/src/solvers/CSolver.cpp | 10 +- 7 files changed, 181 insertions(+), 191 deletions(-) delete mode 100644 SU2_CFD/include/gradients/computeGradientsSymmetry.hpp create mode 100644 SU2_CFD/include/gradients/correctGradientsSymmetry.hpp diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index a119f8e56fb..f03668cafa1 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -32,7 +32,7 @@ #include "../../../Common/include/parallelization/omp_structure.hpp" #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" -#include "computeGradientsSymmetry.hpp" +#include "correctGradientsSymmetry.hpp" namespace detail { @@ -59,8 +59,8 @@ namespace detail { */ template void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, - CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient, short idxVel) { + CGeometry& geometry, const CConfig& config, const FieldType& field, + const size_t varBegin, const size_t varEnd, const int idxVel, GradientType& gradient) { const size_t nPointDomain = geometry.GetnPointDomain(); #ifdef HAVE_OMP @@ -161,7 +161,7 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER /*--- Compute the corrections for symmetry planes and Euler walls. ---*/ - computeGradientsSymmetry(nDim, solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, varEnd, gradient, idxVel); + correctGradientsSymmetry(geometry, config, varBegin, varEnd, idxVel, gradient); /*--- If no solver was provided we do not communicate ---*/ @@ -189,16 +189,16 @@ void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PER */ template void computeGradientsGreenGauss(CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, - CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient, short idxVel) { + CGeometry& geometry, const CConfig& config, const FieldType& field, + const size_t varBegin, const size_t varEnd, const int idxVel, GradientType& gradient) { switch (geometry.GetnDim()) { case 2: detail::computeGradientsGreenGauss<2>(solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, - varEnd, gradient, idxVel); + varEnd, idxVel, gradient); break; case 3: detail::computeGradientsGreenGauss<3>(solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, - varEnd, gradient, idxVel); + varEnd, idxVel, gradient); break; default: SU2_MPI::Error("Too many dimensions to compute gradients.", CURRENT_FUNCTION); diff --git a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp index 90e5eee7eb8..ef476e7a3df 100644 --- a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp +++ b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp @@ -28,7 +28,7 @@ #include "../../../Common/include/parallelization/omp_structure.hpp" #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" -#include "computeGradientsSymmetry.hpp" +#include "correctGradientsSymmetry.hpp" namespace detail { @@ -176,9 +176,9 @@ FORCEINLINE void solveLeastSquares(size_t iPoint, * \param[in] field - Generic object implementing operator (iPoint, iVar). * \param[in] varBegin - Index of first variable for which to compute the gradient. * \param[in] varEnd - Index of last variable for which to compute the gradient. + * \param[in] idxVel - Index to velocity, -1 if no velocity is present in the solver. * \param[out] gradient - Generic object implementing operator (iPoint, iVar, iDim). * \param[out] Rmatrix - Generic object implementing operator (iPoint, iDim, iDim). - * \param[in] idxVel - Index to velocity, -1 if no velocity is present in the solver. */ template void computeGradientsLeastSquares(CSolver* solver, @@ -188,11 +188,11 @@ void computeGradientsLeastSquares(CSolver* solver, const CConfig& config, bool weighted, const FieldType& field, - size_t varBegin, - size_t varEnd, + const size_t varBegin, + const size_t varEnd, + const int idxVel, GradientType& gradient, - RMatrixType& Rmatrix, - short idxVel) + RMatrixType& Rmatrix) { const bool periodic = (solver != nullptr) && (config.GetnMarker_Periodic() > 0); @@ -316,8 +316,8 @@ void computeGradientsLeastSquares(CSolver* solver, } /* --- compute the corrections for symmetry planes and Euler walls. --- */ - computeGradientsSymmetry(nDim, solver, kindMpiComm, kindPeriodicComm, geometry, config, field, varBegin, varEnd, gradient, idxVel); + correctGradientsSymmetry(geometry, config, varBegin, varEnd, idxVel, gradient); /*--- If no solver was provided we do not communicate ---*/ @@ -344,20 +344,19 @@ void computeGradientsLeastSquares(CSolver* solver, const CConfig& config, bool weighted, const FieldType& field, - size_t varBegin, - size_t varEnd, + const size_t varBegin, + const size_t varEnd, + const int idxVel, GradientType& gradient, - RMatrixType& Rmatrix, - short idxVel - ) { + RMatrixType& Rmatrix) { switch (geometry.GetnDim()) { case 2: detail::computeGradientsLeastSquares<2>(solver, kindMpiComm, kindPeriodicComm, geometry, config, - weighted, field, varBegin, varEnd, gradient, Rmatrix, idxVel); + weighted, field, varBegin, varEnd, idxVel, gradient, Rmatrix); break; case 3: detail::computeGradientsLeastSquares<3>(solver, kindMpiComm, kindPeriodicComm, geometry, config, - weighted, field, varBegin, varEnd, gradient, Rmatrix, idxVel); + weighted, field, varBegin, varEnd, idxVel, gradient, Rmatrix); break; default: SU2_MPI::Error("Too many dimensions to compute gradients.", CURRENT_FUNCTION); diff --git a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp b/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp deleted file mode 100644 index 38d91133a05..00000000000 --- a/SU2_CFD/include/gradients/computeGradientsSymmetry.hpp +++ /dev/null @@ -1,161 +0,0 @@ -/*! - * \file computeGradientsSymmetry.hpp - * \brief Implements the symmetry boundary conditions for the gradient computations. - * \author N. Beishuizen - * \version 8.0.1 "Harrier" - * - * SU2 Project Website: https://su2code.github.io - * - * The SU2 Project is maintained by the SU2 Foundation - * (http://su2foundation.org) - * - * Copyright 2012-2024, SU2 Contributors (cf. AUTHORS.md) - * - * SU2 is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * SU2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with SU2. If not, see . - */ - -#pragma once - -#include -#include - -#include "../../../Common/include/parallelization/omp_structure.hpp" -#include "../../../Common/include/toolboxes/geometry_toolbox.hpp" - -namespace detail { -/*! - * \brief Correct the gradient on a symmetry plane. - * \ingroup FvmAlgos - * \param[in] nDim - Number of dimensions, 2 or 3. - * \param[in] varBegin - Start of the variables. - * \param[in] varEnd - End of the variables. - * \param[in] n - Normal direction. - * \param[in] idxVel - Variable index where velocity gradients start (-1 if all variables are scalars). - * \param[in, out] gradients - The gradients to be modified. - */ -template -inline void CorrectGradient(const int nDim_, const int varBegin, const int varEnd, const Scalar* n, - const int idxVel, Matrix&& gradients) { - static constexpr size_t MAXNDIM = 3; - const int nDim = nDim_ == 2 ? 2 : 3; - - /*--- First we correct the part that involves velocities. ---*/ - - if (idxVel != -1) { - /*--- Normal gradient of velocity components and gradient of normal velocity. ---*/ - su2double normalGrad[MAXNDIM] = {}, gradNormalVel[MAXNDIM] = {}; - - for (auto iDim = 0; iDim < nDim; iDim++) { - normalGrad[iDim] = GeometryToolbox::DotProduct(nDim, gradients[idxVel + iDim], n); - - for (auto jDim = 0; jDim < nDim; jDim++) { - gradNormalVel[jDim] += n[iDim] * gradients[idxVel + iDim][jDim]; - } - } - - /*--- Normal gradient of the normal velocity. ---*/ - const su2double normalGradNormalVel = GeometryToolbox::DotProduct(nDim, n, gradNormalVel); - - /*--- Remove the tangential projection (I - n.n^T) of the normal gradients. - * And the normal projection (n.n^T) of the tangential gradients. - * dV = dV - n.n^T dV (I - n.n^T) - (I - n.n^T) dV n.n^T ---*/ - - for (auto iDim = 0; iDim < nDim; iDim++) { - for (auto jDim = 0; jDim < nDim; jDim++) { - gradients[idxVel + iDim][jDim] -= normalGrad[iDim] * n[jDim] + n[iDim] * gradNormalVel[jDim]; - gradients[idxVel + iDim][jDim] += 2 * n[iDim] * normalGradNormalVel * n[jDim]; - } - } - } - - /*--- Remove the normal component for all scalars (excluding velocities). ---*/ - - for (auto iVar = varBegin; iVar < varEnd; iVar++) { - if (idxVel != -1 && iVar >= idxVel && iVar < idxVel + nDim) continue; - - const su2double normalGrad = GeometryToolbox::DotProduct(nDim, n, gradients[iVar]); - for (auto iDim = 0; iDim < nDim; iDim++) { - gradients[iVar][iDim] -= normalGrad * n[iDim]; - } - } -} - -} - - -template -void computeGradientsSymmetry(unsigned short nDim, CSolver* solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, - CGeometry& geometry, const CConfig& config, const FieldType& field, size_t varBegin, - size_t varEnd, GradientType& gradient, short idxVel) { - - static constexpr size_t MAXNDIM = 3; - - /* For symmetry planes (and Euler walls), we need to impose the conditions (Blazek eq. 8.40): - * 1. n.grad(phi) = 0 - * 2. n.grad(v.t) = 0 - * 3. t.grad(v.n) = 0 - */ - - /*--- Check how many symmetry planes there are ---*/ - unsigned short nSym = 0; - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { - if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - nSym++; - } - } - - /*--- No symmetry or Euler walls are present. ---*/ - if (nSym == 0) return; - - for (size_t iMarker = 0; iMarker < geometry.GetnMarker(); ++iMarker) { - - if ((config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || (config.GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - SU2_OMP_FOR_STAT(32) - for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { - - size_t iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - - /*--- Normal vector for this vertex (negate for outward convention). ---*/ - const su2double* VertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); - - const auto NormArea = GeometryToolbox::Norm(nDim, VertexNormal); - - su2double UnitNormal[MAXNDIM] = {0.0}; - for (size_t iDim = 0; iDim < nDim; iDim++) - UnitNormal[iDim] = VertexNormal[iDim] / NormArea; - - /*--- When we have more than 1 symmetry or Euler wall, check if there are shared nodes. - Then correct the normal at those node ---*/ - if (nSym > 1) { - if (geometry.symmetryNormals.size() > 0) { - auto it = std::find_if( - geometry.symmetryNormals[iMarker].begin(), - geometry.symmetryNormals[iMarker].end(), - findSymNormalIndex(iPoint)); - if (it != geometry.symmetryNormals[iMarker].end()) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; - } - } - } - - detail::CorrectGradient(nDim, varBegin, varEnd, UnitNormal, idxVel, gradient[iPoint]); - - } // loop over vertices - END_SU2_OMP_FOR - } // symmetry - } // markers - -} - diff --git a/SU2_CFD/include/gradients/correctGradientsSymmetry.hpp b/SU2_CFD/include/gradients/correctGradientsSymmetry.hpp new file mode 100644 index 00000000000..837fc055b61 --- /dev/null +++ b/SU2_CFD/include/gradients/correctGradientsSymmetry.hpp @@ -0,0 +1,152 @@ +/*! + * \file correctGradientsSymmetry.hpp + * \brief Implements the symmetry boundary conditions for the gradient computations. + * \author N. Beishuizen + * \version 8.0.1 "Harrier" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2024, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include +#include + +#include "../../../Common/include/parallelization/omp_structure.hpp" +#include "../../../Common/include/toolboxes/geometry_toolbox.hpp" + +namespace detail { +/*! + * \brief Correct the gradient on a symmetry plane. + * \ingroup FvmAlgos + * \param[in] varBegin - Start of the variables. + * \param[in] varEnd - End of the variables. + * \param[in] idxVel - Variable index where velocity gradients start (-1 if all variables are scalars). + * \param[in] n - Normal direction. + * \param[in, out] gradients - The gradients to be modified. + */ +template +inline void correctGradient(const size_t varBegin, const size_t varEnd, const int idxVel, const Scalar* n, + Matrix&& gradients) { + + /*--- First we correct the part that involves velocities. ---*/ + + if (idxVel >= static_cast(varBegin) && idxVel + nDim <= varEnd) { + /*--- Normal gradient of velocity components and gradient of normal velocity. ---*/ + su2double normalGrad[nDim] = {}, gradNormalVel[nDim] = {}; + + for (size_t iDim = 0; iDim < nDim; iDim++) { + normalGrad[iDim] = GeometryToolbox::DotProduct(nDim, gradients[idxVel + iDim], n); + + for (size_t jDim = 0; jDim < nDim; jDim++) { + gradNormalVel[jDim] += n[iDim] * gradients[idxVel + iDim][jDim]; + } + } + + /*--- Normal gradient of the normal velocity. ---*/ + const su2double normalGradNormalVel = GeometryToolbox::DotProduct(nDim, n, gradNormalVel); + + /*--- Remove the tangential projection (I - n.n^T) of the normal gradients. + * And the normal projection (n.n^T) of the tangential gradients. + * dV = dV - (I - n.n^T) dV n.n^T - n.n^T dV (I - n.n^T) ---*/ + + for (size_t iDim = 0; iDim < nDim; iDim++) { + for (size_t jDim = 0; jDim < nDim; jDim++) { + gradients[idxVel + iDim][jDim] -= normalGrad[iDim] * n[jDim] + n[iDim] * gradNormalVel[jDim]; + gradients[idxVel + iDim][jDim] += 2 * n[iDim] * normalGradNormalVel * n[jDim]; + } + } + } + + /*--- Remove the normal component for all scalars (excluding velocities). ---*/ + + for (auto iVar = varBegin; iVar < varEnd; iVar++) { + if (idxVel != -1 && static_cast(iVar) >= idxVel && iVar < idxVel + nDim) continue; + + const su2double normalGrad = GeometryToolbox::DotProduct(nDim, n, gradients[iVar]); + for (size_t iDim = 0; iDim < nDim; iDim++) { + gradients[iVar][iDim] -= normalGrad * n[iDim]; + } + } +} +} + +/*! + * \brief Correct gradients on symmetry and Euler (slip) markers to respect the conditions: + * 1. n.grad(phi) = 0 + * 2. n.grad(v.t) = 0 + * 3. t.grad(v.n) = 0 + * \note See Blazek eq. 8.40. + * \ingroup FvmAlgos + * \param[in] geometry - Geometric grid properties. + * \param[in] config - Configuration of the problem, used to identify types of boundaries. + * \param[in] varBegin - Index of first variable for which to compute the gradient. + * \param[in] varEnd - Index of last variable for which to compute the gradient. + * \param[in] idxVel - Index to velocity, -1 if no velocity is present in the solver. + * \param[in,out] gradient - Generic object implementing operator (iPoint, iVar, iDim). + */ +template +void correctGradientsSymmetry(CGeometry& geometry, const CConfig& config, const size_t varBegin, + const size_t varEnd, const int idxVel, GradientType& gradient) { + + /*--- Check how many symmetry planes there are. ---*/ + std::vector symMarkers; + for (auto iMarker = 0u; iMarker < geometry.GetnMarker(); ++iMarker) { + if (config.GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE || + config.GetMarker_All_KindBC(iMarker) == EULER_WALL) { + symMarkers.push_back(iMarker); + } + } + + for (const auto iMarker : symMarkers) { + SU2_OMP_FOR_STAT(32) + for (size_t iVertex = 0; iVertex < geometry.GetnVertex(iMarker); ++iVertex) { + + const auto iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); + + /*--- Normal vector for this vertex. ---*/ + const su2double* vertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); + + const su2double area = GeometryToolbox::Norm(nDim, vertexNormal); + + su2double unitNormal[nDim] = {}; + for (size_t iDim = 0; iDim < nDim; iDim++) unitNormal[iDim] = vertexNormal[iDim] / area; + + /*--- When we have more than 1 symmetry or Euler wall, check if there are shared nodes. + * Then correct the normal at those nodes. ---*/ + if (symMarkers.size() > 1 && !geometry.symmetryNormals.empty()) { + const auto it = std::find_if( + geometry.symmetryNormals[iMarker].begin(), + geometry.symmetryNormals[iMarker].end(), + findSymNormalIndex(iPoint)); + if (it != geometry.symmetryNormals[iMarker].end()) { + for (size_t iDim = 0; iDim < nDim; iDim++) unitNormal[iDim] = it->normal[iDim]; + } + } + + detail::correctGradient(varBegin, varEnd, idxVel, unitNormal, gradient[iPoint]); + + } // loop over vertices + END_SU2_OMP_FOR + } // markers + +} + diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 85b12207e31..f8d1d9ca85d 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -386,7 +386,7 @@ void CFVMFlowSolverBase::SetPrimitive_Gradient_GG(CGeometry* geometry, con const auto comm = reconstruction? MPI_QUANTITIES::PRIMITIVE_GRAD_REC : MPI_QUANTITIES::PRIMITIVE_GRADIENT; const auto commPer = reconstruction? PERIODIC_PRIM_GG_R : PERIODIC_PRIM_GG; - computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, primitives, 0, nPrimVarGrad, gradient, prim_idx.Velocity()); + computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, primitives, 0, nPrimVarGrad, prim_idx.Velocity(), gradient); } template @@ -411,7 +411,7 @@ void CFVMFlowSolverBase::SetPrimitive_Gradient_LS(CGeometry* geometry, con const auto comm = reconstruction? MPI_QUANTITIES::PRIMITIVE_GRAD_REC : MPI_QUANTITIES::PRIMITIVE_GRADIENT; computeGradientsLeastSquares(this, comm, commPer, *geometry, *config, weighted, - primitives, 0, nPrimVarGrad, gradient, rmatrix, prim_idx.Velocity()); + primitives, 0, nPrimVarGrad, prim_idx.Velocity(), gradient, rmatrix); } template diff --git a/SU2_CFD/src/solvers/CNEMONSSolver.cpp b/SU2_CFD/src/solvers/CNEMONSSolver.cpp index d972e701b0b..5b12013cee2 100644 --- a/SU2_CFD/src/solvers/CNEMONSSolver.cpp +++ b/SU2_CFD/src/solvers/CNEMONSSolver.cpp @@ -166,7 +166,7 @@ void CNEMONSSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, const CConfig const auto& primitives = nodes->GetPrimitive_Aux(); - computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, primitives, 0, nPrimVarGrad, gradient, prim_idx.Velocity()); + computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, primitives, 0, nPrimVarGrad, prim_idx.Velocity(), gradient); } void CNEMONSSolver::Viscous_Residual(CGeometry *geometry, diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index fb68be6ad2f..de0ec914b73 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -2097,7 +2097,7 @@ void CSolver::SetAuxVar_Gradient_GG(CGeometry *geometry, const CConfig *config) auto& gradient = base_nodes->GetAuxVarGradient(); computeGradientsGreenGauss(this, MPI_QUANTITIES::AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, - *config, solution, 0, base_nodes->GetnAuxVar(), gradient, -1); + *config, solution, 0, base_nodes->GetnAuxVar(), -1, gradient); } void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, const CConfig *config) { @@ -2108,7 +2108,7 @@ void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, const CConfig *config) auto& rmatrix = base_nodes->GetRmatrix(); computeGradientsLeastSquares(this, MPI_QUANTITIES::AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, *config, - weighted, solution, 0, base_nodes->GetnAuxVar(), gradient, rmatrix, -1); + weighted, solution, 0, base_nodes->GetnAuxVar(), -1, gradient, rmatrix); } void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config, short idxVel, bool reconstruction) { @@ -2117,7 +2117,7 @@ void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, const CConfig *config auto& gradient = reconstruction? base_nodes->GetGradient_Reconstruction() : base_nodes->GetGradient(); const auto comm = reconstruction? MPI_QUANTITIES::SOLUTION_GRAD_REC : MPI_QUANTITIES::SOLUTION_GRADIENT; const auto commPer = reconstruction? PERIODIC_SOL_GG_R : PERIODIC_SOL_GG; - computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, solution, 0, nVar, gradient, idxVel); + computeGradientsGreenGauss(this, comm, commPer, *geometry, *config, solution, 0, nVar, idxVel, gradient); } void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config, short idxVel, bool reconstruction) { @@ -2140,7 +2140,7 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config auto& gradient = reconstruction? base_nodes->GetGradient_Reconstruction() : base_nodes->GetGradient(); const auto comm = reconstruction? MPI_QUANTITIES::SOLUTION_GRAD_REC : MPI_QUANTITIES::SOLUTION_GRADIENT; - computeGradientsLeastSquares(this, comm, commPer, *geometry, *config, weighted, solution, 0, nVar, gradient, rmatrix, idxVel); + computeGradientsLeastSquares(this, comm, commPer, *geometry, *config, weighted, solution, 0, nVar, idxVel, gradient, rmatrix); } void CSolver::SetUndivided_Laplacian(CGeometry *geometry, const CConfig *config) { @@ -2239,7 +2239,7 @@ void CSolver::SetGridVel_Gradient(CGeometry *geometry, const CConfig *config) co auto rmatrix = CVectorOfMatrix(nPoint,nDim,nDim); computeGradientsLeastSquares(nullptr, MPI_QUANTITIES::GRID_VELOCITY, PERIODIC_NONE, *geometry, *config, - true, gridVel, 0, nDim, gridVelGrad, rmatrix, 0); + true, gridVel, 0, nDim, 0, gridVelGrad, rmatrix); } void CSolver::SetSolution_Limiter(CGeometry *geometry, const CConfig *config) { From 505ed23ecb5f3ba1519cdd7ffbffbc887945c794 Mon Sep 17 00:00:00 2001 From: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Date: Sun, 28 Jul 2024 12:03:10 -0700 Subject: [PATCH 183/194] Apply suggestions from code review --- UnitTests/SU2_CFD/gradients.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitTests/SU2_CFD/gradients.cpp b/UnitTests/SU2_CFD/gradients.cpp index 195ce25a640..af3ad8a2fee 100644 --- a/UnitTests/SU2_CFD/gradients.cpp +++ b/UnitTests/SU2_CFD/gradients.cpp @@ -133,7 +133,7 @@ void testGreenGauss() { C3DDoubleMatrix gradient(field.geometry->GetnPoint(), field.nVar, field.geometry->GetnDim()); computeGradientsGreenGauss(nullptr, MPI_QUANTITIES::SOLUTION, PERIODIC_NONE, *field.geometry.get(), - *field.config.get(), field, 0, field.nVar, gradient, -1); + *field.config.get(), field, 0, field.nVar, -1, gradient); check(field, gradient); } @@ -145,7 +145,7 @@ void testLeastSquares(bool weighted) { C3DDoubleMatrix gradient(field.geometry->GetnPoint(), field.nVar, nDim); computeGradientsLeastSquares(nullptr, MPI_QUANTITIES::SOLUTION, PERIODIC_NONE, *field.geometry.get(), - *field.config.get(), weighted, field, 0, field.nVar, gradient, R, -1); + *field.config.get(), weighted, field, 0, field.nVar, -1, gradient, R); check(field, gradient); } From 6a8b03a99b5a1b58eac665884cca863346f5ff6c Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 28 Jul 2024 22:09:48 -0700 Subject: [PATCH 184/194] simplify symmetry normals --- Common/include/geometry/CGeometry.hpp | 29 ++--- .../include/geometry/CMultiGridGeometry.hpp | 3 +- Common/include/geometry/dual_grid/CPoint.hpp | 6 +- Common/src/geometry/CGeometry.cpp | 69 ++++++++++- Common/src/geometry/CMultiGridGeometry.cpp | 87 +------------- Common/src/geometry/CPhysicalGeometry.cpp | 88 +------------- .../src/grid_movement/CVolumetricMovement.cpp | 2 +- .../gradients/correctGradientsSymmetry.hpp | 26 ++-- .../include/solvers/CFVMFlowSolverBase.inl | 112 +++++++----------- SU2_CFD/src/drivers/CDriver.cpp | 2 +- 10 files changed, 146 insertions(+), 278 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index 667d9a826f1..8d3d6374018 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -66,18 +66,6 @@ extern "C" { using namespace std; -struct symNormal { - long unsigned int index; - su2double normal[3]; - symNormal(long unsigned int index) : index(index){}; -}; - -struct findSymNormalIndex : std::unary_function { - unsigned long int index; - findSymNormalIndex(unsigned long int index) : index(index) {} - bool operator()(symNormal const& m) const { return m.index == index; } -}; - /*! * \class CGeometry * \brief Parent class for defining the geometry of the problem (complete geometry, @@ -241,7 +229,6 @@ class CGeometry { public: /*--- Main geometric elements of the grid. ---*/ - vector> symmetryNormals; /*!< \brief Corrected normals on nodes with shared symmetry markers */ CPrimalGrid** elem{nullptr}; /*!< \brief Element vector (primal grid information). */ CPrimalGrid*** bound{nullptr}; /*!< \brief Boundary vector (primal grid information). */ @@ -253,8 +240,11 @@ class CGeometry { unsigned long* nVertex{nullptr}; /*!< \brief Number of vertex for each marker. */ unsigned long* nElem_Bound{nullptr}; /*!< \brief Number of elements of the boundary. */ string* Tag_to_Marker{nullptr}; /*!< \brief Names of boundary markers. */ - vector - bound_is_straight; /*!< \brief Bool if boundary-marker is straight(2D)/plane(3D) for each local marker. */ + + /*!< \brief Corrected normals on nodes with shared symmetry markers. */ + vector>> symmetryNormals; + /*!< \brief Bool if boundary-marker is straight(2D)/plane(3D) for each local marker. */ + vector bound_is_straight; vector SurfaceAreaCfgFile; /*!< \brief Total Surface area for all markers. */ /*--- Partitioning-specific variables ---*/ @@ -832,6 +822,12 @@ class CGeometry { */ inline virtual void SetBoundControlVolume(const CConfig* config, unsigned short action) {} + /*! + * \brief Computes modified normals at intersecting symmetry planes. + * \param[in] config - Definition of the particular problem. + */ + void ComputeModifiedSymmetryNormals(const CConfig* config); + /*! * \brief A virtual member. * \param[in] config_filename - Name of the file where the tecplot information is going to be stored. @@ -949,9 +945,10 @@ class CGeometry { /*! * \brief A virtual member. * \param[in] fine_grid - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. * \param[in] action - Allocate or not the new elements. */ - inline virtual void SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) {} + inline virtual void SetBoundControlVolume(const CGeometry* fine_grid, const CConfig* config, unsigned short action) {} /*! * \brief A virtual member. diff --git a/Common/include/geometry/CMultiGridGeometry.hpp b/Common/include/geometry/CMultiGridGeometry.hpp index 1a7f7f9ab58..541aaa88d6d 100644 --- a/Common/include/geometry/CMultiGridGeometry.hpp +++ b/Common/include/geometry/CMultiGridGeometry.hpp @@ -104,9 +104,10 @@ class CMultiGridGeometry final : public CGeometry { /*! * \brief Set boundary vertex structure of the agglomerated control volume. * \param[in] fine_grid - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. * \param[in] action - Allocate or not the new elements. */ - void SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) override; + void SetBoundControlVolume(const CGeometry* fine_grid, const CConfig* config, unsigned short action) override; /*! * \brief Set a representative coordinates of the agglomerated control volume. diff --git a/Common/include/geometry/dual_grid/CPoint.hpp b/Common/include/geometry/dual_grid/CPoint.hpp index 472a119cc3a..c297b1b5df9 100644 --- a/Common/include/geometry/dual_grid/CPoint.hpp +++ b/Common/include/geometry/dual_grid/CPoint.hpp @@ -314,10 +314,8 @@ class CPoint { * \return Index of the vertex. */ inline long GetVertex(unsigned long iPoint, unsigned long iMarker) const { - if (Boundary(iPoint)) - return Vertex[iPoint][iMarker]; - else - return -1; + if (Boundary(iPoint)) return Vertex[iPoint][iMarker]; + return -1; } /*! diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index eb7fbc8e377..9134efb586d 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2338,7 +2338,7 @@ void CGeometry::UpdateGeometry(CGeometry** geometry_container, CConfig* config) /*--- Update the control volume structures ---*/ geometry_container[iMesh]->SetControlVolume(geometry_container[iMesh - 1], UPDATE); - geometry_container[iMesh]->SetBoundControlVolume(geometry_container[iMesh - 1], UPDATE); + geometry_container[iMesh]->SetBoundControlVolume(geometry_container[iMesh - 1], config, UPDATE); geometry_container[iMesh]->SetCoord(geometry_container[iMesh - 1]); } @@ -2572,6 +2572,73 @@ void CGeometry::ComputeSurf_Straightness(const CConfig* config, bool print_on_sc } // if print_on_scren } +void CGeometry::ComputeModifiedSymmetryNormals(const CConfig* config) { + /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against. + * All nodes that are shared by multiple symmetries have to get a corrected normal. */ + symmetryNormals.resize(nMarker); + std::vector symMarkers; + + for (auto iMarker = 0u; iMarker < nMarker; ++iMarker) { + if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || + (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { + symMarkers.push_back(iMarker); + } + } + + /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ + /*--- The first symmetry does not need a corrected normal vector, hence start at 1. ---*/ + for (size_t i = 1; i < symMarkers.size(); ++i) { + const auto iMarker = symMarkers[i]; + + for (auto iVertex = 0ul; iVertex < nVertex[iMarker]; iVertex++) { + const auto iPoint = vertex[iMarker][iVertex]->GetNode(); + + /*--- Halo points do not need to be considered. ---*/ + if (!nodes->GetDomain(iPoint)) continue; + + /*--- Get the vertex normal on the current symmetry. ---*/ + std::array iNormal = {}; + vertex[iMarker][iVertex]->GetNormal(iNormal.data()); + + /*--- Loop over previous symmetries and if this point shares them, make this normal orthogonal to them. ---*/ + bool isShared = false; + + for (size_t j = 0; j < i; ++j) { + const auto jMarker = symMarkers[j]; + const auto jVertex = nodes->GetVertex(iPoint, jMarker); + if (jVertex < 0) continue; + + isShared = true; + + std::array jNormal = {}; + const auto it = symmetryNormals[jMarker].find(jVertex); + + if (it != symmetryNormals[jMarker].end()) { + jNormal = it->second; + } else { + vertex[jMarker][jVertex]->GetNormal(jNormal.data()); + const su2double area = GeometryToolbox::Norm(nDim, jNormal.data()); + for (auto iDim = 0u; iDim < nDim; iDim++) jNormal[iDim] /= area; + } + + const auto proj = GeometryToolbox::DotProduct(nDim, jNormal.data(), iNormal.data()); + for (auto iDim = 0u; iDim < nDim; iDim++) iNormal[iDim] -= proj * jNormal[iDim]; + } + + if (!isShared) continue; + + /*--- Normalize. If the norm is close to zero it means the normal is a linear combination of previous + * normals, in this case we don't need to store the corrected normal, using the original in the gradient + * correction will have no effect since previous corrections will remove components in this direction). ---*/ + const su2double area = GeometryToolbox::Norm(nDim, iNormal.data()); + if (area > EPS) { + for (auto iDim = 0u; iDim < nDim; iDim++) iNormal[iDim] /= area; + symmetryNormals[iMarker][iVertex] = iNormal; + } + } + } +} + void CGeometry::ComputeSurf_Curvature(CConfig* config) { unsigned short iMarker, iNeigh_Point, iDim, iNode, iNeighbor_Nodes, Neighbor_Node; unsigned long Neighbor_Point, iVertex, iPoint, jPoint, iElem_Bound, iEdge, nLocalVertex, MaxLocalVertex, diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 4ff85fa1b1c..00cc4ebf009 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -924,7 +924,8 @@ void CMultiGridGeometry::SetControlVolume(const CGeometry* fine_grid, unsigned s END_SU2_OMP_SAFE_GLOBAL_ACCESS } -void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsigned short action) { +void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, const CConfig* config, + unsigned short action) { unsigned long iCoarsePoint, iFinePoint, FineVertex, iVertex; su2double Normal[MAXNDIM] = {0.0}, Area, *NormalFace = nullptr; @@ -953,97 +954,17 @@ void CMultiGridGeometry::SetBoundControlVolume(const CGeometry* fine_grid, unsig /*--- Check if there is a normal with null area ---*/ SU2_OMP_FOR_DYN(1) - for (auto iMarker = 0; iMarker < nMarker; iMarker++) + for (auto iMarker = 0; iMarker < nMarker; iMarker++) { for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { NormalFace = vertex[iMarker][iVertex]->GetNormal(); Area = GeometryToolbox::Norm(nDim, NormalFace); if (Area == 0.0) for (auto iDim = 0; iDim < nDim; iDim++) NormalFace[iDim] = EPS * EPS; } - END_SU2_OMP_FOR - - /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against. - All nodes that are shared by multiple symmetries have to get a corrected normal. */ - static constexpr size_t MAXNSYMS = 100; - bool Syms[MAXNSYMS] = {false}; - symmetryNormals.resize(nMarker); - - unsigned short nSym = 0; - SU2_OMP_FOR_DYN(1) - for (auto iMarker = 0; iMarker < nMarker; ++iMarker) { - if (fine_grid->symmetryNormals[iMarker].size() > 0) { - Syms[iMarker] = true; - nSym++; - } } END_SU2_OMP_FOR - // /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ - SU2_OMP_FOR_DYN(1) - for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { - if (Syms[val_marker] == false) continue; - for (iVertex = 0; iVertex < nVertex[val_marker]; iVertex++) { - iCoarsePoint = vertex[val_marker][iVertex]->GetNode(); - - /*--- Halo points do not need to be considered. ---*/ - if (!nodes->GetDomain(iCoarsePoint)) continue; - - /*--- Get the normal of the current symmetry ---*/ - su2double UnitNormal[MAXNDIM] = {0.0}; - vertex[val_marker][iVertex]->GetNormal(Normal); - Area = GeometryToolbox::Norm(nDim, Normal); - for (auto iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; - - /*--- At this point we find out if the node is shared with another symmetry. ---*/ - /*--- We then apply a Gram-Schmidt process to compute the orthonormal basis from all - normal vectors of the shared symmetries at the node. ---*/ - /*--- Step 1: do we have other symmetries? ---*/ - if (nSym > 0) { - /*--- Normal of the primary symmetry plane ---*/ - su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - /*--- Step 2: are we on a shared node? ---*/ - for (auto iMarker = 0; iMarker < nMarker; iMarker++) { - if (Syms[iMarker] == false) continue; // not on a symmetry - /*--- We do not want the current symmetry ---*/ - if (val_marker != iMarker) { - /*--- Loop over all points on the other symmetry and check if current iPoint is on the symmetry ---*/ - for (auto jVertex = 0ul; jVertex < nVertex[iMarker]; jVertex++) { - const auto jPoint = vertex[iMarker][jVertex]->GetNode(); - if (!nodes->GetDomain(jPoint)) continue; - /*--- We are on a shared node. ---*/ - if (iCoarsePoint == jPoint) { - /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ - if (iMarker < val_marker) { - /*--- So we have to get the normal of that other marker ---*/ - vertex[iMarker][jVertex]->GetNormal(NormalPrim); - su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - } - /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ - su2double ProjNorm = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - symNormal sn = {iCoarsePoint}; - - /*--- We check if the normal of the 2 planes coincide. - * We only update the normal if the normals of the symmetry planes are different. ---*/ - if (fabs(1.0 - ProjNorm) > EPS) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - /*--- Make normalized vector ---*/ - su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal); - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea; - } - for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; - symmetryNormals[val_marker].push_back(sn); - } - } - } - } - } - } - } - } - END_SU2_OMP_FOR + SU2_OMP_SAFE_GLOBAL_ACCESS(ComputeModifiedSymmetryNormals(config);) } void CMultiGridGeometry::SetCoord(const CGeometry* fine_grid) { diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 1ca5bd51f98..a069424c666 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -4707,9 +4707,6 @@ void CPhysicalGeometry::SetVertex(const CConfig* config) { } } - /*--- Correction of normals on nodes with more than one symmetry/Euler wall ---*/ - symmetryNormals.resize(nMarker); - /*--- Initialize the Vertex vector for each node, the previous result is deleted ---*/ for (iPoint = 0; iPoint < nPoint; iPoint++) @@ -7287,90 +7284,7 @@ void CPhysicalGeometry::SetBoundControlVolume(const CConfig* config, unsigned sh } END_SU2_OMP_FOR - /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against. - All nodes that are shared by multiple symmetries have to get a corrected normal. */ - static constexpr size_t MAXNSYMS = 100; - unsigned short Syms[MAXNSYMS] = {0}; - unsigned short nSym = 0; - SU2_OMP_FOR_DYN(1) - for (size_t iMarker = 0; iMarker < nMarker; ++iMarker) { - if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - Syms[nSym] = iMarker; - nSym++; - } - } - END_SU2_OMP_FOR - - /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/ - SU2_OMP_FOR_DYN(1) - for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) { - if ((config->GetMarker_All_KindBC(val_marker) != SYMMETRY_PLANE) && - (config->GetMarker_All_KindBC(val_marker) != EULER_WALL)) - continue; - - for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { - const auto iPoint = vertex[val_marker][iVertex]->GetNode(); - - /*--- Halo points do not need to be considered. ---*/ - if (!nodes->GetDomain(iPoint)) continue; - - /*--- Get the normal of the current symmetry ---*/ - su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; - vertex[val_marker][iVertex]->GetNormal(Normal); - const su2double Area = GeometryToolbox::Norm(nDim, Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; - - /*--- At this point we find out if the node is shared with another symmetry. ---*/ - /*--- We then apply a Gram-Schmidt process to compute the orthonormal basis from all - normal vectors of the shared symmetries at the node. ---*/ - /*--- Step 1: do we have other symmetries? ---*/ - if (nSym > 1) { - /*--- Normal of the primary symmetry plane ---*/ - su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0}; - /*--- Step 2: are we on a shared node? ---*/ - for (auto iMarker = 0; iMarker < nSym; iMarker++) { - /*--- We do not want the current symmetry ---*/ - if (val_marker != Syms[iMarker]) { - /*--- Loop over all points on the other symmetry and check if current iPoint is on the symmetry ---*/ - for (auto jVertex = 0ul; jVertex < nVertex[Syms[iMarker]]; jVertex++) { - const auto jPoint = vertex[Syms[iMarker]][jVertex]->GetNode(); - if (!nodes->GetDomain(jPoint)) continue; - /*--- We are on a shared node. ---*/ - if (iPoint == jPoint) { - symNormal sn = {iPoint}; - - /*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/ - if (Syms[iMarker] < val_marker) { - /*--- So we have to get the normal of that other marker ---*/ - vertex[Syms[iMarker]][jVertex]->GetNormal(NormalPrim); - su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim); - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim; - } - /*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/ - su2double ProjNorm = 0.0; - for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim]; - - /*--- We check if the normal of the 2 planes coincide. - * We only update the normal if the normals of the symmetry planes are different. ---*/ - if (fabs(1.0 - ProjNorm) > EPS) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim]; - /*--- Make normalized vector ---*/ - su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal); - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea; - } - } // - for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim]; - symmetryNormals[val_marker].push_back(sn); - } // ipoint==jpoint - } - } - } - } - } - } - END_SU2_OMP_FOR + SU2_OMP_SAFE_GLOBAL_ACCESS(ComputeModifiedSymmetryNormals(config);) } void CPhysicalGeometry::VisualizeControlVolume(const CConfig* config) const { diff --git a/Common/src/grid_movement/CVolumetricMovement.cpp b/Common/src/grid_movement/CVolumetricMovement.cpp index a3f91fa36c1..efd2a6f2b74 100644 --- a/Common/src/grid_movement/CVolumetricMovement.cpp +++ b/Common/src/grid_movement/CVolumetricMovement.cpp @@ -98,7 +98,7 @@ void CVolumetricMovement::UpdateMultiGrid(CGeometry** geometry, CConfig* config) for (iMGlevel = 1; iMGlevel <= nMGlevel; iMGlevel++) { iMGfine = iMGlevel - 1; geometry[iMGlevel]->SetControlVolume(geometry[iMGfine], UPDATE); - geometry[iMGlevel]->SetBoundControlVolume(geometry[iMGfine], UPDATE); + geometry[iMGlevel]->SetBoundControlVolume(geometry[iMGfine], config, UPDATE); geometry[iMGlevel]->SetCoord(geometry[iMGfine]); if (config->GetGrid_Movement()) geometry[iMGlevel]->SetRestricted_GridVelocity(geometry[iMGfine]); } diff --git a/SU2_CFD/include/gradients/correctGradientsSymmetry.hpp b/SU2_CFD/include/gradients/correctGradientsSymmetry.hpp index 837fc055b61..a17ce827184 100644 --- a/SU2_CFD/include/gradients/correctGradientsSymmetry.hpp +++ b/SU2_CFD/include/gradients/correctGradientsSymmetry.hpp @@ -122,24 +122,18 @@ void correctGradientsSymmetry(CGeometry& geometry, const CConfig& config, const const auto iPoint = geometry.vertex[iMarker][iVertex]->GetNode(); - /*--- Normal vector for this vertex. ---*/ - const su2double* vertexNormal = geometry.vertex[iMarker][iVertex]->GetNormal(); - - const su2double area = GeometryToolbox::Norm(nDim, vertexNormal); + /*--- Get the normal of the current symmetry. This may be the original normal of the vertex + * or a modified normal if there are intersecting symmetries. ---*/ su2double unitNormal[nDim] = {}; - for (size_t iDim = 0; iDim < nDim; iDim++) unitNormal[iDim] = vertexNormal[iDim] / area; - - /*--- When we have more than 1 symmetry or Euler wall, check if there are shared nodes. - * Then correct the normal at those nodes. ---*/ - if (symMarkers.size() > 1 && !geometry.symmetryNormals.empty()) { - const auto it = std::find_if( - geometry.symmetryNormals[iMarker].begin(), - geometry.symmetryNormals[iMarker].end(), - findSymNormalIndex(iPoint)); - if (it != geometry.symmetryNormals[iMarker].end()) { - for (size_t iDim = 0; iDim < nDim; iDim++) unitNormal[iDim] = it->normal[iDim]; - } + const auto it = geometry.symmetryNormals[iMarker].find(iVertex); + + if (it != geometry.symmetryNormals[iMarker].end()) { + for (auto iDim = 0u; iDim < nDim; iDim++) unitNormal[iDim] = it->second[iDim]; + } else { + geometry.vertex[iMarker][iVertex]->GetNormal(unitNormal); + const su2double area = GeometryToolbox::Norm(nDim, unitNormal); + for (auto iDim = 0u; iDim < nDim; iDim++) unitNormal[iDim] /= area; } detail::correctGradient(varBegin, varEnd, idxVel, unitNormal, gradient[iPoint]); diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index f8d1d9ca85d..95519a50406 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1134,26 +1134,14 @@ void CFVMFlowSolverBase::PushSolutionBackInTime(unsigned long TimeIter, bo template void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, - CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) { + CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) { const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const auto iVel = prim_idx.Velocity(); - su2double* V_reflected; - /*--- Blazek chapter 8.: Compute the fluxes for the halved control volume but not across the boundary. - * The components of the residual normal to the symmetry plane are then zeroed out. - * It is also necessary to correct normal vectors of those faces of the control volume, which - * touch the boundary. The modification consists of removing all components of the face vector, - * which are normal to the symmetry plane. The gradients also have to be corrected acording to Eq. (8.40) ---*/ - - // first, check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against - - unsigned short nSym = 0; - for (size_t iMarker = 0; iMarker < geometry->GetnMarker(); ++iMarker) { - if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE) || - (config->GetMarker_All_KindBC(iMarker) == EULER_WALL)) { - nSym++; - } - } + /*--- Blazek chapter 8.: + * The components of the momentum residual normal to the symmetry plane are zeroed out. + * The gradients have already been corrected acording to Eq. (8.40). + * Contrary to Blazek we keep some scalar fluxes computed on the boundary to improve stability (see below). ---*/ /*--- Loop over all the vertices on this boundary marker. ---*/ @@ -1164,36 +1152,28 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve /*--- Halo points do not need to be considered. ---*/ if (!geometry->nodes->GetDomain(iPoint)) continue; - /*--- Get the normal of the current symmetry ---*/ - su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0}; - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - - const su2double Area = GeometryToolbox::Norm(nDim, Normal); + /*--- Get the normal of the current symmetry. This may be the original normal of the vertex + * or a modified normal if there are intersecting symmetries. ---*/ - for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; + su2double Normal[MAXNDIM] = {}, UnitNormal[MAXNDIM] = {}; + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + const auto it = geometry->symmetryNormals[val_marker].find(iVertex); - if (nSym > 1) { - if (geometry->symmetryNormals.size() > 0) { - auto it = std::find_if( - geometry->symmetryNormals[val_marker].begin(), - geometry->symmetryNormals[val_marker].end(), - findSymNormalIndex(iPoint)); - if (it != geometry->symmetryNormals[val_marker].end()) { - for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->normal[iDim]; - } - } + if (it != geometry->symmetryNormals[val_marker].end()) { + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = it->second[iDim]; + } else { + const su2double Area = GeometryToolbox::Norm(nDim, Normal); + for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area; } - V_reflected = GetCharacPrimVar(val_marker, iVertex); + su2double* V_reflected = GetCharacPrimVar(val_marker, iVertex); /*--- Grid movement ---*/ if (dynamic_grid) conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); /*--- Normal vector for this vertex (negate for outward convention). ---*/ - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Normal[iDim] = -Normal[iDim]; + for (auto iDim = 0u; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; conv_numerics->SetNormal(Normal); for (auto iVar = 0u; iVar < nPrimVar; iVar++) @@ -1217,10 +1197,10 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve /*--- Compute the residual using an upwind scheme. ---*/ auto residual = conv_numerics->ComputeResidual(config); - /*--- We need only an update of energy here. ---*/ - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - if ((iVar= iVel+nDim)) - LinSysRes(iPoint, iVar) += residual.residual[iVar]; + /*--- We include an update of the continuity and energy here, this is important for stability since + * these fluxes include numerical diffusion. ---*/ + for (auto iVar = 0u; iVar < nVar; iVar++) { + if (iVar < iVel || iVar >= iVel + nDim) LinSysRes(iPoint, iVar) += residual.residual[iVar]; } /*--- Explicitly set the velocity components normal to the symmetry plane to zero. @@ -1229,38 +1209,33 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve su2double* solutionOld = nodes->GetSolution_Old(iPoint); - su2double gridVel[MAXNVAR] = {0.0}; - + su2double gridVel[MAXNVAR] = {}; if (dynamic_grid) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { gridVel[iDim] = geometry->nodes->GetGridVel(iPoint)[iDim]; } - if (FlowRegime == ENUM_REGIME::COMPRESSIBLE) { - for(unsigned short iDim = 0; iDim < nDim; iDim++) { - /* --- multiply by density --- */ - gridVel[iDim] *= solutionOld[0]; + for(auto iDim = 0u; iDim < nDim; iDim++) { + /*--- Multiply by density since we are correcting conservative variables. ---*/ + gridVel[iDim] *= solutionOld[prim_idx.Density()]; } } } - su2double vp = 0.0; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) - vp += (solutionOld[iVel+iDim] - gridVel[iDim]) * UnitNormal[iDim]; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) { + for (auto iDim = 0u; iDim < nDim; iDim++) { + vp += (solutionOld[iVel + iDim] - gridVel[iDim]) * UnitNormal[iDim]; + } + for (auto iDim = 0u; iDim < nDim; iDim++) { solutionOld[iVel + iDim] -= vp * UnitNormal[iDim]; } /*--- Keep only the tangential part of the momentum residuals. ---*/ - su2double NormalProduct = 0.0; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) - NormalProduct += LinSysRes(iPoint, iVel + iDim) * UnitNormal[iDim]; - - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - LinSysRes(iPoint, iVel + iDim) -= NormalProduct * UnitNormal[iDim]; + su2double normalRes = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) { + normalRes += LinSysRes(iPoint, iVel + iDim) * UnitNormal[iDim]; + } + for (auto iDim = 0u; iDim < nDim; iDim++) { + LinSysRes(iPoint, iVel + iDim) -= normalRes * UnitNormal[iDim]; } /*--- Jacobian contribution for implicit integration. ---*/ @@ -1268,14 +1243,15 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); } - /*--- Correction for multigrid ---*/ - NormalProduct = 0.0; + /*--- Correction for multigrid. ---*/ + normalRes = 0.0; su2double* Res_TruncError = nodes->GetResTruncError(iPoint); - for (unsigned short iDim = 0; iDim < nDim; iDim++) - NormalProduct += Res_TruncError[iVel + iDim] * UnitNormal[iDim]; - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Res_TruncError[iVel + iDim] -= NormalProduct * UnitNormal[iDim]; - + for (auto iDim = 0u; iDim < nDim; iDim++) { + normalRes += Res_TruncError[iVel + iDim] * UnitNormal[iDim]; + } + for (auto iDim = 0u; iDim < nDim; iDim++) { + Res_TruncError[iVel + iDim] -= normalRes * UnitNormal[iDim]; + } } END_SU2_OMP_FOR diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 14c478c0f47..03b54ab3e01 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -844,7 +844,7 @@ void CDriver::InitializeGeometryFVM(CConfig *config, CGeometry **&geometry) { /*--- Create the control volume structures ---*/ geometry[iMGlevel]->SetControlVolume(geometry[iMGlevel-1], ALLOCATE); - geometry[iMGlevel]->SetBoundControlVolume(geometry[iMGlevel-1], ALLOCATE); + geometry[iMGlevel]->SetBoundControlVolume(geometry[iMGlevel-1], config, ALLOCATE); geometry[iMGlevel]->SetCoord(geometry[iMGlevel-1]); /*--- Find closest neighbor to a surface point ---*/ From e8ba7c0bd3b672143e466141095bb815fad20c51 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Mon, 29 Jul 2024 07:43:27 -0700 Subject: [PATCH 185/194] fix index --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 95519a50406..9c586616404 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1217,7 +1217,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve if (FlowRegime == ENUM_REGIME::COMPRESSIBLE) { for(auto iDim = 0u; iDim < nDim; iDim++) { /*--- Multiply by density since we are correcting conservative variables. ---*/ - gridVel[iDim] *= solutionOld[prim_idx.Density()]; + gridVel[iDim] *= solutionOld[0]; } } } From 368444dfdd33f105c07a07bca1d73a99563ed805 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Mon, 29 Jul 2024 09:25:54 -0700 Subject: [PATCH 186/194] checking if surfaces are planes is no longer required --- Common/include/geometry/CGeometry.hpp | 12 +-- Common/src/geometry/CGeometry.cpp | 119 -------------------------- SU2_CFD/src/drivers/CDriver.cpp | 14 --- 3 files changed, 1 insertion(+), 144 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index 8d3d6374018..015aaf1fdc2 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -243,8 +243,7 @@ class CGeometry { /*!< \brief Corrected normals on nodes with shared symmetry markers. */ vector>> symmetryNormals; - /*!< \brief Bool if boundary-marker is straight(2D)/plane(3D) for each local marker. */ - vector bound_is_straight; + vector SurfaceAreaCfgFile; /*!< \brief Total Surface area for all markers. */ /*--- Partitioning-specific variables ---*/ @@ -1015,15 +1014,6 @@ class CGeometry { */ su2double GetSurfaceArea(const CConfig* config, unsigned short val_marker) const; - /*! - * \brief Check if a boundary is straight(2D) / plane(3D) for EULER_WALL and SYMMETRY_PLANE - * only and store the information in bound_is_straight. For all other boundary types - * this will return false and could therfore be wrong. Used ultimately for BC_Slip_Wall. - * \param[in] config - Definition of the particular problem. - * \param[in] print_on_screen - Boolean whether to print result on screen. - */ - void ComputeSurf_Straightness(const CConfig* config, bool print_on_screen); - /*! * \brief Find and store all vertices on a sharp corner in the geometry. * \param[in] config - Definition of the particular problem. diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index 9134efb586d..b1c77372141 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2453,125 +2453,6 @@ su2double CGeometry::GetSurfaceArea(const CConfig* config, unsigned short val_ma return 0.0; } -void CGeometry::ComputeSurf_Straightness(const CConfig* config, bool print_on_screen) { - bool RefUnitNormal_defined; - unsigned short iDim, iMarker, iMarker_Global, nMarker_Global = config->GetnMarker_CfgFile(); - unsigned long iVertex; - constexpr passivedouble epsilon = 1.0e-6; - su2double Area; - string Local_TagBound, Global_TagBound; - - vector Normal(nDim), UnitNormal(nDim), RefUnitNormal(nDim); - - /*--- Assume now that this boundary marker is straight. As soon as one - AreaElement is found that is not aligend with a Reference then it is - certain that the boundary marker is not straight and one can stop - searching. Another possibility is that this process doesn't own - any nodes of that boundary, in that case we also have to assume the - boundary is straight. - Any boundary type other than SYMMETRY_PLANE or EULER_WALL gets - the value false (or see cases specified in the conditional below) - which could be wrong. ---*/ - bound_is_straight.resize(nMarker); - fill(bound_is_straight.begin(), bound_is_straight.end(), true); - - /*--- Loop over all local markers ---*/ - for (iMarker = 0; iMarker < nMarker; iMarker++) { - Local_TagBound = config->GetMarker_All_TagBound(iMarker); - - /*--- Marker has to be Symmetry or Euler. Additionally marker can't be a - moving surface and Grid Movement Elasticity is forbidden as well. All - other GridMovements are rigid. ---*/ - if ((config->GetMarker_All_KindBC(iMarker) == SYMMETRY_PLANE || - config->GetMarker_All_KindBC(iMarker) == EULER_WALL) && - !config->GetMarker_Moving_Bool(Local_TagBound) && !config->GetMarker_Deform_Mesh_Bool(Local_TagBound)) { - /*--- Loop over all global markers, and find the local-global pair via - matching unique string tags. ---*/ - for (iMarker_Global = 0; iMarker_Global < nMarker_Global; iMarker_Global++) { - Global_TagBound = config->GetMarker_CfgFile_TagBound(iMarker_Global); - if (Local_TagBound == Global_TagBound) { - RefUnitNormal_defined = false; - iVertex = 0; - - while (bound_is_straight[iMarker] && iVertex < nVertex[iMarker]) { - vertex[iMarker][iVertex]->GetNormal(Normal.data()); - UnitNormal = Normal; - - /*--- Compute unit normal. ---*/ - Area = 0.0; - for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim] * Normal[iDim]; - Area = sqrt(Area); - - /*--- Negate for outward convention. ---*/ - for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] /= -Area; - - /*--- Check if unit normal is within tolerance of the Reference unit normal. - Reference unit normal = first unit normal found. ---*/ - if (RefUnitNormal_defined) { - for (iDim = 0; iDim < nDim; iDim++) { - if (abs(RefUnitNormal[iDim] - UnitNormal[iDim]) > epsilon) { - bound_is_straight[iMarker] = false; - break; - } - } - } else { - RefUnitNormal = UnitNormal; // deep copy of values - RefUnitNormal_defined = true; - } - - iVertex++; - } // while iVertex - } // if Local == Global - } // for iMarker_Global - } else { - /*--- Enforce default value: false ---*/ - bound_is_straight[iMarker] = false; - } // if sym or euler ... - } // for iMarker - - /*--- Communicate results and print on screen. ---*/ - if (print_on_screen) { - /*--- Additional vector which can later be MPI::Allreduce(d) to pring the results - on screen as nMarker (local) can vary across ranks. Default 'true' as it can - happen that a local rank does not contain an element of each surface marker. ---*/ - vector bound_is_straight_Global(nMarker_Global, true); - /*--- Match local with global tag bound and fill a Global Marker vector. ---*/ - for (iMarker = 0; iMarker < nMarker; iMarker++) { - Local_TagBound = config->GetMarker_All_TagBound(iMarker); - for (iMarker_Global = 0; iMarker_Global < nMarker_Global; iMarker_Global++) { - Global_TagBound = config->GetMarker_CfgFile_TagBound(iMarker_Global); - - if (Local_TagBound == Global_TagBound) bound_is_straight_Global[iMarker_Global] = bound_is_straight[iMarker]; - - } // for iMarker_Global - } // for iMarker - - vector Buff_Send_isStraight(nMarker_Global), Buff_Recv_isStraight(nMarker_Global); - - /*--- Cast to int as std::vector can be a special construct. MPI handling using - is more straight-forward. ---*/ - for (iMarker_Global = 0; iMarker_Global < nMarker_Global; iMarker_Global++) - Buff_Send_isStraight[iMarker_Global] = static_cast(bound_is_straight_Global[iMarker_Global]); - - /*--- Product of type (bool) is equivalnt to a 'logical and' ---*/ - SU2_MPI::Allreduce(Buff_Send_isStraight.data(), Buff_Recv_isStraight.data(), nMarker_Global, MPI_INT, MPI_PROD, - SU2_MPI::GetComm()); - - /*--- Print results on screen. ---*/ - if (rank == MASTER_NODE) { - for (iMarker_Global = 0; iMarker_Global < nMarker_Global; iMarker_Global++) { - if (config->GetMarker_CfgFile_KindBC(config->GetMarker_CfgFile_TagBound(iMarker_Global)) == SYMMETRY_PLANE || - config->GetMarker_CfgFile_KindBC(config->GetMarker_CfgFile_TagBound(iMarker_Global)) == EULER_WALL) { - cout << "Boundary marker " << config->GetMarker_CfgFile_TagBound(iMarker_Global) << " is"; - if (!static_cast(Buff_Recv_isStraight[iMarker_Global])) cout << " NOT"; - if (nDim == 2) cout << " a single straight." << endl; - if (nDim == 3) cout << " a single plane." << endl; - } // if sym or euler - } // for iMarker_Global - } // if rank==MASTER - } // if print_on_scren -} - void CGeometry::ComputeModifiedSymmetryNormals(const CConfig* config) { /* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against. * All nodes that are shared by multiple symmetries have to get a corrected normal. */ diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 03b54ab3e01..971ae9e0be7 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -679,20 +679,6 @@ void CDriver::InitializeGeometry(CConfig* config, CGeometry **&geometry, bool du } #endif - /*--- Check if Euler & Symmetry markers are straight/plane. This information - is used in the Euler & Symmetry boundary routines. ---*/ - if((config_container[iZone]->GetnMarker_Euler() != 0 || - config_container[iZone]->GetnMarker_SymWall() != 0) && - !fem_solver) { - - if (rank == MASTER_NODE) - cout << "Checking if Euler & Symmetry markers are straight/plane:" << endl; - - for (iMesh = 0; iMesh <= config_container[iZone]->GetnMGLevels(); iMesh++) - geometry_container[iZone][iInst][iMesh]->ComputeSurf_Straightness(config_container[iZone], (iMesh==MESH_0) ); - - } - /*--- Keep a reference to the main (ZONE_0, INST_0, MESH_0) geometry. ---*/ main_geometry = geometry_container[ZONE_0][INST_0][MESH_0]; From 71fc627f0927c7aac5f1af8577e83539ee0d8091 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 29 Jul 2024 23:21:30 +0200 Subject: [PATCH 187/194] update bunch of regressions --- .../disc_adj_fsi/dyn_fsi/grad_dv.opt.ref | 16 ++--- TestCases/hybrid_regression.py | 26 +++---- TestCases/hybrid_regression_AD.py | 14 ++-- .../multiple_ffd/naca0012/of_grad_cd.dat.ref | 2 +- .../naca0012/of_grad_directdiff.dat.ref | 4 +- TestCases/parallel_regression.py | 64 ++++++++--------- TestCases/parallel_regression_AD.py | 12 ++-- TestCases/serial_regression.py | 72 +++++++++---------- TestCases/serial_regression_AD.py | 16 ++--- TestCases/tutorials.py | 6 +- 10 files changed, 116 insertions(+), 116 deletions(-) diff --git a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref index c1aff90950a..d0a338410ba 100644 --- a/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref +++ b/TestCases/disc_adj_fsi/dyn_fsi/grad_dv.opt.ref @@ -1,9 +1,9 @@ INDEX GRAD -0 -5.381067336954367e-03 -1 -2.900518184471754e-03 -2 -1.286923279803124e-03 -3 -4.900398751994363e-04 -4 -4.890878571990538e-04 -5 -1.280773697154056e-03 -6 -2.879419674440936e-03 -7 -5.327422795820885e-03 +0 -5.239274142145693e-03 +1 -2.822866261832595e-03 +2 -1.251166631047082e-03 +3 -4.746312021502222e-04 +4 -4.726421390156573e-04 +5 -1.242307153964931e-03 +6 -2.797799332331688e-03 +7 -5.181304648315885e-03 diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index ffce74b89ce..34cad2f23b4 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -75,7 +75,7 @@ def main(): oneram6.cfg_dir = "euler/oneram6" oneram6.cfg_file = "inv_ONERAM6.cfg" oneram6.test_iter = 10 - oneram6.test_vals = [0.280737, 0.008725] + oneram6.test_vals = [0.280800, 0.008623] test_list.append(oneram6) # Fixed CL NACA0012 @@ -185,7 +185,7 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-4.156102, -6.736064, -0.176184, 0.057478] + turb_flatplate.test_vals = [-4.156553, -6.736064, -0.176184, 0.057478] test_list.append(turb_flatplate) # ONERA M6 Wing @@ -193,7 +193,7 @@ def main(): turb_oneram6.cfg_dir = "rans/oneram6" turb_oneram6.cfg_file = "turb_ONERAM6.cfg" turb_oneram6.test_iter = 10 - turb_oneram6.test_vals = [-2.392878, -6.689823, 0.230746, 0.158812, -33786.000000] + turb_oneram6.test_vals = [-2.392863, -6.689822, 0.230745, 0.158812, -33786.000000] test_list.append(turb_oneram6) # NACA0012 (SA, FUN3D finest grid results: CL=1.0983, CD=0.01242) @@ -235,7 +235,7 @@ def main(): turb_naca0012_sst_expliciteuler.cfg_dir = "rans/naca0012" turb_naca0012_sst_expliciteuler.cfg_file = "turb_NACA0012_sst_expliciteuler.cfg" turb_naca0012_sst_expliciteuler.test_iter = 10 - turb_naca0012_sst_expliciteuler.test_vals = [-3.532289, -3.157766, 3.364024, 1.122901, 0.500798, -float("inf")] + turb_naca0012_sst_expliciteuler.test_vals = [-3.532289, -3.157766, 3.364024, 1.122901, 0.500798, -inf] test_list.append(turb_naca0012_sst_expliciteuler) # PROPELLER @@ -255,7 +255,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-12.155864, -6.610272, -9.238247, -4.533012, -2019.700000] + axi_rans_air_nozzle_restart.test_vals = [-12.155957, -6.610384, -9.237797, -4.532605, -2019.700000] test_list.append(axi_rans_air_nozzle_restart) ################################# @@ -349,7 +349,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-7.048661, -6.285973, 0.531969, 0.008467] + inc_euler_naca0012.test_vals = [-7.104363, -6.354829, 0.531976, 0.008467] test_list.append(inc_euler_naca0012) # C-D nozzle with pressure inlet and mass flow outlet @@ -357,7 +357,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-6.273660, -5.510215, -0.000682, 0.126552] + inc_nozzle.test_vals = [-6.363748, -5.564772, -0.003840, 0.126592] inc_nozzle.test_vals_aarch64 = [-5.624385, -4.988472, -0.000096, 0.137032] test_list.append(inc_nozzle) @@ -395,7 +395,7 @@ def main(): inc_lam_bend.cfg_dir = "incomp_navierstokes/bend" inc_lam_bend.cfg_file = "lam_bend.cfg" inc_lam_bend.test_iter = 10 - inc_lam_bend.test_vals = [-3.427371, -3.115748, -0.020081, 1.026369] + inc_lam_bend.test_vals = [-3.547250, -3.225803, -0.015148, 1.006543] inc_lam_bend.test_vals_aarch64 = [-3.437996, -3.086188, -0.015600, 1.142213] test_list.append(inc_lam_bend) @@ -508,7 +508,7 @@ def main(): ddes_flatplate.cfg_dir = "ddes/flatplate" ddes_flatplate.cfg_file = "ddes_flatplate.cfg" ddes_flatplate.test_iter = 10 - ddes_flatplate.test_vals = [-2.714788, -5.882720, -0.215049, 0.023758, -617.440000] + ddes_flatplate.test_vals = [-2.714785, -5.882681, -0.215041, 0.023758, -617.440000] ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) @@ -561,7 +561,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-6.614623, -3.001323, -14.336147, -8.776081, -11.382919, -5.852327, 73273, 73273, 0.019884, 82.491] + Jones_tc_restart.test_vals = [-6.614627, -3.001324, -14.336143, -8.776079, -11.382919, -5.852328, 73273.000000, 73273.000000, 0.019884, 82.491000] test_list.append(Jones_tc_restart) # 2D axial stage @@ -569,7 +569,7 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [0.983739, 1.534333, -2.888521, 2.606770, -2.418339, 3.087275, 106380, 106380, 5.7325, 64.711] + axial_stage2D.test_vals = [0.983739, 1.534333, -2.888521, 2.606770, -2.418339, 3.087275, 106380.000000, 106380.000000, 5.732600, 64.711000] axial_stage2D.test_vals_aarch64 = [0.983739, 1.534333, -2.888521, 2.606770, -2.418339, 3.087275, 106380, 106380, 5.7325, 64.711] test_list.append(axial_stage2D) @@ -578,7 +578,7 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630, 94.866, -0.035738] + transonic_stator_restart.test_vals = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630.000000, 94.866000, -0.035738] transonic_stator_restart.test_vals_aarch64 = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630, 94.866, -0.035738] test_list.append(transonic_stator_restart) @@ -611,7 +611,7 @@ def main(): channel_3D.cfg_dir = "sliding_interface/channel_3D" channel_3D.cfg_file = "channel_3D_WA.cfg" channel_3D.test_iter = 2 - channel_3D.test_vals = [2.000000, 0.000000, 0.623108, 0.505080, 0.412779] + channel_3D.test_vals = [2.000000, 0.000000, 0.623108, 0.505077, 0.412801] channel_3D.test_vals_aarch64 = [2.000000, 0.000000, 0.620558, 0.504323, 0.412729] channel_3D.unsteady = True channel_3D.multizone = True diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index e562fe4f0bb..0669ff42a30 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -50,7 +50,7 @@ def main(): discadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" discadj_naca0012.cfg_file = "inv_NACA0012_discadj.cfg" discadj_naca0012.test_iter = 100 - discadj_naca0012.test_vals = [-3.560692, -8.925239, -0.000000, 0.005559] + discadj_naca0012.test_vals = [-3.560691, -8.925239, -0.000000, 0.005559] test_list.append(discadj_naca0012) # Inviscid Cylinder 3D (multiple markers) @@ -58,7 +58,7 @@ def main(): discadj_cylinder3D.cfg_dir = "disc_adj_euler/cylinder3D" discadj_cylinder3D.cfg_file = "inv_cylinder3D.cfg" discadj_cylinder3D.test_iter = 5 - discadj_cylinder3D.test_vals = [-3.773582, -3.736536, -0.000000, 0.000000] + discadj_cylinder3D.test_vals = [-3.764562, -3.719982, -0.000000, 0.000000] test_list.append(discadj_cylinder3D) # Arina nozzle 2D @@ -123,7 +123,7 @@ def main(): discadj_incomp_turb_NACA0012_sa.cfg_dir = "disc_adj_incomp_rans/naca0012" discadj_incomp_turb_NACA0012_sa.cfg_file = "turb_naca0012_sa.cfg" discadj_incomp_turb_NACA0012_sa.test_iter = 10 - discadj_incomp_turb_NACA0012_sa.test_vals = [10.000000, -3.845995, -1.031097, 0.000000] + discadj_incomp_turb_NACA0012_sa.test_vals = [10.000000, -3.845995, -1.031096, 0.000000] test_list.append(discadj_incomp_turb_NACA0012_sa) # Adjoint Incompressible Turbulent NACA 0012 SST @@ -143,7 +143,7 @@ def main(): discadj_cylinder.cfg_dir = "disc_adj_rans/cylinder" discadj_cylinder.cfg_file = "cylinder.cfg" discadj_cylinder.test_iter = 9 - discadj_cylinder.test_vals = [3.746907, -1.544882, -0.008321, 0.000014] + discadj_cylinder.test_vals = [3.746907, -1.544883, -0.008321, 0.000014] discadj_cylinder.unsteady = True discadj_cylinder.enabled_with_tsan = False test_list.append(discadj_cylinder) @@ -199,7 +199,7 @@ def main(): discadj_trans_stator.cfg_dir = "disc_adj_turbomachinery/transonic_stator_2D" discadj_trans_stator.cfg_file = "transonic_stator.cfg" discadj_trans_stator.test_iter = 79 - discadj_trans_stator.test_vals = [79, 0.770065, 0.383137, 0.472153, -0.996484, 2.153296, -4.444301] + discadj_trans_stator.test_vals = [79.000000, 0.770094, 0.383191, 0.472139, -0.996477, 2.153270, -4.444323] discadj_trans_stator.test_vals_aarch64 = [79, 0.769987, 0.383135, 0.472391, -0.996504, 2.153296, -4.444301] discadj_trans_stator.enabled_with_tsan = False test_list.append(discadj_trans_stator) @@ -238,7 +238,7 @@ def main(): pywrapper_FEA_AD_FlowLoad.cfg_dir = "py_wrapper/disc_adj_fea/flow_load_sens" pywrapper_FEA_AD_FlowLoad.cfg_file = "configAD_fem.cfg" pywrapper_FEA_AD_FlowLoad.test_iter = 100 - pywrapper_FEA_AD_FlowLoad.test_vals = [-0.131415, -0.551701, -0.000364, -0.003101] #last 4 columns + pywrapper_FEA_AD_FlowLoad.test_vals = [-0.132037, -0.554472, -0.000364, -0.003101] pywrapper_FEA_AD_FlowLoad.test_vals_aarch64 = [-0.131745, -0.553214, -0.000364, -0.003101] pywrapper_FEA_AD_FlowLoad.command = TestCase.Command(exec = "python", param = "run_adjoint.py --parallel -f") pywrapper_FEA_AD_FlowLoad.timeout = 1600 @@ -253,7 +253,7 @@ def main(): pywrapper_CFD_AD_MeshDisp.cfg_dir = "py_wrapper/disc_adj_flow/mesh_disp_sens" pywrapper_CFD_AD_MeshDisp.cfg_file = "configAD_flow.cfg" pywrapper_CFD_AD_MeshDisp.test_iter = 1000 - pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.505396, 1.403846, 0.000000] + pywrapper_CFD_AD_MeshDisp.test_vals = [30.000000, -2.505480, 1.403813, 0.000000] pywrapper_CFD_AD_MeshDisp.test_vals_aarch64 = [30.000000, -2.499079, 1.440068, 0.000000] pywrapper_CFD_AD_MeshDisp.command = TestCase.Command(exec = "python", param = "run_adjoint.py --parallel -f") pywrapper_CFD_AD_MeshDisp.timeout = 1600 diff --git a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref index 5125e8611f4..bce05aa9bf6 100644 --- a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref +++ b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref @@ -1,3 +1,3 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , 0.0779175 , 0.001 + 0 , 0.0779208 , 0.001 1 , -0.115959 , 0.001 diff --git a/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref b/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref index f2dde38cdf7..74adba36fa1 100644 --- a/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref +++ b/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref @@ -1,3 +1,3 @@ VARIABLES="VARIABLE" , "DRAG" , "EFFICIENCY" , "FORCE_X" , "FORCE_Y" , "FORCE_Z" , "LIFT" , "MOMENT_X" , "MOMENT_Y" , "MOMENT_Z" , "SIDEFORCE" - 0 , 0.06150627044 , -0.6117158351 , 0.05889496613 , 0.1203453382 , 0.0 , 0.1190319124 , 0.0 , 0.0 , 0.009707441327 , 0.0 - 1 , -0.08534352188 , 8.301261675 , -0.09095957455 , 0.2564490596 , 0.0 , 0.2583723043 , 0.0 , 0.0 , 0.004447312573 , 0.0 + 0 , 0.06149476303 , -0.608748249 , 0.05888315926 , 0.1203589365 , 0.0 , 0.119045765 , 0.0 , 0.0 , 0.009719951712 , 0.0 + 1 , -0.08536237383 , 8.303168487 , -0.09097907726 , 0.2564786779 , 0.0 , 0.2584023411 , 0.0 , 0.0 , 0.004460595335 , 0.0 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index ce2097049ea..9a5c4d6289b 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -74,7 +74,7 @@ def main(): cfd_flamelet_h2.cfg_dir = "flamelet/07_laminar_premixed_h2_flame_cfd" cfd_flamelet_h2.cfg_file = "laminar_premixed_h2_flame_cfd.cfg" cfd_flamelet_h2.test_iter = 5 - cfd_flamelet_h2.test_vals = [-9.983442, -9.843934, -3.290032, -11.338453] + cfd_flamelet_h2.test_vals = [-9.999540, -9.843936, -3.290033, -11.338454] cfd_flamelet_h2.new_output = True test_list.append(cfd_flamelet_h2) @@ -112,7 +112,7 @@ def main(): invwedge_a.cfg_dir = "nonequilibrium/invwedge" invwedge_a.cfg_file = "invwedge_ausm.cfg" invwedge_a.test_iter = 10 - invwedge_a.test_vals = [-1.063839, -1.588608, -18.301559, -18.628931, -18.574965, 2.251488, 1.878418, 5.295899, 0.853255] + invwedge_a.test_vals = [-1.069675, -1.594438, -18.299923, -18.627316, -18.573325, 2.245721, 1.874105, 5.290285, 0.847729] invwedge_a.test_vals_aarch64 = [-1.070904, -1.595667, -18.299980, -18.627372, -18.573382, 2.244654, 1.871030, 5.289134, 0.846502] test_list.append(invwedge_a) @@ -130,7 +130,7 @@ def main(): invwedge_msw.cfg_dir = "nonequilibrium/invwedge" invwedge_msw.cfg_file = "invwedge_msw.cfg" invwedge_msw.test_iter = 10 - invwedge_msw.test_vals = [-1.221686, -1.746504, -18.298053, -18.625471, -18.571455, 2.097151, 1.636737, 5.133824, 0.695380] + invwedge_msw.test_vals = [-1.212335, -1.737098, -18.299220, -18.626618, -18.572623, 2.106171, 1.651949, 5.143958, 0.704444] invwedge_msw.test_vals_aarch64 = [-1.224649, -1.749412, -18.299151, -18.626550, -18.572552, 2.094106, 1.635779, 5.131012, 0.692821] test_list.append(invwedge_msw) @@ -139,7 +139,7 @@ def main(): invwedge_roe.cfg_dir = "nonequilibrium/invwedge" invwedge_roe.cfg_file = "invwedge_roe.cfg" invwedge_roe.test_iter = 10 - invwedge_roe.test_vals = [-1.075966, -1.600814, -17.208192, -17.537944, -17.481322, 2.242877, 1.826787, 5.279178, 0.877871] + invwedge_roe.test_vals = [-1.062496, -1.587259, -17.208314, -17.538065, -17.481444, 2.255933, 1.853450, 5.293725, 0.890784] invwedge_roe.test_vals_aarch64 = [-1.069128, -1.593891, -17.208222, -17.537969, -17.481352, 2.249020, 1.852904, 5.287143, 0.879852] test_list.append(invwedge_roe) @@ -157,7 +157,7 @@ def main(): invwedge_ausm_m.cfg_dir = "nonequilibrium/invwedge" invwedge_ausm_m.cfg_file = "invwedge_am.cfg" invwedge_ausm_m.test_iter = 10 - invwedge_ausm_m.test_vals = [-1.173349, -1.698112, -16.739586, -17.063491, -17.012692, 2.124432, 1.961881, 5.182534, 0.747053] + invwedge_ausm_m.test_vals = [-1.173033, -1.697796, -16.739586, -17.063491, -17.012692, 2.124519, 1.963804, 5.182881, 0.747539] invwedge_ausm_m.test_vals_aarch64 = [-1.171654, -1.696417, -16.739585, -17.063491, -17.012691, 2.125633, 1.966511, 5.184281, 0.749068] test_list.append(invwedge_ausm_m) @@ -166,7 +166,7 @@ def main(): invwedge_ss_inlet.cfg_dir = "nonequilibrium/invwedge" invwedge_ss_inlet.cfg_file = "invwedge_ss_inlet.cfg" invwedge_ss_inlet.test_iter = 10 - invwedge_ss_inlet.test_vals = [-1.063621, -1.588388, -18.250175, -18.579516, -18.523248, 2.251739, 1.878447, 5.296108, 0.853467] + invwedge_ss_inlet.test_vals = [-1.068592, -1.593355, -18.250183, -18.579524, -18.523255, 2.246972, 1.874197, 5.291273, 0.848771] invwedge_ss_inlet.test_vals_aarch64 = [-1.069892, -1.594654, -18.250175, -18.579516, -18.523248, 2.245827, 1.871123, 5.290054, 0.847476] test_list.append(invwedge_ss_inlet) @@ -192,7 +192,7 @@ def main(): super_cat.cfg_dir = "nonequilibrium/visc_wedge" super_cat.cfg_file = "super_cat.cfg" super_cat.test_iter = 10 - super_cat.test_vals = [-5.232595, -5.757889, -20.641415, -20.640623, -20.541670, 1.246865, -3.205258, -0.028390, 0.250641, 32440.000000] + super_cat.test_vals = [-5.232595, -5.757889, -20.641415, -20.640623, -20.541670, 1.246866, -3.205258, -0.028372, 0.250647, 32440.000000] test_list.append(super_cat) # Viscous single wedge - partially catalytic walls @@ -200,7 +200,7 @@ def main(): partial_cat.cfg_dir = "nonequilibrium/visc_wedge" partial_cat.cfg_file = "partial_cat.cfg" partial_cat.test_iter = 10 - partial_cat.test_vals = [-5.210302, -5.735065, -20.880449, -20.825971, -23.475263, 1.806201, -2.813952, -0.078419, 0.495601, 29020.000000] + partial_cat.test_vals = [-5.210302, -5.735065, -20.880448, -20.825971, -23.475263, 1.806201, -2.813952, -0.078400, 0.495606, 29020.000000] test_list.append(partial_cat) # Viscous cylinder, ionization, Gupta-Yos @@ -282,7 +282,7 @@ def main(): ea_naca64206.cfg_dir = "optimization_euler/equivalentarea_naca64206" ea_naca64206.cfg_file = "NACA64206.cfg" ea_naca64206.test_iter = 10 - ea_naca64206.test_vals = [-1.150939, -0.455629, -0.003834, 67775.000000] + ea_naca64206.test_vals = [-1.151334, -0.455927, -0.003879, 67775.000000] test_list.append(ea_naca64206) # SUPERSONIC FLOW PAST A RAMP IN A CHANNEL @@ -290,7 +290,7 @@ def main(): ramp.cfg_dir = "euler/ramp" ramp.cfg_file = "inv_ramp.cfg" ramp.test_iter = 10 - ramp.test_vals = [-13.648891, -8.011653, -0.076277, 0.054839] + ramp.test_vals = [-13.648694, -8.010920, -0.076277, 0.054839] ramp.test_vals_aarch64 = [-13.398422, -7.786461, -0.081064, 0.056474] test_list.append(ramp) @@ -311,7 +311,7 @@ def main(): flatplate_udobj.cfg_dir = "user_defined_functions" flatplate_udobj.cfg_file = "lam_flatplate.cfg" flatplate_udobj.test_iter = 20 - flatplate_udobj.test_vals = [-6.547200, -1.073825, -0.772639, 0.000656, -0.000724, 0.000462, -0.001186, 597.060000, 300.130000, 296.930000, 22.704000, 0.506230, 37.280000, 2.347800] + flatplate_udobj.test_vals = [-6.664134, -1.190073, -0.954366, 0.000641, -0.000633, 0.000548, -0.001181, 596.940000, 300.020000, 296.920000, 22.201000, 0.525750, 37.278000, 2.347900] test_list.append(flatplate_udobj) # Laminar cylinder (steady) @@ -381,7 +381,7 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-4.146913, -6.728398, -0.176233, 0.057709] + turb_flatplate.test_vals = [-4.147387, -6.728398, -0.176234, 0.057709] test_list.append(turb_flatplate) # Flat plate (compressible) with species inlet @@ -389,7 +389,7 @@ def main(): turb_flatplate_species.cfg_dir = "rans/flatplate" turb_flatplate_species.cfg_file = "turb_SA_flatplate_species.cfg" turb_flatplate_species.test_iter = 20 - turb_flatplate_species.test_vals = [-4.146913, -0.634805, -1.769793, 1.335806, -3.250287, 9.000000, -6.695482, 5.000000, -6.991164, 10.000000, -6.033070, 0.996034, 0.996034] + turb_flatplate_species.test_vals = [-4.147387, -0.634805, -1.769879, 1.335329, -3.250300, 9.000000, -6.694977, 5.000000, -6.991166, 10.000000, -6.033066, 0.996034, 0.996034] test_list.append(turb_flatplate_species) # Flat plate SST compressibility correction Wilcox @@ -413,7 +413,7 @@ def main(): turb_oneram6.cfg_dir = "rans/oneram6" turb_oneram6.cfg_file = "turb_ONERAM6.cfg" turb_oneram6.test_iter = 10 - turb_oneram6.test_vals = [-2.392880, -6.689822, 0.230746, 0.158811, -33786.000000] + turb_oneram6.test_vals = [-2.392865, -6.689822, 0.230746, 0.158811, -33786.000000] turb_oneram6.timeout = 3200 test_list.append(turb_oneram6) @@ -422,7 +422,7 @@ def main(): turb_oneram6_vc.cfg_dir = "rans/oneram6" turb_oneram6_vc.cfg_file = "turb_ONERAM6_vc.cfg" turb_oneram6_vc.test_iter = 15 - turb_oneram6_vc.test_vals = [-2.266190, -6.628061, 0.228693, 0.142104, -28397.000000] + turb_oneram6_vc.test_vals = [-2.266212, -6.628059, 0.228692, 0.142105, -28396.000000] turb_oneram6_vc.timeout = 3200 test_list.append(turb_oneram6_vc) @@ -431,7 +431,7 @@ def main(): turb_oneram6_nk.cfg_dir = "rans/oneram6" turb_oneram6_nk.cfg_file = "turb_ONERAM6_nk.cfg" turb_oneram6_nk.test_iter = 20 - turb_oneram6_nk.test_vals = [-4.853515, -4.457529, -11.453617, 0.219949, 0.049372, 5.000000, -0.566595, 22.806000] + turb_oneram6_nk.test_vals = [-4.803402, -4.393783, -11.445194, 0.218505, 0.048793, 4.000000, -0.607076, 25.924000] turb_oneram6_nk.timeout = 600 turb_oneram6_nk.tol = 0.0001 test_list.append(turb_oneram6_nk) @@ -530,7 +530,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-12.150457, -6.604319, -9.186421, -4.517442, -2019.700000] + axi_rans_air_nozzle_restart.test_vals = [-12.150822, -6.604726, -9.187292, -4.518261, -2019.700000] axi_rans_air_nozzle_restart.tol = 0.0001 test_list.append(axi_rans_air_nozzle_restart) @@ -558,7 +558,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-7.095661, -6.336732, 0.531986, 0.008466] + inc_euler_naca0012.test_vals = [-7.141428, -6.403478, 0.531992, 0.008466] test_list.append(inc_euler_naca0012) # C-D nozzle with pressure inlet and mass flow outlet @@ -566,7 +566,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-6.235959, -5.472174, -0.001285, 0.126599] + inc_nozzle.test_vals = [-6.308730, -5.512525, -0.004405, 0.126629] test_list.append(inc_nozzle) ############################# @@ -586,7 +586,7 @@ def main(): inc_lam_sphere.cfg_dir = "incomp_navierstokes/sphere" inc_lam_sphere.cfg_file = "sphere.cfg" inc_lam_sphere.test_iter = 5 - inc_lam_sphere.test_vals = [-8.343599, -7.902946, 0.121003, 25.782687] + inc_lam_sphere.test_vals = [-8.342926, -8.032107, 0.121003, 25.782687] test_list.append(inc_lam_sphere) # Buoyancy-driven cavity @@ -610,7 +610,7 @@ def main(): inc_lam_bend.cfg_dir = "incomp_navierstokes/bend" inc_lam_bend.cfg_file = "lam_bend.cfg" inc_lam_bend.test_iter = 10 - inc_lam_bend.test_vals = [-3.427806, -3.127384, -0.020946, 1.018749] + inc_lam_bend.test_vals = [-3.550744, -3.220213, -0.017606, 1.015086] test_list.append(inc_lam_bend) # 3D laminar channnel with 1 cell in flow direction, streamwise periodic @@ -626,7 +626,7 @@ def main(): inc_heatTransfer_BC.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" inc_heatTransfer_BC.cfg_file = "BC_HeatTransfer.cfg" inc_heatTransfer_BC.test_iter = 50 - inc_heatTransfer_BC.test_vals = [-7.495616, -7.036510, -6.758276, 0.598181, -1672.500000] + inc_heatTransfer_BC.test_vals = [-8.201114, -7.405807, -7.555676, -0.113666, -1671.700000] test_list.append(inc_heatTransfer_BC) ############################ @@ -1005,7 +1005,7 @@ def main(): ddes_flatplate.cfg_dir = "ddes/flatplate" ddes_flatplate.cfg_file = "ddes_flatplate.cfg" ddes_flatplate.test_iter = 10 - ddes_flatplate.test_vals = [-2.714785, -5.882734, -0.215042, 0.023758, -617.450000] + ddes_flatplate.test_vals = [-2.714785, -5.882679, -0.215041, 0.023758, -617.450000] ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) @@ -1023,7 +1023,7 @@ def main(): flatplate_unsteady.cfg_dir = "navierstokes/flatplate" flatplate_unsteady.cfg_file = "lam_flatplate_unst.cfg" flatplate_unsteady.test_iter = 3 - flatplate_unsteady.test_vals = [0.000008, -8.876475, -8.249821, -6.294138, -5.468911, -3.398656, 0.002075, -0.324342] + flatplate_unsteady.test_vals = [0.000008, -8.876477, -8.249920, -6.294138, -5.468911, -3.398657, 0.002075, -0.324341] flatplate_unsteady.unsteady = True test_list.append(flatplate_unsteady) @@ -1052,7 +1052,7 @@ def main(): coolprop_fluidModel.cfg_dir = "nicf/coolprop" coolprop_fluidModel.cfg_file = "fluidModel.cfg" coolprop_fluidModel.test_iter = 5 - coolprop_fluidModel.test_vals = [-4.360609, -1.582898, 3.442423, 0.000000, 0.000000] + coolprop_fluidModel.test_vals = [-4.424953, -1.582877, 3.442422, 0.000000, 0.000000] coolprop_fluidModel.enabled_on_cpu_arch = ["x86_64"] test_list.append(coolprop_fluidModel) @@ -1061,7 +1061,7 @@ def main(): coolprop_transportModel.cfg_dir = "nicf/coolprop" coolprop_transportModel.cfg_file = "transportModel.cfg" coolprop_transportModel.test_iter = 5 - coolprop_transportModel.test_vals = [-4.364142, -1.314350, 4.630876, 0.000000, 0.000000] + coolprop_transportModel.test_vals = [-4.428098, -1.314332, 4.630872, 0.000000, 0.000000] coolprop_transportModel.enabled_on_cpu_arch = ["x86_64"] test_list.append(coolprop_transportModel) @@ -1070,7 +1070,7 @@ def main(): datadriven_fluidModel.cfg_dir = "nicf/datadriven" datadriven_fluidModel.cfg_file = "datadriven_nozzle.cfg" datadriven_fluidModel.test_iter = 50 - datadriven_fluidModel.test_vals = [-2.633095, 0.155844, 4.690841, 0.000000, 0.000000] + datadriven_fluidModel.test_vals = [-2.632817, 0.155922, 4.690917, 0.000000, 0.000000] test_list.append(datadriven_fluidModel) ###################################### @@ -1325,7 +1325,7 @@ def main(): sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" sp_pinArray_cht_2d_dp_hf.cfg_file = "configMaster.cfg" sp_pinArray_cht_2d_dp_hf.test_iter = 100 - sp_pinArray_cht_2d_dp_hf.test_vals = [0.125853, -0.632632, -1.068922, -0.746156, 208.023676, 340.340000, -0.000000, -0.746160, 0.746160] + sp_pinArray_cht_2d_dp_hf.test_vals = [0.088580, -0.764276, -1.086940, -0.747450, 208.023676, 344.680000, -0.000000, -0.747450, 0.747450] sp_pinArray_cht_2d_dp_hf.multizone = True test_list.append(sp_pinArray_cht_2d_dp_hf) @@ -1334,7 +1334,7 @@ def main(): sp_pinArray_3d_cht_mf_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_3d" sp_pinArray_3d_cht_mf_hf_tp.cfg_file = "configMaster.cfg" sp_pinArray_3d_cht_mf_hf_tp.test_iter = 30 - sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-1.622914, -3.081114, -4.576282, -0.009725, 104.632412, 418.370000, 0.000000] + sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-1.627413, -3.083567, -4.577909, -0.009725, 104.632413, 418.370000, 0.000000] sp_pinArray_3d_cht_mf_hf_tp.test_vals_aarch64 = [-1.622914, -3.081114, -4.576282, -0.009725, 104.632412, 418.370000, 0.000000] sp_pinArray_3d_cht_mf_hf_tp.multizone = True test_list.append(sp_pinArray_3d_cht_mf_hf_tp) @@ -1441,7 +1441,7 @@ def main(): pywrapper_deformingBump.cfg_dir = "py_wrapper/deforming_bump_in_channel" pywrapper_deformingBump.cfg_file = "config.cfg" pywrapper_deformingBump.test_iter = 1 - pywrapper_deformingBump.test_vals = [0.500000, 0.000000, -2.359718, -0.424610, -0.285358, 3.102752, 6.943751, -1.049871] + pywrapper_deformingBump.test_vals = [0.500000, 0.000000, -3.037857, -1.603573, -2.074205, 2.424288, 7.765352, -0.220502] pywrapper_deformingBump.command = TestCase.Command("mpirun -np 2", "python", "run.py") pywrapper_deformingBump.unsteady = True test_list.append(pywrapper_deformingBump) @@ -1586,7 +1586,7 @@ def main(): species_passive_val.cfg_dir = "species_transport/passive_transport_validation" species_passive_val.cfg_file = "passive_transport.cfg" species_passive_val.test_iter = 50 - species_passive_val.test_vals = [-16.580418, -16.383067, -16.916872, -4.257599, 10.000000, -4.627854, 8.000000, -5.193350, 0.186610, 0.000000] + species_passive_val.test_vals = [-16.604279, -16.303255, -16.970059, -4.257599, 10.000000, -4.731945, 8.000000, -5.193350, 0.186610, 0.000000] species_passive_val.test_vals_aarch64 = [-16.538551, -16.312552, -16.882823, -4.257599, 10, -4.585464, 8, -5.19335, 0.18661, 0] test_list.append(species_passive_val) @@ -1595,7 +1595,7 @@ def main(): species3_multizone_restart.cfg_dir = "species_transport/multizone" species3_multizone_restart.cfg_file = "configMaster.cfg" species3_multizone_restart.test_iter = 5 - species3_multizone_restart.test_vals = [-5.848602, -5.646854] + species3_multizone_restart.test_vals = [-6.111017, -5.720050] species3_multizone_restart.multizone = True test_list.append(species3_multizone_restart) diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 9f8fab0c071..fa23f55a61d 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -71,7 +71,7 @@ def main(): ea_naca64206.cfg_dir = "optimization_euler/equivalentarea_naca64206" ea_naca64206.cfg_file = "NACA64206.cfg" ea_naca64206.test_iter = 10 - ea_naca64206.test_vals = [3.182290, 2.473505, -5513300.000000, 5.483900] + ea_naca64206.test_vals = [3.182170, 2.473052, -5509000.000000, 5.551800] test_list.append(ea_naca64206) #################################### @@ -150,7 +150,7 @@ def main(): discadj_axisymmetric_rans_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle" discadj_axisymmetric_rans_nozzle.cfg_file = "air_nozzle_restart.cfg" discadj_axisymmetric_rans_nozzle.test_iter = 10 - discadj_axisymmetric_rans_nozzle.test_vals = [9.508489, 5.086848, 7.377942, 2.753320] + discadj_axisymmetric_rans_nozzle.test_vals = [9.550040, 4.937865, 7.377284, 2.748846] discadj_axisymmetric_rans_nozzle.no_restart = True test_list.append(discadj_axisymmetric_rans_nozzle) @@ -256,7 +256,7 @@ def main(): discadj_heat.cfg_dir = "disc_adj_heat" discadj_heat.cfg_file = "disc_adj_heat.cfg" discadj_heat.test_iter = 10 - discadj_heat.test_vals = [-2.117979, 0.783623, 0.000000, -0.575210] + discadj_heat.test_vals = [-2.117791, 0.784475, 0.000000, -0.574700] discadj_heat.test_vals_aarch64 = [-2.226539, 0.605868, 0.000000, -6.256400] test_list.append(discadj_heat) @@ -277,7 +277,7 @@ def main(): discadj_fsi2.cfg_dir = "disc_adj_fsi/Airfoil_2d" discadj_fsi2.cfg_file = "config.cfg" discadj_fsi2.test_iter = 8 - discadj_fsi2.test_vals = [-2.560432, 2.314360, -1.272250, -1.242500, 3.266800] + discadj_fsi2.test_vals = [-2.402639, 2.740269, -1.270185, -1.273900, 3.860200] discadj_fsi2.test_vals_aarch64 = [-4.349372, 0.190601, -1.303589, 0.754070, 2.324400] discadj_fsi2.tol = 0.00001 test_list.append(discadj_fsi2) @@ -299,7 +299,7 @@ def main(): da_sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" da_sp_pinArray_cht_2d_dp_hf.cfg_file = "DA_configMaster.cfg" da_sp_pinArray_cht_2d_dp_hf.test_iter = 100 - da_sp_pinArray_cht_2d_dp_hf.test_vals = [-4.706855, -4.062651, -4.137373] + da_sp_pinArray_cht_2d_dp_hf.test_vals = [-4.706292, -4.062398, -4.137374] da_sp_pinArray_cht_2d_dp_hf.multizone = True test_list.append(da_sp_pinArray_cht_2d_dp_hf) @@ -308,7 +308,7 @@ def main(): da_sp_pinArray_cht_2d_mf.cfg_dir = "incomp_navierstokes/streamwise_periodic/dp-adjoint_chtPinArray_2d" da_sp_pinArray_cht_2d_mf.cfg_file = "configMaster.cfg" da_sp_pinArray_cht_2d_mf.test_iter = 100 - da_sp_pinArray_cht_2d_mf.test_vals = [-4.600060, -1.298170, -1.427707, -18.503399, -0.869869, -5.768763, -19.069544, -47.953239] + da_sp_pinArray_cht_2d_mf.test_vals = [-4.600710, -1.298285, -1.430286, -18.503417, -0.870017, -51G.768271, -19.069555, -47.953298] da_sp_pinArray_cht_2d_mf.multizone = True test_list.append(da_sp_pinArray_cht_2d_mf) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index d0a393d5c52..6e7c7f4e82d 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -64,7 +64,7 @@ def main(): invwedge.cfg_dir = "nonequilibrium/invwedge" invwedge.cfg_file = "invwedge_ausm.cfg" invwedge.test_iter = 10 - invwedge.test_vals = [-1.067133, -1.591903, -18.301537, -18.628929, -18.574965, 2.248225, 1.874391, 5.292468, 0.849987] + invwedge.test_vals = [-1.073699, -1.598462, -18.299911, -18.627322, -18.573334, 2.241760, 1.868575, 5.286072, 0.843741] invwedge.test_vals_aarch64 = [-1.046323, -1.571086, -18.301361, -18.628744, -18.574788, 2.271778, 1.875687, 5.315769, 0.870008] test_list.append(invwedge) @@ -73,7 +73,7 @@ def main(): visc_cone.cfg_dir = "nonequilibrium/visc_wedge" visc_cone.cfg_file = "axi_visccone.cfg" visc_cone.test_iter = 10 - visc_cone.test_vals = [-5.215239, -5.739373, -20.560904, -20.517094, -20.406632, 1.262779, -3.205484, -0.015695, 0.093205, 32641.000000] + visc_cone.test_vals = [-5.215239, -5.739373, -20.560910, -20.517094, -20.406632, 1.262779, -3.205484, -0.015695, 0.093205, 32641.000000] visc_cone.test_vals_aarch64 = [-5.215229, -5.739368, -20.556662, -20.517022, -20.437459, 1.262784, -3.205455, -0.015696, 0.093207, 32656.000000] test_list.append(visc_cone) @@ -242,7 +242,7 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-4.156102, -6.736064, -0.176184, 0.057478] + turb_flatplate.test_vals = [-4.156553, -6.736064, -0.176184, 0.057478] test_list.append(turb_flatplate) # FLAT PLATE, WALL FUNCTIONS, COMPRESSIBLE SST @@ -250,7 +250,7 @@ def main(): turb_wallfunction_flatplate_sst.cfg_dir = "wallfunctions/flatplate/compressible_SST" turb_wallfunction_flatplate_sst.cfg_file = "turb_SST_flatplate.cfg" turb_wallfunction_flatplate_sst.test_iter = 10 - turb_wallfunction_flatplate_sst.test_vals = [-4.144776, -1.876300, -1.850354, 1.302342, -1.259217, 1.536899, 10.000000, -2.028314, 0.075364, 0.002932] + turb_wallfunction_flatplate_sst.test_vals = [-4.177397, -1.880811, -1.943377, 1.263787, -1.254740, 1.538892, 10.000000, -2.097623, 0.074673, 0.002932] test_list.append(turb_wallfunction_flatplate_sst) # FLAT PLATE, WALL FUNCTIONS, COMPRESSIBLE SA @@ -258,7 +258,7 @@ def main(): turb_wallfunction_flatplate_sa.cfg_dir = "wallfunctions/flatplate/compressible_SA" turb_wallfunction_flatplate_sa.cfg_file = "turb_SA_flatplate.cfg" turb_wallfunction_flatplate_sa.test_iter = 10 - turb_wallfunction_flatplate_sa.test_vals = [-4.139937, -1.945019, -1.836534, 1.328488, -5.388178, 10.000000, -1.746370, 0.068393, 0.002645] + turb_wallfunction_flatplate_sa.test_vals = [-4.414833, -2.031596, -2.120806, 1.007586, -5.386444, 10.000000, -1.635112, 0.068983, 0.002640] test_list.append(turb_wallfunction_flatplate_sa) # ONERA M6 Wing @@ -266,7 +266,7 @@ def main(): turb_oneram6.cfg_dir = "rans/oneram6" turb_oneram6.cfg_file = "turb_ONERAM6.cfg" turb_oneram6.test_iter = 10 - turb_oneram6.test_vals = [-2.392882, -6.689824, 0.230747, 0.158811, -33786.000000] + turb_oneram6.test_vals = [-2.392867, -6.689823, 0.230746, 0.158811, -33786.000000] turb_oneram6.timeout = 3200 test_list.append(turb_oneram6) @@ -335,7 +335,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-12.151236, -6.605231, -9.187907, -4.514903, -2019.700000] + axi_rans_air_nozzle_restart.test_vals = [-12.151701, -6.605756, -9.188910, -4.516059, -2019.700000] axi_rans_air_nozzle_restart.test_vals_aarch64 = [-12.063354, -7.004772, -8.705740, -4.036824, -2019.800000] axi_rans_air_nozzle_restart.tol = 0.0001 test_list.append(axi_rans_air_nozzle_restart) @@ -371,7 +371,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-7.082058, -6.313934, 0.531975, 0.008467] + inc_euler_naca0012.test_vals = [-7.128795, -6.375403, 0.531980, 0.008467] test_list.append(inc_euler_naca0012) # C-D nozzle with pressure inlet and mass flow outlet @@ -379,7 +379,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-6.252514, -5.497664, 0.005991, 0.126673] + inc_nozzle.test_vals = [-6.363763, -5.566528, -0.005348, 0.126610] test_list.append(inc_nozzle) ############################# @@ -422,7 +422,7 @@ def main(): inc_lam_bend.cfg_dir = "incomp_navierstokes/bend" inc_lam_bend.cfg_file = "lam_bend.cfg" inc_lam_bend.test_iter = 10 - inc_lam_bend.test_vals = [-3.442756, -3.144155, -0.019882, 1.032083] + inc_lam_bend.test_vals = [-3.558881, -3.234611, -0.016265, 1.024052] test_list.append(inc_lam_bend) ############################ @@ -457,7 +457,7 @@ def main(): inc_turb_wallfunction_flatplate_sst.cfg_dir = "wallfunctions/flatplate/incompressible_SST" inc_turb_wallfunction_flatplate_sst.cfg_file = "turb_SST_flatplate.cfg" inc_turb_wallfunction_flatplate_sst.test_iter = 10 - inc_turb_wallfunction_flatplate_sst.test_vals = [-6.316002, -5.685545, -6.192078, -4.194542, -7.007482, -1.954553, 10.000000, -3.024432, 0.001082, 0.003644, 0.623780] + inc_turb_wallfunction_flatplate_sst.test_vals = [-6.507362, -5.693894, -6.434063, -4.223774, -7.008049, -1.954102, 10.000000, -3.047554, 0.001081, 0.003644, 0.618140] test_list.append(inc_turb_wallfunction_flatplate_sst) # FLAT PLATE, WALL FUNCTIONS, INCOMPRESSIBLE SA @@ -465,7 +465,7 @@ def main(): inc_turb_wallfunction_flatplate_sa.cfg_dir = "wallfunctions/flatplate/incompressible_SA" inc_turb_wallfunction_flatplate_sa.cfg_file = "turb_SA_flatplate.cfg" inc_turb_wallfunction_flatplate_sa.test_iter = 10 - inc_turb_wallfunction_flatplate_sa.test_vals = [-6.329151, -5.702221, -6.190413, -4.196637, -9.586831, 10.000000, -3.025954, 0.000998, 0.003758] + inc_turb_wallfunction_flatplate_sa.test_vals = [-6.521493, -5.710967, -6.424313, -4.224459, -9.586823, 10.000000, -3.054800, 0.000999, 0.003759] test_list.append(inc_turb_wallfunction_flatplate_sa) #################### @@ -577,7 +577,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-11.967646, -17.480367, -1.056500, 0.019964] + contadj_naca0012.test_vals = [-0.249026, -5.647249, -0.723920, 0.019964] contadj_naca0012.tol = 0.001 test_list.append(contadj_naca0012) @@ -753,7 +753,7 @@ def main(): cavity.cfg_dir = "moving_wall/cavity" cavity.cfg_file = "lam_cavity.cfg" cavity.test_iter = 25 - cavity.test_vals = [ -5.627868, -0.164405, 0.053283, 2.545817] + cavity.test_vals = [-5.627868, -0.164405, 0.053283, 2.545817] test_list.append(cavity) # Spinning cylinder @@ -800,7 +800,7 @@ def main(): ddes_flatplate.cfg_dir = "ddes/flatplate" ddes_flatplate.cfg_file = "ddes_flatplate.cfg" ddes_flatplate.test_iter = 10 - ddes_flatplate.test_vals = [-2.714785, -5.882735, -0.215042, 0.023758, -617.450000] + ddes_flatplate.test_vals = [-2.714785, -5.882680, -0.215041, 0.023758, -617.450000] ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) @@ -868,7 +868,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-6.614623, -3.001323, -14.336147, -8.776081, -11.382919, -5.852327, 73273, 73273, 0.019884, 82.491] + Jones_tc_restart.test_vals = [-6.614623, -3.001323, -14.336147, -8.776081, -11.382919, -5.852327, 73273.000000, 73273.000000, 0.019884, 82.491000] test_list.append(Jones_tc_restart) # 2D axial stage @@ -876,7 +876,7 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [0.983751, 1.534480, -2.888520, 2.606773, -2.418421, 3.087187, 106380, 106380, 5.7325, 64.711] + axial_stage2D.test_vals = [0.983751, 1.534480, -2.888520, 2.606773, -2.418421, 3.087187, 106380.000000, 106380.000000, 5.732500, 64.711000] axial_stage2D.test_vals_aarch64 = [0.983751, 1.534480, -2.888520, 2.606773, -2.418421, 3.087187, 106380, 106380, 5.7325, 64.711] test_list.append(axial_stage2D) @@ -885,7 +885,7 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630, 94.866, -0.035806] + transonic_stator_restart.test_vals = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630.000000, 94.866000, -0.035806] transonic_stator_restart.test_vals_aarch64 = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630, 94.866, -0.035806] test_list.append(transonic_stator_restart) @@ -1079,7 +1079,7 @@ def main(): airfoilRBF.cfg_file = "config.cfg" airfoilRBF.test_iter = 1 - airfoilRBF.test_vals = [1.000000, -0.904551, -3.224510] + airfoilRBF.test_vals = [1.000000, -2.581853, -5.085822] airfoilRBF.tol = 0.0001 airfoilRBF.multizone = True test_list.append(airfoilRBF) @@ -1210,7 +1210,7 @@ def main(): naca0012_geo = TestCase('naca0012_geo') naca0012_geo.cfg_dir = "optimization_euler/steady_naca0012" naca0012_geo.cfg_file = "inv_NACA0012_adv.cfg" - naca0012_geo.test_vals = [1.0000, 62.0455, 0.120011, 0.0000] #chord, LE radius, ToC, Alpha + naca0012_geo.test_vals = [1.000000, 62.045500, 0.120011, 0.000000] naca0012_geo.command = TestCase.Command(exec = "SU2_GEO") naca0012_geo.timeout = 1600 naca0012_geo.tol = 0.00001 @@ -1226,7 +1226,7 @@ def main(): intersect_def.cfg_dir = "deformation/intersection_prevention" intersect_def.cfg_file = "def_intersect.cfg" intersect_def.test_iter = 10 - intersect_def.test_vals = [0.000112] #residual + intersect_def.test_vals = [0.000112] intersect_def.command = TestCase.Command(exec = "SU2_DEF") intersect_def.timeout = 1600 intersect_def.tol = 1e-04 @@ -1239,7 +1239,7 @@ def main(): naca0012_def.cfg_dir = "deformation/naca0012" naca0012_def.cfg_file = "def_NACA0012.cfg" naca0012_def.test_iter = 10 - naca0012_def.test_vals = [0.00344658] #residual + naca0012_def.test_vals = [0.003447] naca0012_def.command = TestCase.Command(exec = "SU2_DEF") naca0012_def.timeout = 1600 naca0012_def.tol = 1e-08 @@ -1252,7 +1252,7 @@ def main(): naca0012_def_file.cfg_dir = "deformation/naca0012" naca0012_def_file.cfg_file = "surface_file_NACA0012.cfg" naca0012_def_file.test_iter = 10 - naca0012_def_file.test_vals = [0.00344658] #residual + naca0012_def_file.test_vals = [0.003447] naca0012_def_file.command = TestCase.Command(exec = "SU2_DEF") naca0012_def_file.timeout = 1600 naca0012_def_file.tol = 1e-8 @@ -1265,7 +1265,7 @@ def main(): rae2822_def.cfg_dir = "deformation/rae2822" rae2822_def.cfg_file = "def_RAE2822.cfg" rae2822_def.test_iter = 10 - rae2822_def.test_vals = [7.94218e-09] #residual + rae2822_def.test_vals = [0.000000] rae2822_def.command = TestCase.Command(exec = "SU2_DEF") rae2822_def.timeout = 1600 rae2822_def.tol = 1e-13 @@ -1278,7 +1278,7 @@ def main(): naca4412_def.cfg_dir = "deformation/naca4412" naca4412_def.cfg_file = "def_NACA4412.cfg" naca4412_def.test_iter = 10 - naca4412_def.test_vals = [8.855370e-13] #residual + naca4412_def.test_vals = [0.000000] naca4412_def.command = TestCase.Command(exec = "SU2_DEF") naca4412_def.timeout = 1600 naca4412_def.tol = 1e-12 @@ -1291,7 +1291,7 @@ def main(): brick_tets_def.cfg_dir = "deformation/brick_tets" brick_tets_def.cfg_file = "def_brick_tets.cfg" brick_tets_def.test_iter = 10 - brick_tets_def.test_vals = [8.973010e-04] #residual + brick_tets_def.test_vals = [0.000897] brick_tets_def.command = TestCase.Command(exec = "SU2_DEF") brick_tets_def.timeout = 1600 brick_tets_def.tol = 1e-09 @@ -1304,7 +1304,7 @@ def main(): brick_hex_def.cfg_dir = "deformation/brick_hex" brick_hex_def.cfg_file = "def_brick_hex.cfg" brick_hex_def.test_iter = 10 - brick_hex_def.test_vals = [2.082100e-04] #residual + brick_hex_def.test_vals = [0.000208] brick_hex_def.command = TestCase.Command(exec = "SU2_DEF") brick_hex_def.timeout = 1600 brick_hex_def.tol = 1e-09 @@ -1317,7 +1317,7 @@ def main(): brick_pyra_def.cfg_dir = "deformation/brick_pyra" brick_pyra_def.cfg_file = "def_brick_pyra.cfg" brick_pyra_def.test_iter = 10 - brick_pyra_def.test_vals = [0.00150063] #residual + brick_pyra_def.test_vals = [0.001501] brick_pyra_def.command = TestCase.Command(exec = "SU2_DEF") brick_pyra_def.timeout = 1600 brick_pyra_def.tol = 1e-08 @@ -1330,7 +1330,7 @@ def main(): brick_prism_def.cfg_dir = "deformation/brick_prism" brick_prism_def.cfg_file = "def_brick_prism.cfg" brick_prism_def.test_iter = 10 - brick_prism_def.test_vals = [0.00212069] #residual + brick_prism_def.test_vals = [0.002121] brick_prism_def.command = TestCase.Command(exec = "SU2_DEF") brick_prism_def.timeout = 1600 brick_prism_def.tol = 1e-08 @@ -1343,7 +1343,7 @@ def main(): brick_prism_rans_def.cfg_dir = "deformation/brick_prism_rans" brick_prism_rans_def.cfg_file = "def_brick_prism_rans.cfg" brick_prism_rans_def.test_iter = 10 - brick_prism_rans_def.test_vals = [4.8066e-08] #residual + brick_prism_rans_def.test_vals = [0.000000] brick_prism_rans_def.command = TestCase.Command(exec = "SU2_DEF") brick_prism_rans_def.timeout = 1600 brick_prism_rans_def.tol = 1e-12 @@ -1356,7 +1356,7 @@ def main(): brick_hex_rans_def.cfg_dir = "deformation/brick_hex_rans" brick_hex_rans_def.cfg_file = "def_brick_hex_rans.cfg" brick_hex_rans_def.test_iter = 10 - brick_hex_rans_def.test_vals = [2.260750e-07] #residual + brick_hex_rans_def.test_vals = [0.000000] brick_hex_rans_def.command = TestCase.Command(exec = "SU2_DEF") brick_hex_rans_def.timeout = 1600 brick_hex_rans_def.tol = 1e-12 @@ -1369,7 +1369,7 @@ def main(): cylinder_ffd_def.cfg_dir = "deformation/cylindrical_ffd" cylinder_ffd_def.cfg_file = "def_cylindrical.cfg" cylinder_ffd_def.test_iter = 10 - cylinder_ffd_def.test_vals = [0.000470133] #residual + cylinder_ffd_def.test_vals = [0.000470] cylinder_ffd_def.command = TestCase.Command(exec = "SU2_DEF") cylinder_ffd_def.timeout = 1600 cylinder_ffd_def.tol = 1e-09 @@ -1382,7 +1382,7 @@ def main(): sphere_ffd_def.cfg_dir = "deformation/spherical_ffd" sphere_ffd_def.cfg_file = "def_spherical.cfg" sphere_ffd_def.test_iter = 10 - sphere_ffd_def.test_vals = [0.00356699] #residual + sphere_ffd_def.test_vals = [0.003567] sphere_ffd_def.command = TestCase.Command(exec = "SU2_DEF") sphere_ffd_def.timeout = 1600 sphere_ffd_def.tol = 1e-08 @@ -1395,7 +1395,7 @@ def main(): sphere_ffd_def_bspline.cfg_dir = "deformation/spherical_ffd" sphere_ffd_def_bspline.cfg_file = "def_spherical_bspline.cfg" sphere_ffd_def_bspline.test_iter = 10 - sphere_ffd_def_bspline.test_vals = [0.00206808] #residual + sphere_ffd_def_bspline.test_vals = [0.002068] sphere_ffd_def_bspline.command = TestCase.Command(exec = "SU2_DEF") sphere_ffd_def_bspline.timeout = 1600 sphere_ffd_def_bspline.tol = 1e-08 @@ -1425,7 +1425,7 @@ def main(): shape_opt_euler_py.cfg_dir = "optimization_euler/steady_naca0012" shape_opt_euler_py.cfg_file = "inv_NACA0012_adv.cfg" shape_opt_euler_py.test_iter = 1 - shape_opt_euler_py.test_vals = [1.000000, 1.000000, 0.000021, 0.003643] #last 4 columns + shape_opt_euler_py.test_vals = [1.000000, 1.000000, 0.000021, 0.003643] shape_opt_euler_py.command = TestCase.Command(exec = "shape_optimization.py", param = "-g CONTINUOUS_ADJOINT -f") shape_opt_euler_py.timeout = 1600 shape_opt_euler_py.tol = 0.00001 @@ -1605,7 +1605,7 @@ def main(): pywrapper_custom_inlet.cfg_dir = "py_wrapper/custom_inlet" pywrapper_custom_inlet.cfg_file = "lam_flatplate.cfg" pywrapper_custom_inlet.test_iter = 20 - pywrapper_custom_inlet.test_vals = [-4.121218, -1.541055, -3.439454, 1.341706, -0.747895, 0.161442, -0.013213, 0.516040, -0.529260] + pywrapper_custom_inlet.test_vals = [-4.120494, -1.540195, -3.566114, 1.342509, -0.748827, 0.161349, -0.013214, 0.516000, -0.529220] pywrapper_custom_inlet.command = TestCase.Command(exec = "python", param = "run.py") pywrapper_custom_inlet.timeout = 1600 pywrapper_custom_inlet.tol = 0.0001 diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index 01c5604bfca..6faaeff53af 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -110,7 +110,7 @@ def main(): discadj_incomp_cylinder.cfg_dir = "disc_adj_incomp_navierstokes/cylinder" discadj_incomp_cylinder.cfg_file = "heated_cylinder.cfg" discadj_incomp_cylinder.test_iter = 20 - discadj_incomp_cylinder.test_vals = [20.000000, -2.373367, -2.368305, 0.000000] #last 4 columns + discadj_incomp_cylinder.test_vals = [20.000000, -2.373367, -2.368305, 0.000000] test_list.append(discadj_incomp_cylinder) ####################################################### @@ -122,7 +122,7 @@ def main(): discadj_cylinder.cfg_dir = "disc_adj_rans/cylinder" discadj_cylinder.cfg_file = "cylinder.cfg" discadj_cylinder.test_iter = 9 - discadj_cylinder.test_vals = [3.746909, -1.544883, -0.008321, 0.000014] #last 4 columns + discadj_cylinder.test_vals = [3.746909, -1.544883, -0.008321, 0.000014] discadj_cylinder.unsteady = True test_list.append(discadj_cylinder) @@ -135,7 +135,7 @@ def main(): discadj_DT_1ST_cylinder.cfg_dir = "disc_adj_rans/cylinder_DT_1ST" discadj_DT_1ST_cylinder.cfg_file = "cylinder.cfg" discadj_DT_1ST_cylinder.test_iter = 9 - discadj_DT_1ST_cylinder.test_vals = [3.698168, -1.607050, -0.002159, 0.000028] #last 4 columns + discadj_DT_1ST_cylinder.test_vals = [3.698168, -1.607050, -0.002159, 0.000028] discadj_DT_1ST_cylinder.unsteady = True test_list.append(discadj_DT_1ST_cylinder) @@ -170,7 +170,7 @@ def main(): discadj_fea.cfg_dir = "disc_adj_fea" discadj_fea.cfg_file = "configAD_fem.cfg" discadj_fea.test_iter = 4 - discadj_fea.test_vals = [-2.849781, -3.238667, -0.000364, -8.708700] + discadj_fea.test_vals = [-2.849844, -3.238713, -0.000364, -8.708700] discadj_fea.tol = 0.00007 test_list.append(discadj_fea) @@ -183,7 +183,7 @@ def main(): discadj_heat.cfg_dir = "disc_adj_heat" discadj_heat.cfg_file = "disc_adj_heat.cfg" discadj_heat.test_iter = 10 - discadj_heat.test_vals = [-2.122649, 0.692345, 0.000000, -0.869760] + discadj_heat.test_vals = [-2.122406, 0.693852, 0.000000, -0.869010] test_list.append(discadj_heat) ################################### @@ -195,7 +195,7 @@ def main(): discadj_fsi.cfg_dir = "disc_adj_fsi" discadj_fsi.cfg_file = "config.cfg" discadj_fsi.test_iter = 6 - discadj_fsi.test_vals = [6.000000, -1.965877, -3.084381, 0.000440, -1.063100] #last 5 columns + discadj_fsi.test_vals = [6.000000, -1.965877, -3.084381, 0.000440, -1.063100] test_list.append(discadj_fsi) ################################### @@ -207,7 +207,7 @@ def main(): discadj_cht.cfg_dir = "coupled_cht/disc_adj_incomp_2d" discadj_cht.cfg_file = "cht_2d_3cylinders.cfg" discadj_cht.test_iter = 10 - discadj_cht.test_vals = [-2.955506, -3.085551, -3.085518, -3.085513] #last 4 columns + discadj_cht.test_vals = [-2.955506, -3.085551, -3.085518, -3.085513] test_list.append(discadj_cht) ###################################### @@ -323,7 +323,7 @@ def main(): pywrapper_FEA_AD_FlowLoad.cfg_dir = "py_wrapper/disc_adj_fea/flow_load_sens" pywrapper_FEA_AD_FlowLoad.cfg_file = "configAD_fem.cfg" pywrapper_FEA_AD_FlowLoad.test_iter = 100 - pywrapper_FEA_AD_FlowLoad.test_vals = [-0.13945587401579657, -0.585985886606256, -0.00036377840086080753, -0.0031005670174756375] #last 4 columns + pywrapper_FEA_AD_FlowLoad.test_vals = [-0.139456, -0.585986, -0.000364, -0.003101] pywrapper_FEA_AD_FlowLoad.command = TestCase.Command(exec = "python", param = "run_adjoint.py -f") pywrapper_FEA_AD_FlowLoad.timeout = 1600 pywrapper_FEA_AD_FlowLoad.tol = 0.000001 diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 01ec8a702e2..e2cac1f32d0 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -71,7 +71,7 @@ def main(): sp_pinArray_2d_mf_hf.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" sp_pinArray_2d_mf_hf.cfg_file = "sp_pinArray_2d_mf_hf.cfg" sp_pinArray_2d_mf_hf.test_iter = 25 - sp_pinArray_2d_mf_hf.test_vals = [-4.553585, 1.528036, -0.748523, 241.672145] + sp_pinArray_2d_mf_hf.test_vals = [-4.613682, 1.471278, -0.748987, 241.667177] test_list.append(sp_pinArray_2d_mf_hf) # 2D pin case pressure drop periodic with heatflux BC and temperature periodicity @@ -79,7 +79,7 @@ def main(): sp_pinArray_2d_dp_hf_tp.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" sp_pinArray_2d_dp_hf_tp.cfg_file = "sp_pinArray_2d_dp_hf_tp.cfg" sp_pinArray_2d_dp_hf_tp.test_iter = 25 - sp_pinArray_2d_dp_hf_tp.test_vals = [-4.570733, 1.503285, -0.706846, 208.023676] + sp_pinArray_2d_dp_hf_tp.test_vals = [-4.640621, 1.436697, -0.707302, 208.023676] test_list.append(sp_pinArray_2d_dp_hf_tp) ### Species Transport @@ -245,7 +245,7 @@ def main(): tutorial_nicfd_nozzle.cfg_dir = "../Tutorials/compressible_flow/NICFD_nozzle" tutorial_nicfd_nozzle.cfg_file = "NICFD_nozzle.cfg" tutorial_nicfd_nozzle.test_iter = 20 - tutorial_nicfd_nozzle.test_vals = [-1.847208, -2.303300, 3.803912, 0.000000, 0.000000] + tutorial_nicfd_nozzle.test_vals = [-2.056675, -2.124123, 3.687027, 0.000000, 0.000000] tutorial_nicfd_nozzle.no_restart = True test_list.append(tutorial_nicfd_nozzle) From 38dd1ee3451465442a8437f4f5fe14e24dfc6c10 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Mon, 29 Jul 2024 23:55:45 +0200 Subject: [PATCH 188/194] fix regression --- TestCases/hybrid_regression.py | 2 +- TestCases/parallel_regression_AD.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 34cad2f23b4..3f14c4c40c6 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -235,7 +235,7 @@ def main(): turb_naca0012_sst_expliciteuler.cfg_dir = "rans/naca0012" turb_naca0012_sst_expliciteuler.cfg_file = "turb_NACA0012_sst_expliciteuler.cfg" turb_naca0012_sst_expliciteuler.test_iter = 10 - turb_naca0012_sst_expliciteuler.test_vals = [-3.532289, -3.157766, 3.364024, 1.122901, 0.500798, -inf] + turb_naca0012_sst_expliciteuler.test_vals = [-3.532289, -3.157766, 3.364024, 1.122901, 0.500798, -float("inf")] test_list.append(turb_naca0012_sst_expliciteuler) # PROPELLER diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index fa23f55a61d..60cef502e36 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -308,7 +308,7 @@ def main(): da_sp_pinArray_cht_2d_mf.cfg_dir = "incomp_navierstokes/streamwise_periodic/dp-adjoint_chtPinArray_2d" da_sp_pinArray_cht_2d_mf.cfg_file = "configMaster.cfg" da_sp_pinArray_cht_2d_mf.test_iter = 100 - da_sp_pinArray_cht_2d_mf.test_vals = [-4.600710, -1.298285, -1.430286, -18.503417, -0.870017, -51G.768271, -19.069555, -47.953298] + da_sp_pinArray_cht_2d_mf.test_vals = [-4.600710, -1.298285, -1.430286, -18.503417, -0.870017, -51.768271, -19.069555, -47.953298] da_sp_pinArray_cht_2d_mf.multizone = True test_list.append(da_sp_pinArray_cht_2d_mf) From df34b2f5dad977d54bee172e33a13b1188694c2b Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 30 Jul 2024 22:29:07 +0200 Subject: [PATCH 189/194] change to getDensity --- SU2_CFD/include/solvers/CFVMFlowSolverBase.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 9c586616404..8fcb6d05bec 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1217,7 +1217,7 @@ void CFVMFlowSolverBase::BC_Sym_Plane(CGeometry* geometry, CSolve if (FlowRegime == ENUM_REGIME::COMPRESSIBLE) { for(auto iDim = 0u; iDim < nDim; iDim++) { /*--- Multiply by density since we are correcting conservative variables. ---*/ - gridVel[iDim] *= solutionOld[0]; + gridVel[iDim] *= nodes->GetDensity(iPoint); } } } From f552f2fc46ee48f91b36a2f07d00539b27a52e6d Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 31 Jul 2024 22:44:57 +0200 Subject: [PATCH 190/194] fix regression --- .../naca0012/of_grad_cd.dat.ref | 76 +++++++++---------- .../chtPinArray_2d/of_grad_findiff.csv.ref | 2 +- TestCases/parallel_regression_AD.py | 2 +- TestCases/serial_regression.py | 52 ++++++------- 4 files changed, 66 insertions(+), 66 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref index 825d10e13cf..f4d572e7874 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -0.3957 , 0.0001 - 1 , -0.296173 , 0.0001 - 2 , -0.213567 , 0.0001 - 3 , -0.15797 , 0.0001 - 4 , -0.129897 , 0.0001 - 5 , -0.127172 , 0.0001 - 6 , -0.145365 , 0.0001 - 7 , -0.177645 , 0.0001 - 8 , -0.215406 , 0.0001 - 9 , -0.250173 , 0.0001 - 10 , -0.276475 , 0.0001 - 11 , -0.294359 , 0.0001 - 12 , -0.309628 , 0.0001 - 13 , -0.330814 , 0.0001 - 14 , -0.364804 , 0.0001 - 15 , -0.415697 , 0.0001 - 16 , -0.490218 , 0.0001 - 17 , -0.611024 , 0.0001 - 18 , -0.874971 , 0.0001 - 19 , 0.0510475 , 0.0001 - 20 , 0.782353 , 0.0001 - 21 , 1.26329 , 0.0001 - 22 , 1.47992 , 0.0001 - 23 , 1.46463 , 0.0001 - 24 , 1.27505 , 0.0001 - 25 , 0.979585 , 0.0001 - 26 , 0.644706 , 0.0001 - 27 , 0.325487 , 0.0001 - 28 , 0.0610001 , 0.0001 - 29 , -0.125212 , 0.0001 - 30 , -0.221301 , 0.0001 - 31 , -0.223531 , 0.0001 - 32 , -0.137307 , 0.0001 - 33 , 0.0153574 , 0.0001 - 34 , 0.190118 , 0.0001 - 35 , 0.339925 , 0.0001 - 36 , 0.471371 , 0.0001 - 37 , 0.692488 , 0.0001 + 0 , -0.340041 , 0.0001 + 1 , -0.241925 , 0.0001 + 2 , -0.166871 , 0.0001 + 3 , -0.120134 , 0.0001 + 4 , -0.1003 , 0.0001 + 5 , -0.1044 , 0.0001 + 6 , -0.12781 , 0.0001 + 7 , -0.163829 , 0.0001 + 8 , -0.204135 , 0.0001 + 9 , -0.240572 , 0.0001 + 10 , -0.267954 , 0.0001 + 11 , -0.286537 , 0.0001 + 12 , -0.30224 , 0.0001 + 13 , -0.323626 , 0.0001 + 14 , -0.357538 , 0.0001 + 15 , -0.408031 , 0.0001 + 16 , -0.481995 , 0.0001 + 17 , -0.602887 , 0.0001 + 18 , -0.86805 , 0.0001 + 19 , 0.124791 , 0.0001 + 20 , 0.848025 , 0.0001 + 21 , 1.31517 , 0.0001 + 22 , 1.51923 , 0.0001 + 23 , 1.49443 , 0.0001 + 24 , 1.29851 , 0.0001 + 25 , 0.999371 , 0.0001 + 26 , 0.662793 , 0.0001 + 27 , 0.343157 , 0.0001 + 28 , 0.0789034 , 0.0001 + 29 , -0.107036 , 0.0001 + 30 , -0.203464 , 0.0001 + 31 , -0.207317 , 0.0001 + 32 , -0.124433 , 0.0001 + 33 , 0.0236203 , 0.0001 + 34 , 0.194448 , 0.0001 + 35 , 0.343482 , 0.0001 + 36 , 0.477178 , 0.0001 + 37 , 0.701355 , 0.0001 diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref index 0b8cbb20943..c3abdd950f9 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref @@ -1,2 +1,2 @@ "VARIABLE" , "AVG_DENSITY[0]", "AVG_ENTHALPY[0]", "AVG_NORMALVEL[0]", "DRAG[0]" , "EFFICIENCY[0]" , "FORCE_X[0]" , "FORCE_Y[0]" , "FORCE_Z[0]" , "LIFT[0]" , "MOMENT_X[0]" , "MOMENT_Y[0]" , "MOMENT_Z[0]" , "SIDEFORCE[0]" , "SURFACE_MACH[0]", "SURFACE_MASSFLOW[0]", "SURFACE_MOM_DISTORTION[0]", "SURFACE_PRESSURE_DROP[0]", "SURFACE_SECONDARY[0]", "SURFACE_SECOND_OVER_UNIFORM[0]", "SURFACE_STATIC_PRESSURE[0]", "SURFACE_STATIC_TEMPERATURE[0]", "SURFACE_TOTAL_PRESSURE[0]", "SURFACE_TOTAL_TEMPERATURE[0]", "SURFACE_UNIFORMITY[0]", "AVG_TEMPERATURE[1]", "MAXIMUM_HEATFLUX[1]", "TOTAL_HEATFLUX[1]", "FINDIFF_STEP" -0 , 0.0 , -300000.0026077032, -1.1102300000033865e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.02000000026702864, 4.440999999041655e-08, -0.9799999992066155 , 0.0 , 1.10399999975197 , 1.9200000006547313 , 389.9999967416079 , -80.00000661922968 , 396.00000008022107 , -79.99999525054591 , -0.5999999830308411 , -380.0000001774606, 0.0 , -320.0000037395512, 1e-08 +0 , 0.0 , -13500000.024214387, 1.1102230000000746e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.09000000050773949, 0.0 , -0.5560000002069465 , 0.0 , 0.8789999991765107 , 1.6299999988644842 , -690.0000016685226 , -3790.0000052104588 , -1266.0000002995275 , -3800.000001774606 , -1.2999999965401798 , -12620.000001106746, 0.0 , 8590.000004460308, 1e-08 diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 60cef502e36..b62fed781a3 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -308,7 +308,7 @@ def main(): da_sp_pinArray_cht_2d_mf.cfg_dir = "incomp_navierstokes/streamwise_periodic/dp-adjoint_chtPinArray_2d" da_sp_pinArray_cht_2d_mf.cfg_file = "configMaster.cfg" da_sp_pinArray_cht_2d_mf.test_iter = 100 - da_sp_pinArray_cht_2d_mf.test_vals = [-4.600710, -1.298285, -1.430286, -18.503417, -0.870017, -51.768271, -19.069555, -47.953298] + da_sp_pinArray_cht_2d_mf.test_vals = [-4.600710, -1.298285, -1.430286, -18.503417, -0.870017, -5.768271, -19.069555, -47.953298] da_sp_pinArray_cht_2d_mf.multizone = True test_list.append(da_sp_pinArray_cht_2d_mf) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 6e7c7f4e82d..8c175c61f57 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -1239,10 +1239,10 @@ def main(): naca0012_def.cfg_dir = "deformation/naca0012" naca0012_def.cfg_file = "def_NACA0012.cfg" naca0012_def.test_iter = 10 - naca0012_def.test_vals = [0.003447] + naca0012_def.test_vals = [0.0034470] naca0012_def.command = TestCase.Command(exec = "SU2_DEF") naca0012_def.timeout = 1600 - naca0012_def.tol = 1e-08 + naca0012_def.tol = 1e-07 pass_list.append(naca0012_def.run_def(args.tsan, args.asan)) test_list.append(naca0012_def) @@ -1252,10 +1252,10 @@ def main(): naca0012_def_file.cfg_dir = "deformation/naca0012" naca0012_def_file.cfg_file = "surface_file_NACA0012.cfg" naca0012_def_file.test_iter = 10 - naca0012_def_file.test_vals = [0.003447] + naca0012_def_file.test_vals = [0.0034470] naca0012_def_file.command = TestCase.Command(exec = "SU2_DEF") naca0012_def_file.timeout = 1600 - naca0012_def_file.tol = 1e-8 + naca0012_def_file.tol = 1e-7 pass_list.append(naca0012_def_file.run_def(args.tsan, args.asan)) test_list.append(naca0012_def_file) @@ -1265,10 +1265,10 @@ def main(): rae2822_def.cfg_dir = "deformation/rae2822" rae2822_def.cfg_file = "def_RAE2822.cfg" rae2822_def.test_iter = 10 - rae2822_def.test_vals = [0.000000] + rae2822_def.test_vals = [0.0000000] rae2822_def.command = TestCase.Command(exec = "SU2_DEF") rae2822_def.timeout = 1600 - rae2822_def.tol = 1e-13 + rae2822_def.tol = 1e-07 pass_list.append(rae2822_def.run_def(args.tsan, args.asan)) test_list.append(rae2822_def) @@ -1278,10 +1278,10 @@ def main(): naca4412_def.cfg_dir = "deformation/naca4412" naca4412_def.cfg_file = "def_NACA4412.cfg" naca4412_def.test_iter = 10 - naca4412_def.test_vals = [0.000000] + naca4412_def.test_vals = [0.0000000] naca4412_def.command = TestCase.Command(exec = "SU2_DEF") naca4412_def.timeout = 1600 - naca4412_def.tol = 1e-12 + naca4412_def.tol = 1e-07 pass_list.append(naca4412_def.run_def(args.tsan, args.asan)) test_list.append(naca4412_def) @@ -1291,10 +1291,10 @@ def main(): brick_tets_def.cfg_dir = "deformation/brick_tets" brick_tets_def.cfg_file = "def_brick_tets.cfg" brick_tets_def.test_iter = 10 - brick_tets_def.test_vals = [0.000897] + brick_tets_def.test_vals = [0.0008970] brick_tets_def.command = TestCase.Command(exec = "SU2_DEF") brick_tets_def.timeout = 1600 - brick_tets_def.tol = 1e-09 + brick_tets_def.tol = 1e-07 pass_list.append(brick_tets_def.run_def(args.tsan, args.asan)) test_list.append(brick_tets_def) @@ -1304,10 +1304,10 @@ def main(): brick_hex_def.cfg_dir = "deformation/brick_hex" brick_hex_def.cfg_file = "def_brick_hex.cfg" brick_hex_def.test_iter = 10 - brick_hex_def.test_vals = [0.000208] + brick_hex_def.test_vals = [0.0002080] brick_hex_def.command = TestCase.Command(exec = "SU2_DEF") brick_hex_def.timeout = 1600 - brick_hex_def.tol = 1e-09 + brick_hex_def.tol = 1e-07 pass_list.append(brick_hex_def.run_def(args.tsan, args.asan)) test_list.append(brick_hex_def) @@ -1317,10 +1317,10 @@ def main(): brick_pyra_def.cfg_dir = "deformation/brick_pyra" brick_pyra_def.cfg_file = "def_brick_pyra.cfg" brick_pyra_def.test_iter = 10 - brick_pyra_def.test_vals = [0.001501] + brick_pyra_def.test_vals = [0.0015010] brick_pyra_def.command = TestCase.Command(exec = "SU2_DEF") brick_pyra_def.timeout = 1600 - brick_pyra_def.tol = 1e-08 + brick_pyra_def.tol = 1e-07 pass_list.append(brick_pyra_def.run_def(args.tsan, args.asan)) test_list.append(brick_pyra_def) @@ -1330,10 +1330,10 @@ def main(): brick_prism_def.cfg_dir = "deformation/brick_prism" brick_prism_def.cfg_file = "def_brick_prism.cfg" brick_prism_def.test_iter = 10 - brick_prism_def.test_vals = [0.002121] + brick_prism_def.test_vals = [0.0021210] brick_prism_def.command = TestCase.Command(exec = "SU2_DEF") brick_prism_def.timeout = 1600 - brick_prism_def.tol = 1e-08 + brick_prism_def.tol = 1e-07 pass_list.append(brick_prism_def.run_def(args.tsan, args.asan)) test_list.append(brick_prism_def) @@ -1343,10 +1343,10 @@ def main(): brick_prism_rans_def.cfg_dir = "deformation/brick_prism_rans" brick_prism_rans_def.cfg_file = "def_brick_prism_rans.cfg" brick_prism_rans_def.test_iter = 10 - brick_prism_rans_def.test_vals = [0.000000] + brick_prism_rans_def.test_vals = [0.0000000] brick_prism_rans_def.command = TestCase.Command(exec = "SU2_DEF") brick_prism_rans_def.timeout = 1600 - brick_prism_rans_def.tol = 1e-12 + brick_prism_rans_def.tol = 1e-07 pass_list.append(brick_prism_rans_def.run_def(args.tsan, args.asan)) test_list.append(brick_prism_rans_def) @@ -1356,10 +1356,10 @@ def main(): brick_hex_rans_def.cfg_dir = "deformation/brick_hex_rans" brick_hex_rans_def.cfg_file = "def_brick_hex_rans.cfg" brick_hex_rans_def.test_iter = 10 - brick_hex_rans_def.test_vals = [0.000000] + brick_hex_rans_def.test_vals = [0.0000000] brick_hex_rans_def.command = TestCase.Command(exec = "SU2_DEF") brick_hex_rans_def.timeout = 1600 - brick_hex_rans_def.tol = 1e-12 + brick_hex_rans_def.tol = 1e-07 pass_list.append(brick_hex_rans_def.run_def(args.tsan, args.asan)) test_list.append(brick_hex_rans_def) @@ -1369,10 +1369,10 @@ def main(): cylinder_ffd_def.cfg_dir = "deformation/cylindrical_ffd" cylinder_ffd_def.cfg_file = "def_cylindrical.cfg" cylinder_ffd_def.test_iter = 10 - cylinder_ffd_def.test_vals = [0.000470] + cylinder_ffd_def.test_vals = [0.0004700] cylinder_ffd_def.command = TestCase.Command(exec = "SU2_DEF") cylinder_ffd_def.timeout = 1600 - cylinder_ffd_def.tol = 1e-09 + cylinder_ffd_def.tol = 1e-07 pass_list.append(cylinder_ffd_def.run_def(args.tsan, args.asan)) test_list.append(cylinder_ffd_def) @@ -1382,10 +1382,10 @@ def main(): sphere_ffd_def.cfg_dir = "deformation/spherical_ffd" sphere_ffd_def.cfg_file = "def_spherical.cfg" sphere_ffd_def.test_iter = 10 - sphere_ffd_def.test_vals = [0.003567] + sphere_ffd_def.test_vals = [0.0035670] sphere_ffd_def.command = TestCase.Command(exec = "SU2_DEF") sphere_ffd_def.timeout = 1600 - sphere_ffd_def.tol = 1e-08 + sphere_ffd_def.tol = 1e-07 pass_list.append(sphere_ffd_def.run_def(args.tsan, args.asan)) test_list.append(sphere_ffd_def) @@ -1395,10 +1395,10 @@ def main(): sphere_ffd_def_bspline.cfg_dir = "deformation/spherical_ffd" sphere_ffd_def_bspline.cfg_file = "def_spherical_bspline.cfg" sphere_ffd_def_bspline.test_iter = 10 - sphere_ffd_def_bspline.test_vals = [0.002068] + sphere_ffd_def_bspline.test_vals = [0.0020680] sphere_ffd_def_bspline.command = TestCase.Command(exec = "SU2_DEF") sphere_ffd_def_bspline.timeout = 1600 - sphere_ffd_def_bspline.tol = 1e-08 + sphere_ffd_def_bspline.tol = 1e-07 pass_list.append(sphere_ffd_def_bspline.run_def(args.tsan, args.asan)) test_list.append(sphere_ffd_def_bspline) From 8215322b26f2e6733a5ac194b3d0707f1ca3cde4 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 31 Jul 2024 23:41:43 +0200 Subject: [PATCH 191/194] fix regression --- .../naca0012/of_grad_cd.dat.ref | 76 +++++++++---------- .../naca0012/of_grad_cd_disc.dat.ref | 76 +++++++++---------- .../chtPinArray_2d/of_grad_findiff.csv.ref | 2 +- TestCases/parallel_regression.py | 2 +- TestCases/serial_regression.py | 2 +- 5 files changed, 79 insertions(+), 79 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref index f4d572e7874..c9cda259729 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -0.340041 , 0.0001 - 1 , -0.241925 , 0.0001 - 2 , -0.166871 , 0.0001 - 3 , -0.120134 , 0.0001 - 4 , -0.1003 , 0.0001 - 5 , -0.1044 , 0.0001 - 6 , -0.12781 , 0.0001 - 7 , -0.163829 , 0.0001 - 8 , -0.204135 , 0.0001 - 9 , -0.240572 , 0.0001 - 10 , -0.267954 , 0.0001 - 11 , -0.286537 , 0.0001 - 12 , -0.30224 , 0.0001 - 13 , -0.323626 , 0.0001 - 14 , -0.357538 , 0.0001 - 15 , -0.408031 , 0.0001 - 16 , -0.481995 , 0.0001 - 17 , -0.602887 , 0.0001 - 18 , -0.86805 , 0.0001 - 19 , 0.124791 , 0.0001 - 20 , 0.848025 , 0.0001 - 21 , 1.31517 , 0.0001 - 22 , 1.51923 , 0.0001 - 23 , 1.49443 , 0.0001 - 24 , 1.29851 , 0.0001 - 25 , 0.999371 , 0.0001 - 26 , 0.662793 , 0.0001 - 27 , 0.343157 , 0.0001 - 28 , 0.0789034 , 0.0001 - 29 , -0.107036 , 0.0001 - 30 , -0.203464 , 0.0001 - 31 , -0.207317 , 0.0001 - 32 , -0.124433 , 0.0001 - 33 , 0.0236203 , 0.0001 - 34 , 0.194448 , 0.0001 - 35 , 0.343482 , 0.0001 - 36 , 0.477178 , 0.0001 - 37 , 0.701355 , 0.0001 + 0 , -0.346339 , 0.0001 + 1 , -0.248052 , 0.0001 + 2 , -0.1713 , 0.0001 + 3 , -0.122543 , 0.0001 + 4 , -0.101101 , 0.0001 + 5 , -0.104377 , 0.0001 + 6 , -0.127816 , 0.0001 + 7 , -0.164567 , 0.0001 + 8 , -0.206037 , 0.0001 + 9 , -0.24378 , 0.0001 + 10 , -0.272396 , 0.0001 + 11 , -0.292059 , 0.0001 + 12 , -0.308757 , 0.0001 + 13 , -0.331226 , 0.0001 + 14 , -0.366529 , 0.0001 + 15 , -0.418919 , 0.0001 + 16 , -0.495353 , 0.0001 + 17 , -0.619083 , 0.0001 + 18 , -0.889061 , 0.0001 + 19 , 0.118474 , 0.0001 + 20 , 0.849882 , 0.0001 + 21 , 1.3251 , 0.0001 + 22 , 1.53508 , 0.0001 + 23 , 1.51368 , 0.0001 + 24 , 1.31908 , 0.0001 + 25 , 1.02001 , 0.0001 + 26 , 0.68317 , 0.0001 + 27 , 0.363758 , 0.0001 + 28 , 0.100704 , 0.0001 + 29 , -0.0830333 , 0.0001 + 30 , -0.176826 , 0.0001 + 31 , -0.178825 , 0.0001 + 32 , -0.096525 , 0.0001 + 33 , 0.0472928 , 0.0001 + 34 , 0.21134 , 0.0001 + 35 , 0.355622 , 0.0001 + 36 , 0.490104 , 0.0001 + 37 , 0.718618 , 0.0001 diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref index 21bc1b74c28..6da6f45e3ee 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -2431.38 , 0.001 - 1 , -6779.34 , 0.001 - 2 , -10706.2 , 0.001 - 3 , -12152.6 , 0.001 - 4 , -10810.4 , 0.001 - 5 , -6991.71 , 0.001 - 6 , -1252.83 , 0.001 - 7 , 5852.21 , 0.001 - 8 , 13872.3 , 0.001 - 9 , 22359.0 , 0.001 - 10 , 30580.0 , 0.001 - 11 , 37174.2 , 0.001 - 12 , 40014.9 , 0.001 - 13 , 36701.9 , 0.001 - 14 , 26346.2 , 0.001 - 15 , 13749.0 , 0.001 - 16 , 17274.3 , 0.001 - 17 , 76626.8 , 0.001 - 18 , 136341.0 , 0.001 - 19 , -17521.7 , 0.001 - 20 , -20152.6 , 0.001 - 21 , -22257.1 , 0.001 - 22 , -24218.7 , 0.001 - 23 , -27807.6 , 0.001 - 24 , -34729.8 , 0.001 - 25 , -45730.3 , 0.001 - 26 , -60127.1 , 0.001 - 27 , -75585.0 , 0.001 - 28 , -88103.6 , 0.001 - 29 , -92454.6 , 0.001 - 30 , -83558.5 , 0.001 - 31 , -59241.6 , 0.001 - 32 , -23717.5 , 0.001 - 33 , 11922.7 , 0.001 - 34 , 38773.8 , 0.001 - 35 , 63557.6 , 0.001 - 36 , 79743.0 , 0.001 - 37 , -43384.6 , 0.001 + 0 , -2656.0 , 0.001 + 1 , -7290.69 , 0.001 + 2 , -11252.7 , 0.001 + 3 , -12531.4 , 0.001 + 4 , -10923.7 , 0.001 + 5 , -6826.86 , 0.001 + 6 , -843.71 , 0.001 + 7 , 6462.74 , 0.001 + 8 , 14656.3 , 0.001 + 9 , 23308.0 , 0.001 + 10 , 31688.2 , 0.001 + 11 , 38407.2 , 0.001 + 12 , 41274.9 , 0.001 + 13 , 37812.2 , 0.001 + 14 , 27093.1 , 0.001 + 15 , 14049.9 , 0.001 + 16 , 17583.8 , 0.001 + 17 , 78620.8 , 0.001 + 18 , 140614.0 , 0.001 + 19 , -18263.2 , 0.001 + 20 , -20877.9 , 0.001 + 21 , -22859.6 , 0.001 + 22 , -24751.5 , 0.001 + 23 , -28392.5 , 0.001 + 24 , -35514.1 , 0.001 + 25 , -46855.4 , 0.001 + 26 , -61697.7 , 0.001 + 27 , -77631.1 , 0.001 + 28 , -90537.8 , 0.001 + 29 , -95036.8 , 0.001 + 30 , -85899.0 , 0.001 + 31 , -60885.3 , 0.001 + 32 , -24333.4 , 0.001 + 33 , 12334.3 , 0.001 + 34 , 39948.1 , 0.001 + 35 , 65452.2 , 0.001 + 36 , 82215.8 , 0.001 + 37 , -44066.2 , 0.001 diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref index c3abdd950f9..e0ca1f0545c 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref @@ -1,2 +1,2 @@ "VARIABLE" , "AVG_DENSITY[0]", "AVG_ENTHALPY[0]", "AVG_NORMALVEL[0]", "DRAG[0]" , "EFFICIENCY[0]" , "FORCE_X[0]" , "FORCE_Y[0]" , "FORCE_Z[0]" , "LIFT[0]" , "MOMENT_X[0]" , "MOMENT_Y[0]" , "MOMENT_Z[0]" , "SIDEFORCE[0]" , "SURFACE_MACH[0]", "SURFACE_MASSFLOW[0]", "SURFACE_MOM_DISTORTION[0]", "SURFACE_PRESSURE_DROP[0]", "SURFACE_SECONDARY[0]", "SURFACE_SECOND_OVER_UNIFORM[0]", "SURFACE_STATIC_PRESSURE[0]", "SURFACE_STATIC_TEMPERATURE[0]", "SURFACE_TOTAL_PRESSURE[0]", "SURFACE_TOTAL_TEMPERATURE[0]", "SURFACE_UNIFORMITY[0]", "AVG_TEMPERATURE[1]", "MAXIMUM_HEATFLUX[1]", "TOTAL_HEATFLUX[1]", "FINDIFF_STEP" -0 , 0.0 , -13500000.024214387, 1.1102230000000746e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.09000000050773949, 0.0 , -0.5560000002069465 , 0.0 , 0.8789999991765107 , 1.6299999988644842 , -690.0000016685226 , -3790.0000052104588 , -1266.0000002995275 , -3800.000001774606 , -1.2999999965401798 , -12620.000001106746, 0.0 , 8590.000004460308, 1e-08 +0 , 0.0 , -300000.0026077032, 1.1102230000000746e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.09000000050773949, 0.0 , -0.5560000002069465 , 0.0 , 0.8789999991765107 , 1.6299999988644842 , -690.0000016685226 , -3790.0000052104588 , -1266.0000002995275 , -3800.000001774606 , -1.2999999965401798 , -12620.000001106746, 0.0 , 8590.000004460308, 1e-08 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 9a5c4d6289b..4cad2c9789c 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -789,7 +789,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-11.956426, -17.476600, -1.056500, 0.019964] + contadj_naca0012.test_vals = [-9.662585, -14.998832, -0.726250, 0.020280] test_list.append(contadj_naca0012) # Inviscid ONERA M6 diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 8c175c61f57..4fdca621e80 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -577,7 +577,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-0.249026, -5.647249, -0.723920, 0.019964] + contadj_naca0012.test_vals = [-9.748339, -15.067997, -0.726250, 0.020280] contadj_naca0012.tol = 0.001 test_list.append(contadj_naca0012) From 7321fd4a8cd77ca1d1a8f37bc39ab8ff5a0edd1c Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 2 Aug 2024 00:15:07 +0200 Subject: [PATCH 192/194] update streamwise file --- .../streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref index e0ca1f0545c..2634fca1ff5 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref @@ -1,2 +1,2 @@ "VARIABLE" , "AVG_DENSITY[0]", "AVG_ENTHALPY[0]", "AVG_NORMALVEL[0]", "DRAG[0]" , "EFFICIENCY[0]" , "FORCE_X[0]" , "FORCE_Y[0]" , "FORCE_Z[0]" , "LIFT[0]" , "MOMENT_X[0]" , "MOMENT_Y[0]" , "MOMENT_Z[0]" , "SIDEFORCE[0]" , "SURFACE_MACH[0]", "SURFACE_MASSFLOW[0]", "SURFACE_MOM_DISTORTION[0]", "SURFACE_PRESSURE_DROP[0]", "SURFACE_SECONDARY[0]", "SURFACE_SECOND_OVER_UNIFORM[0]", "SURFACE_STATIC_PRESSURE[0]", "SURFACE_STATIC_TEMPERATURE[0]", "SURFACE_TOTAL_PRESSURE[0]", "SURFACE_TOTAL_TEMPERATURE[0]", "SURFACE_UNIFORMITY[0]", "AVG_TEMPERATURE[1]", "MAXIMUM_HEATFLUX[1]", "TOTAL_HEATFLUX[1]", "FINDIFF_STEP" -0 , 0.0 , -300000.0026077032, 1.1102230000000746e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.09000000050773949, 0.0 , -0.5560000002069465 , 0.0 , 0.8789999991765107 , 1.6299999988644842 , -690.0000016685226 , -3790.0000052104588 , -1266.0000002995275 , -3800.000001774606 , -1.2999999965401798 , -12620.000001106746, 0.0 , 8590.000004460308, 1e-08 +0 , 0.0 , -300000.0026077032, -3.3306691000000184e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.01999999887924986, 0.0 , -0.9000000009140585 , 0.0 , 0.9379999998948563 , 1.649999997743734 , 419.99999780273356 , -69.99999868639861 , 358.9999998609983 , -69.99999868639861 , -0.6000000052353016 , -380.0000001774606, 0.0 , -430.00000005122274, 1e-08 From ddcf40b28aadf1f4cf2af07a949fff8c7cb313f4 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 2 Aug 2024 23:05:56 +0200 Subject: [PATCH 193/194] fix regression tolerance --- TestCases/serial_regression.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 4fdca621e80..8d328dc460f 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -1242,7 +1242,7 @@ def main(): naca0012_def.test_vals = [0.0034470] naca0012_def.command = TestCase.Command(exec = "SU2_DEF") naca0012_def.timeout = 1600 - naca0012_def.tol = 1e-07 + naca0012_def.tol = 1e-06 pass_list.append(naca0012_def.run_def(args.tsan, args.asan)) test_list.append(naca0012_def) @@ -1255,7 +1255,7 @@ def main(): naca0012_def_file.test_vals = [0.0034470] naca0012_def_file.command = TestCase.Command(exec = "SU2_DEF") naca0012_def_file.timeout = 1600 - naca0012_def_file.tol = 1e-7 + naca0012_def_file.tol = 1e-6 pass_list.append(naca0012_def_file.run_def(args.tsan, args.asan)) test_list.append(naca0012_def_file) @@ -1268,7 +1268,7 @@ def main(): rae2822_def.test_vals = [0.0000000] rae2822_def.command = TestCase.Command(exec = "SU2_DEF") rae2822_def.timeout = 1600 - rae2822_def.tol = 1e-07 + rae2822_def.tol = 1e-06 pass_list.append(rae2822_def.run_def(args.tsan, args.asan)) test_list.append(rae2822_def) @@ -1281,7 +1281,7 @@ def main(): naca4412_def.test_vals = [0.0000000] naca4412_def.command = TestCase.Command(exec = "SU2_DEF") naca4412_def.timeout = 1600 - naca4412_def.tol = 1e-07 + naca4412_def.tol = 1e-06 pass_list.append(naca4412_def.run_def(args.tsan, args.asan)) test_list.append(naca4412_def) @@ -1294,7 +1294,7 @@ def main(): brick_tets_def.test_vals = [0.0008970] brick_tets_def.command = TestCase.Command(exec = "SU2_DEF") brick_tets_def.timeout = 1600 - brick_tets_def.tol = 1e-07 + brick_tets_def.tol = 1e-06 pass_list.append(brick_tets_def.run_def(args.tsan, args.asan)) test_list.append(brick_tets_def) @@ -1307,7 +1307,7 @@ def main(): brick_hex_def.test_vals = [0.0002080] brick_hex_def.command = TestCase.Command(exec = "SU2_DEF") brick_hex_def.timeout = 1600 - brick_hex_def.tol = 1e-07 + brick_hex_def.tol = 1e-06 pass_list.append(brick_hex_def.run_def(args.tsan, args.asan)) test_list.append(brick_hex_def) @@ -1320,7 +1320,7 @@ def main(): brick_pyra_def.test_vals = [0.0015010] brick_pyra_def.command = TestCase.Command(exec = "SU2_DEF") brick_pyra_def.timeout = 1600 - brick_pyra_def.tol = 1e-07 + brick_pyra_def.tol = 1e-06 pass_list.append(brick_pyra_def.run_def(args.tsan, args.asan)) test_list.append(brick_pyra_def) @@ -1333,7 +1333,7 @@ def main(): brick_prism_def.test_vals = [0.0021210] brick_prism_def.command = TestCase.Command(exec = "SU2_DEF") brick_prism_def.timeout = 1600 - brick_prism_def.tol = 1e-07 + brick_prism_def.tol = 1e-06 pass_list.append(brick_prism_def.run_def(args.tsan, args.asan)) test_list.append(brick_prism_def) @@ -1346,7 +1346,7 @@ def main(): brick_prism_rans_def.test_vals = [0.0000000] brick_prism_rans_def.command = TestCase.Command(exec = "SU2_DEF") brick_prism_rans_def.timeout = 1600 - brick_prism_rans_def.tol = 1e-07 + brick_prism_rans_def.tol = 1e-06 pass_list.append(brick_prism_rans_def.run_def(args.tsan, args.asan)) test_list.append(brick_prism_rans_def) @@ -1359,7 +1359,7 @@ def main(): brick_hex_rans_def.test_vals = [0.0000000] brick_hex_rans_def.command = TestCase.Command(exec = "SU2_DEF") brick_hex_rans_def.timeout = 1600 - brick_hex_rans_def.tol = 1e-07 + brick_hex_rans_def.tol = 1e-06 pass_list.append(brick_hex_rans_def.run_def(args.tsan, args.asan)) test_list.append(brick_hex_rans_def) @@ -1372,7 +1372,7 @@ def main(): cylinder_ffd_def.test_vals = [0.0004700] cylinder_ffd_def.command = TestCase.Command(exec = "SU2_DEF") cylinder_ffd_def.timeout = 1600 - cylinder_ffd_def.tol = 1e-07 + cylinder_ffd_def.tol = 1e-06 pass_list.append(cylinder_ffd_def.run_def(args.tsan, args.asan)) test_list.append(cylinder_ffd_def) @@ -1385,7 +1385,7 @@ def main(): sphere_ffd_def.test_vals = [0.0035670] sphere_ffd_def.command = TestCase.Command(exec = "SU2_DEF") sphere_ffd_def.timeout = 1600 - sphere_ffd_def.tol = 1e-07 + sphere_ffd_def.tol = 1e-06 pass_list.append(sphere_ffd_def.run_def(args.tsan, args.asan)) test_list.append(sphere_ffd_def) @@ -1398,7 +1398,7 @@ def main(): sphere_ffd_def_bspline.test_vals = [0.0020680] sphere_ffd_def_bspline.command = TestCase.Command(exec = "SU2_DEF") sphere_ffd_def_bspline.timeout = 1600 - sphere_ffd_def_bspline.tol = 1e-07 + sphere_ffd_def_bspline.tol = 1e-06 pass_list.append(sphere_ffd_def_bspline.run_def(args.tsan, args.asan)) test_list.append(sphere_ffd_def_bspline) From f48d2ffd6c248ea7da46da2bb0f387a3a43e81c3 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 4 Aug 2024 20:30:48 +0200 Subject: [PATCH 194/194] change workflow to develop --- .github/workflows/regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 0c6625a06da..af6f6c60875 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -213,7 +213,7 @@ jobs: uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536 with: # -t -c - args: -b ${{github.ref}} -t fix_symmetry -c fix_symmetry -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} - name: Cleanup uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536 with: