Skip to content
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

New data structure for multidimensional data (+some bugfixes) #1286

Merged
merged 55 commits into from
May 29, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
89b6700
Fix rough wall treatment for multizone setup
maxaehle May 11, 2021
188869f
removed redundant "virtual"
maxaehle May 12, 2021
f6f62f5
communicate wall roughness with NdFlattener
maxaehle May 12, 2021
5d62fc7
Index shift for K in NdFlattener
maxaehle May 14, 2021
dea3838
corrections
maxaehle May 14, 2021
53e6189
improvements proposed by @pcarruscag
maxaehle May 14, 2021
1b827e5
NdFlattener IndexAccumulator to provide []...[] interface
maxaehle May 14, 2021
fc628c7
SetWallRoughness as template with the [][][] interface
maxaehle May 14, 2021
b433ff6
moved ndflattener.hpp to Common/include/toolboxes
maxaehle May 14, 2021
af1bb01
Unit tests added
maxaehle May 14, 2021
22073ff
documentation of NdFlattener
maxaehle May 15, 2021
16c75e5
correct handling of non-const and const access
maxaehle May 15, 2021
4a1b3d4
operator[] returns reference to Data, and provide .data()
maxaehle May 15, 2021
9284153
IndexAccumulator_Checked added, which also carries size
maxaehle May 15, 2021
f940ff7
Removed get, getNChildren in favor of []...[] interface
maxaehle May 15, 2021
663e9b9
correction, now unit tests are passed
maxaehle May 15, 2021
9020677
NdFlattener documentation improved: refreshing
maxaehle May 15, 2021
80ec291
::Get_Nd_MPI_Env() is inline, not static
maxaehle May 15, 2021
e2a44d1
removed unnecessary ";"
maxaehle May 15, 2021
1bfa060
removed more unused ";"
maxaehle May 15, 2021
706e878
correct spelling in comment
maxaehle May 19, 2021
c6d7346
inherit default values for SetWallDistance
maxaehle May 24, 2021
13cb05d
use default NdFlattener arguments
maxaehle May 24, 2021
f60ca15
Refactoring in ndflattener.hpp
maxaehle May 24, 2021
c70706b
typedef -> using
maxaehle May 24, 2021
efe1c63
continue f60ca15d with _N -> N_
maxaehle May 24, 2021
0b19e6d
IndexAccumulator_Base::conditional -> ::su2conditional
maxaehle May 24, 2021
dfd3686
'Merge' IndexAccumulator_Checked into IndexAccumulator
maxaehle May 24, 2021
b82a065
added functionality to NdFlattener<1>
maxaehle May 24, 2021
26fca77
Reference instead of pointer for gathering initialization/refreshing
maxaehle May 24, 2021
a410d09
nd pointer->ref
maxaehle May 24, 2021
a0fb3d5
const reference in parameter packs
maxaehle May 24, 2021
fe56658
Merge branch 'fix_wallroughness_multizone' into tmp_1
maxaehle May 24, 2021
12890b9
replace parameter pack in IndexAccumulator constructor
maxaehle May 24, 2021
25e58e6
continue f60ca15d
maxaehle May 24, 2021
0cfcf1b
Nd_MPI_Environment in main scope, with constructor
maxaehle May 24, 2021
3a98d59
Look-up for IndexAccumulator is always a const method
maxaehle May 24, 2021
9d13918
get rid of ones and displs by using MPI_Allgather
maxaehle May 24, 2021
ab085f5
use std::vector for Nodes_all_K_as_int, Nodes_all_k_cumulated
maxaehle May 24, 2021
8d88a68
use su2matrix for Nodes_all
maxaehle May 24, 2021
fd29fe9
update comments to reflect 0cfcf1bb
maxaehle May 24, 2021
f376c80
clang-format -i Common/include/toolboxes/ndflattener.hpp
maxaehle May 24, 2021
e1f2f73
manual improvements of code formatting
maxaehle May 24, 2021
d66a0ef
Merge remote-tracking branch 'upstream/develop' into fix_wallroughnes…
pcarruscag May 24, 2021
13c63fa
avoid duplication of default values
pcarruscag May 25, 2021
018b1a8
example of what should not be possible
pcarruscag May 25, 2021
f0e16b0
IndexAccumulator::operator[],data is non-const, added const variants
maxaehle May 25, 2021
722a4dc
Removed forbidden write access in ndflattener_tests.cpp
maxaehle May 25, 2021
e97b0bf
little less duplication in []
pcarruscag May 26, 2021
1244638
error if roughness is set to non-0 value
maxaehle May 27, 2021
b5bd2b1
documentation improved
maxaehle May 27, 2021
340cf8c
further testing of the CI pipeline
maxaehle May 27, 2021
a5d8a62
remove debug stuff
maxaehle May 28, 2021
8372309
correct non-MPI Allgatherv, Alltoallv
maxaehle May 28, 2021
aaf5b8a
include <limits> in CPrimalGrid.hpp
maxaehle May 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Common/include/fem/fem_geometry_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,11 +1227,14 @@ class CMeshFEM_DG: public CMeshFEM {
void SetWallDistance(su2double val) override;

/*!
* \brief Set the wall distance based on an previously constructed ADT
* \param[in] config - Definition of the particular problem.
* \param[in] WallADT - The ADT to compute the wall distance
* \brief Reduce the wall distance based on an previously constructed ADT.
* \details The ADT might belong to another zone, giving rise to lower wall distances
* than those already stored.
* \param[in] WallADT - The ADT to reduce the wall distance
* \param[in] geometry - ignored
* \param[in] config - ignored
*/
void SetWallDistance(const CConfig *config, CADTElemClass* WallADT) override;
void SetWallDistance(CADTElemClass* WallADT, const CConfig *config = nullptr, const CGeometry* geometry = nullptr) override;
};

/*!
Expand Down
16 changes: 12 additions & 4 deletions Common/include/geometry/CGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1683,11 +1683,14 @@ class CGeometry {
virtual std::unique_ptr<CADTElemClass> ComputeViscousWallADT(const CConfig *config) const { return nullptr; }

/*!
* \brief Set the wall distance based on an previously constructed ADT
* \param[in] config - Definition of the particular problem.
* \param[in] WallADT - The ADT to compute the wall distance
* \brief Reduce the wall distance based on an previously constructed ADT.
* \details The ADT might belong to another zone, giving rise to lower wall distances
* than those already stored.
* \param[in] WallADT - The ADT to reduce the wall distance
* \param[in] geometry - Geometry associated to the ADT
* \param[in] config - Config associated to the ADT
*/
virtual void SetWallDistance(const CConfig *config, CADTElemClass* WallADT) {}
virtual void SetWallDistance(CADTElemClass* WallADT, const CConfig *config = nullptr, const CGeometry* geometry=nullptr) {}

/*!
* \brief Set wall distances a specific value
Expand All @@ -1702,6 +1705,11 @@ class CGeometry {
*/
static void ComputeWallDistance(const CConfig * const *config_container, CGeometry ****geometry_container);

/*!
* \brief Virtual function to set roughness values.
*/
virtual void SetGlobalMarkerRoughness(const CConfig* config) {}

/*!
* \brief Set the amount of nonconvex elements in the mesh.
* \param[in] nonconvex_elems - amount of nonconvex elements in the mesh
Expand Down
17 changes: 11 additions & 6 deletions Common/include/geometry/CPhysicalGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ class CPhysicalGeometry final : public CGeometry {
unsigned long *Elem_ID_BoundTria_Linear{nullptr};
unsigned long *Elem_ID_BoundQuad_Linear{nullptr};

su2double Streamwise_Periodic_RefNode[MAXNDIM] = {0}; /*!< \brief Coordinates of the reference node [m] on the receiving periodic marker, for recovered pressure/temperature computation only.*/

public:
vector<int> GlobalMarkerStorageDispl;
vector<su2double> GlobalRoughness_Height;

su2double Streamwise_Periodic_RefNode[MAXNDIM] = {0}; /*!< \brief Coordinates of the reference node [m] on the receiving periodic marker, for recovered pressure/temperature computation only.*/

public:
/*--- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/
using CGeometry::SetVertex;
Expand Down Expand Up @@ -767,10 +768,14 @@ class CPhysicalGeometry final : public CGeometry {
std::unique_ptr<CADTElemClass> ComputeViscousWallADT(const CConfig *config) const override;

/*!
* \brief Set the wall distance based on an previously constructed ADT
* \param[in] WallADT - The ADT to compute the wall distance
* \brief Reduce the wall distance based on an previously constructed ADT.
* \details The ADT might belong to another zone, giving rise to lower wall distances
* than those already stored.
* \param[in] WallADT - The ADT to reduce the wall distance
* \param[in] geometry - Physical geometry associated to the ADT
* \param[in] config - Config associated to the ADT
*/
void SetWallDistance(const CConfig *config, CADTElemClass* WallADT) override;
void SetWallDistance(CADTElemClass* WallADT, const CConfig *config = nullptr, const CGeometry* geometry=nullptr) override;

/*!
* \brief Set wall distances a specific value
Expand All @@ -784,7 +789,7 @@ class CPhysicalGeometry final : public CGeometry {
/*!
* \brief Set roughness values for markers in a global array.
*/
void SetGlobalMarkerRoughness(const CConfig* config);
void SetGlobalMarkerRoughness(const CConfig* config) override;

/*!
* \brief For streamwise periodicity, find & store a unique reference node on the designated periodic inlet.
Expand Down
2 changes: 1 addition & 1 deletion Common/src/fem/fem_wall_distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void CMeshFEM_DG::SetWallDistance(su2double val){
}
}

void CMeshFEM_DG::SetWallDistance(const CConfig *config, CADTElemClass *WallADT){
void CMeshFEM_DG::SetWallDistance(CADTElemClass *WallADT, const CConfig *config, const CGeometry* geometry){

/*--------------------------------------------------------------------------*/
/*--- Step 3: Determine the wall distance of the integration points of ---*/
Expand Down
9 changes: 7 additions & 2 deletions Common/src/geometry/CGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3923,14 +3923,19 @@ void CGeometry::ComputeWallDistance(const CConfig* const* config_container, CGeo
/*--- Loop over all zones and compute the ADT based on the viscous walls in that zone ---*/
for (int iZone = 0; iZone < nZone; iZone++){
CGeometry *geometry = geometry_container[iZone][iInst][MESH_0];
unique_ptr<CADTElemClass> WallADT = geometry->ComputeViscousWallADT(config_container[iZone]);
const CConfig *config = config_container[iZone];
unique_ptr<CADTElemClass> WallADT = geometry->ComputeViscousWallADT(config);
if (WallADT && !WallADT->IsEmpty()){
allEmpty = false;
/*--- Along with finding the closest walls, we collect their roughnesses. ---*/
if (config_container[iZone]->GetnRoughWall() > 0)
geometry->SetGlobalMarkerRoughness(config);

/*--- Inner loop over all zones to update the wall distances.
* It might happen that there is a closer viscous wall in zone iZone for points in zone jZone. ---*/
for (int jZone = 0; jZone < nZone; jZone++){
if (wallDistanceNeeded[jZone])
geometry_container[jZone][iInst][MESH_0]->SetWallDistance(config_container[jZone], WallADT.get());
geometry_container[jZone][iInst][MESH_0]->SetWallDistance(WallADT.get(), config, geometry);
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions Common/src/geometry/CPhysicalGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11017,16 +11017,13 @@ std::unique_ptr<CADTElemClass> CPhysicalGeometry::ComputeViscousWallADT(const CC

}

void CPhysicalGeometry::SetWallDistance(const CConfig *config, CADTElemClass *WallADT) {
void CPhysicalGeometry::SetWallDistance(CADTElemClass* WallADT, const CConfig *config, const CGeometry* geometry) {

/*--------------------------------------------------------------------------*/
/*--- Step 3: Loop over all interior mesh nodes and compute minimum ---*/
/*--- distance to a solid wall element ---*/
/*--------------------------------------------------------------------------*/

/*--- Store marker list and roughness in a global array. ---*/
if (config->GetnRoughWall() > 0) SetGlobalMarkerRoughness(config);

SU2_OMP_PARALLEL
if (!WallADT->IsEmpty()) {
/*--- Solid wall boundary nodes are present. Compute the wall
Expand All @@ -11041,12 +11038,15 @@ void CPhysicalGeometry::SetWallDistance(const CConfig *config, CADTElemClass *Wa

WallADT->DetermineNearestElement(nodes->GetCoord(iPoint), dist, markerID, elemID, rankID);

nodes->SetWall_Distance(iPoint, min(dist,nodes->GetWall_Distance(iPoint)));
if(dist < nodes->GetWall_Distance(iPoint)){
nodes->SetWall_Distance(iPoint, dist);

if (config->GetnRoughWall() > 0) {
auto index = GlobalMarkerStorageDispl[rankID] + markerID;
auto localRoughness = GlobalRoughness_Height[index];
nodes->SetRoughnessHeight(iPoint, localRoughness);
if (config->GetnRoughWall() > 0) {
const CPhysicalGeometry* ph_geometry = dynamic_cast<const CPhysicalGeometry*>(geometry);
auto index = ph_geometry->GlobalMarkerStorageDispl[rankID] + markerID;
pcarruscag marked this conversation as resolved.
Show resolved Hide resolved
su2double localRoughness = ph_geometry->GlobalRoughness_Height[index];
nodes->SetRoughnessHeight(iPoint, localRoughness);
}
}
}
END_SU2_OMP_FOR
Expand Down