Skip to content

Commit

Permalink
cleanup old implementation, start new
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfooted committed Jan 7, 2025
1 parent 4e27793 commit f5f2de9
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 211 deletions.
6 changes: 0 additions & 6 deletions Common/include/geometry/CGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,12 +1179,6 @@ class CGeometry {
*/
inline virtual void FindNormal_Neighbor(const CConfig* config) {}

/*!
* \brief A virtual member.
* \param[in] config - Definition of the particular problem.
*/
inline virtual void FindNearest_Neighbor(const CConfig* config) {}

/*!
* \brief A virtual member.
*/
Expand Down
6 changes: 0 additions & 6 deletions Common/include/geometry/CMultiGridGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,6 @@ class CMultiGridGeometry final : public CGeometry {
*/
void FindNormal_Neighbor(const CConfig* config) override;

/*!
* \brief Find and store the closest interior neighbor to a vertex.
* \param[in] config - Definition of the particular problem.
*/
void FindNearest_Neighbor(const CConfig* config) override;

/*!
* \brief Mach the near field boundary condition.
* \param[in] config - Definition of the particular problem.
Expand Down
6 changes: 0 additions & 6 deletions Common/include/geometry/CPhysicalGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,6 @@ class CPhysicalGeometry final : public CGeometry {
*/
void FindNormal_Neighbor(const CConfig* config) override;

/*!
* \brief Find and store the closest interior neighbor to a vertex.
* \param[in] config - Definition of the particular problem.
*/
void FindNearest_Neighbor(const CConfig* config) override;

/*!
* \brief Read the sensitivity from an input file.
* \param[in] config - Definition of the particular problem.
Expand Down
11 changes: 0 additions & 11 deletions Common/include/geometry/dual_grid/CVertex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,4 @@ class CVertex : public CDualGrid {
*/
inline unsigned long GetNormal_Neighbor(void) const { return Normal_Neighbor; }

/*!
* \brief Set the index of the closest interior neighbor to a point on the boundaries.
* \param[in] val_Nearest_Neighbor - Index of the closest neighbor.
*/
inline void SetNearest_Neighbor(unsigned long val_Nearest_Neighbor) { Nearest_Neighbor = val_Nearest_Neighbor; }

/*!
* \brief Get the value of the closest neighbor.
* \return Index of the closest neighbor.
*/
inline unsigned long GetNearest_Neighbor(void) const { return Nearest_Neighbor; }
};
79 changes: 0 additions & 79 deletions Common/src/geometry/CMultiGridGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,82 +1089,3 @@ void CMultiGridGeometry::FindNormal_Neighbor(const CConfig* config) {
}
}
}
/*--- We determine the interior node that is closest to the wall node. If there is no
interior node, we have to take the closest wall node. ---*/
void CMultiGridGeometry::FindNearest_Neighbor(const CConfig* config) {
su2double dist_min;
unsigned long Point_Normal, jPoint;
unsigned short iNeigh, iMarker, jNeigh;
unsigned long iPoint, kPoint, iVertex;
// did we find an interiornode?
bool interiorNode;

for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) != SEND_RECEIVE &&
config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY &&
config->GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
const su2double* Coord_i = nodes->GetCoord(iPoint);

/*--- Compute closest normal neighbor, note that the normal are oriented inwards ---*/
Point_Normal = 0;
// we use distance
dist_min = 1.0e10;
interiorNode = false;
for (iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); iNeigh++) {
jPoint = nodes->GetPoint(iPoint, iNeigh);
const su2double* Coord_j = nodes->GetCoord(jPoint);

su2double distance = 0.0;
vector<su2double> edgeVector(nDim);
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
edgeVector[iDim] = Coord_j[iDim] - Coord_i[iDim];
// squared distance
distance += edgeVector[iDim] * edgeVector[iDim];
}

// Take the interior node that is closest to the wall node.
if ((nodes->GetViscousBoundary(jPoint) == false) && (distance < dist_min)) {
Point_Normal = jPoint;
dist_min = distance;
interiorNode = true;
}
}

// if we did not find a normal neighbor, then loop over the cells that are connected to the point
if (interiorNode == false) {
// find neighbor nodes to i.
for (iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); iNeigh++) {
jPoint = nodes->GetPoint(iPoint, iNeigh);
// now loop over the nodes of the neighbors
for (jNeigh = 0; jNeigh < nodes->GetnPoint(jPoint); jNeigh++) {
kPoint = nodes->GetPoint(jPoint, jNeigh);

if (kPoint == iPoint) continue;

const su2double* Coord_k = nodes->GetCoord(kPoint);
// now find the distance from ipoint to kpoint
su2double distance = 0.0;
vector<su2double> edgeVector(nDim);
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
edgeVector[iDim] = Coord_k[iDim] - Coord_i[iDim];
// squared distance
distance += edgeVector[iDim] * edgeVector[iDim];
}

// Take the interior node that is closest to the wall node.
if ((nodes->GetViscousBoundary(kPoint) == false) && (distance < dist_min)) {
Point_Normal = kPoint;
dist_min = distance;
interiorNode = true;
}
}
}
}

vertex[iMarker][iVertex]->SetNearest_Neighbor(Point_Normal);
}
}
}
}
80 changes: 0 additions & 80 deletions Common/src/geometry/CPhysicalGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8133,86 +8133,6 @@ void CPhysicalGeometry::FindNormal_Neighbor(const CConfig* config) {
}
}

/*--- We determine the interior node that is closest to the wall node. If there is no
interior node, we have to take the closest wall node. ---*/
void CPhysicalGeometry::FindNearest_Neighbor(const CConfig* config) {
su2double dist_min;
unsigned long Point_Normal, jPoint;
unsigned short iNeigh, iMarker, jNeigh;
unsigned long iPoint, kPoint, iVertex;
// did we find an interiornode?
bool interiorNode;

for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_KindBC(iMarker) != SEND_RECEIVE &&
config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY &&
config->GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = vertex[iMarker][iVertex]->GetNode();
const su2double* Coord_i = nodes->GetCoord(iPoint);

/*--- Compute closest normal neighbor, note that the normal are oriented inwards ---*/
Point_Normal = 0;
// we use distance
dist_min = 1.0e10;
interiorNode = false;
for (iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); iNeigh++) {
jPoint = nodes->GetPoint(iPoint, iNeigh);
const su2double* Coord_j = nodes->GetCoord(jPoint);

su2double distance = 0.0;
vector<su2double> edgeVector(nDim);
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
edgeVector[iDim] = Coord_j[iDim] - Coord_i[iDim];
// squared distance
distance += edgeVector[iDim] * edgeVector[iDim];
}

// Take the interior node that is closest to the wall node.
if ((nodes->GetViscousBoundary(jPoint) == false) && (distance < dist_min)) {
Point_Normal = jPoint;
dist_min = distance;
interiorNode = true;
}
}

// if we did not find a normal neighbor, then loop over the cells that are connected to the point
if (interiorNode == false) {
// find neighbor nodes to i.
for (iNeigh = 0; iNeigh < nodes->GetnPoint(iPoint); iNeigh++) {
jPoint = nodes->GetPoint(iPoint, iNeigh);
// now loop over the nodes of the neighbors
for (jNeigh = 0; jNeigh < nodes->GetnPoint(jPoint); jNeigh++) {
kPoint = nodes->GetPoint(jPoint, jNeigh);

if (kPoint == iPoint) continue;

const su2double* Coord_k = nodes->GetCoord(kPoint);
// now find the distance from ipoint to kpoint
su2double distance = 0.0;
vector<su2double> edgeVector(nDim);
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
edgeVector[iDim] = Coord_k[iDim] - Coord_i[iDim];
// squared distance
distance += edgeVector[iDim] * edgeVector[iDim];
}

// Take the interior node that is closest to the wall node.
if ((nodes->GetViscousBoundary(kPoint) == false) && (distance < dist_min)) {
Point_Normal = kPoint;
dist_min = distance;
interiorNode = true;
}
}
}
}

vertex[iMarker][iVertex]->SetNearest_Neighbor(Point_Normal);
}
}
}
}

void CPhysicalGeometry::SetBoundSensitivity(CConfig* config) {
unsigned short iMarker, icommas;
unsigned long iVertex, iPoint, (*Point2Vertex)[2], nPointLocal = 0, nPointGlobal = 0;
Expand Down
8 changes: 8 additions & 0 deletions SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2419,6 +2419,14 @@ class CFVMFlowSolverBase : public CSolver {
return YPlus[val_marker][val_vertex];
}

/*!
* \brief Set the y plus.
* \param[in] val_yplus - new value of yplus
*/
inline void SetYPlus(su2double val_yplus, unsigned short val_marker, unsigned long val_vertex) final {
YPlus[val_marker][val_vertex] = val_yplus;
}

/*!
* \brief Get the u_tau .
* \param[in] val_marker - Surface marker where the coefficient is computed.
Expand Down
7 changes: 6 additions & 1 deletion SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2498,10 +2498,15 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
FrictionVel = sqrt(fabs(WallShearStress[iMarker][iVertex]) / Density);

if (!wallfunctions && (MGLevel == MESH_0 || geometry->nodes->GetDomain(iPoint))) {
// for CMultiGridGeometry, the normal neighbor of halo nodes in not set
// for CMultiGridGeometry, the normal neighbor of halo nodes is not set
iPointNormal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
Coord_Normal = geometry->nodes->GetCoord(iPointNormal);
WallDistMod = GeometryToolbox::Distance(nDim, Coord, Coord_Normal);
//nijso: we can modifiy y+ as well now?




YPlus[iMarker][iVertex] = WallDistMod * FrictionVel / (Viscosity / Density);
}

Expand Down
8 changes: 8 additions & 0 deletions SU2_CFD/include/solvers/CSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2989,6 +2989,14 @@ class CSolver {
*/
inline virtual su2double GetYPlus(unsigned short val_marker, unsigned long val_vertex) const { return 0; }

/*!
* \brief A virtual member.
* \param[in] val_marker - Surface marker where the coefficient is computed.
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
* \return Value of the y plus.
*/
inline virtual void SetYPlus(su2double val_yplus, unsigned short val_marker, unsigned long val_vertex) {};

/*!
* \brief A virtual member.
* \param[in] val_marker - Surface marker where the coefficient is computed.
Expand Down
1 change: 1 addition & 0 deletions SU2_CFD/include/solvers/CTurbSSTSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,5 +302,6 @@ class CTurbSSTSolver final : public CTurbSolver {
*/
inline su2double GetOmega_Inf(void) const override { return Solution_Inf[1]; }

su2double GetNearest_Neighbor(CGeometry *geometry, unsigned long iPoint,unsigned short iMarker, unsigned long iVertex);

};
9 changes: 0 additions & 9 deletions SU2_CFD/src/drivers/CDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,12 +777,6 @@ void CDriver::InitializeGeometryFVM(CConfig *config, CGeometry **&geometry) {
if (rank == MASTER_NODE) cout << "Searching for the closest normal neighbors to the surfaces." << endl;
geometry[MESH_0]->FindNormal_Neighbor(config);

/*--- Identify closest interior neighbor, this is a replacement of the FindNormal_Neighbor implementation ---*/

if (rank == MASTER_NODE) cout << "Searching for the closest interior neighbors to the surfaces." << endl;
geometry[MESH_0]->FindNearest_Neighbor(config);


/*--- Store the global to local mapping. ---*/

if (rank == MASTER_NODE) cout << "Storing a mapping from global to local point index." << endl;
Expand Down Expand Up @@ -843,9 +837,6 @@ void CDriver::InitializeGeometryFVM(CConfig *config, CGeometry **&geometry) {

geometry[iMGlevel]->FindNormal_Neighbor(config);

/*--- Find closest interior neighbor to a surface point (eventual replacement of FindNormal_Neighbor) ---*/
geometry[iMGlevel]->FindNearest_Neighbor(config);

/*--- Store our multigrid index. ---*/

geometry[iMGlevel]->SetMGLevel(iMGlevel);
Expand Down
Loading

0 comments on commit f5f2de9

Please sign in to comment.