-
Notifications
You must be signed in to change notification settings - Fork 826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup and document the multigrid agglomeration strategy #1372
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c021f89
cleanup and improve comments
pcarruscag 6d83f41
Merge remote-tracking branch 'upstream/develop' into improve_mg
pcarruscag d980f8c
re-use SetPoint_Connectivity
pcarruscag 737df10
cleanup SetMultiGridWall** functions
pcarruscag 81f3687
const correctness
pcarruscag cb9fce3
Merge branch 'develop' into improve_mg
pcarruscag c4f27dc
Merge branch 'develop' into improve_mg
pcarruscag File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,23 +36,7 @@ | |
* \author F. Palacios | ||
*/ | ||
class CMultiGridGeometry final : public CGeometry { | ||
|
||
public: | ||
/*--- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/ | ||
using CGeometry::SetVertex; | ||
using CGeometry::SetControlVolume; | ||
using CGeometry::SetBoundControlVolume; | ||
using CGeometry::SetPoint_Connectivity; | ||
|
||
/*! | ||
* \brief Constructor of the class. | ||
* \param[in] geometry - Geometrical definition of the problem. | ||
* \param[in] config - Definition of the particular problem. | ||
* \param[in] iMesh - Level of the multigrid. | ||
* \param[in] iZone - Current zone in the mesh. | ||
*/ | ||
CMultiGridGeometry(CGeometry **geometry, CConfig *config_container, unsigned short iMesh); | ||
|
||
private: | ||
/*! | ||
* \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. | ||
|
@@ -61,101 +45,159 @@ class CMultiGridGeometry final : public CGeometry { | |
* \param[in] config - Definition of the particular problem. | ||
* \return <code>TRUE</code> or <code>FALSE</code> depending if the control volume can be agglomerated. | ||
*/ | ||
bool SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, CGeometry *fine_grid, CConfig *config); | ||
bool SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, const CGeometry *fine_grid, | ||
const CConfig *config) const; | ||
|
||
/*! | ||
* \brief Determine if a can be agglomerated using geometrical criteria. | ||
* \param[in] iPoint - Seed point. | ||
* \param[in] fine_grid - Geometrical definition of the problem. | ||
* \param[in] config - Definition of the particular problem. | ||
*/ | ||
bool GeometricalCheck(unsigned long iPoint, CGeometry *fine_grid, CConfig *config); | ||
bool GeometricalCheck(unsigned long iPoint, const CGeometry *fine_grid, const CConfig *config) const; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe with that amount of changes clang-format could have been a thing. (Again pointer-Alignment is the rat here) |
||
|
||
/*! | ||
* \brief Determine if a CVPoint van be agglomerated, if it have the same marker point as the seed. | ||
* \param[in] Suitable_Indirect_Neighbors - List of Indirect Neighbours that can be agglomerated. | ||
* \param[out] Suitable_Indirect_Neighbors - List of Indirect Neighbours that can be agglomerated. | ||
* \param[in] iPoint - Seed point. | ||
* \param[in] Index_CoarseCV - Index of agglomerated point. | ||
* \param[in] fine_grid - Geometrical definition of the problem. | ||
*/ | ||
void SetSuitableNeighbors(vector<unsigned long> *Suitable_Indirect_Neighbors, unsigned long iPoint, | ||
unsigned long Index_CoarseCV, CGeometry *fine_grid); | ||
void SetSuitableNeighbors(vector<unsigned long>& Suitable_Indirect_Neighbors, unsigned long iPoint, | ||
unsigned long Index_CoarseCV, const CGeometry *fine_grid) const; | ||
|
||
/*! | ||
* \brief Set boundary vertex. | ||
* \param[in] geometry - Geometrical definition of the problem. | ||
* \param[in] config - Definition of the particular problem. | ||
* \brief Set a representative wall value of the agglomerated control volumes on a particular boundary marker. | ||
* \param[in] fine_grid - Geometrical definition of the problem. | ||
* \param[in] val_marker - Index of the boundary marker. | ||
* \param[in] wall_quantity - Object with methods Get(iVertex_fine) and Set(iVertex_coarse, val). | ||
*/ | ||
void SetVertex(CGeometry *geometry, CConfig *config) override; | ||
template <class T> | ||
void SetMultiGridWallQuantity(const CGeometry *fine_grid, unsigned short val_marker, T& wall_quantity) { | ||
|
||
for (auto iVertex = 0ul; iVertex < nVertex[val_marker]; iVertex++) { | ||
const auto Point_Coarse = vertex[val_marker][iVertex]->GetNode(); | ||
|
||
if (!nodes->GetDomain(Point_Coarse)) continue; | ||
|
||
su2double Area_Parent = 0.0; | ||
|
||
/*--- Compute area parent by taking into account only volumes that are on the marker. ---*/ | ||
for (auto iChildren = 0u; iChildren < nodes->GetnChildren_CV(Point_Coarse); iChildren++) { | ||
const auto Point_Fine = nodes->GetChildren_CV(Point_Coarse, iChildren); | ||
const auto isVertex = fine_grid->nodes->GetDomain(Point_Fine) && | ||
(fine_grid->nodes->GetVertex(Point_Fine, val_marker) != -1); | ||
if (isVertex) { | ||
Area_Parent += fine_grid->nodes->GetVolume(Point_Fine); | ||
} | ||
} | ||
|
||
su2double Quantity_Coarse = 0.0; | ||
|
||
/*--- Loop again to average coarser value. ---*/ | ||
for (auto iChildren = 0u; iChildren < nodes->GetnChildren_CV(Point_Coarse); iChildren++) { | ||
const auto Point_Fine = nodes->GetChildren_CV(Point_Coarse, iChildren); | ||
const auto isVertex = fine_grid->nodes->GetDomain(Point_Fine) && | ||
(fine_grid->nodes->GetVertex(Point_Fine, val_marker) != -1); | ||
if (isVertex) { | ||
const auto Vertex_Fine = fine_grid->nodes->GetVertex(Point_Fine, val_marker); | ||
const auto Area_Children = fine_grid->nodes->GetVolume(Point_Fine); | ||
Quantity_Coarse += wall_quantity.Get(Vertex_Fine) * Area_Children / Area_Parent; | ||
} | ||
} | ||
|
||
/*--- Set the value at the coarse level. ---*/ | ||
wall_quantity.Set(iVertex, Quantity_Coarse); | ||
} | ||
|
||
} | ||
|
||
public: | ||
/*--- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/ | ||
using CGeometry::SetVertex; | ||
using CGeometry::SetControlVolume; | ||
using CGeometry::SetBoundControlVolume; | ||
using CGeometry::SetPoint_Connectivity; | ||
|
||
/*! | ||
* \brief Set points which surround a point. | ||
* \param[in] geometry - Geometrical definition of the problem. | ||
* \brief Constructor of the class. | ||
* \param[in] fine_grid - Geometrical definition of the problem. | ||
* \param[in] config - Definition of the particular problem. | ||
* \param[in] iMesh - Level of the multigrid. | ||
*/ | ||
void SetPoint_Connectivity(CGeometry *geometry) override; | ||
CMultiGridGeometry(CGeometry *fine_grid, CConfig *config, unsigned short iMesh); | ||
|
||
/*! | ||
* \brief Set the edge structure of the agglomerated control volume. | ||
* \brief Set boundary vertex. | ||
* \param[in] fine_grid - Geometrical definition of the problem. | ||
* \param[in] config - Definition of the particular problem. | ||
* \param[in] geometry - Geometrical definition of the problem. | ||
* \param[in] action - Allocate or not the new elements. | ||
*/ | ||
void SetControlVolume(CConfig *config, CGeometry *geometry, unsigned short action) override; | ||
void SetVertex(const CGeometry *fine_grid, const CConfig *config) override; | ||
|
||
/*! | ||
* \brief Mach the near field boundary condition. | ||
* \param[in] config - Definition of the particular problem. | ||
* \brief Set points which surround a point. | ||
* \param[in] fine_grid - Geometrical definition of the child grid. | ||
*/ | ||
void MatchActuator_Disk(CConfig *config) override; | ||
void SetPoint_Connectivity(const CGeometry *fine_grid) override; | ||
|
||
/*! | ||
* \brief Mach the periodic boundary conditions. | ||
* \param[in] config - Definition of the particular problem. | ||
* \param[in] val_periodic - Index of the first periodic face in a pair. | ||
* \brief Set the edge structure of the agglomerated control volume. | ||
* \param[in] fine_grid - Geometrical definition of the problem. | ||
* \param[in] action - Allocate or not the new elements. | ||
*/ | ||
void MatchPeriodic(CConfig *config, unsigned short val_periodic) override; | ||
void SetControlVolume(const CGeometry *fine_grid, unsigned short action) override; | ||
|
||
/*! | ||
* \brief Set boundary vertex structure of the agglomerated control volume. | ||
* \param[in] config - Definition of the particular problem. | ||
* \param[in] geometry - Geometrical definition of the problem. | ||
* \param[in] fine_grid - Geometrical definition of the problem. | ||
* \param[in] action - Allocate or not the new elements. | ||
*/ | ||
void SetBoundControlVolume(CConfig *config, CGeometry *geometry, unsigned short action) override; | ||
void SetBoundControlVolume(const CGeometry *fine_grid, unsigned short action) override; | ||
|
||
/*! | ||
* \brief Set a representative coordinates of the agglomerated control volume. | ||
* \param[in] geometry - Geometrical definition of the problem. | ||
* \param[in] fine_grid - Geometrical definition of the problem. | ||
*/ | ||
void SetCoord(CGeometry *geometry) override; | ||
void SetCoord(const CGeometry *fine_grid) override; | ||
|
||
/*! | ||
* \brief Set a representative wall normal heat flux of the agglomerated control volume on a particular boundary marker. | ||
* \param[in] geometry - Geometrical definition of the problem. | ||
* \param[in] val_marker - Index of the boundary marker. | ||
* \brief Set the grid velocity at each node in the coarse mesh level based | ||
* on a restriction from a finer mesh. | ||
* \param[in] fine_grid - Geometry container for the finer mesh level. | ||
*/ | ||
void SetMultiGridWallHeatFlux(CGeometry *geometry, unsigned short val_marker) override; | ||
void SetRestricted_GridVelocity(const CGeometry *fine_grid) override; | ||
|
||
/*! | ||
* \brief Set a representative wall temperature of the agglomerated control volume on a particular boundary marker. | ||
* \param[in] geometry - Geometrical definition of the problem. | ||
* \param[in] val_marker - Index of the boundary marker. | ||
* \brief Find and store the closest neighbor to a vertex. | ||
* \param[in] config - Definition of the particular problem. | ||
*/ | ||
void SetMultiGridWallTemperature(CGeometry *geometry, unsigned short val_marker) override; | ||
void FindNormal_Neighbor(const CConfig *config) override; | ||
|
||
/*! | ||
* \brief Set the grid velocity at each node in the coarse mesh level based | ||
* on a restriction from a finer mesh. | ||
* \param[in] fine_mesh - Geometry container for the finer mesh level. | ||
* \brief Mach the near field boundary condition. | ||
* \param[in] config - Definition of the particular problem. | ||
*/ | ||
void SetRestricted_GridVelocity(CGeometry *fine_mesh, const CConfig *config) override; | ||
void MatchActuator_Disk(const CConfig *config) override; | ||
|
||
/*! | ||
* \brief Find and store the closest neighbor to a vertex. | ||
* \brief Mach the periodic boundary conditions. | ||
* \param[in] config - Definition of the particular problem. | ||
* \param[in] val_periodic - Index of the first periodic face in a pair. | ||
*/ | ||
void FindNormal_Neighbor(CConfig *config) override; | ||
void MatchPeriodic(const CConfig *config, unsigned short val_periodic) override; | ||
|
||
}; | ||
/*! | ||
* \brief Set a representative wall normal heat flux of the agglomerated control volume on a particular boundary marker. | ||
* \param[in] fine_grid - Geometrical definition of the problem. | ||
* \param[in] val_marker - Index of the boundary marker. | ||
*/ | ||
void SetMultiGridWallHeatFlux(const CGeometry *fine_grid, unsigned short val_marker) override; | ||
|
||
/*! | ||
* \brief Set a representative wall temperature of the agglomerated control volume on a particular boundary marker. | ||
* \param[in] fine_grid - Geometrical definition of the problem. | ||
* \param[in] val_marker - Index of the boundary marker. | ||
*/ | ||
void SetMultiGridWallTemperature(const CGeometry *fine_grid, unsigned short val_marker) override; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 looks like all methods were public before