Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ class CConfig {
Wrt_Performance, /*!< \brief Write the performance summary at the end of a calculation. */
Wrt_AD_Statistics, /*!< \brief Write the tape statistics (discrete adjoint). */
Wrt_MeshQuality, /*!< \brief Write the mesh quality statistics to the visualization files. */
Wrt_MultiGrid, /*!< \brief Write the coarse grids to the visualization files. */
Wrt_Projected_Sensitivity, /*!< \brief Write projected sensitivities (dJ/dx) on surfaces to ASCII file. */
Plot_Section_Forces; /*!< \brief Write sectional forces for specified markers. */
unsigned short
Expand Down Expand Up @@ -3043,6 +3044,11 @@ class CConfig {
*/
bool GetWrt_MeshQuality(void) const { return Wrt_MeshQuality; }

/*!
* \brief Write coarse grids to the visualization files.
*/
bool GetWrt_MultiGrid(void) const { return Wrt_MultiGrid; }

/*!
* \brief Get information about writing projected sensitivities on surfaces to an ASCII file with rows as x, y, z, dJ/dx, dJ/dy, dJ/dz for each vertex.
* \return <code>TRUE</code> means that projected sensitivities on surfaces in an ASCII file with rows as x, y, z, dJ/dx, dJ/dy, dJ/dz for each vertex will be written.
Expand Down
11 changes: 11 additions & 0 deletions Common/include/geometry/CGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ class CGeometry {
unsigned long edgeColorGroupSize{1}; /*!< \brief Size of the edge groups within each color. */
unsigned long elemColorGroupSize{1}; /*!< \brief Size of the element groups within each color. */

ColMajorMatrix<uint8_t> CoarseGridColor_; /*!< \brief Coarse grid levels, colorized. */

public:
/*--- Main geometric elements of the grid. ---*/

Expand Down Expand Up @@ -258,6 +260,8 @@ class CGeometry {
vector<su2double> Aspect_Ratio; /*!< \brief Measure of dual CV aspect ratio (max face area / min face area). */
vector<su2double> Volume_Ratio; /*!< \brief Measure of dual CV volume ratio (max sub-element volume / min sub-element volume). */

const ColMajorMatrix<uint8_t>& CoarseGridColor = CoarseGridColor_; /*!< \brief Coarse grid levels, colorized. */

/*!
* \brief Constructor of the class.
*/
Expand Down Expand Up @@ -1597,6 +1601,13 @@ class CGeometry {
*/
inline virtual void ComputeMeshQualityStatistics(const CConfig *config) {}

/*!
* \brief Color multigrid levels for visualization.
* \param nMGLevels - Number of levels
* \param geometry - The levels
*/
void ColorMGLevels(unsigned short nMGLevels, const CGeometry* const* geometry);

/*!
* \brief Get the sparse pattern of "type" with given level of fill.
* \note This method builds the pattern if that has not been done yet.
Expand Down
2 changes: 1 addition & 1 deletion Common/include/linear_algebra/CSysMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct CSysMatrixComms {
template<class ScalarType>
class CSysMatrix {
private:
friend class CSysMatrixComms;
friend struct CSysMatrixComms;

const int rank; /*!< \brief MPI Rank. */
const int size; /*!< \brief MPI Size. */
Expand Down
14 changes: 11 additions & 3 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3207,6 +3207,14 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
}
}

/*--- Check if MULTIGRID is requested in VOLUME_OUTPUT and set the config boolean accordingly. ---*/
Wrt_MultiGrid = false;
for (unsigned short iField = 0; iField < nVolumeOutput; iField++) {
if(VolumeOutput[iField].find("MULTIGRID") != string::npos) {
Wrt_MultiGrid = true;
}
}

if (Kind_Solver == NAVIER_STOKES && Kind_Turb_Model != NONE){
SU2_MPI::Error("KIND_TURB_MODEL must be NONE if SOLVER= NAVIER_STOKES", CURRENT_FUNCTION);
}
Expand Down Expand Up @@ -4996,9 +5004,9 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
if (GetGasModel() == "ARGON") monoatomic = true;

// This option is deprecated. After a grace period until 7.2.0 the usage warning should become an error.
if(OptionIsSet("CONV_CRITERIA")) {
cout << string("\n\nWARNING: CONV_CRITERIA is deprecated. SU2 will choose the criteria automatically based on the CONV_FIELD.\n") +
string("RESIDUAL for any RMS_* BGS_* value. CAUCHY for coefficients like DRAG etc.\n\n");
if(OptionIsSet("CONV_CRITERIA") && rank == MASTER_NODE) {
Comment thread
pcarruscag marked this conversation as resolved.
cout << "\n\nWARNING: CONV_CRITERIA is deprecated. SU2 will choose the criteria automatically based on the CONV_FIELD.\n"
"That is, RESIDUAL for any RMS_* BGS_* value, and CAUCHY for coefficients such as DRAG etc.\n" << endl;
}
}

Expand Down
27 changes: 27 additions & 0 deletions Common/src/geometry/CGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3823,6 +3823,33 @@ void CGeometry::SetNaturalElementColoring()
if (omp_get_max_threads() > 1) elemColorGroupSize = nElem;
}

void CGeometry::ColorMGLevels(unsigned short nMGLevels, const CGeometry* const* geometry) {

using tColor = uint8_t;
constexpr auto nColor = numeric_limits<tColor>::max();

if (nMGLevels) CoarseGridColor_.resize(nPoint,nMGLevels) = 0;

for (auto iMesh = nMGLevels; iMesh >= 1; --iMesh) {
/*--- Color the coarse points. ---*/
vector<tColor> color;
const auto& adjacency = geometry[iMesh]->nodes->GetPoints();
if (colorSparsePattern<CCompressedSparsePatternUL, tColor, nColor>(adjacency, 1, false, &color).empty())
continue;

/*--- Propagate colors to fine mesh. ---*/
for (auto step = 0u; step < iMesh; ++step) {
auto coarseMesh = geometry[iMesh-1-step];
if (step)
for (auto iPoint = 0ul; iPoint < coarseMesh->GetnPoint(); ++iPoint)
CoarseGridColor_(iPoint,step) = CoarseGridColor_(coarseMesh->nodes->GetParent_CV(iPoint), step-1);
else
for (auto iPoint = 0ul; iPoint < coarseMesh->GetnPoint(); ++iPoint)
CoarseGridColor_(iPoint,step) = color[coarseMesh->nodes->GetParent_CV(iPoint)];
}
}
}

void CGeometry::ComputeWallDistance(const CConfig* const* config_container, CGeometry ****geometry_container){

int nZone = config_container[ZONE_0]->GetnZone();
Expand Down
11 changes: 11 additions & 0 deletions SU2_CFD/include/output/CFlowOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,15 @@ class CFlowOutput : public COutput{
* \param node_flow
*/
void LoadTimeAveragedData(unsigned long iPoint, CVariable *node_flow);

/*!
* \brief Add common FVM outputs.
*/
void AddCommonFVMOutputs(const CConfig* config);

/*!
* \brief Load common FVM outputs.
*/
void LoadCommonFVMOutputs(const CConfig* config, const CGeometry* geometry, unsigned long iPoint);

};
2 changes: 2 additions & 0 deletions SU2_CFD/src/drivers/CDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,8 @@ void CDriver::Geometrical_Preprocessing_FVM(CConfig *config, CGeometry **&geomet

}

if (config->GetWrt_MultiGrid()) geometry[MESH_0]->ColorMGLevels(config->GetnMGLevels(), geometry);

/*--- For unsteady simulations, initialize the grid volumes
and coordinates for previous solutions. Loop over all zones/grids ---*/

Expand Down
18 changes: 2 additions & 16 deletions SU2_CFD/src/output/CFlowCompOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,7 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){
AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion");
}

// Mesh quality metrics, computed in CPhysicalGeometry::ComputeMeshQualityStatistics.
AddVolumeOutput("ORTHOGONALITY", "Orthogonality", "MESH_QUALITY", "Orthogonality Angle (deg.)");
AddVolumeOutput("ASPECT_RATIO", "Aspect_Ratio", "MESH_QUALITY", "CV Face Area Aspect Ratio");
AddVolumeOutput("VOLUME_RATIO", "Volume_Ratio", "MESH_QUALITY", "CV Sub-Volume Ratio");

// MPI-Rank
AddVolumeOutput("RANK", "rank", "MPI", "Rank of the MPI-partition");
AddCommonFVMOutputs(config);

if (config->GetTime_Domain()){
SetTimeAveragedFields();
Expand Down Expand Up @@ -567,15 +561,7 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv
SetVolumeOutputValue("Q_CRITERION", iPoint, GetQ_Criterion(&(Node_Flow->GetGradient_Primitive(iPoint)[1])));
}

// Mesh quality metrics
if (config->GetWrt_MeshQuality()) {
SetVolumeOutputValue("ORTHOGONALITY", iPoint, geometry->Orthogonality[iPoint]);
SetVolumeOutputValue("ASPECT_RATIO", iPoint, geometry->Aspect_Ratio[iPoint]);
SetVolumeOutputValue("VOLUME_RATIO", iPoint, geometry->Volume_Ratio[iPoint]);
}

// MPI-Rank
SetVolumeOutputValue("RANK", iPoint, rank);
LoadCommonFVMOutputs(config, geometry, iPoint);

if (config->GetTime_Domain()){
LoadTimeAveragedData(iPoint, Node_Flow);
Expand Down
18 changes: 2 additions & 16 deletions SU2_CFD/src/output/CFlowIncOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,20 +498,14 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){
AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion");
}

// Mesh quality metrics, computed in CPhysicalGeometry::ComputeMeshQualityStatistics.
AddVolumeOutput("ORTHOGONALITY", "Orthogonality", "MESH_QUALITY", "Orthogonality Angle (deg.)");
AddVolumeOutput("ASPECT_RATIO", "Aspect_Ratio", "MESH_QUALITY", "CV Face Area Aspect Ratio");
AddVolumeOutput("VOLUME_RATIO", "Volume_Ratio", "MESH_QUALITY", "CV Sub-Volume Ratio");

// Streamwise Periodicity
if(streamwisePeriodic) {
AddVolumeOutput("RECOVERED_PRESSURE", "Recovered_Pressure", "SOLUTION", "Recovered physical pressure");
if (heat && streamwisePeriodic_temperature)
AddVolumeOutput("RECOVERED_TEMPERATURE", "Recovered_Temperature", "SOLUTION", "Recovered physical temperature");
}

// MPI-Rank
AddVolumeOutput("RANK", "Rank", "MPI", "Rank of the MPI-partition");
AddCommonFVMOutputs(config);
}

void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
Expand Down Expand Up @@ -669,15 +663,7 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve
SetVolumeOutputValue("RECOVERED_TEMPERATURE", iPoint, Node_Flow->GetStreamwise_Periodic_RecoveredTemperature(iPoint));
}

// Mesh quality metrics
if (config->GetWrt_MeshQuality()) {
SetVolumeOutputValue("ORTHOGONALITY", iPoint, geometry->Orthogonality[iPoint]);
SetVolumeOutputValue("ASPECT_RATIO", iPoint, geometry->Aspect_Ratio[iPoint]);
SetVolumeOutputValue("VOLUME_RATIO", iPoint, geometry->Volume_Ratio[iPoint]);
}

// MPI-Rank
SetVolumeOutputValue("RANK", iPoint, rank);
LoadCommonFVMOutputs(config, geometry, iPoint);
}

void CFlowIncOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){
Expand Down
35 changes: 35 additions & 0 deletions SU2_CFD/src/output/CFlowOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2735,6 +2735,41 @@ bool CFlowOutput::WriteVolume_Output(CConfig *config, unsigned long Iter, bool f
return false || force_writing;
}

void CFlowOutput::AddCommonFVMOutputs(const CConfig *config) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Special reason to not move COORD-XYZ here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order matters I think.

@TobiKattmann TobiKattmann Apr 28, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep it does (tried it out) ... it needs to be the first, at least for paraview output


AddVolumeOutput("ORTHOGONALITY", "Orthogonality", "MESH_QUALITY", "Orthogonality Angle (deg.)");
AddVolumeOutput("ASPECT_RATIO", "Aspect_Ratio", "MESH_QUALITY", "CV Face Area Aspect Ratio");
AddVolumeOutput("VOLUME_RATIO", "Volume_Ratio", "MESH_QUALITY", "CV Sub-Volume Ratio");

AddVolumeOutput("RANK", "rank", "MPI", "Rank of the MPI-partition");

for (auto iMesh = 1u; iMesh <= config->GetnMGLevels(); ++iMesh) {
stringstream key, name;
key << "MG_" << iMesh;
name << "Coarse_Grid_" << iMesh;
AddVolumeOutput(key.str(), name.str(), "MULTIGRID", "Coarse mesh");
}
}

void CFlowOutput::LoadCommonFVMOutputs(const CConfig* config, const CGeometry* geometry, unsigned long iPoint) {

if (config->GetWrt_MeshQuality()) {
SetVolumeOutputValue("ORTHOGONALITY", iPoint, geometry->Orthogonality[iPoint]);
SetVolumeOutputValue("ASPECT_RATIO", iPoint, geometry->Aspect_Ratio[iPoint]);
SetVolumeOutputValue("VOLUME_RATIO", iPoint, geometry->Volume_Ratio[iPoint]);
}

SetVolumeOutputValue("RANK", iPoint, rank);

if (config->GetWrt_MultiGrid()) {
for (auto iMesh = 1u; iMesh <= config->GetnMGLevels(); ++iMesh) {
stringstream key;
key << "MG_" << iMesh;
SetVolumeOutputValue(key.str(), iPoint, geometry->CoarseGridColor(iPoint,iMesh-1));
}
}
}

void CFlowOutput::SetTimeAveragedFields(){
AddVolumeOutput("MEAN_DENSITY", "MeanDensity", "TIME_AVERAGE", "Mean density");
AddVolumeOutput("MEAN_VELOCITY-X", "MeanVelocity_x", "TIME_AVERAGE", "Mean velocity x-component");
Expand Down
4 changes: 4 additions & 0 deletions SU2_CFD/src/output/CNEMOCompOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ void CNEMOCompOutput::SetVolumeOutputFields(CConfig *config){
AddVolumeOutput("VORTICITY_Z", "Vorticity_z", "VORTEX_IDENTIFICATION", "z-component of the vorticity vector");
}

AddCommonFVMOutputs(config);

if (config->GetTime_Domain()){
SetTimeAveragedFields();
}
Expand Down Expand Up @@ -555,6 +557,8 @@ void CNEMOCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv
SetVolumeOutputValue("ROE_DISSIPATION", iPoint, Node_Flow->GetRoe_Dissipation(iPoint));
}

LoadCommonFVMOutputs(config, geometry, iPoint);

if (config->GetTime_Domain()){
LoadTimeAveragedData(iPoint, Node_Flow);
}
Expand Down