From 838cd964be1e048bc85296d11f942690ac0e08e2 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 31 Oct 2024 22:50:55 +0100 Subject: [PATCH 01/49] initial idea --- Common/include/CConfig.hpp | 7 +++++++ Common/src/CConfig.cpp | 2 ++ SU2_CFD/include/output/COutput.hpp | 11 +++++++--- .../output/filewriter/CParallelDataSorter.hpp | 19 +++++++++++++++++- SU2_CFD/src/output/COutput.cpp | 20 ++++++++++++++++++- .../src/output/filewriter/CSU2FileWriter.cpp | 3 ++- config_template.cfg | 3 +++ 7 files changed, 59 insertions(+), 6 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 0c32f044288..b5a595ce5c6 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -700,6 +700,7 @@ class CConfig { unsigned long StartConv_Iter; /*!< \brief Start convergence criteria at iteration. */ su2double Cauchy_Eps; /*!< \brief Epsilon used for the convergence. */ bool Restart, /*!< \brief Restart solution (for direct, adjoint, and linearized problems).*/ + Wrt_Restart_Compact, /*!< \brief Write compact restart files with minimum nr. of variables. */ Read_Binary_Restart, /*!< \brief Read binary SU2 native restart files.*/ Wrt_Restart_Overwrite, /*!< \brief Overwrite restart files or append iteration number.*/ Wrt_Surface_Overwrite, /*!< \brief Overwrite surface output files or append iteration number.*/ @@ -5490,6 +5491,12 @@ class CConfig { */ bool GetRead_Binary_Restart(void) const { return Read_Binary_Restart; } + /*! + * \brief Flag for whether restart files contain only necessary variables. + * \return Flag TRUE then the code will write compact restart files. + */ + bool GetWrt_Restart_Compact(void) const { return Wrt_Restart_Compact; } + /*! * \brief Flag for whether restart solution files are overwritten. * \return Flag for overwriting. If Flag=false, iteration nr is appended to filename diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 8a60579189c..be10298e348 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1169,6 +1169,8 @@ void CConfig::SetConfig_Options() { /*!\brief RESTART_SOL \n DESCRIPTION: Restart solution from native solution file \n Options: NO, YES \ingroup Config */ addBoolOption("RESTART_SOL", Restart, false); + /*!\brief WRT_RESTART_COMPACT \n DESCRIPTION: Minimize the size of restart files \n Options: NO, YES \ingroup Config */ + addBoolOption("WRT_RESTART_COMPACT", Wrt_Restart_Compact, true); /*!\brief BINARY_RESTART \n DESCRIPTION: Read binary SU2 native restart files. \n Options: YES, NO \ingroup Config */ addBoolOption("READ_BINARY_RESTART", Read_Binary_Restart, true); /*!\brief WRT_RESTART_OVERWRITE \n DESCRIPTION: overwrite restart files or append iteration number. \n Options: YES, NO \ingroup Config */ diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index a549a6c5541..146a2d6bc0c 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -293,6 +293,11 @@ class COutput { /*! \brief Number of requested volume field names in the config file. */ unsigned short nRequestedVolumeFields; + /*! \brief Minimum required volume fields for restart file. */ + std::vector requiredVolumeFields; + /*! \brief Minimum required volume fields for restart file. */ + unsigned short nRequiredVolumeFields; + /*----------------------------- Convergence monitoring ----------------------------*/ su2double cauchyValue, /*!< \brief Summed value of the convergence indicator. */ @@ -959,14 +964,14 @@ class COutput { /*! * \brief Sets the turboperformance screen output - * \param[in] TurboPerf - Turboperformance class + * \param[in] TurboPerf - Turboperformance class * \param[in] config - Definition of the particular problem * \param[in] TimeIter - Index of the current time-step * \param[in] OuterIter - Index of current outer iteration * \param[in] InnerIter - Index of current inner iteration */ inline virtual void SetTurboPerformance_Output(std::shared_ptr TurboPerf, CConfig *config, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter) {} - + /*! * \brief Sets the multizone turboperformacne screen output * \param[in] TurboStagePerf - Stage turboperformance class @@ -982,7 +987,7 @@ class COutput { * \param[in] config - Definition of the particular problem */ inline virtual void LoadTurboHistoryData(std::shared_ptr TurboStagePerf, std::shared_ptr TurboPerf, CConfig *config) {} - + /*! * \brief Write the kinematic and thermodynamic variables at each spanwise division * \param[in] solver - The container hold all solution data diff --git a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp index da2f6a1f3bf..fc7418c09ad 100644 --- a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp @@ -108,7 +108,8 @@ class CParallelDataSorter{ int nSends, //!< Number of sends nRecvs; //!< Number of receives - vector fieldNames; //!< Vector with names of the output fields + vector fieldNames; //!< Vector with names of the all output fields + vector requiredFieldNames; //!< Vector with names of the required output fields that we write to file unsigned short nDim; //!< Spatial dimension of the data @@ -340,6 +341,22 @@ class CParallelDataSorter{ return fieldNames; } + /*! + * \brief Get the vector containing the names of the required output fields + * \return Vector of strings containing the required field names + */ + const vector& GetRequiredFieldNames() const{ + return requiredFieldNames; + } + + /*! + * \brief Set the vector of required output fields. + * \return None. + */ + void SetRequiredFieldNames(vector req_field_names) { + requiredFieldNames = req_field_names; + } + /*! * \brief Get the spatial dimension * \return The spatial dimension diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index adc6f942145..58763f238f5 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -123,6 +123,8 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output): requestedVolumeFields.push_back(config->GetVolumeOutput_Field(iField)); } + nRequiredVolumeFields = 0; + /*--- Default is to write history to file and screen --- */ noWriting = false; @@ -430,6 +432,9 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form if (!config->GetWrt_Restart_Overwrite()) filename_iter = config->GetFilename_Iter(fileName, curInnerIter, curOuterIter); + volumeDataSorter->SetRequiredFieldNames(requiredVolumeFields); + + LogOutputFiles("SU2 ASCII restart"); fileWriter = new CSU2FileWriter(volumeDataSorter); @@ -836,6 +841,7 @@ bool COutput::SetResultFiles(CGeometry *geometry, CConfig *config, CSolver** sol /*--- Loop through all requested output files and write * the partitioned and sorted data stored in the data sorters. ---*/ + WriteToFile(config, geometry, VolumeFiles[iFile]); /*--- Write any additonal files defined in the child class ----*/ @@ -1513,6 +1519,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ requestedVolumeFields.emplace_back("COORDINATES"); nRequestedVolumeFields++; } + auto itSol = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "SOLUTION"); if (itSol == requestedVolumeFields.end()){ @@ -1520,6 +1527,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ nRequestedVolumeFields++; } + nVolumeFields = 0; string RequestedField; @@ -1548,13 +1556,23 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ Field.offset = nVolumeFields; volumeFieldNames.push_back(Field.fieldName); nVolumeFields++; - FoundField[iReqField] = true; + + /*--- If we want compact solution, then required field contains only SOLUTION and COORDINATES, + else the required fields is all requested fields. ---*/ + if ( ((config->GetWrt_Restart_Compact() == true) && + ((Field.outputGroup == "SOLUTION") || (Field.outputGroup == "COORDINATES"))) || + (config->GetWrt_Restart_Compact() == false) + ) { + requiredVolumeFields.push_back(Field.fieldName); + nRequiredVolumeFields++; + } } } } } + for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ if (!FoundField[iReqField]){ FieldsToRemove.push_back(requestedVolumeFields[iReqField]); diff --git a/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp b/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp index 4c04cf0e70d..ff498b1d357 100644 --- a/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp @@ -35,7 +35,8 @@ CSU2FileWriter::CSU2FileWriter(CParallelDataSorter *valDataSorter) : void CSU2FileWriter::WriteData(string val_filename){ ofstream restart_file; - const vector fieldNames = dataSorter->GetFieldNames(); + const vector fieldNames = dataSorter->GetRequiredFieldNames(); + /*--- We append the pre-defined suffix (extension) to the filename (prefix) ---*/ val_filename.append(fileExt); diff --git a/config_template.cfg b/config_template.cfg index 8a953b7be78..c28d1ed40de 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -60,6 +60,9 @@ GRAVITY_FORCE= NO % Restart solution (NO, YES) RESTART_SOL= NO % +% Only save minimum required variables for restart to minimize the restart file size. +WRT_RESTART_COMPACT= YES +% % Discard the data storaged in the solution and geometry files % e.g. AOA, dCL/dAoA, dCD/dCL, iter, etc. % Note that AoA in the solution and geometry files is critical From 4fdc8b425cecbe8d42b78ab5339ab590f6f0c77e Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 31 Oct 2024 22:58:59 +0100 Subject: [PATCH 02/49] do not write SOLUTION by default --- SU2_CFD/src/output/COutput.cpp | 3 ++- SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 58763f238f5..9c1bb808b28 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1520,13 +1520,14 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ nRequestedVolumeFields++; } + /* auto itSol = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "SOLUTION"); if (itSol == requestedVolumeFields.end()){ requestedVolumeFields.emplace_back("SOLUTION"); nRequestedVolumeFields++; } - + */ nVolumeFields = 0; diff --git a/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp b/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp index 8e7a869f1bf..fb8c660c740 100644 --- a/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp @@ -41,7 +41,7 @@ void CSU2BinaryFileWriter::WriteData(string val_filename){ unsigned short iVar; - const vector& fieldNames = dataSorter->GetFieldNames(); + const vector& fieldNames = dataSorter->GetRequiredFieldNames(); unsigned short nVar = fieldNames.size(); unsigned long nParallel_Poin = dataSorter->GetnPoints(); unsigned long nPoint_Global = dataSorter->GetnPointsGlobal(); From de9ce794c3d9ea7caf299aee38e5b07411edeb1c Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 31 Oct 2024 23:22:51 +0100 Subject: [PATCH 03/49] small cleanup --- .../include/output/filewriter/CParallelDataSorter.hpp | 2 +- SU2_CFD/src/output/COutput.cpp | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp index fc7418c09ad..cfe7929b69f 100644 --- a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp @@ -108,7 +108,7 @@ class CParallelDataSorter{ int nSends, //!< Number of sends nRecvs; //!< Number of receives - vector fieldNames; //!< Vector with names of the all output fields + vector fieldNames; //!< Vector with names of all the output fields vector requiredFieldNames; //!< Vector with names of the required output fields that we write to file unsigned short nDim; //!< Spatial dimension of the data diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 9c1bb808b28..fd8045365de 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -841,7 +841,6 @@ bool COutput::SetResultFiles(CGeometry *geometry, CConfig *config, CSolver** sol /*--- Loop through all requested output files and write * the partitioned and sorted data stored in the data sorters. ---*/ - WriteToFile(config, geometry, VolumeFiles[iFile]); /*--- Write any additonal files defined in the child class ----*/ @@ -1520,15 +1519,6 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ nRequestedVolumeFields++; } - /* - auto itSol = std::find(requestedVolumeFields.begin(), - requestedVolumeFields.end(), "SOLUTION"); - if (itSol == requestedVolumeFields.end()){ - requestedVolumeFields.emplace_back("SOLUTION"); - nRequestedVolumeFields++; - } - */ - nVolumeFields = 0; string RequestedField; From 2992d7cb38a84b02cdb28bbcff4e22446fcd4839 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 1 Nov 2024 09:15:02 +0100 Subject: [PATCH 04/49] change default to false --- Common/src/CConfig.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index be10298e348..1af4a36b1f1 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1170,7 +1170,7 @@ void CConfig::SetConfig_Options() { /*!\brief RESTART_SOL \n DESCRIPTION: Restart solution from native solution file \n Options: NO, YES \ingroup Config */ addBoolOption("RESTART_SOL", Restart, false); /*!\brief WRT_RESTART_COMPACT \n DESCRIPTION: Minimize the size of restart files \n Options: NO, YES \ingroup Config */ - addBoolOption("WRT_RESTART_COMPACT", Wrt_Restart_Compact, true); + addBoolOption("WRT_RESTART_COMPACT", Wrt_Restart_Compact, false); /*!\brief BINARY_RESTART \n DESCRIPTION: Read binary SU2 native restart files. \n Options: YES, NO \ingroup Config */ addBoolOption("READ_BINARY_RESTART", Read_Binary_Restart, true); /*!\brief WRT_RESTART_OVERWRITE \n DESCRIPTION: overwrite restart files or append iteration number. \n Options: YES, NO \ingroup Config */ From af2fd4f7f87667fe63ae4898d7d47ba7fa18ac6a Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 6 Nov 2024 11:29:49 +0100 Subject: [PATCH 05/49] fixed --- SU2_CFD/include/output/COutput.hpp | 7 ++- SU2_CFD/src/output/COutput.cpp | 74 +++++++++++++++++++++--------- 2 files changed, 57 insertions(+), 24 deletions(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 146a2d6bc0c..55e335be036 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -247,6 +247,9 @@ class COutput { vector volumeFieldNames; //!< Vector containing the volume field names unsigned short nVolumeFields; //!< Number of fields in the volume output + vector requiredVolumeFieldNames; //!< Vector containing the minimum required volume field names. + //unsigned short nrequiredVolumeFields; //!< Number of fields in the minimum required volume output. + string volumeFilename, //!< Volume output filename surfaceFilename, //!< Surface output filename restartFilename; //!< Restart output filename @@ -294,9 +297,9 @@ class COutput { unsigned short nRequestedVolumeFields; /*! \brief Minimum required volume fields for restart file. */ - std::vector requiredVolumeFields; + std::vector requiredVolumeFields = {"COORDINATES", "SOLUTION"}; /*! \brief Minimum required volume fields for restart file. */ - unsigned short nRequiredVolumeFields; + unsigned short nRequiredVolumeFields = 2; /*----------------------------- Convergence monitoring ----------------------------*/ diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index fd8045365de..5d9b83eebe7 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -123,7 +123,7 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output): requestedVolumeFields.push_back(config->GetVolumeOutput_Field(iField)); } - nRequiredVolumeFields = 0; + //nRequiredVolumeFields = 0; /*--- Default is to write history to file and screen --- */ @@ -432,8 +432,12 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form if (!config->GetWrt_Restart_Overwrite()) filename_iter = config->GetFilename_Iter(fileName, curInnerIter, curOuterIter); - volumeDataSorter->SetRequiredFieldNames(requiredVolumeFields); + /*--- If we have compact restarts, we use only the required fields. ---*/ + if (config->GetWrt_Restart_Compact() == true) + volumeDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); + else + volumeDataSorter->SetRequiredFieldNames(volumeDataSorter->GetFieldNames()); LogOutputFiles("SU2 ASCII restart"); fileWriter = new CSU2FileWriter(volumeDataSorter); @@ -450,6 +454,12 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form if (!config->GetWrt_Restart_Overwrite()) filename_iter = config->GetFilename_Iter(fileName, curInnerIter, curOuterIter); + /*--- If we have compact restarts, we use only the required fields. ---*/ + if (config->GetWrt_Restart_Compact() == true) + volumeDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); + else + volumeDataSorter->SetRequiredFieldNames(volumeDataSorter->GetFieldNames()); + LogOutputFiles("SU2 binary restart"); fileWriter = new CSU2BinaryFileWriter(volumeDataSorter); @@ -1509,61 +1519,81 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ SetVolumeOutputFields(config); - /*---Coordinates and solution groups must be always in the output. - * If they are not requested, add them here. ---*/ + /*--- Coordinates must be always in the output. + * If they are not requested, add them here. + * SOLUTION is only required for restart files. ---*/ auto itCoord = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "COORDINATES"); - if (itCoord == requestedVolumeFields.end()){ + if (itCoord == requestedVolumeFields.end()) { requestedVolumeFields.emplace_back("COORDINATES"); nRequestedVolumeFields++; } + /*--- If no volume fields were requested, we add the entire SOLUTION field. + * We also add the solution field if we are not using the compact formulation. + This is for backwards compatibility. ---*/ + if ((config->GetWrt_Restart_Compact() == false) || (nRequestedVolumeFields == 1)) { + requestedVolumeFields.emplace_back("SOLUTION"); + nRequestedVolumeFields++; + } + nVolumeFields = 0; string RequestedField; + string RequiredField; std::vector FoundField(nRequestedVolumeFields, false); vector FieldsToRemove; /*--- Loop through all fields defined in the corresponding SetVolumeOutputFields(). - * If it is also defined in the config (either as part of a group or a single field), the field - * object gets an offset so that we know where to find the data in the Local_Data() array. - * Note that the default offset is -1. An index !=-1 defines this field as part of the output. ---*/ + * If it is also defined in the config (either as part of a group or a single field), the field + * object gets an offset so that we know where to find the data in the Local_Data() array. + * Note that the default offset is -1. An index !=-1 defines this field as part of the output. ---*/ + + for (unsigned short iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { + + const string &fieldReference1 = volumeOutput_List[iField_Output]; + if (volumeOutput_Map.count(fieldReference1) > 0) { + + VolumeOutputField &Field1 = volumeOutput_Map.at(fieldReference1); + /*--- Loop through all fields specified in the config ---*/ + for (unsigned short iReqField = 0; iReqField < nRequiredVolumeFields; iReqField++) { + + RequiredField = requiredVolumeFields[iReqField]; + if (((RequiredField == Field1.outputGroup) || (RequiredField == fieldReference1)) && (Field1.offset == -1)) { + requiredVolumeFieldNames.push_back(Field1.fieldName); + } + } + } + } + nVolumeFields = 0; - for (unsigned short iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++){ + for (unsigned short iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { const string &fieldReference = volumeOutput_List[iField_Output]; if (volumeOutput_Map.count(fieldReference) > 0){ VolumeOutputField &Field = volumeOutput_Map.at(fieldReference); /*--- Loop through all fields specified in the config ---*/ - - for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ + for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++) { RequestedField = requestedVolumeFields[iReqField]; + if (((RequestedField == Field.outputGroup) || (RequestedField == fieldReference)) && (Field.offset == -1)) { - if (((RequestedField == Field.outputGroup) || (RequestedField == fieldReference)) && (Field.offset == -1)){ Field.offset = nVolumeFields; volumeFieldNames.push_back(Field.fieldName); nVolumeFields++; FoundField[iReqField] = true; - - /*--- If we want compact solution, then required field contains only SOLUTION and COORDINATES, - else the required fields is all requested fields. ---*/ - if ( ((config->GetWrt_Restart_Compact() == true) && - ((Field.outputGroup == "SOLUTION") || (Field.outputGroup == "COORDINATES"))) || - (config->GetWrt_Restart_Compact() == false) - ) { - requiredVolumeFields.push_back(Field.fieldName); - nRequiredVolumeFields++; - } } } } } + + + for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ if (!FoundField[iReqField]){ FieldsToRemove.push_back(requestedVolumeFields[iReqField]); From 1f4390238e074d684fed304e5390e002ccad824f Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 6 Nov 2024 11:39:25 +0100 Subject: [PATCH 06/49] cleanup --- SU2_CFD/include/output/COutput.hpp | 1 - SU2_CFD/src/output/COutput.cpp | 11 +++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 55e335be036..9d3d9685a98 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -248,7 +248,6 @@ class COutput { unsigned short nVolumeFields; //!< Number of fields in the volume output vector requiredVolumeFieldNames; //!< Vector containing the minimum required volume field names. - //unsigned short nrequiredVolumeFields; //!< Number of fields in the minimum required volume output. string volumeFilename, //!< Volume output filename surfaceFilename, //!< Surface output filename diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 5d9b83eebe7..94a359142a9 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -123,8 +123,6 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output): requestedVolumeFields.push_back(config->GetVolumeOutput_Field(iField)); } - //nRequiredVolumeFields = 0; - /*--- Default is to write history to file and screen --- */ noWriting = false; @@ -1521,7 +1519,6 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ /*--- Coordinates must be always in the output. * If they are not requested, add them here. - * SOLUTION is only required for restart files. ---*/ auto itCoord = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "COORDINATES"); @@ -1532,7 +1529,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ /*--- If no volume fields were requested, we add the entire SOLUTION field. * We also add the solution field if we are not using the compact formulation. - This is for backwards compatibility. ---*/ + * This is for backwards compatibility. ---*/ if ((config->GetWrt_Restart_Compact() == false) || (nRequestedVolumeFields == 1)) { requestedVolumeFields.emplace_back("SOLUTION"); nRequestedVolumeFields++; @@ -1576,9 +1573,11 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ VolumeOutputField &Field = volumeOutput_Map.at(fieldReference); /*--- Loop through all fields specified in the config ---*/ + for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++) { RequestedField = requestedVolumeFields[iReqField]; + if (((RequestedField == Field.outputGroup) || (RequestedField == fieldReference)) && (Field.offset == -1)) { Field.offset = nVolumeFields; @@ -1590,10 +1589,6 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ } } - - - - for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ if (!FoundField[iReqField]){ FieldsToRemove.push_back(requestedVolumeFields[iReqField]); From f9687803e7bae8e0197c8d94ad4b6746ced674c4 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 6 Nov 2024 11:48:00 +0100 Subject: [PATCH 07/49] variable renaming --- SU2_CFD/src/output/COutput.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 94a359142a9..bebf54cef5e 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1550,16 +1550,16 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ for (unsigned short iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { - const string &fieldReference1 = volumeOutput_List[iField_Output]; - if (volumeOutput_Map.count(fieldReference1) > 0) { + const string &fieldReference = volumeOutput_List[iField_Output]; + if (volumeOutput_Map.count(fieldReference) > 0) { - VolumeOutputField &Field1 = volumeOutput_Map.at(fieldReference1); + VolumeOutputField &Field = volumeOutput_Map.at(fieldReference); /*--- Loop through all fields specified in the config ---*/ for (unsigned short iReqField = 0; iReqField < nRequiredVolumeFields; iReqField++) { RequiredField = requiredVolumeFields[iReqField]; - if (((RequiredField == Field1.outputGroup) || (RequiredField == fieldReference1)) && (Field1.offset == -1)) { - requiredVolumeFieldNames.push_back(Field1.fieldName); + if (((RequiredField == Field.outputGroup) || (RequiredField == fieldReference)) && (Field.offset == -1)) { + requiredVolumeFieldNames.push_back(Field.fieldName); } } } From ecfca082d9c6bbe714eb84916a5c1631e571fccc Mon Sep 17 00:00:00 2001 From: Nijso Date: Wed, 20 Nov 2024 23:02:37 +0100 Subject: [PATCH 08/49] Fix code scanning alert no. 625: Comparison of narrow type with wide type in loop condition Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- SU2_CFD/src/output/COutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index bebf54cef5e..f35624b7630 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1548,7 +1548,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ * object gets an offset so that we know where to find the data in the Local_Data() array. * Note that the default offset is -1. An index !=-1 defines this field as part of the output. ---*/ - for (unsigned short iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { + for (size_t iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { const string &fieldReference = volumeOutput_List[iField_Output]; if (volumeOutput_Map.count(fieldReference) > 0) { From 202cc3c006ef6a84ec116aed663373e6419c181c Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 21 Nov 2024 15:27:02 +0100 Subject: [PATCH 09/49] include surface csv --- SU2_CFD/src/output/COutput.cpp | 7 +++++++ config_template.cfg | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index f35624b7630..86684bf66d4 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -412,6 +412,13 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form if (!config->GetWrt_Surface_Overwrite()) filename_iter = config->GetFilename_Iter(fileName, curInnerIter, curOuterIter); + /*--- If we have compact restarts, we use only the required fields. ---*/ + if (config->GetWrt_Restart_Compact() == true) + surfaceDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); + else + surfaceDataSorter->SetRequiredFieldNames(surfaceDataSorter->GetFieldNames()); + + surfaceDataSorter->SortConnectivity(config, geometry); surfaceDataSorter->SortOutputData(); diff --git a/config_template.cfg b/config_template.cfg index c28d1ed40de..f21ced6fd46 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -61,7 +61,7 @@ GRAVITY_FORCE= NO RESTART_SOL= NO % % Only save minimum required variables for restart to minimize the restart file size. -WRT_RESTART_COMPACT= YES +WRT_RESTART_COMPACT= NO % % Discard the data storaged in the solution and geometry files % e.g. AOA, dCL/dAoA, dCD/dCL, iter, etc. From 8fbc8258e542ac25e7b9f044cbb02286c49b50b2 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 21 Nov 2024 15:35:32 +0100 Subject: [PATCH 10/49] change to size_t --- SU2_CFD/src/output/COutput.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 86684bf66d4..2d82b1fecf0 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1573,7 +1573,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ } nVolumeFields = 0; - for (unsigned short iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { + for (size_t iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { const string &fieldReference = volumeOutput_List[iField_Output]; if (volumeOutput_Map.count(fieldReference) > 0){ @@ -1596,7 +1596,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ } } - for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ + for (size_t iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ if (!FoundField[iReqField]){ FieldsToRemove.push_back(requestedVolumeFields[iReqField]); } @@ -1604,7 +1604,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ /*--- Remove fields which are not defined --- */ - for (unsigned short iReqField = 0; iReqField < FieldsToRemove.size(); iReqField++){ + for (size_t iReqField = 0; iReqField < FieldsToRemove.size(); iReqField++){ if (rank == MASTER_NODE) { if (iReqField == 0){ cout << " Info: Ignoring the following volume output fields/groups:" << endl; From 9307d7d645127d6e7bb9e8447c3f33380dfe34e7 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 21 Nov 2024 15:49:10 +0100 Subject: [PATCH 11/49] remove variable --- SU2_CFD/include/output/COutput.hpp | 1 - SU2_CFD/src/output/COutput.cpp | 15 ++++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 9d3d9685a98..0f5dddf43e3 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -245,7 +245,6 @@ class COutput { CParallelDataSorter* surfaceDataSorter; //!< Surface data sorter vector volumeFieldNames; //!< Vector containing the volume field names - unsigned short nVolumeFields; //!< Number of fields in the volume output vector requiredVolumeFieldNames; //!< Vector containing the minimum required volume field names. diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 2d82b1fecf0..ac0d893ae96 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1542,9 +1542,6 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ nRequestedVolumeFields++; } - nVolumeFields = 0; - - string RequestedField; string RequiredField; std::vector FoundField(nRequestedVolumeFields, false); vector FieldsToRemove; @@ -1562,7 +1559,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ VolumeOutputField &Field = volumeOutput_Map.at(fieldReference); /*--- Loop through all fields specified in the config ---*/ - for (unsigned short iReqField = 0; iReqField < nRequiredVolumeFields; iReqField++) { + for (size_t iReqField = 0; iReqField < nRequiredVolumeFields; iReqField++) { RequiredField = requiredVolumeFields[iReqField]; if (((RequiredField == Field.outputGroup) || (RequiredField == fieldReference)) && (Field.offset == -1)) { @@ -1571,7 +1568,8 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ } } } - nVolumeFields = 0; + + unsigned short nVolumeFields = 0; for (size_t iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { @@ -1581,9 +1579,9 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ /*--- Loop through all fields specified in the config ---*/ - for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++) { + for (size_t iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++) { - RequestedField = requestedVolumeFields[iReqField]; + const string &RequestedField = requestedVolumeFields[iReqField]; if (((RequestedField == Field.outputGroup) || (RequestedField == fieldReference)) && (Field.offset == -1)) { @@ -1625,8 +1623,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ if (rank == MASTER_NODE){ cout <<"Volume output fields: "; - for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ - RequestedField = requestedVolumeFields[iReqField]; + for (size_t iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ cout << requestedVolumeFields[iReqField]; if (iReqField != nRequestedVolumeFields - 1) cout << ", "; } From 3db06276c65dcf115bcdc5257b5121c112e1385a Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 21 Nov 2024 22:41:36 +0100 Subject: [PATCH 12/49] change to size_t --- SU2_CFD/src/output/COutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index ac0d893ae96..321054a8083 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1623,7 +1623,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ if (rank == MASTER_NODE){ cout <<"Volume output fields: "; - for (size_t iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ + for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ cout << requestedVolumeFields[iReqField]; if (iReqField != nRequestedVolumeFields - 1) cout << ", "; } From 4c2ba55f52ede40a5ce766d0c7aec7d34ce61d01 Mon Sep 17 00:00:00 2001 From: Nijso Date: Mon, 25 Nov 2024 08:00:31 +0100 Subject: [PATCH 13/49] Update SU2_CFD/src/output/COutput.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/output/COutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 321054a8083..be2b9b848c3 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -413,7 +413,7 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form filename_iter = config->GetFilename_Iter(fileName, curInnerIter, curOuterIter); /*--- If we have compact restarts, we use only the required fields. ---*/ - if (config->GetWrt_Restart_Compact() == true) + if (config->GetWrt_Restart_Compact()) surfaceDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); else surfaceDataSorter->SetRequiredFieldNames(surfaceDataSorter->GetFieldNames()); From fb8e8956ed14d373eef55f11335f73efc0e888d3 Mon Sep 17 00:00:00 2001 From: Nijso Date: Mon, 25 Nov 2024 08:00:39 +0100 Subject: [PATCH 14/49] Update SU2_CFD/src/output/COutput.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/output/COutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index be2b9b848c3..974447e4e13 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -439,7 +439,7 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form /*--- If we have compact restarts, we use only the required fields. ---*/ - if (config->GetWrt_Restart_Compact() == true) + if (config->GetWrt_Restart_Compact()) volumeDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); else volumeDataSorter->SetRequiredFieldNames(volumeDataSorter->GetFieldNames()); From 6dc6724a48a328ae2f08cd61dce3e0186c3f999c Mon Sep 17 00:00:00 2001 From: Nijso Date: Mon, 25 Nov 2024 08:00:48 +0100 Subject: [PATCH 15/49] Update SU2_CFD/src/output/COutput.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/output/COutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 974447e4e13..d98933d24e6 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -460,7 +460,7 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form filename_iter = config->GetFilename_Iter(fileName, curInnerIter, curOuterIter); /*--- If we have compact restarts, we use only the required fields. ---*/ - if (config->GetWrt_Restart_Compact() == true) + if (config->GetWrt_Restart_Compact()) volumeDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); else volumeDataSorter->SetRequiredFieldNames(volumeDataSorter->GetFieldNames()); From bb0a5685eae91f024e6e1589190083d8e3ef0853 Mon Sep 17 00:00:00 2001 From: Nijso Date: Mon, 25 Nov 2024 08:00:55 +0100 Subject: [PATCH 16/49] Update Common/src/CConfig.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- Common/src/CConfig.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index b5f6bc05194..31f29697aee 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1170,7 +1170,7 @@ void CConfig::SetConfig_Options() { /*!\brief RESTART_SOL \n DESCRIPTION: Restart solution from native solution file \n Options: NO, YES \ingroup Config */ addBoolOption("RESTART_SOL", Restart, false); /*!\brief WRT_RESTART_COMPACT \n DESCRIPTION: Minimize the size of restart files \n Options: NO, YES \ingroup Config */ - addBoolOption("WRT_RESTART_COMPACT", Wrt_Restart_Compact, false); + addBoolOption("WRT_RESTART_COMPACT", Wrt_Restart_Compact, true); /*!\brief BINARY_RESTART \n DESCRIPTION: Read binary SU2 native restart files. \n Options: YES, NO \ingroup Config */ addBoolOption("READ_BINARY_RESTART", Read_Binary_Restart, true); /*!\brief WRT_RESTART_OVERWRITE \n DESCRIPTION: overwrite restart files or append iteration number. \n Options: YES, NO \ingroup Config */ From a5d27b3aaa34c8bffe542303a1d979b57f8b86da Mon Sep 17 00:00:00 2001 From: Nijso Date: Mon, 25 Nov 2024 08:01:02 +0100 Subject: [PATCH 17/49] Update config_template.cfg Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- config_template.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_template.cfg b/config_template.cfg index f21ced6fd46..c28d1ed40de 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -61,7 +61,7 @@ GRAVITY_FORCE= NO RESTART_SOL= NO % % Only save minimum required variables for restart to minimize the restart file size. -WRT_RESTART_COMPACT= NO +WRT_RESTART_COMPACT= YES % % Discard the data storaged in the solution and geometry files % e.g. AOA, dCL/dAoA, dCD/dCL, iter, etc. From b18b92db2ce775f24ab20a05ceb922e576a35430 Mon Sep 17 00:00:00 2001 From: Nijso Date: Mon, 25 Nov 2024 08:01:09 +0100 Subject: [PATCH 18/49] Update SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp index cfe7929b69f..4882165a770 100644 --- a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp @@ -353,7 +353,7 @@ class CParallelDataSorter{ * \brief Set the vector of required output fields. * \return None. */ - void SetRequiredFieldNames(vector req_field_names) { + void SetRequiredFieldNames(const vector& req_field_names) { requiredFieldNames = req_field_names; } From b6f23c3c701d0d35533c6f8e5caecc3e8648c51a Mon Sep 17 00:00:00 2001 From: Nijso Date: Mon, 25 Nov 2024 08:04:33 +0100 Subject: [PATCH 19/49] Update SU2_CFD/include/output/COutput.hpp --- SU2_CFD/include/output/COutput.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 0f5dddf43e3..1d34312ce00 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -295,7 +295,7 @@ class COutput { unsigned short nRequestedVolumeFields; /*! \brief Minimum required volume fields for restart file. */ - std::vector requiredVolumeFields = {"COORDINATES", "SOLUTION"}; + std::vector requiredVolumeFields = {"COORDINATES", "SOLUTION", "GRID_VELOCITY"}; /*! \brief Minimum required volume fields for restart file. */ unsigned short nRequiredVolumeFields = 2; From c5a6c5e28d09ff74b7579573ae5153d107d7ec27 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 27 Nov 2024 00:34:05 +0100 Subject: [PATCH 20/49] introduce COMPACT keyword --- SU2_CFD/include/output/COutput.hpp | 2 +- SU2_CFD/src/output/COutput.cpp | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 1d34312ce00..710f7df9dd6 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -297,7 +297,7 @@ class COutput { /*! \brief Minimum required volume fields for restart file. */ std::vector requiredVolumeFields = {"COORDINATES", "SOLUTION", "GRID_VELOCITY"}; /*! \brief Minimum required volume fields for restart file. */ - unsigned short nRequiredVolumeFields = 2; + unsigned short nRequiredVolumeFields = requiredVolumeFields.size(); /*----------------------------- Convergence monitoring ----------------------------*/ diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index d98933d24e6..e8144363127 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -414,9 +414,9 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form /*--- If we have compact restarts, we use only the required fields. ---*/ if (config->GetWrt_Restart_Compact()) - surfaceDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); - else surfaceDataSorter->SetRequiredFieldNames(surfaceDataSorter->GetFieldNames()); + else + surfaceDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); surfaceDataSorter->SortConnectivity(config, geometry); @@ -1537,16 +1537,21 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ /*--- If no volume fields were requested, we add the entire SOLUTION field. * We also add the solution field if we are not using the compact formulation. * This is for backwards compatibility. ---*/ - if ((config->GetWrt_Restart_Compact() == false) || (nRequestedVolumeFields == 1)) { - requestedVolumeFields.emplace_back("SOLUTION"); - nRequestedVolumeFields++; + itCoord = std::find(requestedVolumeFields.begin(), + requestedVolumeFields.end(), "SOLUTION"); + if (itCoord == requestedVolumeFields.end()) { + auto itCoordCompact = std::find(requestedVolumeFields.begin(), + requestedVolumeFields.end(), "COMPACT"); + if (itCoordCompact == requestedVolumeFields.end()) { + requestedVolumeFields.emplace_back("SOLUTION"); + nRequestedVolumeFields++; + } } string RequiredField; std::vector FoundField(nRequestedVolumeFields, false); vector FieldsToRemove; - /*--- Loop through all fields defined in the corresponding SetVolumeOutputFields(). * If it is also defined in the config (either as part of a group or a single field), the field * object gets an offset so that we know where to find the data in the Local_Data() array. @@ -1555,6 +1560,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ for (size_t iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { const string &fieldReference = volumeOutput_List[iField_Output]; + if (volumeOutput_Map.count(fieldReference) > 0) { VolumeOutputField &Field = volumeOutput_Map.at(fieldReference); @@ -2452,7 +2458,7 @@ void COutput::PrintVolumeFields(){ } cout << "Available volume output fields for the current configuration in " << multiZoneHeaderString << ":" << endl; - cout << "Note: COORDINATES and SOLUTION groups are always in the volume output." << endl; + cout << "Note: COORDINATES and SOLUTION groups are always in the volume output unless WRT_COMPACT_RESTART=YES." << endl; VolumeFieldTable.AddColumn("Name", NameSize); VolumeFieldTable.AddColumn("Group Name", GroupSize); VolumeFieldTable.AddColumn("Description", DescrSize); From 8cd04b00c6f9c7ec589711efa0fb9b7c7b6efc35 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 27 Nov 2024 00:38:45 +0100 Subject: [PATCH 21/49] update dry-run text --- SU2_CFD/src/output/COutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index e8144363127..eeb2174961c 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -2458,7 +2458,7 @@ void COutput::PrintVolumeFields(){ } cout << "Available volume output fields for the current configuration in " << multiZoneHeaderString << ":" << endl; - cout << "Note: COORDINATES and SOLUTION groups are always in the volume output unless WRT_COMPACT_RESTART=YES." << endl; + cout << "Note: COORDINATES and SOLUTION groups are always in the volume output unless you add the keyword COMPACT." << endl; VolumeFieldTable.AddColumn("Name", NameSize); VolumeFieldTable.AddColumn("Group Name", GroupSize); VolumeFieldTable.AddColumn("Description", DescrSize); From 4d6f92e019263cf5bce65374c7d7b17b24123db8 Mon Sep 17 00:00:00 2001 From: Nijso Date: Wed, 27 Nov 2024 07:24:30 +0100 Subject: [PATCH 22/49] Update SU2_CFD/include/output/COutput.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/include/output/COutput.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 710f7df9dd6..726b170b7d7 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -295,9 +295,7 @@ class COutput { unsigned short nRequestedVolumeFields; /*! \brief Minimum required volume fields for restart file. */ - std::vector requiredVolumeFields = {"COORDINATES", "SOLUTION", "GRID_VELOCITY"}; - /*! \brief Minimum required volume fields for restart file. */ - unsigned short nRequiredVolumeFields = requiredVolumeFields.size(); + const std::vector restartVolumeFields = {"COORDINATES", "SOLUTION", "GRID_VELOCITY"}; /*----------------------------- Convergence monitoring ----------------------------*/ From 1ba790c737a9e967e5e7f3d74bdf43070853b156 Mon Sep 17 00:00:00 2001 From: Nijso Date: Wed, 27 Nov 2024 07:24:46 +0100 Subject: [PATCH 23/49] Update SU2_CFD/src/output/COutput.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/output/COutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index eeb2174961c..7525f430706 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1565,7 +1565,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ VolumeOutputField &Field = volumeOutput_Map.at(fieldReference); /*--- Loop through all fields specified in the config ---*/ - for (size_t iReqField = 0; iReqField < nRequiredVolumeFields; iReqField++) { + for (size_t iReqField = 0; iReqField < requiredVolumeFields.size(); iReqField++) { RequiredField = requiredVolumeFields[iReqField]; if (((RequiredField == Field.outputGroup) || (RequiredField == fieldReference)) && (Field.offset == -1)) { From d9ec9931add7196e3a91ab8f8da2df27927cff56 Mon Sep 17 00:00:00 2001 From: Nijso Date: Wed, 27 Nov 2024 07:24:59 +0100 Subject: [PATCH 24/49] Update SU2_CFD/src/output/COutput.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/output/COutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 7525f430706..05b07d71c38 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1540,7 +1540,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ itCoord = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "SOLUTION"); if (itCoord == requestedVolumeFields.end()) { - auto itCoordCompact = std::find(requestedVolumeFields.begin(), + auto itCompact = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "COMPACT"); if (itCoordCompact == requestedVolumeFields.end()) { requestedVolumeFields.emplace_back("SOLUTION"); From e48c22a61be0c5d125631edcdb2d800cb55337ae Mon Sep 17 00:00:00 2001 From: Nijso Date: Wed, 27 Nov 2024 07:25:09 +0100 Subject: [PATCH 25/49] Update SU2_CFD/src/output/COutput.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/output/COutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 05b07d71c38..c95d90a992f 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1537,7 +1537,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ /*--- If no volume fields were requested, we add the entire SOLUTION field. * We also add the solution field if we are not using the compact formulation. * This is for backwards compatibility. ---*/ - itCoord = std::find(requestedVolumeFields.begin(), + auto itSol = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "SOLUTION"); if (itCoord == requestedVolumeFields.end()) { auto itCompact = std::find(requestedVolumeFields.begin(), From 6e6c70e0227d4c47e0625a11082a67d4e272edbf Mon Sep 17 00:00:00 2001 From: Nijso Date: Wed, 27 Nov 2024 07:25:25 +0100 Subject: [PATCH 26/49] Update SU2_CFD/src/output/COutput.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/output/COutput.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index c95d90a992f..9602c5bfb85 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1525,8 +1525,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ SetVolumeOutputFields(config); /*--- Coordinates must be always in the output. - * If they are not requested, add them here. - * SOLUTION is only required for restart files. ---*/ + * If they are not requested, add them here. ---*/ auto itCoord = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "COORDINATES"); if (itCoord == requestedVolumeFields.end()) { From 9134d8b1edf19b21c926792b1f8f7f5e65f58f6a Mon Sep 17 00:00:00 2001 From: Nijso Date: Wed, 27 Nov 2024 07:25:41 +0100 Subject: [PATCH 27/49] Update SU2_CFD/src/output/COutput.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/output/COutput.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 9602c5bfb85..c0f9756affa 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1533,9 +1533,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ nRequestedVolumeFields++; } - /*--- If no volume fields were requested, we add the entire SOLUTION field. - * We also add the solution field if we are not using the compact formulation. - * This is for backwards compatibility. ---*/ + /*--- Add the solution if it was not requested for backwards compatibility, unless the COMPACT keyword was used to request exclusively the specified fields. ---*/ auto itSol = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "SOLUTION"); if (itCoord == requestedVolumeFields.end()) { From 1a0aef878a28ee1838bcabdee07f67c1c04155d0 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 27 Nov 2024 07:34:00 +0100 Subject: [PATCH 28/49] add better config_template description --- config_template.cfg | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config_template.cfg b/config_template.cfg index c28d1ed40de..d75f8932cef 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -51,7 +51,7 @@ KIND_VERIFICATION_SOLUTION= NO_VERIFICATION_SOLUTION % Defaults to DISCRETE_ADJOINT for the SU2_*_AD codes, and to DIRECT otherwise. MATH_PROBLEM= DIRECT % -% Axisymmetric simulation, only compressible flows (NO, YES) +% Axisymmetric simulation for 2D problems. (NO, YES) AXISYMMETRIC= NO % % Gravity force @@ -60,7 +60,10 @@ GRAVITY_FORCE= NO % Restart solution (NO, YES) RESTART_SOL= NO % -% Only save minimum required variables for restart to minimize the restart file size. +% Only save minimum required variables to restart files (NO, YES). +% If this option is set to NO, then the SOLUTION fields will be written to all output +% files by default. If you would also like to have minimum output files +% (e.g. paraview, tecplot), then add the keyword COMPACT to VOLUME_OUTPUT. WRT_RESTART_COMPACT= YES % % Discard the data storaged in the solution and geometry files From da4c87e4787dde717d04c850ec4146dd5631c88a Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 27 Nov 2024 08:15:47 +0100 Subject: [PATCH 29/49] update variable name --- SU2_CFD/src/output/COutput.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index c0f9756affa..d3dc4cc64cb 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1562,9 +1562,9 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ VolumeOutputField &Field = volumeOutput_Map.at(fieldReference); /*--- Loop through all fields specified in the config ---*/ - for (size_t iReqField = 0; iReqField < requiredVolumeFields.size(); iReqField++) { + for (size_t iReqField = 0; iReqField < restartVolumeFields.size(); iReqField++) { - RequiredField = requiredVolumeFields[iReqField]; + RequiredField = restartVolumeFields[iReqField]; if (((RequiredField == Field.outputGroup) || (RequiredField == fieldReference)) && (Field.offset == -1)) { requiredVolumeFieldNames.push_back(Field.fieldName); } From d54eb64abd83dc309431a8d6d3911a30c7fc4607 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 27 Nov 2024 08:34:00 +0100 Subject: [PATCH 30/49] update variable name --- SU2_CFD/src/output/COutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index d3dc4cc64cb..fe1b7d9dc74 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1539,7 +1539,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ if (itCoord == requestedVolumeFields.end()) { auto itCompact = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "COMPACT"); - if (itCoordCompact == requestedVolumeFields.end()) { + if (itCompact == requestedVolumeFields.end()) { requestedVolumeFields.emplace_back("SOLUTION"); nRequestedVolumeFields++; } From 915fa30246844cd230b6b9cfacd16d453514d11d Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 27 Nov 2024 08:51:59 +0100 Subject: [PATCH 31/49] update variable name --- SU2_CFD/src/output/COutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index fe1b7d9dc74..08e3c633217 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1536,7 +1536,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ /*--- Add the solution if it was not requested for backwards compatibility, unless the COMPACT keyword was used to request exclusively the specified fields. ---*/ auto itSol = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "SOLUTION"); - if (itCoord == requestedVolumeFields.end()) { + if (itSol == requestedVolumeFields.end()) { auto itCompact = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "COMPACT"); if (itCompact == requestedVolumeFields.end()) { From 2ece849afe9ab5819a85f8e90864df361bfe95a0 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 27 Nov 2024 13:27:46 +0100 Subject: [PATCH 32/49] do not use compact to pass regressions --- .../02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg | 2 +- .../lam_prem_ch4_cht_cfd_fluid.cfg | 2 ++ TestCases/radiation/p1adjoint/configp1adjoint.cfg | 2 +- TestCases/rans/oneram6/turb_ONERAM6.cfg | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg b/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg index ff52e8d58b6..b79c1f3b367 100644 --- a/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg +++ b/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg @@ -128,7 +128,7 @@ MARKER_ANALYZE_AVERAGE= MASSFLUX OUTPUT_FILES= RESTART, RESTART_ASCII, PARAVIEW VOLUME_OUTPUT= RESIDUAL, PRIMITIVE VOLUME_ADJ_FILENAME= ch4_flame_hx_ad - +WRT_RESTART_COMPACT = NO OUTPUT_WRT_FREQ= 100 % GRAD_OBJFUNC_FILENAME= of_grad.csv diff --git a/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg b/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg index adf9a65020f..af8e562b0cd 100644 --- a/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg +++ b/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg @@ -19,6 +19,8 @@ HISTORY_OUTPUT= RMS_RES AERO_COEFF FLOW_COEFF FLOW_COEFF_SURF VOLUME_OUTPUT= SOLUTION PRIMITIVE SOURCE RESIDUAL LOOKUP +WRT_RESTART_COMPACT = NO + OUTPUT_FILES= (RESTART_ASCII, PARAVIEW) INNER_ITER= 1 diff --git a/TestCases/radiation/p1adjoint/configp1adjoint.cfg b/TestCases/radiation/p1adjoint/configp1adjoint.cfg index 93740e5ea95..cdbad6937b7 100644 --- a/TestCases/radiation/p1adjoint/configp1adjoint.cfg +++ b/TestCases/radiation/p1adjoint/configp1adjoint.cfg @@ -131,7 +131,7 @@ FFD_CONTINUITY = 2ND_DERIVATIVE %%%%%%%%%%%%%%%%%%%%%%% OUTPUT_FILES = (RESTART, PARAVIEW) - +WRT_RESTART_COMPACT = NO SOLUTION_FILENAME = solution_rht RESTART_FILENAME = restart_rht VOLUME_FILENAME = volume_rht diff --git a/TestCases/rans/oneram6/turb_ONERAM6.cfg b/TestCases/rans/oneram6/turb_ONERAM6.cfg index a43f3974459..d38d71b3287 100644 --- a/TestCases/rans/oneram6/turb_ONERAM6.cfg +++ b/TestCases/rans/oneram6/turb_ONERAM6.cfg @@ -110,6 +110,7 @@ MESH_OUT_FILENAME= mesh_out.su2 SOLUTION_FILENAME= restart_flow.dat SOLUTION_ADJ_FILENAME= solution_adj.dat OUTPUT_FILES=(RESTART, STL_ASCII, PARAVIEW, SURFACE_PARAVIEW) +WRT_RESTART_COMPACT = NO TABULAR_FORMAT= CSV CONV_FILENAME= history RESTART_FILENAME= restart_flow.dat From 605d42ded11b2d99e808a403f73c5d2b9fdcf165 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 27 Nov 2024 15:05:42 +0100 Subject: [PATCH 33/49] update naca0012 cfg --- TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg b/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg index 7a63c1ff189..1911bdef3b7 100644 --- a/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg +++ b/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg @@ -127,6 +127,7 @@ SURFACE_ADJ_FILENAME= surface_adjoint OUTPUT_WRT_FREQ= 250 SCREEN_OUTPUT = (INNER_ITER, RMS_ADJ_DENSITY, RMS_ADJ_ENERGY, SENS_GEO, SENS_AOA, RMS_DENSITY, RMS_ENERGY, LIFT, DRAG) HISTORY_OUTPUT= (ITER, RMS_RES, AERO_COEFF, SENSITIVITY) +WRT_RESTART_COMPACT = NO VOLUME_OUTPUT= (COORDINATES, SOLUTION, PRESSURE, TEMPERATURE, SENSITIVITY) OUTPUT_FILES=(RESTART_ASCII, PARAVIEW, SURFACE_CSV) From cb748fd6a9c8bc3c755b20a3189e3515e82f8f88 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 27 Nov 2024 21:19:28 +0100 Subject: [PATCH 34/49] fix writing surface csv --- SU2_CFD/src/output/COutput.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 08e3c633217..3fb9fbb5582 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -414,9 +414,9 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form /*--- If we have compact restarts, we use only the required fields. ---*/ if (config->GetWrt_Restart_Compact()) - surfaceDataSorter->SetRequiredFieldNames(surfaceDataSorter->GetFieldNames()); - else surfaceDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); + else + surfaceDataSorter->SetRequiredFieldNames(surfaceDataSorter->GetFieldNames()); surfaceDataSorter->SortConnectivity(config, geometry); From 452d5893d39cd673d5cafc90ab13fadaa6b4a5c1 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 27 Nov 2024 22:16:13 +0100 Subject: [PATCH 35/49] add SENSITIVITY to required restart fields --- SU2_CFD/include/output/COutput.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 726b170b7d7..a3a222dff40 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -295,7 +295,7 @@ class COutput { unsigned short nRequestedVolumeFields; /*! \brief Minimum required volume fields for restart file. */ - const std::vector restartVolumeFields = {"COORDINATES", "SOLUTION", "GRID_VELOCITY"}; + const std::vector restartVolumeFields = {"COORDINATES", "SOLUTION", "SENSITIVITY", "GRID_VELOCITY"}; /*----------------------------- Convergence monitoring ----------------------------*/ From dc99d6f672d45521609aaf8b69b3042fd1b390aa Mon Sep 17 00:00:00 2001 From: bigfooted Date: Thu, 28 Nov 2024 00:03:28 +0100 Subject: [PATCH 36/49] fix regression tests --- TestCases/disc_adj_rans/naca0012/naca0012.cfg | 1 + .../lam_prem_ch4_cht_ad_fluid.cfg | 2 ++ 2 files changed, 3 insertions(+) diff --git a/TestCases/disc_adj_rans/naca0012/naca0012.cfg b/TestCases/disc_adj_rans/naca0012/naca0012.cfg index 9a84427b263..6a722eead1c 100644 --- a/TestCases/disc_adj_rans/naca0012/naca0012.cfg +++ b/TestCases/disc_adj_rans/naca0012/naca0012.cfg @@ -105,6 +105,7 @@ CONV_FILENAME= 0_history RESTART_FILENAME= restart_flow.dat RESTART_ADJ_FILENAME= restart_adj.dat VOLUME_FILENAME= flow +WRT_RESTART_COMPACT= NO SURFACE_FILENAME= surface_flow OUTPUT_WRT_FREQ= 1 % diff --git a/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg b/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg index 7824d6780fd..b251e54182a 100644 --- a/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg +++ b/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg @@ -23,6 +23,8 @@ VOLUME_OUTPUT= SOLUTION PRIMITIVE SOURCE RESIDUAL LOOKUP OUTPUT_FILES= ( RESTART_ASCII) +WRT_RESTART_COMPACT= NO + INNER_ITER= 1 % -------------------- BOUNDARY CONDITION DEFINITION --------------------------% From 145018b0213f2818450c554ad8413fe54eedc1bb Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 29 Nov 2024 10:31:33 +0100 Subject: [PATCH 37/49] add compact=no to pywrapper regressions --- TestCases/py_wrapper/custom_load_fea/run_ad.py | 1 + TestCases/py_wrapper/wavy_wall/run_steady.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/TestCases/py_wrapper/custom_load_fea/run_ad.py b/TestCases/py_wrapper/custom_load_fea/run_ad.py index dfb9fab4fab..59e4ec03c07 100644 --- a/TestCases/py_wrapper/custom_load_fea/run_ad.py +++ b/TestCases/py_wrapper/custom_load_fea/run_ad.py @@ -61,6 +61,7 @@ OUTPUT_WRT_FREQ= 1 OBJECTIVE_FUNCTION= STRESS_PENALTY STRESS_PENALTY_PARAM= ( 500, 20 ) +WRT_RESTART_CUSTOM= NO INNER_ITER= 20 CONV_RESIDUAL_MINVAL= -4 diff --git a/TestCases/py_wrapper/wavy_wall/run_steady.py b/TestCases/py_wrapper/wavy_wall/run_steady.py index 511aa585827..db40659c68b 100644 --- a/TestCases/py_wrapper/wavy_wall/run_steady.py +++ b/TestCases/py_wrapper/wavy_wall/run_steady.py @@ -93,7 +93,7 @@ primal_settings = """ MATH_PROBLEM= DIRECT RESTART_SOL= YES - +WRT_RESTART_COMPACT= NO CFL_NUMBER= 1000 LINEAR_SOLVER= FGMRES LINEAR_SOLVER_PREC= ILU From b61e7cec2e9c402b11aca3c723a4268111bb49ab Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 29 Nov 2024 21:26:47 +0100 Subject: [PATCH 38/49] add compact=no to pywrapper regressions --- TestCases/py_wrapper/custom_load_fea/run_ad.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/py_wrapper/custom_load_fea/run_ad.py b/TestCases/py_wrapper/custom_load_fea/run_ad.py index 59e4ec03c07..dc643ad67a1 100644 --- a/TestCases/py_wrapper/custom_load_fea/run_ad.py +++ b/TestCases/py_wrapper/custom_load_fea/run_ad.py @@ -61,7 +61,7 @@ OUTPUT_WRT_FREQ= 1 OBJECTIVE_FUNCTION= STRESS_PENALTY STRESS_PENALTY_PARAM= ( 500, 20 ) -WRT_RESTART_CUSTOM= NO +WRT_RESTART_COMPACT= NO INNER_ITER= 20 CONV_RESIDUAL_MINVAL= -4 From 864512001d116948cad8d0d9cab3991cd54c6491 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 29 Nov 2024 22:31:59 +0100 Subject: [PATCH 39/49] add compact=no to pywrapper regressions --- TestCases/optimization_rans/naca0012/naca0012.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/TestCases/optimization_rans/naca0012/naca0012.cfg b/TestCases/optimization_rans/naca0012/naca0012.cfg index 763109d820a..a9d0b530419 100644 --- a/TestCases/optimization_rans/naca0012/naca0012.cfg +++ b/TestCases/optimization_rans/naca0012/naca0012.cfg @@ -107,6 +107,7 @@ RESTART_ADJ_FILENAME= restart_adj.dat VOLUME_FILENAME= flow SURFACE_FILENAME= surface_flow OUTPUT_WRT_FREQ= 1 +WRT_RESTART_COMPACT= NO % % ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% % From a9682ac22e01857fb9cd82aa1312aaecaa1b42f6 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 1 Dec 2024 16:22:44 +0100 Subject: [PATCH 40/49] stl writer - change SU2_SOL to SU2_CFD --- TestCases/parallel_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 66aa66fb805..8537e636c12 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1660,7 +1660,7 @@ def main(): stl_writer_test.cfg_dir = "rans/oneram6" stl_writer_test.cfg_file = "turb_ONERAM6.cfg" stl_writer_test.test_iter = 1 - stl_writer_test.command = TestCase.Command("mpirun -n 2", "SU2_SOL") + stl_writer_test.command = TestCase.Command("mpirun -n 2", "SU2_CFD") stl_writer_test.timeout = 1600 stl_writer_test.reference_file = "surface_flow.stl.ref" stl_writer_test.test_file = "surface_flow.stl" From e22089fd79062de05511feeaf92e7a6d64ba0b3f Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 22 Dec 2024 13:55:22 +0100 Subject: [PATCH 41/49] fixing binary restart --- SU2_CFD/include/output/COutput.hpp | 15 ++++++---- SU2_CFD/src/output/COutput.cpp | 48 +++++++++++++++++++++++++----- 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index a3a222dff40..eea8188ed46 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -242,6 +242,7 @@ class COutput { /*----------------------------- Volume output ----------------------------*/ CParallelDataSorter* volumeDataSorter; //!< Volume data sorter + CParallelDataSorter* volumeDataSorterCompact; //!< Volume data sorter CParallelDataSorter* surfaceDataSorter; //!< Surface data sorter vector volumeFieldNames; //!< Vector containing the volume field names @@ -260,10 +261,12 @@ class COutput { /*! \brief The name of the field, i.e. the name that is printed in the file header.*/ string fieldName; /*! \brief This value identifies the position of the values of this field at each node in the ::Local_Data array. */ - short offset; + short offset; + /*! \brief This offset is used for the compact formulation. */ + short offsetCompact; /*! \brief The group this field belongs to. */ string outputGroup; - /*! \brief String containing the description of the field */ + /*! \brief String containing the description of the field. */ string description; /*! \brief Default constructor. */ VolumeOutputField () {} @@ -278,15 +281,15 @@ class COutput { /*! \brief Vector that contains the keys of the ::volumeOutput_Map in the order of their insertion. */ std::vector volumeOutput_List; - /*! \brief Vector to cache the positions of the field in the data array */ + /*! \brief Vector to cache the positions of the field in the data array. */ std::vector fieldIndexCache; - /*! \brief Current value of the cache index */ + /*! \brief Current value of the cache index. */ unsigned short cachePosition; /*! \brief Boolean to store whether the field index cache should be build. */ bool buildFieldIndexCache; - /*! \brief Vector to cache the positions of the field in the data array */ + /*! \brief Vector to cache the positions of the field in the data array. */ std::vector fieldGetIndexCache; - /*! \brief Current value of the cache index */ + /*! \brief Current value of the cache index. */ unsigned short curGetFieldIndex; /*! \brief Requested volume field names in the config file. */ diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 3fb9fbb5582..1400e6378ba 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -179,6 +179,7 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output): curTimeIter = 0; volumeDataSorter = nullptr; + volumeDataSorterCompact = nullptr; surfaceDataSorter = nullptr; headerNeeded = false; @@ -195,6 +196,7 @@ COutput::~COutput() { delete fileWritingTable; delete historyFileTable; delete volumeDataSorter; + delete volumeDataSorterCompact; delete surfaceDataSorter; } @@ -343,6 +345,9 @@ void COutput::AllocateDataSorters(CConfig *config, CGeometry *geometry){ if (volumeDataSorter == nullptr) volumeDataSorter = new CFEMDataSorter(config, geometry, volumeFieldNames); + if (volumeDataSorterCompact == nullptr) + volumeDataSorterCompact = new CFEMDataSorter(config, geometry, requiredVolumeFieldNames); + if (surfaceDataSorter == nullptr) surfaceDataSorter = new CSurfaceFEMDataSorter(config, geometry, dynamic_cast(volumeDataSorter)); @@ -352,6 +357,9 @@ void COutput::AllocateDataSorters(CConfig *config, CGeometry *geometry){ if (volumeDataSorter == nullptr) volumeDataSorter = new CFVMDataSorter(config, geometry, volumeFieldNames); + if (volumeDataSorterCompact == nullptr) + volumeDataSorterCompact = new CFVMDataSorter(config, geometry, requiredVolumeFieldNames); + if (surfaceDataSorter == nullptr) surfaceDataSorter = new CSurfaceFVMDataSorter(config, geometry, dynamic_cast(volumeDataSorter)); @@ -461,12 +469,15 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form /*--- If we have compact restarts, we use only the required fields. ---*/ if (config->GetWrt_Restart_Compact()) - volumeDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); + volumeDataSorterCompact->SetRequiredFieldNames(requiredVolumeFieldNames); else volumeDataSorter->SetRequiredFieldNames(volumeDataSorter->GetFieldNames()); LogOutputFiles("SU2 binary restart"); - fileWriter = new CSU2BinaryFileWriter(volumeDataSorter); + if (config->GetWrt_Restart_Compact()) + fileWriter = new CSU2BinaryFileWriter(volumeDataSorterCompact); + else + fileWriter = new CSU2BinaryFileWriter(volumeDataSorter); break; @@ -846,6 +857,7 @@ bool COutput::SetResultFiles(CGeometry *geometry, CConfig *config, CSolver** sol /*--- Partition and sort the data --- */ volumeDataSorter->SortOutputData(); + volumeDataSorterCompact->SortOutputData(); if (rank == MASTER_NODE && !isFileWrite) { fileWritingTable->SetAlign(PrintingToolbox::CTablePrinter::CENTER); @@ -1554,24 +1566,32 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ * object gets an offset so that we know where to find the data in the Local_Data() array. * Note that the default offset is -1. An index !=-1 defines this field as part of the output. ---*/ + unsigned short nVolumeFieldsCompact = 0; + for (size_t iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { const string &fieldReference = volumeOutput_List[iField_Output]; - if (volumeOutput_Map.count(fieldReference) > 0) { - VolumeOutputField &Field = volumeOutput_Map.at(fieldReference); + /*--- Loop through all fields specified in the config ---*/ + for (size_t iReqField = 0; iReqField < restartVolumeFields.size(); iReqField++) { + // minimum required fields for restarts RequiredField = restartVolumeFields[iReqField]; + if (((RequiredField == Field.outputGroup) || (RequiredField == fieldReference)) && (Field.offset == -1)) { + Field.offsetCompact = nVolumeFieldsCompact; requiredVolumeFieldNames.push_back(Field.fieldName); + nVolumeFieldsCompact++; } } } } + //volumeDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); + unsigned short nVolumeFields = 0; for (size_t iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { @@ -1716,16 +1736,25 @@ void COutput::LoadDataIntoSorter(CConfig* config, CGeometry* geometry, CSolver** void COutput::SetVolumeOutputValue(const string& name, unsigned long iPoint, su2double value){ - if (buildFieldIndexCache){ + const vector reqFieldNames = requiredVolumeFieldNames; + string fieldname = volumeOutput_Map.at(name).fieldName; + bool contains = std::any_of(requiredVolumeFieldNames.begin(), requiredVolumeFieldNames.end(), + [fieldname](string n) { return n == fieldname; }); + if (buildFieldIndexCache) { /*--- Build up the offset cache to speed up subsequent * calls of this routine since the order of calls is * the same for every value of iPoint --- */ - if (volumeOutput_Map.count(name) > 0){ + if (volumeOutput_Map.count(name) > 0) { const short Offset = volumeOutput_Map.at(name).offset; fieldIndexCache.push_back(Offset); if (Offset != -1){ + // note that the compact fields are a subset of the full fields + if (contains == true) { + const short OffsetCompact = volumeOutput_Map.at(name).offsetCompact; + volumeDataSorterCompact->SetUnsortedData(iPoint, OffsetCompact, value); + } volumeDataSorter->SetUnsortedData(iPoint, Offset, value); } } else { @@ -1734,9 +1763,12 @@ void COutput::SetVolumeOutputValue(const string& name, unsigned long iPoint, su2 } else { /*--- Use the offset cache for the access ---*/ - const short Offset = fieldIndexCache[cachePosition++]; - if (Offset != -1){ + if (Offset != -1) { + if (contains == true) { + const short OffsetCompact = volumeOutput_Map.at(name).offsetCompact; + volumeDataSorterCompact->SetUnsortedData(iPoint, OffsetCompact, value); + } volumeDataSorter->SetUnsortedData(iPoint, Offset, value); } if (cachePosition == fieldIndexCache.size()){ From dc862fd6bb76ea1dbfefdf34c00fe0a99dbd715e Mon Sep 17 00:00:00 2001 From: bigfooted Date: Sun, 29 Dec 2024 22:24:23 +0100 Subject: [PATCH 42/49] compact restart testcases quick update --- TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg | 2 +- TestCases/disc_adj_rans/naca0012/naca0012.cfg | 2 +- .../02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg | 2 +- .../lam_prem_ch4_cht_cfd_fluid.cfg | 2 +- .../lam_prem_ch4_cht_ad_fluid.cfg | 2 +- TestCases/optimization_rans/naca0012/naca0012.cfg | 2 +- TestCases/radiation/p1adjoint/configp1adjoint.cfg | 2 +- TestCases/rans/oneram6/turb_ONERAM6.cfg | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg b/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg index 1911bdef3b7..b7f4b338875 100644 --- a/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg +++ b/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg @@ -127,7 +127,7 @@ SURFACE_ADJ_FILENAME= surface_adjoint OUTPUT_WRT_FREQ= 250 SCREEN_OUTPUT = (INNER_ITER, RMS_ADJ_DENSITY, RMS_ADJ_ENERGY, SENS_GEO, SENS_AOA, RMS_DENSITY, RMS_ENERGY, LIFT, DRAG) HISTORY_OUTPUT= (ITER, RMS_RES, AERO_COEFF, SENSITIVITY) -WRT_RESTART_COMPACT = NO +WRT_RESTART_COMPACT = YES VOLUME_OUTPUT= (COORDINATES, SOLUTION, PRESSURE, TEMPERATURE, SENSITIVITY) OUTPUT_FILES=(RESTART_ASCII, PARAVIEW, SURFACE_CSV) diff --git a/TestCases/disc_adj_rans/naca0012/naca0012.cfg b/TestCases/disc_adj_rans/naca0012/naca0012.cfg index 6a722eead1c..3af10b754e4 100644 --- a/TestCases/disc_adj_rans/naca0012/naca0012.cfg +++ b/TestCases/disc_adj_rans/naca0012/naca0012.cfg @@ -105,7 +105,7 @@ CONV_FILENAME= 0_history RESTART_FILENAME= restart_flow.dat RESTART_ADJ_FILENAME= restart_adj.dat VOLUME_FILENAME= flow -WRT_RESTART_COMPACT= NO +WRT_RESTART_COMPACT= YES SURFACE_FILENAME= surface_flow OUTPUT_WRT_FREQ= 1 % diff --git a/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg b/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg index b79c1f3b367..8df82d47a78 100644 --- a/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg +++ b/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg @@ -128,7 +128,7 @@ MARKER_ANALYZE_AVERAGE= MASSFLUX OUTPUT_FILES= RESTART, RESTART_ASCII, PARAVIEW VOLUME_OUTPUT= RESIDUAL, PRIMITIVE VOLUME_ADJ_FILENAME= ch4_flame_hx_ad -WRT_RESTART_COMPACT = NO +WRT_RESTART_COMPACT = YES OUTPUT_WRT_FREQ= 100 % GRAD_OBJFUNC_FILENAME= of_grad.csv diff --git a/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg b/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg index af8e562b0cd..6ba0b04835c 100644 --- a/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg +++ b/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg @@ -19,7 +19,7 @@ HISTORY_OUTPUT= RMS_RES AERO_COEFF FLOW_COEFF FLOW_COEFF_SURF VOLUME_OUTPUT= SOLUTION PRIMITIVE SOURCE RESIDUAL LOOKUP -WRT_RESTART_COMPACT = NO +WRT_RESTART_COMPACT = YES OUTPUT_FILES= (RESTART_ASCII, PARAVIEW) diff --git a/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg b/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg index b251e54182a..060f9be0663 100644 --- a/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg +++ b/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg @@ -23,7 +23,7 @@ VOLUME_OUTPUT= SOLUTION PRIMITIVE SOURCE RESIDUAL LOOKUP OUTPUT_FILES= ( RESTART_ASCII) -WRT_RESTART_COMPACT= NO +WRT_RESTART_COMPACT= YES INNER_ITER= 1 diff --git a/TestCases/optimization_rans/naca0012/naca0012.cfg b/TestCases/optimization_rans/naca0012/naca0012.cfg index a9d0b530419..bc277d88e48 100644 --- a/TestCases/optimization_rans/naca0012/naca0012.cfg +++ b/TestCases/optimization_rans/naca0012/naca0012.cfg @@ -107,7 +107,7 @@ RESTART_ADJ_FILENAME= restart_adj.dat VOLUME_FILENAME= flow SURFACE_FILENAME= surface_flow OUTPUT_WRT_FREQ= 1 -WRT_RESTART_COMPACT= NO +WRT_RESTART_COMPACT= YES % % ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% % diff --git a/TestCases/radiation/p1adjoint/configp1adjoint.cfg b/TestCases/radiation/p1adjoint/configp1adjoint.cfg index cdbad6937b7..54d80d40a24 100644 --- a/TestCases/radiation/p1adjoint/configp1adjoint.cfg +++ b/TestCases/radiation/p1adjoint/configp1adjoint.cfg @@ -131,7 +131,7 @@ FFD_CONTINUITY = 2ND_DERIVATIVE %%%%%%%%%%%%%%%%%%%%%%% OUTPUT_FILES = (RESTART, PARAVIEW) -WRT_RESTART_COMPACT = NO +WRT_RESTART_COMPACT = YES SOLUTION_FILENAME = solution_rht RESTART_FILENAME = restart_rht VOLUME_FILENAME = volume_rht diff --git a/TestCases/rans/oneram6/turb_ONERAM6.cfg b/TestCases/rans/oneram6/turb_ONERAM6.cfg index d38d71b3287..f7a3ce88e2e 100644 --- a/TestCases/rans/oneram6/turb_ONERAM6.cfg +++ b/TestCases/rans/oneram6/turb_ONERAM6.cfg @@ -110,7 +110,7 @@ MESH_OUT_FILENAME= mesh_out.su2 SOLUTION_FILENAME= restart_flow.dat SOLUTION_ADJ_FILENAME= solution_adj.dat OUTPUT_FILES=(RESTART, STL_ASCII, PARAVIEW, SURFACE_PARAVIEW) -WRT_RESTART_COMPACT = NO +WRT_RESTART_COMPACT = YES TABULAR_FORMAT= CSV CONV_FILENAME= history RESTART_FILENAME= restart_flow.dat From 76fddc4312b156f76162d9e9c386676a8a834d08 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 31 Dec 2024 08:54:44 +0100 Subject: [PATCH 43/49] compact restart for flamelet --- .../lam_prem_ch4_cht_cfd_fluid.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg b/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg index 6ba0b04835c..af8e562b0cd 100644 --- a/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg +++ b/TestCases/flamelet/03_laminar_premixed_ch4_flame_cht_cfd/lam_prem_ch4_cht_cfd_fluid.cfg @@ -19,7 +19,7 @@ HISTORY_OUTPUT= RMS_RES AERO_COEFF FLOW_COEFF FLOW_COEFF_SURF VOLUME_OUTPUT= SOLUTION PRIMITIVE SOURCE RESIDUAL LOOKUP -WRT_RESTART_COMPACT = YES +WRT_RESTART_COMPACT = NO OUTPUT_FILES= (RESTART_ASCII, PARAVIEW) From 7a66387f461f90cc786341b4ee797341530ca75f Mon Sep 17 00:00:00 2001 From: bigfooted Date: Tue, 31 Dec 2024 13:36:39 +0100 Subject: [PATCH 44/49] remove unnecessary WRT_COMPACT_RESTART statements --- TestCases/disc_adj_rans/naca0012/naca0012.cfg | 1 - .../02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg | 2 +- .../lam_prem_ch4_cht_ad_fluid.cfg | 2 +- TestCases/optimization_rans/naca0012/naca0012.cfg | 1 - TestCases/radiation/p1adjoint/configp1adjoint.cfg | 1 - TestCases/rans/oneram6/turb_ONERAM6.cfg | 1 - 6 files changed, 2 insertions(+), 6 deletions(-) diff --git a/TestCases/disc_adj_rans/naca0012/naca0012.cfg b/TestCases/disc_adj_rans/naca0012/naca0012.cfg index 3af10b754e4..9a84427b263 100644 --- a/TestCases/disc_adj_rans/naca0012/naca0012.cfg +++ b/TestCases/disc_adj_rans/naca0012/naca0012.cfg @@ -105,7 +105,6 @@ CONV_FILENAME= 0_history RESTART_FILENAME= restart_flow.dat RESTART_ADJ_FILENAME= restart_adj.dat VOLUME_FILENAME= flow -WRT_RESTART_COMPACT= YES SURFACE_FILENAME= surface_flow OUTPUT_WRT_FREQ= 1 % diff --git a/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg b/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg index 8df82d47a78..b79c1f3b367 100644 --- a/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg +++ b/TestCases/flamelet/02_laminar_premixed_ch4_flame_hx_ad/lam_prem_ch4_hx_ad.cfg @@ -128,7 +128,7 @@ MARKER_ANALYZE_AVERAGE= MASSFLUX OUTPUT_FILES= RESTART, RESTART_ASCII, PARAVIEW VOLUME_OUTPUT= RESIDUAL, PRIMITIVE VOLUME_ADJ_FILENAME= ch4_flame_hx_ad -WRT_RESTART_COMPACT = YES +WRT_RESTART_COMPACT = NO OUTPUT_WRT_FREQ= 100 % GRAD_OBJFUNC_FILENAME= of_grad.csv diff --git a/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg b/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg index 060f9be0663..b251e54182a 100644 --- a/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg +++ b/TestCases/flamelet/04_laminar_premixed_ch4_flame_cht_ad/lam_prem_ch4_cht_ad_fluid.cfg @@ -23,7 +23,7 @@ VOLUME_OUTPUT= SOLUTION PRIMITIVE SOURCE RESIDUAL LOOKUP OUTPUT_FILES= ( RESTART_ASCII) -WRT_RESTART_COMPACT= YES +WRT_RESTART_COMPACT= NO INNER_ITER= 1 diff --git a/TestCases/optimization_rans/naca0012/naca0012.cfg b/TestCases/optimization_rans/naca0012/naca0012.cfg index bc277d88e48..763109d820a 100644 --- a/TestCases/optimization_rans/naca0012/naca0012.cfg +++ b/TestCases/optimization_rans/naca0012/naca0012.cfg @@ -107,7 +107,6 @@ RESTART_ADJ_FILENAME= restart_adj.dat VOLUME_FILENAME= flow SURFACE_FILENAME= surface_flow OUTPUT_WRT_FREQ= 1 -WRT_RESTART_COMPACT= YES % % ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% % diff --git a/TestCases/radiation/p1adjoint/configp1adjoint.cfg b/TestCases/radiation/p1adjoint/configp1adjoint.cfg index 54d80d40a24..15603eea1a6 100644 --- a/TestCases/radiation/p1adjoint/configp1adjoint.cfg +++ b/TestCases/radiation/p1adjoint/configp1adjoint.cfg @@ -131,7 +131,6 @@ FFD_CONTINUITY = 2ND_DERIVATIVE %%%%%%%%%%%%%%%%%%%%%%% OUTPUT_FILES = (RESTART, PARAVIEW) -WRT_RESTART_COMPACT = YES SOLUTION_FILENAME = solution_rht RESTART_FILENAME = restart_rht VOLUME_FILENAME = volume_rht diff --git a/TestCases/rans/oneram6/turb_ONERAM6.cfg b/TestCases/rans/oneram6/turb_ONERAM6.cfg index f7a3ce88e2e..a43f3974459 100644 --- a/TestCases/rans/oneram6/turb_ONERAM6.cfg +++ b/TestCases/rans/oneram6/turb_ONERAM6.cfg @@ -110,7 +110,6 @@ MESH_OUT_FILENAME= mesh_out.su2 SOLUTION_FILENAME= restart_flow.dat SOLUTION_ADJ_FILENAME= solution_adj.dat OUTPUT_FILES=(RESTART, STL_ASCII, PARAVIEW, SURFACE_PARAVIEW) -WRT_RESTART_COMPACT = YES TABULAR_FORMAT= CSV CONV_FILENAME= history RESTART_FILENAME= restart_flow.dat From 60d7256ebc68716d26d404dfdb3121569648c766 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 1 Jan 2025 01:16:42 +0100 Subject: [PATCH 45/49] remove unnecessary WRT_COMPACT_RESTART statements --- SU2_CFD/src/output/COutput.cpp | 2 -- TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg | 1 - TestCases/py_wrapper/wavy_wall/run_steady.py | 1 - TestCases/radiation/p1adjoint/configp1adjoint.cfg | 1 + 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 1400e6378ba..4c0ce5e096f 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1590,8 +1590,6 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ } } - //volumeDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); - unsigned short nVolumeFields = 0; for (size_t iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { diff --git a/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg b/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg index b7f4b338875..7a63c1ff189 100644 --- a/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg +++ b/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg @@ -127,7 +127,6 @@ SURFACE_ADJ_FILENAME= surface_adjoint OUTPUT_WRT_FREQ= 250 SCREEN_OUTPUT = (INNER_ITER, RMS_ADJ_DENSITY, RMS_ADJ_ENERGY, SENS_GEO, SENS_AOA, RMS_DENSITY, RMS_ENERGY, LIFT, DRAG) HISTORY_OUTPUT= (ITER, RMS_RES, AERO_COEFF, SENSITIVITY) -WRT_RESTART_COMPACT = YES VOLUME_OUTPUT= (COORDINATES, SOLUTION, PRESSURE, TEMPERATURE, SENSITIVITY) OUTPUT_FILES=(RESTART_ASCII, PARAVIEW, SURFACE_CSV) diff --git a/TestCases/py_wrapper/wavy_wall/run_steady.py b/TestCases/py_wrapper/wavy_wall/run_steady.py index db40659c68b..4a90995ace1 100644 --- a/TestCases/py_wrapper/wavy_wall/run_steady.py +++ b/TestCases/py_wrapper/wavy_wall/run_steady.py @@ -93,7 +93,6 @@ primal_settings = """ MATH_PROBLEM= DIRECT RESTART_SOL= YES -WRT_RESTART_COMPACT= NO CFL_NUMBER= 1000 LINEAR_SOLVER= FGMRES LINEAR_SOLVER_PREC= ILU diff --git a/TestCases/radiation/p1adjoint/configp1adjoint.cfg b/TestCases/radiation/p1adjoint/configp1adjoint.cfg index 15603eea1a6..93740e5ea95 100644 --- a/TestCases/radiation/p1adjoint/configp1adjoint.cfg +++ b/TestCases/radiation/p1adjoint/configp1adjoint.cfg @@ -131,6 +131,7 @@ FFD_CONTINUITY = 2ND_DERIVATIVE %%%%%%%%%%%%%%%%%%%%%%% OUTPUT_FILES = (RESTART, PARAVIEW) + SOLUTION_FILENAME = solution_rht RESTART_FILENAME = restart_rht VOLUME_FILENAME = volume_rht From e599fa10adc3bdb7d175b41d597e0acb2392cbc2 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Wed, 1 Jan 2025 13:56:44 -0800 Subject: [PATCH 46/49] index cache for compact --- SU2_CFD/include/output/COutput.hpp | 47 +++--- SU2_CFD/src/output/CElasticityOutput.cpp | 17 +- SU2_CFD/src/output/COutput.cpp | 155 +++++++----------- .../output/filewriter/CParallelDataSorter.cpp | 3 +- TestCases/parallel_regression.py | 2 +- TestCases/py_wrapper/wavy_wall/run_steady.py | 1 + config_template.cfg | 8 +- 7 files changed, 102 insertions(+), 131 deletions(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index eea8188ed46..e39b047ce82 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -241,17 +241,16 @@ class COutput { /*----------------------------- Volume output ----------------------------*/ - CParallelDataSorter* volumeDataSorter; //!< Volume data sorter - CParallelDataSorter* volumeDataSorterCompact; //!< Volume data sorter - CParallelDataSorter* surfaceDataSorter; //!< Surface data sorter + CParallelDataSorter* volumeDataSorter; //!< Volume data sorter. + CParallelDataSorter* volumeDataSorterCompact; //!< Volume data sorter for compact files. + CParallelDataSorter* surfaceDataSorter; //!< Surface data sorter. - vector volumeFieldNames; //!< Vector containing the volume field names + vector volumeFieldNames; //!< Vector containing the volume field names. + vector requiredVolumeFieldNames; //!< Vector containing the minimum required volume field names. - vector requiredVolumeFieldNames; //!< Vector containing the minimum required volume field names. - - string volumeFilename, //!< Volume output filename - surfaceFilename, //!< Surface output filename - restartFilename; //!< Restart output filename + string volumeFilename, //!< Volume output filename. + surfaceFilename, //!< Surface output filename. + restartFilename; //!< Restart output filename. /** \brief Structure to store information for a volume output field. * @@ -269,28 +268,32 @@ class COutput { /*! \brief String containing the description of the field. */ string description; /*! \brief Default constructor. */ - VolumeOutputField () {} + VolumeOutputField() = default; /*! \brief Constructor to initialize all members. */ VolumeOutputField(string fieldName_, int offset_, string volumeOutputGroup_, string description_): - fieldName(std::move(fieldName_)), offset(std::move(offset_)), - outputGroup(std::move(volumeOutputGroup_)), description(std::move(description_)){} + fieldName(std::move(fieldName_)), + offset(offset_), + outputGroup(std::move(volumeOutputGroup_)), + description(std::move(description_)) {} }; /*! \brief Associative map to access data stored in the volume output fields by a string identifier. */ - std::map volumeOutput_Map; + std::map volumeOutput_Map; /*! \brief Vector that contains the keys of the ::volumeOutput_Map in the order of their insertion. */ - std::vector volumeOutput_List; + std::vector volumeOutput_List; + + /*! \brief Whether the field index caches should be build. */ + bool buildFieldIndexCache; + + /*! \brief Vectors to cache the positions of the fields in the data array. */ + std::vector fieldIndexCache, fieldIndexCacheCompact; + /*! \brief Current value of the cache indices. */ + unsigned short cachePosition; /*! \brief Vector to cache the positions of the field in the data array. */ - std::vector fieldIndexCache; - /*! \brief Current value of the cache index. */ - unsigned short cachePosition; - /*! \brief Boolean to store whether the field index cache should be build. */ - bool buildFieldIndexCache; - /*! \brief Vector to cache the positions of the field in the data array. */ - std::vector fieldGetIndexCache; + std::vector fieldGetIndexCache; /*! \brief Current value of the cache index. */ - unsigned short curGetFieldIndex; + unsigned short curGetFieldIndex; /*! \brief Requested volume field names in the config file. */ std::vector requestedVolumeFields; diff --git a/SU2_CFD/src/output/CElasticityOutput.cpp b/SU2_CFD/src/output/CElasticityOutput.cpp index a2abc4e6d12..1af62426cce 100644 --- a/SU2_CFD/src/output/CElasticityOutput.cpp +++ b/SU2_CFD/src/output/CElasticityOutput.cpp @@ -235,21 +235,20 @@ void CElasticityOutput::SetVolumeOutputFields(CConfig *config){ // Grid coordinates AddVolumeOutput("COORD-X", "x", "COORDINATES", "x-component of the coordinate vector"); AddVolumeOutput("COORD-Y", "y", "COORDINATES", "y-component of the coordinate vector"); - if (nDim == 3) - AddVolumeOutput("COORD-Z", "z", "COORDINATES", "z-component of the coordinate vector"); + if (nDim == 3) AddVolumeOutput("COORD-Z", "z", "COORDINATES", "z-component of the coordinate vector"); AddVolumeOutput("DISPLACEMENT-X", "Displacement_x", "SOLUTION", "x-component of the displacement vector"); AddVolumeOutput("DISPLACEMENT-Y", "Displacement_y", "SOLUTION", "y-component of the displacement vector"); if (nDim == 3) AddVolumeOutput("DISPLACEMENT-Z", "Displacement_z", "SOLUTION", "z-component of the displacement vector"); - if(dynamic){ - AddVolumeOutput("VELOCITY-X", "Velocity_x", "VELOCITY", "x-component of the velocity vector"); - AddVolumeOutput("VELOCITY-Y", "Velocity_y", "VELOCITY", "y-component of the velocity vector"); - if (nDim == 3) AddVolumeOutput("VELOCITY-Z", "Velocity_z", "VELOCITY", "z-component of the velocity vector"); + if (dynamic) { + AddVolumeOutput("VELOCITY-X", "Velocity_x", "SOLUTION", "x-component of the velocity vector"); + AddVolumeOutput("VELOCITY-Y", "Velocity_y", "SOLUTION", "y-component of the velocity vector"); + if (nDim == 3) AddVolumeOutput("VELOCITY-Z", "Velocity_z", "SOLUTION", "z-component of the velocity vector"); - AddVolumeOutput("ACCELERATION-X", "Acceleration_x", "ACCELERATION", "x-component of the acceleration vector"); - AddVolumeOutput("ACCELERATION-Y", "Acceleration_y", "ACCELERATION", "y-component of the acceleration vector"); - if (nDim == 3) AddVolumeOutput("ACCELERATION-Z", "Acceleration_z", "ACCELERATION", "z-component of the acceleration vector"); + AddVolumeOutput("ACCELERATION-X", "Acceleration_x", "SOLUTION", "x-component of the acceleration vector"); + AddVolumeOutput("ACCELERATION-Y", "Acceleration_y", "SOLUTION", "y-component of the acceleration vector"); + if (nDim == 3) AddVolumeOutput("ACCELERATION-Z", "Acceleration_z", "SOLUTION", "z-component of the acceleration vector"); } AddVolumeOutput("STRESS-XX", "Sxx", "STRESS", "x-component of the normal stress vector"); diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 4c0ce5e096f..bfb0b6329c5 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -173,7 +173,6 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output): convergence = false; buildFieldIndexCache = false; - curInnerIter = 0; curOuterIter = 0; curTimeIter = 0; @@ -345,7 +344,7 @@ void COutput::AllocateDataSorters(CConfig *config, CGeometry *geometry){ if (volumeDataSorter == nullptr) volumeDataSorter = new CFEMDataSorter(config, geometry, volumeFieldNames); - if (volumeDataSorterCompact == nullptr) + if (config->GetWrt_Restart_Compact() && volumeDataSorterCompact == nullptr) volumeDataSorterCompact = new CFEMDataSorter(config, geometry, requiredVolumeFieldNames); if (surfaceDataSorter == nullptr) @@ -357,7 +356,7 @@ void COutput::AllocateDataSorters(CConfig *config, CGeometry *geometry){ if (volumeDataSorter == nullptr) volumeDataSorter = new CFVMDataSorter(config, geometry, volumeFieldNames); - if (volumeDataSorterCompact == nullptr) + if (config->GetWrt_Restart_Compact() && volumeDataSorterCompact == nullptr) volumeDataSorterCompact = new CFVMDataSorter(config, geometry, requiredVolumeFieldNames); if (surfaceDataSorter == nullptr) @@ -423,9 +422,6 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form /*--- If we have compact restarts, we use only the required fields. ---*/ if (config->GetWrt_Restart_Compact()) surfaceDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); - else - surfaceDataSorter->SetRequiredFieldNames(surfaceDataSorter->GetFieldNames()); - surfaceDataSorter->SortConnectivity(config, geometry); surfaceDataSorter->SortOutputData(); @@ -445,12 +441,9 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form if (!config->GetWrt_Restart_Overwrite()) filename_iter = config->GetFilename_Iter(fileName, curInnerIter, curOuterIter); - /*--- If we have compact restarts, we use only the required fields. ---*/ if (config->GetWrt_Restart_Compact()) volumeDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); - else - volumeDataSorter->SetRequiredFieldNames(volumeDataSorter->GetFieldNames()); LogOutputFiles("SU2 ASCII restart"); fileWriter = new CSU2FileWriter(volumeDataSorter); @@ -467,18 +460,14 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form if (!config->GetWrt_Restart_Overwrite()) filename_iter = config->GetFilename_Iter(fileName, curInnerIter, curOuterIter); - /*--- If we have compact restarts, we use only the required fields. ---*/ - if (config->GetWrt_Restart_Compact()) - volumeDataSorterCompact->SetRequiredFieldNames(requiredVolumeFieldNames); - else - volumeDataSorter->SetRequiredFieldNames(volumeDataSorter->GetFieldNames()); - LogOutputFiles("SU2 binary restart"); - if (config->GetWrt_Restart_Compact()) + if (config->GetWrt_Restart_Compact()) { + /*--- If we have compact restarts, we use only the required fields. ---*/ + volumeDataSorterCompact->SetRequiredFieldNames(requiredVolumeFieldNames); fileWriter = new CSU2BinaryFileWriter(volumeDataSorterCompact); - else + } else { fileWriter = new CSU2BinaryFileWriter(volumeDataSorter); - + } break; case OUTPUT_TYPE::MESH: @@ -857,7 +846,7 @@ bool COutput::SetResultFiles(CGeometry *geometry, CConfig *config, CSolver** sol /*--- Partition and sort the data --- */ volumeDataSorter->SortOutputData(); - volumeDataSorterCompact->SortOutputData(); + if (volumeDataSorterCompact != nullptr) volumeDataSorterCompact->SortOutputData(); if (rank == MASTER_NODE && !isFileWrite) { fileWritingTable->SetAlign(PrintingToolbox::CTablePrinter::CENTER); @@ -1536,21 +1525,17 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ SetVolumeOutputFields(config); - /*--- Coordinates must be always in the output. - * If they are not requested, add them here. ---*/ - auto itCoord = std::find(requestedVolumeFields.begin(), - requestedVolumeFields.end(), "COORDINATES"); + /*--- Coordinates must be always in the output. If they are not requested, add them here. ---*/ + auto itCoord = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "COORDINATES"); if (itCoord == requestedVolumeFields.end()) { requestedVolumeFields.emplace_back("COORDINATES"); nRequestedVolumeFields++; } /*--- Add the solution if it was not requested for backwards compatibility, unless the COMPACT keyword was used to request exclusively the specified fields. ---*/ - auto itSol = std::find(requestedVolumeFields.begin(), - requestedVolumeFields.end(), "SOLUTION"); + auto itSol = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "SOLUTION"); if (itSol == requestedVolumeFields.end()) { - auto itCompact = std::find(requestedVolumeFields.begin(), - requestedVolumeFields.end(), "COMPACT"); + auto itCompact = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "COMPACT"); if (itCompact == requestedVolumeFields.end()) { requestedVolumeFields.emplace_back("SOLUTION"); nRequestedVolumeFields++; @@ -1661,10 +1646,11 @@ void COutput::LoadDataIntoSorter(CConfig* config, CGeometry* geometry, CSolver** /*--- Reset the offset cache and index --- */ cachePosition = 0; fieldIndexCache.clear(); + fieldIndexCacheCompact.clear(); curGetFieldIndex = 0; fieldGetIndexCache.clear(); - if (femOutput){ + if (femOutput) { /*--- Create an object of the class CMeshFEM_DG and retrieve the necessary geometrical information for the FEM DG solver. ---*/ @@ -1678,33 +1664,24 @@ void COutput::LoadDataIntoSorter(CConfig* config, CGeometry* geometry, CSolver** /*--- Access the solution by looping over the owned volume elements. ---*/ for(unsigned long l=0; lGetnPointDomain(); iPoint++) { - - /*--- Load the volume data into the data sorter. --- */ - buildFieldIndexCache = fieldIndexCache.empty(); - LoadVolumeData(config, geometry, solver, iPoint); - } /*--- Reset the offset cache and index --- */ cachePosition = 0; fieldIndexCache.clear(); + fieldIndexCacheCompact.clear(); curGetFieldIndex = 0; fieldGetIndexCache.clear(); @@ -1712,19 +1689,16 @@ void COutput::LoadDataIntoSorter(CConfig* config, CGeometry* geometry, CSolver** /*--- We only want to have surface values on solid walls ---*/ - if (config->GetSolid_Wall(iMarker)){ - for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++){ + if (config->GetSolid_Wall(iMarker)) { + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); /*--- Load the surface data into the data sorter. --- */ - if(geometry->nodes->GetDomain(iPoint)){ - + if (geometry->nodes->GetDomain(iPoint)) { buildFieldIndexCache = fieldIndexCache.empty(); - LoadSurfaceData(config, geometry, solver, iPoint, iMarker, iVertex); - } } } @@ -1734,79 +1708,74 @@ void COutput::LoadDataIntoSorter(CConfig* config, CGeometry* geometry, CSolver** void COutput::SetVolumeOutputValue(const string& name, unsigned long iPoint, su2double value){ - const vector reqFieldNames = requiredVolumeFieldNames; - string fieldname = volumeOutput_Map.at(name).fieldName; - bool contains = std::any_of(requiredVolumeFieldNames.begin(), requiredVolumeFieldNames.end(), - [fieldname](string n) { return n == fieldname; }); if (buildFieldIndexCache) { - /*--- Build up the offset cache to speed up subsequent * calls of this routine since the order of calls is - * the same for every value of iPoint --- */ + * the same for every value of iPoint. ---*/ - if (volumeOutput_Map.count(name) > 0) { - const short Offset = volumeOutput_Map.at(name).offset; + const auto it = volumeOutput_Map.find(name); + if (it != volumeOutput_Map.end()) { + const short Offset = it->second.offset; fieldIndexCache.push_back(Offset); - if (Offset != -1){ - // note that the compact fields are a subset of the full fields - if (contains == true) { - const short OffsetCompact = volumeOutput_Map.at(name).offsetCompact; - volumeDataSorterCompact->SetUnsortedData(iPoint, OffsetCompact, value); - } + if (Offset != -1) { volumeDataSorter->SetUnsortedData(iPoint, Offset, value); } + /*--- Note that the compact fields are a subset of the full fields. ---*/ + const short OffsetCompact = it->second.offsetCompact; + fieldIndexCacheCompact.push_back(OffsetCompact); + if (volumeDataSorterCompact != nullptr && OffsetCompact != -1) { + volumeDataSorterCompact->SetUnsortedData(iPoint, OffsetCompact, value); + } } else { - SU2_MPI::Error(string("Cannot find output field with name ") + name, CURRENT_FUNCTION); + SU2_MPI::Error("Cannot find output field with name " + name, CURRENT_FUNCTION); } } else { - /*--- Use the offset cache for the access ---*/ - const short Offset = fieldIndexCache[cachePosition++]; + /*--- Use the offset caches for the access. ---*/ + const short Offset = fieldIndexCache[cachePosition]; + const short OffsetCompact = fieldIndexCacheCompact[cachePosition++]; + if (cachePosition == fieldIndexCache.size()) { + cachePosition = 0; + } if (Offset != -1) { - if (contains == true) { - const short OffsetCompact = volumeOutput_Map.at(name).offsetCompact; - volumeDataSorterCompact->SetUnsortedData(iPoint, OffsetCompact, value); - } volumeDataSorter->SetUnsortedData(iPoint, Offset, value); } - if (cachePosition == fieldIndexCache.size()){ - cachePosition = 0; + if (volumeDataSorterCompact != nullptr && OffsetCompact != -1) { + volumeDataSorterCompact->SetUnsortedData(iPoint, OffsetCompact, value); } } } -su2double COutput::GetVolumeOutputValue(const string& name, unsigned long iPoint){ - - if (buildFieldIndexCache){ +su2double COutput::GetVolumeOutputValue(const string& name, unsigned long iPoint) { + if (buildFieldIndexCache) { /*--- Build up the offset cache to speed up subsequent * calls of this routine since the order of calls is - * the same for every value of iPoint --- */ + * the same for every value of iPoint. ---*/ - if (volumeOutput_Map.count(name) > 0){ - const short Offset = volumeOutput_Map.at(name).offset; + const auto it = volumeOutput_Map.find(name); + if (it != volumeOutput_Map.end()) { + const short Offset = it->second.offset; fieldGetIndexCache.push_back(Offset); - if (Offset != -1){ + if (Offset != -1) { return volumeDataSorter->GetUnsortedData(iPoint, Offset); } } else { - SU2_MPI::Error(string("Cannot find output field with name ") + name, CURRENT_FUNCTION); + SU2_MPI::Error("Cannot find output field with name " + name, CURRENT_FUNCTION); } } else { - - /*--- Use the offset cache for the access ---*/ + /*--- Use the offset cache for the access, ---*/ const short Offset = fieldGetIndexCache[curGetFieldIndex++]; - if (curGetFieldIndex == fieldGetIndexCache.size()){ + if (curGetFieldIndex == fieldGetIndexCache.size()) { curGetFieldIndex = 0; } - if (Offset != -1){ + if (Offset != -1) { return volumeDataSorter->GetUnsortedData(iPoint, Offset); } } - return 0.0; } @@ -1814,38 +1783,36 @@ void COutput::SetAvgVolumeOutputValue(const string& name, unsigned long iPoint, const su2double scaling = 1.0 / su2double(curAbsTimeIter + 1); - if (buildFieldIndexCache){ - + if (buildFieldIndexCache) { /*--- Build up the offset cache to speed up subsequent * calls of this routine since the order of calls is - * the same for every value of iPoint --- */ + * the same for every value of iPoint. ---*/ - if (volumeOutput_Map.count(name) > 0){ - const short Offset = volumeOutput_Map.at(name).offset; + const auto it = volumeOutput_Map.find(name); + if (it != volumeOutput_Map.end()) { + const short Offset = it->second.offset; fieldIndexCache.push_back(Offset); - if (Offset != -1){ - + if (Offset != -1) { const su2double old_value = volumeDataSorter->GetUnsortedData(iPoint, Offset); - const su2double new_value = value * scaling + old_value *( 1.0 - scaling); + const su2double new_value = value * scaling + old_value * (1.0 - scaling); volumeDataSorter->SetUnsortedData(iPoint, Offset, new_value); } } else { - SU2_MPI::Error(string("Cannot find output field with name ") + name, CURRENT_FUNCTION); + SU2_MPI::Error("Cannot find output field with name " + name, CURRENT_FUNCTION); } } else { /*--- Use the offset cache for the access ---*/ const short Offset = fieldIndexCache[cachePosition++]; - if (Offset != -1){ - + if (Offset != -1) { const su2double old_value = volumeDataSorter->GetUnsortedData(iPoint, Offset); - const su2double new_value = value * scaling + old_value *( 1.0 - scaling); + const su2double new_value = value * scaling + old_value * (1.0 - scaling); volumeDataSorter->SetUnsortedData(iPoint, Offset, new_value); } - if (cachePosition == fieldIndexCache.size()){ + if (cachePosition == fieldIndexCache.size()) { cachePosition = 0; } } @@ -2485,7 +2452,7 @@ void COutput::PrintVolumeFields(){ } cout << "Available volume output fields for the current configuration in " << multiZoneHeaderString << ":" << endl; - cout << "Note: COORDINATES and SOLUTION groups are always in the volume output unless you add the keyword COMPACT." << endl; + cout << "Note: COORDINATES are always included, and so is SOLUTION unless you add the keyword COMPACT to the list of fields." << endl; VolumeFieldTable.AddColumn("Name", NameSize); VolumeFieldTable.AddColumn("Group Name", GroupSize); VolumeFieldTable.AddColumn("Description", DescrSize); diff --git a/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp b/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp index 0290c20b025..2bc2778ec24 100644 --- a/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp +++ b/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp @@ -32,7 +32,8 @@ CParallelDataSorter::CParallelDataSorter(CConfig *config, const vector &valFieldNames) : rank(SU2_MPI::GetRank()), size(SU2_MPI::GetSize()), - fieldNames(valFieldNames) { + fieldNames(valFieldNames), + requiredFieldNames(valFieldNames) { GlobalField_Counter = fieldNames.size(); diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 9c6cdf65373..530328b52a6 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1671,7 +1671,7 @@ def main(): stl_writer_test.cfg_dir = "rans/oneram6" stl_writer_test.cfg_file = "turb_ONERAM6.cfg" stl_writer_test.test_iter = 1 - stl_writer_test.command = TestCase.Command("mpirun -n 2", "SU2_CFD") + stl_writer_test.command = TestCase.Command("mpirun -n 2", "SU2_SOL") stl_writer_test.timeout = 1600 stl_writer_test.reference_file = "surface_flow.stl.ref" stl_writer_test.test_file = "surface_flow.stl" diff --git a/TestCases/py_wrapper/wavy_wall/run_steady.py b/TestCases/py_wrapper/wavy_wall/run_steady.py index 4a90995ace1..511aa585827 100644 --- a/TestCases/py_wrapper/wavy_wall/run_steady.py +++ b/TestCases/py_wrapper/wavy_wall/run_steady.py @@ -93,6 +93,7 @@ primal_settings = """ MATH_PROBLEM= DIRECT RESTART_SOL= YES + CFL_NUMBER= 1000 LINEAR_SOLVER= FGMRES LINEAR_SOLVER_PREC= ILU diff --git a/config_template.cfg b/config_template.cfg index 8b6b313246d..0acf538f856 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -60,10 +60,10 @@ GRAVITY_FORCE= NO % Restart solution (NO, YES) RESTART_SOL= NO % -% Only save minimum required variables to restart files (NO, YES). -% If this option is set to NO, then the SOLUTION fields will be written to all output -% files by default. If you would also like to have minimum output files -% (e.g. paraview, tecplot), then add the keyword COMPACT to VOLUME_OUTPUT. +% Only save the minimum required variables for restarting to restart files (NO, YES). +% If this option is set to NO, then all fields will be written to all output files. +% To minimize the size of other output files (e.g. paraview, tecplot) by not including +% default restart fields in them, add the keyword COMPACT to VOLUME_OUTPUT. WRT_RESTART_COMPACT= YES % % Discard the data storaged in the solution and geometry files From cf4f6094772135c76ebd215ae8be1569639b61e2 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Wed, 1 Jan 2025 14:57:25 -0800 Subject: [PATCH 47/49] missing initialization --- SU2_CFD/include/output/COutput.hpp | 12 +++---- SU2_CFD/src/output/CAdjFlowCompOutput.cpp | 2 +- SU2_CFD/src/output/CAdjFlowIncOutput.cpp | 2 +- SU2_CFD/src/output/CAdjHeatOutput.cpp | 2 +- SU2_CFD/src/output/CFlowCompOutput.cpp | 20 +++++------ SU2_CFD/src/output/CFlowIncOutput.cpp | 2 +- SU2_CFD/src/output/CNEMOCompOutput.cpp | 2 +- SU2_CFD/src/output/COutput.cpp | 42 +++++++---------------- 8 files changed, 33 insertions(+), 51 deletions(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index e39b047ce82..14b0bbec9b6 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -260,9 +260,9 @@ class COutput { /*! \brief The name of the field, i.e. the name that is printed in the file header.*/ string fieldName; /*! \brief This value identifies the position of the values of this field at each node in the ::Local_Data array. */ - short offset; + short offset = -1; /*! \brief This offset is used for the compact formulation. */ - short offsetCompact; + short offsetCompact = -1; /*! \brief The group this field belongs to. */ string outputGroup; /*! \brief String containing the description of the field. */ @@ -270,9 +270,8 @@ class COutput { /*! \brief Default constructor. */ VolumeOutputField() = default; /*! \brief Constructor to initialize all members. */ - VolumeOutputField(string fieldName_, int offset_, string volumeOutputGroup_, string description_): + VolumeOutputField(string fieldName_, string volumeOutputGroup_, string description_): fieldName(std::move(fieldName_)), - offset(offset_), outputGroup(std::move(volumeOutputGroup_)), description(std::move(description_)) {} }; @@ -746,8 +745,9 @@ class COutput { * \param[in] groupname - The name of the group this field belongs to. * \param[in] description - Description of the volume field. */ - inline void AddVolumeOutput(string name, string field_name, string groupname, string description){ - volumeOutput_Map[name] = VolumeOutputField(field_name, -1, groupname, description); + inline void AddVolumeOutput(const string& name, const string& field_name, + const string& group_name, const string& description) { + volumeOutput_Map[name] = VolumeOutputField(field_name, group_name, description); volumeOutput_List.push_back(name); } diff --git a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp index 108856156e7..f1e492e1a37 100644 --- a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp @@ -61,7 +61,7 @@ CAdjFlowCompOutput::CAdjFlowCompOutput(CConfig *config, unsigned short nDim) : C if (find(requestedVolumeFields.begin(), requestedVolumeFields.end(), string("SENSITIVITY")) == requestedVolumeFields.end()) { requestedVolumeFields.emplace_back("SENSITIVITY"); - nRequestedVolumeFields ++; + nRequestedVolumeFields++; } stringstream ss; diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index be86c12a494..3fff6de99e5 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -67,7 +67,7 @@ CAdjFlowIncOutput::CAdjFlowIncOutput(CConfig *config, unsigned short nDim) : CAd if (find(requestedVolumeFields.begin(), requestedVolumeFields.end(), string("SENSITIVITY")) == requestedVolumeFields.end()) { requestedVolumeFields.emplace_back("SENSITIVITY"); - nRequestedVolumeFields ++; + nRequestedVolumeFields++; } stringstream ss; diff --git a/SU2_CFD/src/output/CAdjHeatOutput.cpp b/SU2_CFD/src/output/CAdjHeatOutput.cpp index 578175fccad..9c8a85e2f5d 100644 --- a/SU2_CFD/src/output/CAdjHeatOutput.cpp +++ b/SU2_CFD/src/output/CAdjHeatOutput.cpp @@ -58,7 +58,7 @@ CAdjHeatOutput::CAdjHeatOutput(CConfig *config, unsigned short nDim) : COutput(c if (find(requestedVolumeFields.begin(), requestedVolumeFields.end(), string("SENSITIVITY")) == requestedVolumeFields.end()) { requestedVolumeFields.emplace_back("SENSITIVITY"); - nRequestedVolumeFields ++; + nRequestedVolumeFields++; } stringstream ss; diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index e460109c8b5..d3c76e75a36 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -61,7 +61,7 @@ CFlowCompOutput::CFlowCompOutput(const CConfig *config, unsigned short nDim) : C auto notFound = requestedVolumeFields.end(); if (find(requestedVolumeFields.begin(), notFound, string("GRID_VELOCITY")) == notFound) { requestedVolumeFields.emplace_back("GRID_VELOCITY"); - nRequestedVolumeFields ++; + nRequestedVolumeFields++; } } @@ -219,7 +219,7 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("DENSITY", "Density", "SOLUTION", "Density"); AddVolumeOutput("MOMENTUM-X", "Momentum_x", "SOLUTION", "x-component of the momentum vector"); AddVolumeOutput("MOMENTUM-Y", "Momentum_y", "SOLUTION", "y-component of the momentum vector"); - + if (nDim == 3) AddVolumeOutput("MOMENTUM-Z", "Momentum_z", "SOLUTION", "z-component of the momentum vector"); AddVolumeOutput("ENERGY", "Energy", "SOLUTION", "Energy"); @@ -241,7 +241,7 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("PRESSURE_COEFF", "Pressure_Coefficient", "PRIMITIVE", "Pressure coefficient"); AddVolumeOutput("VELOCITY-X", "Velocity_x", "PRIMITIVE", "x-component of the velocity vector"); AddVolumeOutput("VELOCITY-Y", "Velocity_y", "PRIMITIVE", "y-component of the velocity vector"); - + if (nDim == 3) AddVolumeOutput("VELOCITY-Z", "Velocity_z", "PRIMITIVE", "z-component of the velocity vector"); @@ -525,7 +525,7 @@ void CFlowCompOutput::SetTurboPerformance_Output(std::shared_ptr T for (unsigned short iZone = 0; iZone <= config->GetnZone()-1; iZone++) { auto nSpan = config->GetnSpan_iZones(iZone); - const auto& BladePerf = BladePerformance.at(iZone).at(nSpan); + const auto& BladePerf = BladePerformance.at(iZone).at(nSpan); TurboInOut<<" BLADE ROW INDEX "<GetInletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); } file.width(30); file << BladePerf->GetInletState().GetVelocityValue()*config[ZONE_0]->GetVelocity_Ref(); - // This captures NaNs + // This captures NaNs if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ file.width(30); file << "0.0000"; } @@ -792,11 +792,11 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptr 1) { - spanwise_performance_filename.append("_" + std::to_string(val_iZone) + ".dat"); - } else { - spanwise_performance_filename.append(".dat"); - } + if (nZone > 1) { + spanwise_performance_filename.append("_" + std::to_string(val_iZone) + ".dat"); + } else { + spanwise_performance_filename.append(".dat"); + } file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); file.setf(ios::scientific); file.precision(12); diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index eeffb6a3486..1f4c0809d1b 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -70,7 +70,7 @@ CFlowIncOutput::CFlowIncOutput(CConfig *config, unsigned short nDim) : CFlowOutp auto notFound = requestedVolumeFields.end(); if (find(requestedVolumeFields.begin(), notFound, string("GRID_VELOCITY")) == notFound) { requestedVolumeFields.emplace_back("GRID_VELOCITY"); - nRequestedVolumeFields ++; + nRequestedVolumeFields++; } } diff --git a/SU2_CFD/src/output/CNEMOCompOutput.cpp b/SU2_CFD/src/output/CNEMOCompOutput.cpp index 7b75ac646d2..2994dd4345e 100644 --- a/SU2_CFD/src/output/CNEMOCompOutput.cpp +++ b/SU2_CFD/src/output/CNEMOCompOutput.cpp @@ -65,7 +65,7 @@ CNEMOCompOutput::CNEMOCompOutput(const CConfig *config, unsigned short nDim) : C auto notFound = requestedVolumeFields.end(); if (find(requestedVolumeFields.begin(), notFound, string("GRID_VELOCITY")) == notFound) { requestedVolumeFields.emplace_back("GRID_VELOCITY"); - nRequestedVolumeFields ++; + nRequestedVolumeFields++; } } diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index bfb0b6329c5..e66c1752ea9 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1542,7 +1542,6 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ } } - string RequiredField; std::vector FoundField(nRequestedVolumeFields, false); vector FieldsToRemove; @@ -1551,49 +1550,32 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ * object gets an offset so that we know where to find the data in the Local_Data() array. * Note that the default offset is -1. An index !=-1 defines this field as part of the output. ---*/ - unsigned short nVolumeFieldsCompact = 0; + unsigned short nVolumeFields = 0, nVolumeFieldsCompact = 0; for (size_t iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { const string &fieldReference = volumeOutput_List[iField_Output]; - if (volumeOutput_Map.count(fieldReference) > 0) { - VolumeOutputField &Field = volumeOutput_Map.at(fieldReference); - - /*--- Loop through all fields specified in the config ---*/ - - for (size_t iReqField = 0; iReqField < restartVolumeFields.size(); iReqField++) { + const auto it = volumeOutput_Map.find(fieldReference); + if (it != volumeOutput_Map.end()) { + VolumeOutputField &Field = it->second; - // minimum required fields for restarts - RequiredField = restartVolumeFields[iReqField]; + /*--- Loop through the minimum required fields for restarts. ---*/ - if (((RequiredField == Field.outputGroup) || (RequiredField == fieldReference)) && (Field.offset == -1)) { - Field.offsetCompact = nVolumeFieldsCompact; + for (const auto& RequiredField : restartVolumeFields) { + if ((RequiredField == Field.outputGroup || RequiredField == fieldReference) && Field.offsetCompact == -1) { + Field.offsetCompact = nVolumeFieldsCompact++; requiredVolumeFieldNames.push_back(Field.fieldName); - nVolumeFieldsCompact++; } } - } - } - - unsigned short nVolumeFields = 0; - for (size_t iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) { - - const string &fieldReference = volumeOutput_List[iField_Output]; - if (volumeOutput_Map.count(fieldReference) > 0){ - VolumeOutputField &Field = volumeOutput_Map.at(fieldReference); - - /*--- Loop through all fields specified in the config ---*/ + /*--- Loop through all fields specified in the config. ---*/ for (size_t iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++) { + const auto &RequestedField = requestedVolumeFields[iReqField]; - const string &RequestedField = requestedVolumeFields[iReqField]; - - if (((RequestedField == Field.outputGroup) || (RequestedField == fieldReference)) && (Field.offset == -1)) { - - Field.offset = nVolumeFields; + if ((RequestedField == Field.outputGroup || RequestedField == fieldReference) && Field.offset == -1) { + Field.offset = nVolumeFields++; volumeFieldNames.push_back(Field.fieldName); - nVolumeFields++; FoundField[iReqField] = true; } } From ae84d15a6650cf05b4971dd8ebb2af9dc74ee7af Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Wed, 1 Jan 2025 17:34:55 -0800 Subject: [PATCH 48/49] time average fix --- SU2_CFD/src/output/COutput.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index e66c1752ea9..edae19efa44 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1712,7 +1712,6 @@ void COutput::SetVolumeOutputValue(const string& name, unsigned long iPoint, su2 SU2_MPI::Error("Cannot find output field with name " + name, CURRENT_FUNCTION); } } else { - /*--- Use the offset caches for the access. ---*/ const short Offset = fieldIndexCache[cachePosition]; const short OffsetCompact = fieldIndexCacheCompact[cachePosition++]; @@ -1740,6 +1739,9 @@ su2double COutput::GetVolumeOutputValue(const string& name, unsigned long iPoint if (it != volumeOutput_Map.end()) { const short Offset = it->second.offset; fieldGetIndexCache.push_back(Offset); + /*--- This function is used for time-averaged fields and we know + * those are not part of the compact restart fields. ---*/ + fieldIndexCacheCompact.push_back(-1); if (Offset != -1) { return volumeDataSorter->GetUnsortedData(iPoint, Offset); } From 13b08f559cdab16c14713e211e7efffaadc27a42 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Wed, 1 Jan 2025 18:54:05 -0800 Subject: [PATCH 49/49] fix... --- SU2_CFD/src/output/COutput.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index edae19efa44..016b5d35ec0 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -380,6 +380,7 @@ void COutput::LoadData(CGeometry *geometry, CConfig *config, CSolver** solver_co /*--- Partition and sort the volume output data -- */ volumeDataSorter->SortOutputData(); + if (volumeDataSorterCompact != nullptr) volumeDataSorterCompact->SortOutputData(); } @@ -1739,9 +1740,6 @@ su2double COutput::GetVolumeOutputValue(const string& name, unsigned long iPoint if (it != volumeOutput_Map.end()) { const short Offset = it->second.offset; fieldGetIndexCache.push_back(Offset); - /*--- This function is used for time-averaged fields and we know - * those are not part of the compact restart fields. ---*/ - fieldIndexCacheCompact.push_back(-1); if (Offset != -1) { return volumeDataSorter->GetUnsortedData(iPoint, Offset); } @@ -1776,6 +1774,9 @@ void COutput::SetAvgVolumeOutputValue(const string& name, unsigned long iPoint, if (it != volumeOutput_Map.end()) { const short Offset = it->second.offset; fieldIndexCache.push_back(Offset); + /*--- This function is used for time-averaged fields and we know + * those are not part of the compact restart fields. ---*/ + fieldIndexCacheCompact.push_back(-1); if (Offset != -1) { const su2double old_value = volumeDataSorter->GetUnsortedData(iPoint, Offset); const su2double new_value = value * scaling + old_value * (1.0 - scaling);