Skip to content

Commit

Permalink
Merge branch 'develop' into fix_random_version_numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
WallyMaier authored Apr 30, 2021
2 parents 1882b64 + 8d469a7 commit 1e986d9
Show file tree
Hide file tree
Showing 31 changed files with 440 additions and 234 deletions.
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
1 change: 0 additions & 1 deletion Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,6 @@ enum MPI_QUANTITIES {
MESH_DISPLACEMENTS , /*!< \brief Mesh displacements at the interface. */
SOLUTION_TIME_N , /*!< \brief Solution at time n. */
SOLUTION_TIME_N1 , /*!< \brief Solution at time n-1. */
PRIMITIVE /*!< \brief Primitive solution communication. */
};

/*!
Expand Down
20 changes: 10 additions & 10 deletions Common/include/option_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public:
auto it = m.find(option_value[0]);

if (it == m.cend()) {
string str = name;
str.append(": invalid option value ");
str.append(option_value[0]);
str.append(". Check current SU2 options in config_template.cfg.");
return str;
stringstream ss;
ss << name << ": invalid option value " << option_value[0] << ".\nDid you mean";
for (auto& item : m) ss << ", " << item.first;
ss << "?";
return ss.str();
}
// If it is there, set the option value
field = it->second;
Expand Down Expand Up @@ -224,11 +224,11 @@ public:
auto it = m.find(option_value[i]);

if (it == m.cend()) {
string str = name;
str.append(": invalid option value ");
str.append(option_value[i]);
str.append(". Check current SU2 options in config_template.cfg.");
return str;
stringstream ss;
ss << name << ": invalid option value " << option_value[i] << ".\nDid you mean";
for (auto& item : m) ss << ", " << item.first;
ss << "?";
return ss.str();
}
// If it is there, set the option value
field[i] = it->second;
Expand Down
96 changes: 64 additions & 32 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2807,8 +2807,8 @@ void CConfig::SetConfig_Parsing(istream& config_buffer){

string errorString;

const int max_err_count = 30; // Maximum number of errors to print before stopping
int err_count = 0; // How many errors have we found in the config file
int max_err_count = 30; // Maximum number of errors to print before stopping
int line_count = 1;

map<string, bool> included_options;
Expand All @@ -2818,10 +2818,8 @@ void CConfig::SetConfig_Parsing(istream& config_buffer){
while (getline (config_buffer, text_line)) {

if (err_count >= max_err_count) {
errorString.append("too many errors. Stopping parse");

cout << errorString << endl;
throw(1);
errorString.append("Too many errors, stopping parse.");
break;
}

PrintingToolbox::trim(text_line);
Expand Down Expand Up @@ -2862,34 +2860,63 @@ void CConfig::SetConfig_Parsing(istream& config_buffer){
if (!option_name.compare("RELAXATION_FACTOR_ADJFLOW"))
newString.append("Option RELAXATION_FACTOR_ADJFLOW is now RELAXATION_FACTOR_ADJOINT, "
"and it also applies to discrete adjoint problems.\n\n");
if (!option_name.compare("WRT_MESH_QUALITY"))
else if (!option_name.compare("WRT_MESH_QUALITY"))
newString.append("WRT_MESH_QUALITY is deprecated. Use VOLUME_OUTPUT= (MESH_QUALITY, ...) instead.\n\n");
if (!option_name.compare("VISUALIZE_SURFACE_DEF"))
else if (!option_name.compare("VISUALIZE_SURFACE_DEF"))
newString.append("VISUALIZE_SURFACE_DEF is deprecated. Simply add a surface format to OUTPUT_FILES.\n\n");
if (!option_name.compare("VISUALIZE_VOLUME_DEF"))
else if (!option_name.compare("VISUALIZE_VOLUME_DEF"))
newString.append("VISUALIZE_VOLUME_DEF is deprecated. Simply add a volume format to OUTPUT_FILES.\n\n");
if (!option_name.compare("WRT_BINARY_RESTART"))
else if (!option_name.compare("WRT_BINARY_RESTART"))
newString.append("WRT_BINARY_RESTART is deprecated. The type of restart is determined from the OUTPUT_FILES list.\n\n");
if (!option_name.compare("WRT_RESIDUALS"))
else if (!option_name.compare("WRT_RESIDUALS"))
newString.append("WRT_RESIDUALS is deprecated. Use VOLUME_OUTPUT= ( RESIDUAL, ... ) instead.\n\n");
if (!option_name.compare("WRT_LIMITERS"))
else if (!option_name.compare("WRT_LIMITERS"))
newString.append("WRT_LIMITERS is deprecated. Use VOLUME_OUTPUT= ( LIMITER, ... ) instead.\n\n");
if (!option_name.compare("WRT_CON_FREQ"))
else if (!option_name.compare("WRT_CON_FREQ"))
newString.append("WRT_CON_FREQ is deprecated. Use SCREEN_WRT_FREQ_INNER or SCREEN_WRT_FREQ_OUTER for multizone cases instead.\n\n");
if (!option_name.compare("WRT_CON_FREQ_DUALTIME"))
else if (!option_name.compare("WRT_CON_FREQ_DUALTIME"))
newString.append("WRT_CON_FREQ_DUALTIME is deprecated. Use SCREEN_WRT_FREQ_TIME instead.\n\n");
if (!option_name.compare("WRT_SRF_SOL"))
else if (!option_name.compare("WRT_SRF_SOL"))
newString.append("WRT_SRF_SOL is deprecated. Simply add a surface format to OUTPUT_FILES.\n\n");
if (!option_name.compare("WRT_CSV_SOL"))
else if (!option_name.compare("WRT_CSV_SOL"))
newString.append("WRT_CSV_SOL is deprecated. Simply add a CSV format to OUTPUT_FILES.\n\n");
if (!option_name.compare("WRT_SOL_FREQ"))
else if (!option_name.compare("WRT_SOL_FREQ"))
newString.append("WRT_SOL_FREQ is deprecated. Use OUTPUT_WRT_FREQ instead.\n\n");
if (!option_name.compare("WRT_SOL_FREQ_DUALTIME"))
else if (!option_name.compare("WRT_SOL_FREQ_DUALTIME"))
newString.append("WRT_SOL_FREQ_DUALTIME is deprecated. Use OUTPUT_WRT_FREQ instead.\n\n");
// This option is deprecated. After a grace period until 7.2.0 the usage warning should become an error.
/*if (!option_name.compare("CONV_CRITERIA"))
/*else if (!option_name.compare("CONV_CRITERIA"))
newString.append(string("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"));*/
else {
/*--- Find the most likely candidate for the unrecognized option, based on the length
of start and end character sequences shared by candidates and the option. ---*/
auto countMatchChars = [&option_name](const string& candidate) {
const size_t sz1 = option_name.size(), sz2 = candidate.size();
size_t nMatch = 0;
for (size_t i=0; i<min(sz1,sz2); ++i) {
if (option_name[i] == candidate[i]) nMatch++;
else break;
}
for (size_t i=0; i<min(sz1,sz2); ++i) {
if (option_name[sz1-1-i] == candidate[sz2-1-i]) nMatch++;
else break;
}
return nMatch;
};
string match;
size_t maxScore = 0;
for (auto& candidate : option_map) {
auto score = countMatchChars(candidate.first);
if (score > maxScore) {
maxScore = score;
match = candidate.first;
}
}
newString.append("Did you mean ");
newString.append(match);
newString.append("?\n");
}
errorString.append(newString);
err_count++;
line_count++;
Expand All @@ -2909,7 +2936,6 @@ void CConfig::SetConfig_Parsing(istream& config_buffer){
continue;
}


/*--- New found option. Add it to the map, and delete from all options ---*/

included_options.insert(pair<string, bool>(option_name, true));
Expand Down Expand Up @@ -2973,7 +2999,7 @@ bool CConfig::SetRunTime_Parsing(char case_filename[MAX_STRING_SIZE]) {
string errorString;

int err_count = 0; // How many errors have we found in the config file
int max_err_count = 30; // Maximum number of errors to print before stopping
const int max_err_count = 30; // Maximum number of errors to print before stopping

map<string, bool> included_options;

Expand All @@ -2982,10 +3008,8 @@ bool CConfig::SetRunTime_Parsing(char case_filename[MAX_STRING_SIZE]) {
while (getline (case_file, text_line)) {

if (err_count >= max_err_count) {
errorString.append("too many errors. Stopping parse");

cout << errorString << endl;
throw(1);
errorString.append("Too many errors, stopping parse.");
break;
}

if (TokenizeString(text_line, option_name, option_value)) {
Expand Down Expand Up @@ -3207,6 +3231,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 @@ -4393,11 +4425,11 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i

if (DirectDiff != NO_DERIVATIVE) {
#ifndef CODI_FORWARD_TYPE
if (Kind_SU2 == SU2_COMPONENT::SU2_CFD) {
SU2_MPI::Error(string("SU2_CFD: Config option DIRECT_DIFF= YES requires AD or complex support!\n") +
string("Please use SU2_CFD_DIRECTDIFF (configuration/compilation is done using the preconfigure.py script)."),
CURRENT_FUNCTION);
}
if (Kind_SU2 == SU2_COMPONENT::SU2_CFD) {
SU2_MPI::Error(string("SU2_CFD: Config option DIRECT_DIFF= YES requires AD or complex support!\n") +
string("Please use SU2_CFD_DIRECTDIFF (configuration/compilation is done using the preconfigure.py script)."),
CURRENT_FUNCTION);
}
#endif
/*--- Initialize the derivative values ---*/
switch (DirectDiff) {
Expand Down Expand Up @@ -4996,9 +5028,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) {
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);

};
Loading

0 comments on commit 1e986d9

Please sign in to comment.