Skip to content

Commit 10c2a05

Browse files
committed
Make mesh quality metrics available in new output structure.
1 parent 50299b7 commit 10c2a05

5 files changed

Lines changed: 56 additions & 0 deletions

File tree

SU2_CFD/src/output/CFlowCompOutput.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,12 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){
414414
AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion");
415415
}
416416

417+
// Mesh quality metrics, computed in CPhysicalGeometry::ComputeMeshQualityStatistics.
418+
// WRT_MESH_QUALITY= YES has to be set, otherwise the memory holding the data is freed.
419+
AddVolumeOutput("ORTHOGONALITY", "Orthogonality", "MESH_QUALITY", "Orthogonality, additionally set \"WRT_MESH_QUALITY= YES\"");
420+
AddVolumeOutput("ASPECT_RATIO", "Aspect_Ratio", "MESH_QUALITY", "Aspect ratio, additionally set \"WRT_MESH_QUALITY= YES\"");
421+
AddVolumeOutput("VOLUME_RATIO", "Volume_Ratio", "MESH_QUALITY", "Volume Ratio, additionally set \"WRT_MESH_QUALITY= YES\"");
422+
417423
if (config->GetTime_Domain()){
418424
SetTimeAveragedFields();
419425
}
@@ -554,6 +560,13 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv
554560
SetVolumeOutputValue("Q_CRITERION", iPoint, GetQ_Criterion(&(Node_Flow->GetGradient_Primitive(iPoint)[1])));
555561
}
556562

563+
// Mesh quality metrics
564+
if (config->GetWrt_MeshQuality()) {
565+
SetVolumeOutputValue("ORTHOGONALITY", iPoint, geometry->Orthogonality[iPoint]);
566+
SetVolumeOutputValue("ASPECT_RATIO", iPoint, geometry->Aspect_Ratio[iPoint]);
567+
SetVolumeOutputValue("VOLUME_RATIO", iPoint, geometry->Volume_Ratio[iPoint]);
568+
}
569+
557570
if (config->GetTime_Domain()){
558571
LoadTimeAveragedData(iPoint, Node_Flow);
559572
}

SU2_CFD/src/output/CFlowIncOutput.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,13 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){
478478
}
479479
AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion");
480480
}
481+
482+
// Mesh quality metrics, computed in CPhysicalGeometry::ComputeMeshQualityStatistics.
483+
// WRT_MESH_QUALITY= YES has to be set, otherwise the memory holding the data is freed.
484+
AddVolumeOutput("ORTHOGONALITY", "Orthogonality", "MESH_QUALITY", "Orthogonality, additionally set \"WRT_MESH_QUALITY= YES\"");
485+
AddVolumeOutput("ASPECT_RATIO", "Aspect_Ratio", "MESH_QUALITY", "Aspect ratio, additionally set \"WRT_MESH_QUALITY= YES\"");
486+
AddVolumeOutput("VOLUME_RATIO", "Volume_Ratio", "MESH_QUALITY", "Volume Ratio, additionally set \"WRT_MESH_QUALITY= YES\"");
487+
481488
}
482489

483490
void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
@@ -641,6 +648,14 @@ void CFlowIncOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolv
641648
}
642649
SetVolumeOutputValue("Y_PLUS", iPoint, solver[FLOW_SOL]->GetYPlus(iMarker, iVertex));
643650
}
651+
652+
// Mesh quality metrics
653+
if (config->GetWrt_MeshQuality()) {
654+
SetVolumeOutputValue("ORTHOGONALITY", iPoint, geometry->Orthogonality[iPoint]);
655+
SetVolumeOutputValue("ASPECT_RATIO", iPoint, geometry->Aspect_Ratio[iPoint]);
656+
SetVolumeOutputValue("VOLUME_RATIO", iPoint, geometry->Volume_Ratio[iPoint]);
657+
}
658+
644659
}
645660

646661
bool CFlowIncOutput::SetInit_Residuals(CConfig *config){

SU2_CFD/src/output/CHeatOutput.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ void CHeatOutput::SetVolumeOutputFields(CConfig *config){
131131
// Residuals
132132
AddVolumeOutput("RES_TEMPERATURE", "Residual_Temperature", "RESIDUAL", "Residual of the temperature");
133133

134+
// Mesh quality metrics, computed in CPhysicalGeometry::ComputeMeshQualityStatistics.
135+
// WRT_MESH_QUALITY= YES has to be set, otherwise the memory holding the data is freed.
136+
AddVolumeOutput("ORTHOGONALITY", "Orthogonality", "MESH_QUALITY", "Orthogonality, additionally set \"WRT_MESH_QUALITY= YES\"");
137+
AddVolumeOutput("ASPECT_RATIO", "Aspect_Ratio", "MESH_QUALITY", "Aspect ratio, additionally set \"WRT_MESH_QUALITY= YES\"");
138+
AddVolumeOutput("VOLUME_RATIO", "Volume_Ratio", "MESH_QUALITY", "Volume Ratio, additionally set \"WRT_MESH_QUALITY= YES\"");
139+
134140
}
135141

136142

@@ -151,6 +157,13 @@ void CHeatOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver *
151157
// Residuals
152158
SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[HEAT_SOL]->LinSysRes(iPoint, 0));
153159

160+
// Mesh quality metrics
161+
if (config->GetWrt_MeshQuality()) {
162+
SetVolumeOutputValue("ORTHOGONALITY", iPoint, geometry->Orthogonality[iPoint]);
163+
SetVolumeOutputValue("ASPECT_RATIO", iPoint, geometry->Aspect_Ratio[iPoint]);
164+
SetVolumeOutputValue("VOLUME_RATIO", iPoint, geometry->Volume_Ratio[iPoint]);
165+
}
166+
154167
}
155168

156169
void CHeatOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){

SU2_CFD/src/output/CMeshOutput.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ void CMeshOutput::SetVolumeOutputFields(CConfig *config){
5656
if (nDim == 3)
5757
AddVolumeOutput("COORD-Z", "z", "COORDINATES", "z-component of the coordinate vector");
5858

59+
// Mesh quality metrics, computed in CPhysicalGeometry::ComputeMeshQualityStatistics.
60+
// WRT_MESH_QUALITY= YES has to be set, otherwise the memory holding the data is freed.
61+
AddVolumeOutput("ORTHOGONALITY", "Orthogonality", "MESH_QUALITY", "Orthogonality, additionally set \"WRT_MESH_QUALITY= YES\"");
62+
AddVolumeOutput("ASPECT_RATIO", "Aspect_Ratio", "MESH_QUALITY", "Aspect ratio, additionally set \"WRT_MESH_QUALITY= YES\"");
63+
AddVolumeOutput("VOLUME_RATIO", "Volume_Ratio", "MESH_QUALITY", "Volume Ratio, additionally set \"WRT_MESH_QUALITY= YES\"");
5964

6065
}
6166

@@ -68,4 +73,11 @@ void CMeshOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver *
6873
if (nDim == 3)
6974
SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2));
7075

76+
// Mesh quality metrics
77+
if (config->GetWrt_MeshQuality()) {
78+
SetVolumeOutputValue("ORTHOGONALITY", iPoint, geometry->Orthogonality[iPoint]);
79+
SetVolumeOutputValue("ASPECT_RATIO", iPoint, geometry->Aspect_Ratio[iPoint]);
80+
SetVolumeOutputValue("VOLUME_RATIO", iPoint, geometry->Volume_Ratio[iPoint]);
81+
}
82+
7183
}

config_template.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,9 @@ HISTORY_OUTPUT= (ITER, RMS_RES)
14221422
% Volume output fields/groups (use 'SU2_CFD -d <config_file>' to view list of available fields)
14231423
VOLUME_OUTPUT= (COORDINATES, SOLUTION, PRIMITIVE)
14241424
%
1425+
% Write volume data for mesh quality metrics. Additionally set VOLUME_OUTPUT= (MESH_QUALITY, ...)
1426+
WRT_MESH_QUALITY= NO
1427+
%
14251428
% Writing frequency for screen output
14261429
SCREEN_WRT_FREQ_INNER= 1
14271430
%

0 commit comments

Comments
 (0)