From 46799db9f6063fb157a36f21d3c2d85500997b95 Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Mon, 24 Jan 2022 16:51:10 +0100 Subject: [PATCH 01/22] Multiply heat OF by specified weight. --- SU2_CFD/include/solvers/CHeatSolver.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/include/solvers/CHeatSolver.hpp b/SU2_CFD/include/solvers/CHeatSolver.hpp index 7d8b7ef2e33c..1407d74112ac 100644 --- a/SU2_CFD/include/solvers/CHeatSolver.hpp +++ b/SU2_CFD/include/solvers/CHeatSolver.hpp @@ -313,15 +313,17 @@ class CHeatSolver final : public CSolver { * \param[in] solver - Container vector with all the solutions. */ void Evaluate_ObjFunc(const CConfig *config, CSolver**) override { + const auto weight = config->GetWeight_ObjFunc(0); + switch (config->GetKind_ObjFunc()) { case TOTAL_HEATFLUX: - Total_ComboObj = Total_HeatFlux; + Total_ComboObj = weight * Total_HeatFlux; break; case AVG_TEMPERATURE: - Total_ComboObj = Total_AverageT; + Total_ComboObj = weight * Total_AverageT; break; case CUSTOM_OBJFUNC: - Total_ComboObj = Total_Custom_ObjFunc; + Total_ComboObj = weight * Total_Custom_ObjFunc; break; default: Total_ComboObj = 0.0; From 2811d4576c822b5871232b2c339a23a60bbba651 Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Mon, 24 Jan 2022 16:54:32 +0100 Subject: [PATCH 02/22] Pressure_Drop computed with first two markers, additional follwoing warkers allowed --- Common/src/CConfig.cpp | 4 ++-- SU2_CFD/src/output/CFlowOutput.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index c9bc0804e8bb..120f27485677 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -4755,8 +4755,8 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i pressure drop objective function is selected. ---*/ for (unsigned short iObj = 0; iObj < nObj; iObj++) { - if ((Kind_ObjFunc[iObj] == SURFACE_PRESSURE_DROP) && (nMarker_Analyze != 2)) { - SU2_MPI::Error("Must list two markers for the pressure drop objective function.\n Expected format: MARKER_ANALYZE= (outlet_name, inlet_name).", CURRENT_FUNCTION); + if ((Kind_ObjFunc[iObj] == SURFACE_PRESSURE_DROP) && (nMarker_Analyze < 2)) { + SU2_MPI::Error("Must list the first two markers for the pressure drop objective function.\n Expected format: MARKER_ANALYZE= (outlet_name, inlet_name, ...).", CURRENT_FUNCTION); } } diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index bfc10a698503..18bf079b280b 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -67,10 +67,10 @@ void CFlowOutput::AddAnalyzeSurfaceOutput(const CConfig *config){ /// DESCRIPTION: Average total pressure AddHistoryOutput("SURFACE_TOTAL_PRESSURE", "Avg_TotalPress", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total average total pressure on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Pressure drop - if (config->GetnMarker_Analyze() == 2) { + if (config->GetnMarker_Analyze() >= 2) { AddHistoryOutput("SURFACE_PRESSURE_DROP", "Pressure_Drop", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total pressure drop on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); } else if (rank == MASTER_NODE) { - cout << "\nWARNING: SURFACE_PRESSURE_DROP can only be computed for 2 surfaces (outlet, inlet)\n" << endl; + cout << "\nWARNING: SURFACE_PRESSURE_DROP can only be computed for at least 2 surfaces (outlet, inlet, ...)\n" << endl; } if (config->GetKind_Species_Model() != SPECIES_MODEL::NONE) { /// DESCRIPTION: Average Species @@ -530,7 +530,7 @@ void CFlowOutput::SetAnalyzeSurface(const CSolver* const*solver, const CGeometry which require the outlet to be listed first. This is a simple first version that could be generalized to a different orders/lists/etc. ---*/ - if (nMarker_Analyze == 2) { + if (nMarker_Analyze >= 2) { su2double PressureDrop = (Surface_Pressure_Total[1] - Surface_Pressure_Total[0]) * config->GetPressure_Ref(); for (iMarker_Analyze = 0; iMarker_Analyze < nMarker_Analyze; iMarker_Analyze++) { config->SetSurface_PressureDrop(iMarker_Analyze, PressureDrop); From c11354115757d673a771e04562e6920024e013a2 Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Tue, 25 Jan 2022 16:32:39 +0100 Subject: [PATCH 03/22] Add dp for streamwise massflow to flow-metadata to allow restarts with that setting. Note though that the comment in the pressure update computation of the streamwise periodicity still holds: Currently the pressure update for massflow is omitted in the first iteration, as the function is called in the Preprocessing phase which leads to multiple calls during 1 iteration. Ideally this whole method is called in another place or a setup has to be found which prevents multiple calls. --- Common/include/CConfig.hpp | 5 +++++ SU2_CFD/src/output/CFlowOutput.cpp | 9 ++++++++- SU2_CFD/src/solvers/CEulerSolver.cpp | 5 ++--- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 9 ++++++++- SU2_CFD/src/solvers/CIncNSSolver.cpp | 8 ++++---- SU2_CFD/src/solvers/CSolver.cpp | 21 +++++++++++++++++++++ 6 files changed, 48 insertions(+), 9 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 2f103c455276..9a3c826cc44c 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -5989,6 +5989,11 @@ class CConfig { */ su2double GetStreamwise_Periodic_PressureDrop(void) const { return Streamwise_Periodic_PressureDrop; } + /*! + * \brief Set the value of the pressure delta from which body force vector is computed. Necessary for Restart metadata. + */ + void SetStreamwise_Periodic_PressureDrop(su2double Streamwise_Periodic_PressureDrop_) { Streamwise_Periodic_PressureDrop = Streamwise_Periodic_PressureDrop_; } + /*! * \brief Get the value of the massflow from which body force vector is computed. * \return Massflow for body force computation. diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 3d43077a7d36..96d3577ecc3a 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1736,7 +1736,8 @@ void CFlowOutput::Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *g void CFlowOutput::WriteAdditionalFiles(CConfig *config, CGeometry *geometry, CSolver **solver_container){ - if (config->GetFixed_CL_Mode()){ + if (config->GetFixed_CL_Mode() || + (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW)){ WriteMetaData(config); } @@ -1757,6 +1758,8 @@ void CFlowOutput::WriteMetaData(const CConfig *config){ /*--- All processors open the file. ---*/ if (rank == MASTER_NODE) { + cout << "Writing Flow Meta-Data file: " << filename << endl; + meta_file.open(filename.c_str(), ios::out); meta_file.precision(15); @@ -1783,6 +1786,10 @@ void CFlowOutput::WriteMetaData(const CConfig *config){ config->GetKind_Solver() == MAIN_SOLVER::DISC_ADJ_RANS )) { meta_file << "SENS_AOA=" << GetHistoryFieldValue("SENS_AOA") * PI_NUMBER / 180.0 << endl; } + + if(config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW) { + meta_file << "STREAMWISE_PERIODIC_PRESSURE_DROP=" << GetHistoryFieldValue("STREAMWISE_DP") << endl; + } } meta_file.close(); diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index f325cf07ce02..0f5b7bfe996f 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -94,11 +94,10 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, else Unst_RestartIter = SU2_TYPE::Int(config->GetRestart_Iter())-1; } - string filename_ = "flow"; - filename_ = config->GetFilename(filename_, ".meta", Unst_RestartIter); - /*--- Read and store the restart metadata. ---*/ + string filename_ = "flow"; + filename_ = config->GetFilename(filename_, ".meta", Unst_RestartIter); Read_SU2_Restart_Metadata(geometry, config, adjoint, filename_); } diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 11445707794e..4e27a46dd811 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -91,9 +91,16 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned /*--- Read and store the restart metadata. ---*/ -// Read_SU2_Restart_Metadata(geometry, config, false, filename_); + filename_ = "flow"; + filename_ = config->GetFilename(filename_, ".meta", Unst_RestartIter); + Read_SU2_Restart_Metadata(geometry, config, adjoint, filename_); } + if (restart && (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW)) { + string filename_ = "flow"; + filename_ = config->GetFilename(filename_, ".meta", Unst_RestartIter); + Read_SU2_Restart_Metadata(geometry, config, adjoint, filename_); + } /*--- Set the gamma value ---*/ diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 9329c8b023a7..93aade2668ea 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -176,7 +176,7 @@ void CIncNSSolver::GetStreamwise_Periodic_Properties(const CGeometry *geometry, } // loop periodic boundaries } // loop MarkerAll - // MPI Communication: Sum Area, Sum rho*A & T*A and divide by AreaGlobbal, sum massflow + // MPI Communication: Sum Area, Sum rho*A & T*A and divide by AreaGlobal, sum massflow su2double Area_Global(0), Average_Density_Global(0), MassFlow_Global(0), Temperature_Global(0); SU2_MPI::Allreduce(&Area_Local, &Area_Global, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(&Average_Density_Local, &Average_Density_Global, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); @@ -216,10 +216,10 @@ void CIncNSSolver::GetStreamwise_Periodic_Properties(const CGeometry *geometry, (e.g. 4x for INC_RANS restart). Each time, the pressure drop gets updated. For INC_RANS restarts it gets called 2x before the restart files are read such that the current massflow is Area*inital-velocity which can be way off! - With this there is still a slight inconsitency wrt to a non-restarted simulation: The restarted "zero-th" + With this there is still a slight inconsistency wrt to a non-restarted simulation: The restarted "zero-th" iteration does not get a pressure-update but the continuing simulation would have an update here. This can be fully neglected if the pressure drop is converged. And for all other cases it should be minor difference at - best ---*/ + best. ---*/ if((nZone==1 && InnerIter>0) || (nZone>1 && OuterIter>0)) { SPvals.Streamwise_Periodic_PressureDrop = Pressure_Drop_new; @@ -232,7 +232,7 @@ void CIncNSSolver::GetStreamwise_Periodic_Properties(const CGeometry *geometry, /*---------------------------------------------------------------------------------------------*/ /*--- 3. Compute the integrated Heatflow [W] for the energy equation source term, heatflux ---*/ /*--- boundary term and recovered Temperature. The computation is not completely clear. ---*/ - /*--- Here the Heatflux from all Bounary markers in the config-file is used. ---*/ + /*--- Here the Heatflux from all Boundary markers in the config-file is used. ---*/ /*---------------------------------------------------------------------------------------------*/ su2double HeatFlow_Local = 0.0, HeatFlow_Global = 0.0; diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 0ec0b5438f80..7fa0cb0dc10b 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -3332,6 +3332,7 @@ void CSolver::Read_SU2_Restart_Metadata(CGeometry *geometry, CConfig *config, bo su2double dCMx_dCL_ = config->GetdCMx_dCL(); su2double dCMy_dCL_ = config->GetdCMy_dCL(); su2double dCMz_dCL_ = config->GetdCMz_dCL(); + su2double SPPressureDrop_ = config->GetStreamwise_Periodic_PressureDrop(); string::size_type position; unsigned long InnerIter_ = 0; ifstream restart_file; @@ -3357,6 +3358,7 @@ void CSolver::Read_SU2_Restart_Metadata(CGeometry *geometry, CConfig *config, bo position = text_line.find ("ITER=",0); if (position != string::npos) { + // TODO: 'ITER=' has 5 chars, not 9! text_line.erase (0,9); InnerIter_ = atoi(text_line.c_str()); } @@ -3409,6 +3411,14 @@ void CSolver::Read_SU2_Restart_Metadata(CGeometry *geometry, CConfig *config, bo text_line.erase (0,15); dCMz_dCL_ = atof(text_line.c_str()); } + /*--- Streamwise periodic pressure drop for prescribed massflow cases. ---*/ + + position = text_line.find ("STREAMWISE_PERIODIC_PRESSURE_DROP=",0); + if (position != string::npos) { + // Erase the name from the line, 'STREAMWISE_PERIODIC_PRESSURE_DROP=' has 34 chars. + text_line.erase (0,34); SPPressureDrop_ = atof(text_line.c_str()); + } + } /*--- Close the restart meta file. ---*/ @@ -3500,6 +3510,17 @@ void CSolver::Read_SU2_Restart_Metadata(CGeometry *geometry, CConfig *config, bo } + + if (config->GetDiscard_InFiles() == false) { + if ((config->GetStreamwise_Periodic_PressureDrop() != SPPressureDrop_) && (rank == MASTER_NODE)) + cout <<"WARNING: SU2 will use the STREAMWISE_PERIODIC_PRESSURE_DROP provided in the direct solution file: " << std::setprecision(16) << SPPressureDrop_ << endl; + config->SetStreamwise_Periodic_PressureDrop(SPPressureDrop_); + } + else { + if ((config->GetStreamwise_Periodic_PressureDrop() != SPPressureDrop_) && (rank == MASTER_NODE)) + cout <<"WARNING: Discarding the STREAMWISE_PERIODIC_PRESSURE_DROP in the direct solution file." << endl; + } + /*--- External iteration ---*/ if ((config->GetDiscard_InFiles() == false) && (!adjoint || (adjoint && config->GetRestart()))) From cc00b17bf58d97c02e3dc83f19bf519bdac00015 Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Tue, 25 Jan 2022 17:30:15 +0100 Subject: [PATCH 04/22] Fix builds for github due to warning. --- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 4e27a46dd811..5e17736681f2 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -47,7 +47,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned ifstream restart_file; unsigned short nZone = geometry->GetnZone(); bool restart = (config->GetRestart() || config->GetRestart_Flow()); - int Unst_RestartIter; + int Unst_RestartIter = 0; unsigned short iZone = config->GetiZone(); bool dual_time = ((config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_1ST) || (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_2ND)); From db52fb15404c0e58cb3f67d54caa172ada30fc37 Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Fri, 28 Jan 2022 14:08:10 +0100 Subject: [PATCH 05/22] Try to add *_SURF hist output for Multizone cases. Not working yet. E.g. FLOW_COEFF_SURF[0] is not longer reported as ignored hist output filed but all values for these in the history file are zero. Not sure why tbh --- SU2_CFD/include/output/CMultizoneOutput.hpp | 2 +- SU2_CFD/include/output/COutput.hpp | 18 +++++++++- SU2_CFD/src/output/CMultizoneOutput.cpp | 37 ++++++++++++++++++++- SU2_CFD/src/output/COutput.cpp | 2 +- 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/include/output/CMultizoneOutput.hpp b/SU2_CFD/include/output/CMultizoneOutput.hpp index 308c919d8f3b..038d8e0259a5 100644 --- a/SU2_CFD/include/output/CMultizoneOutput.hpp +++ b/SU2_CFD/include/output/CMultizoneOutput.hpp @@ -73,7 +73,7 @@ class CMultizoneOutput final: public COutput { * \brief Set the available multizone history output fields * \param[in] output - Container holding the output instances per zone. */ - void SetMultizoneHistoryOutputFields(const COutput* const* output) override; + void SetMultizoneHistoryOutputFields(const COutput* const* output, const CConfig* const* config) override; /*! * \brief Determines if the history file output. diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 9b6da6cf484c..9f8d1499c9a2 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -432,6 +432,14 @@ class COutput { return historyOutput_List; } + /*! + * \brief Get the list of all per-surface fields + * \return Vector container all output per-surface fields + */ + const vector& GetHistoryOutputPerSurface_List() const { + return historyOutputPerSurface_List; + } + /*! * \brief Get the map containing all output fields * \return Map containing all output fields @@ -440,6 +448,14 @@ class COutput { return historyOutput_Map; } + /*! + * \brief Get the map containing all output per-surface fields + * \return Map containing all output per-surface fields + */ + const map>& GetHistoryPerSurfaceFields() const { + return historyOutputPerSurface_Map; + } + /*! * \brief Monitor the convergence of an output field * \param[in] config - Definition of the particular problem. @@ -837,7 +853,7 @@ class COutput { * \brief Set the available multizone history output fields * \param[in] output - Container holding the output instances per zone. */ - inline virtual void SetMultizoneHistoryOutputFields(const COutput* const* output) {} + inline virtual void SetMultizoneHistoryOutputFields(const COutput* const* output, const CConfig* const* config) {} /*! * \brief Write any additional files defined for the current solver. diff --git a/SU2_CFD/src/output/CMultizoneOutput.cpp b/SU2_CFD/src/output/CMultizoneOutput.cpp index 99064d64bc27..246b07104503 100644 --- a/SU2_CFD/src/output/CMultizoneOutput.cpp +++ b/SU2_CFD/src/output/CMultizoneOutput.cpp @@ -101,7 +101,7 @@ void CMultizoneOutput::LoadMultizoneHistoryData(const COutput* const* output) { SetHistoryOutputValue("COMBO", comboValue); } -void CMultizoneOutput::SetMultizoneHistoryOutputFields(const COutput* const* output) { +void CMultizoneOutput::SetMultizoneHistoryOutputFields(const COutput* const* output, const CConfig* const* config) { string name, header, group, zoneIndex; @@ -125,6 +125,41 @@ void CMultizoneOutput::SetMultizoneHistoryOutputFields(const COutput* const* out AddHistoryOutput(name, header, field.screenFormat, group, "", field.fieldType ); } } + /*--- Also add the PerSurface outputs ---*/ + const auto& ZoneHistoryPerSurfaceFields = output[iZone]->GetHistoryPerSurfaceFields(); + + vector Marker_Analyze; + for (unsigned short iMarker_Analyze = 0; iMarker_Analyze < config[iZone]->GetnMarker_Analyze(); iMarker_Analyze++){ + Marker_Analyze.push_back(config[iZone]->GetMarker_Analyze_TagBound(iMarker_Analyze)); + } + //Marker_Analyze.push_back("test"); + + for (const auto& nameSinglezone : output[iZone]->GetHistoryOutputPerSurface_List()) { + + if (nameSinglezone != "TIME_ITER" && nameSinglezone != "OUTER_ITER") { + + const auto& field = ZoneHistoryPerSurfaceFields.at(nameSinglezone); + + name = nameSinglezone + zoneIndex; + + // field[0].fieldName contains names like Avg_Massflow(fluid_outlet) but looking at CFlowOutput.cpp it is also: + // AddHistoryOutputPerSurface("SURFACE_MASSFLOW", "Avg_Massflow", ... without the markerTag already attached + // So first the fieldName for one of the markers (here the 0th) is taken and the markerTag in brackets is removed + string baseheader = field[0].fieldName; + std::string::size_type pos = baseheader.find('('); + if (pos != std::string::npos) + baseheader = baseheader.substr(0, pos); + else + SU2_MPI::Error("Cannot proccess PerSurface *_SURF history output.", CURRENT_FUNCTION); + + header = baseheader + zoneIndex; // field[i] where i is the marker + group = field[0].outputGroup + zoneIndex; + + AddHistoryOutputPerSurface(name, header, field[0].screenFormat, group, Marker_Analyze, field[0].fieldType ); + //AddHistoryOutputPerSurface("SURFACE_MASSFLOW", "Avg_Massflow", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); + //AddHistoryOutput "SURFACE_MASSFLOW", "Avg_Massflow", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "desc", HistoryFieldType::COEFFICIENT); + } + } } AddHistoryOutput("COMBO", "ComboObj", ScreenOutputFormat::SCIENTIFIC, "COMBO", "Combined obj. function value.", HistoryFieldType::COEFFICIENT); } diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 7d09aae1073a..ed834cd237b0 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1365,7 +1365,7 @@ void COutput::PreprocessMultizoneHistoryOutput(COutput **output, CConfig **confi /*--- Set the History output fields using a virtual function call to the child implementation ---*/ - SetMultizoneHistoryOutputFields(output); + SetMultizoneHistoryOutputFields(output, config); /*--- Postprocess the history fields. Creates new fields based on the ones set in the child classes ---*/ From 5dd641cf290caa5f705cf8e6a470ee933e14d72d Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Sun, 30 Jan 2022 13:57:59 +0100 Subject: [PATCH 06/22] Remove DV_MARKER check for multiple zones. CConfig checks whether the DV_MARKERs appear in the marker list. But for multizone cases it can happen, that the marker to be deformed are just in the zonal configs. The check would fail although everything is alright. To check it right one would need to check this after all zonal cfgs were read and then check it once with a loop over all cfgs to see whether DV_MARKER appears somewhere there. --- Common/src/CConfig.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 284b56e7243e..6b22c939589d 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -5733,7 +5733,10 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) { break; } } - if(!found) { + // In case of multiple zones, the markers might appear only in zonal config and not in the Master. + // A loop over all zones would need to be included which is not straight forward as this can only be + // checked once all zonal configs are read. + if(!found && (nZone==1)) { SU2_MPI::Error("DV_MARKER contains marker names that do not exist in the lists of BCs in the config file.", CURRENT_FUNCTION); } } From 7ba1efcb94ea20b5a857a8c684eb77428b2f0c8d Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Tue, 1 Feb 2022 11:53:43 +0100 Subject: [PATCH 07/22] Multizone PerSurf Hist output now working In multizone everything is done again + attaching the zone indices. So one had to do the AddHistPerSurf and SetHistPerSurf for multizone again. --- SU2_CFD/include/output/CMultizoneOutput.hpp | 3 +- SU2_CFD/include/output/COutput.hpp | 3 +- SU2_CFD/src/output/CMultizoneOutput.cpp | 54 +++++++++++++++++---- SU2_CFD/src/output/COutput.cpp | 2 +- 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/SU2_CFD/include/output/CMultizoneOutput.hpp b/SU2_CFD/include/output/CMultizoneOutput.hpp index 038d8e0259a5..c7dd56be6f13 100644 --- a/SU2_CFD/include/output/CMultizoneOutput.hpp +++ b/SU2_CFD/include/output/CMultizoneOutput.hpp @@ -66,8 +66,9 @@ class CMultizoneOutput final: public COutput { /*! * \brief Load the multizone history output field values * \param[in] output - Container holding the output instances per zone. + * \param[in] config - Definition of the particular problem. */ - void LoadMultizoneHistoryData(const COutput* const* output) override; + void LoadMultizoneHistoryData(const COutput* const* output, const CConfig* const* config) override; /*! * \brief Set the available multizone history output fields diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 9f8d1499c9a2..29aad51313be 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -840,8 +840,9 @@ class COutput { /*! * \brief Load the multizone history output field values * \param[in] output - Container holding the output instances per zone. + * \param[in] config - Definition of the particular problem. */ - inline virtual void LoadMultizoneHistoryData(const COutput* const* output) {} + inline virtual void LoadMultizoneHistoryData(const COutput* const* output, const CConfig* const* config) {} /*! * \brief Set the available history output fields diff --git a/SU2_CFD/src/output/CMultizoneOutput.cpp b/SU2_CFD/src/output/CMultizoneOutput.cpp index 246b07104503..f7a2ec2e2b37 100644 --- a/SU2_CFD/src/output/CMultizoneOutput.cpp +++ b/SU2_CFD/src/output/CMultizoneOutput.cpp @@ -78,7 +78,7 @@ CMultizoneOutput::CMultizoneOutput(const CConfig* driver_config, const CConfig* } -void CMultizoneOutput::LoadMultizoneHistoryData(const COutput* const* output) { +void CMultizoneOutput::LoadMultizoneHistoryData(const COutput* const* output, const CConfig* const* config) { string nameMultizone, zoneIndex; su2double comboValue = 0; @@ -97,6 +97,28 @@ void CMultizoneOutput::LoadMultizoneHistoryData(const COutput* const* output) { comboValue += item.second.value; } } + + for (const auto& item : output[iZone]->GetHistoryPerSurfaceFields()) { + const auto& name = item.first; + nameMultizone = name + zoneIndex; + const auto& group = item.second[0].outputGroup; + + /*--- Determine whether nMaker_Analyze/Monitoring has to be looped. ---*/ + unsigned short nMarker = 1; + if (group == "FLOW_COEFF_SURF") + nMarker = config[iZone]->GetnMarker_Analyze(); + else if (group == "AERO_COEFF_SURF") + nMarker = config[iZone]->GetnMarker_Monitoring(); + else + SU2_MPI::Error("Per Surface output group unknown: " + group, CURRENT_FUNCTION); + + for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { + SetHistoryOutputPerSurfaceValue(nameMultizone, item.second[iMarker].value, iMarker); + if (name == "COMBO") { + comboValue += item.second[iMarker].value; + } + }// for iMarker + }// for HistPerSurfFields } SetHistoryOutputValue("COMBO", comboValue); } @@ -125,14 +147,19 @@ void CMultizoneOutput::SetMultizoneHistoryOutputFields(const COutput* const* out AddHistoryOutput(name, header, field.screenFormat, group, "", field.fieldType ); } } - /*--- Also add the PerSurface outputs ---*/ - const auto& ZoneHistoryPerSurfaceFields = output[iZone]->GetHistoryPerSurfaceFields(); vector Marker_Analyze; - for (unsigned short iMarker_Analyze = 0; iMarker_Analyze < config[iZone]->GetnMarker_Analyze(); iMarker_Analyze++){ + for (unsigned short iMarker_Analyze = 0; iMarker_Analyze < config[iZone]->GetnMarker_Analyze(); iMarker_Analyze++) { Marker_Analyze.push_back(config[iZone]->GetMarker_Analyze_TagBound(iMarker_Analyze)); } - //Marker_Analyze.push_back("test"); + + vector Marker_Monitoring; + for (unsigned short iMarker_Monitoring = 0; iMarker_Monitoring < config[iZone]->GetnMarker_Monitoring(); iMarker_Monitoring++) { + Marker_Monitoring.push_back(config[iZone]->GetMarker_Monitoring_TagBound(iMarker_Monitoring)); + } + + /*--- Also add the PerSurface outputs ---*/ + const auto& ZoneHistoryPerSurfaceFields = output[iZone]->GetHistoryPerSurfaceFields(); for (const auto& nameSinglezone : output[iZone]->GetHistoryOutputPerSurface_List()) { @@ -153,11 +180,20 @@ void CMultizoneOutput::SetMultizoneHistoryOutputFields(const COutput* const* out SU2_MPI::Error("Cannot proccess PerSurface *_SURF history output.", CURRENT_FUNCTION); header = baseheader + zoneIndex; // field[i] where i is the marker - group = field[0].outputGroup + zoneIndex; + group = field[0].outputGroup; // Attach zone-index to the group after determining which group it is + + /*--- Determine whether nMaker_Analyze/Monitoring has to be used. ---*/ + vector Marker; + if (group == "FLOW_COEFF_SURF") + Marker = Marker_Analyze; + else if (group == "AERO_COEFF_SURF") + Marker = Marker_Monitoring; + else + SU2_MPI::Error("Per Surface output group unknown: " + group, CURRENT_FUNCTION); + + group += zoneIndex; - AddHistoryOutputPerSurface(name, header, field[0].screenFormat, group, Marker_Analyze, field[0].fieldType ); - //AddHistoryOutputPerSurface("SURFACE_MASSFLOW", "Avg_Massflow", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - //AddHistoryOutput "SURFACE_MASSFLOW", "Avg_Massflow", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "desc", HistoryFieldType::COEFFICIENT); + AddHistoryOutputPerSurface(name, header, field[0].screenFormat, group, Marker, field[0].fieldType ); } } } diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index ed834cd237b0..890a6561fe5d 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -236,7 +236,7 @@ void COutput::SetMultizoneHistory_Output(COutput **output, CConfig **config, CCo LoadCommonHistoryData(driver_config); - LoadMultizoneHistoryData(output); + LoadMultizoneHistoryData(output, config); Convergence_Monitoring(driver_config, curOuterIter); From 52410719a08703740263b4be824194d5b41f2c3a Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Tue, 1 Feb 2022 12:04:47 +0100 Subject: [PATCH 08/22] Adapt reg test for mutlizone per Surf output (on screen that is for now). --- .../streamwise_periodic/chtPinArray_2d/configMaster.cfg | 4 ++-- TestCases/parallel_regression.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configMaster.cfg index c34ee4da917d..b2a8a4dd23d2 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configMaster.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configMaster.cfg @@ -24,10 +24,10 @@ OUTER_ITER= 4000 % %CHT_ROBIN= NO % -SCREEN_OUTPUT= ( OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1] ) +SCREEN_OUTPUT= ( OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1], SURFACE_MASSFLOW[0] ) SCREEN_WRT_FREQ_OUTER= 100 % -HISTORY_OUTPUT= ( ITER, BGS_RES[0], BGS_RES[1], RMS_RES[0], RMS_RES[1], STREAMWISE_PERIODIC[0], FLOW_COEFF[0], HEAT[1], LINSOL[0], LINSOL[1], HEAT[0] ) +HISTORY_OUTPUT= ( ITER, BGS_RES[0], BGS_RES[1], RMS_RES[0], RMS_RES[1], STREAMWISE_PERIODIC[0], FLOW_COEFF[0], FLOW_COEFF_SURF[0], HEAT[1], LINSOL[0], LINSOL[1], HEAT[0] ) % OUTPUT_FILES= ( RESTART, PARAVIEW_MULTIBLOCK ) OUTPUT_WRT_FREQ= 1000 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index ca1a8b3f48db..64a366562341 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1411,12 +1411,12 @@ def main(): cht_compressible.tol = 0.00001 test_list.append(cht_compressible) - # 2D CHT case streamwise periodicity + # 2D CHT case streamwise periodicity. Also test Multizone PerSurface screen output. sp_pinArray_cht_2d_dp_hf = TestCase('sp_pinArray_cht_2d_dp_hf') sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" sp_pinArray_cht_2d_dp_hf.cfg_file = "configMaster.cfg" sp_pinArray_cht_2d_dp_hf.test_iter = 100 - sp_pinArray_cht_2d_dp_hf.test_vals = [0.246959, -0.811849, -0.962120, -0.753320, 208.023676, 349.990000] #last 7 lines + sp_pinArray_cht_2d_dp_hf.test_vals = [0.246959, -0.811849, -0.962120, -0.753320, 208.023676, 349.990000, -8.9660e-10, -7.5332e-01, 7.5332e-01] sp_pinArray_cht_2d_dp_hf.su2_exec = "mpirun -n 2 SU2_CFD" sp_pinArray_cht_2d_dp_hf.timeout = 1600 sp_pinArray_cht_2d_dp_hf.tol = 0.00001 From 16611fd84f2f6682a22ee822e7e1226638324ddf Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Tue, 1 Feb 2022 12:15:26 +0100 Subject: [PATCH 09/22] Polishing of PerSurf Multizone output --- SU2_CFD/src/output/CMultizoneOutput.cpp | 62 ++++++++++++------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/SU2_CFD/src/output/CMultizoneOutput.cpp b/SU2_CFD/src/output/CMultizoneOutput.cpp index f7a2ec2e2b37..622c0cf0b177 100644 --- a/SU2_CFD/src/output/CMultizoneOutput.cpp +++ b/SU2_CFD/src/output/CMultizoneOutput.cpp @@ -98,13 +98,14 @@ void CMultizoneOutput::LoadMultizoneHistoryData(const COutput* const* output, co } } + /*-- Load the PerSurface values.- ---*/ for (const auto& item : output[iZone]->GetHistoryPerSurfaceFields()) { const auto& name = item.first; nameMultizone = name + zoneIndex; - const auto& group = item.second[0].outputGroup; /*--- Determine whether nMaker_Analyze/Monitoring has to be looped. ---*/ - unsigned short nMarker = 1; + const auto& group = item.second[0].outputGroup; + unsigned short nMarker = 0; if (group == "FLOW_COEFF_SURF") nMarker = config[iZone]->GetnMarker_Analyze(); else if (group == "AERO_COEFF_SURF") @@ -148,6 +149,7 @@ void CMultizoneOutput::SetMultizoneHistoryOutputFields(const COutput* const* out } } + /*--- Prepare Marker lists that are passed to 'AddHistoryOutputPerSurface'. ---*/ vector Marker_Analyze; for (unsigned short iMarker_Analyze = 0; iMarker_Analyze < config[iZone]->GetnMarker_Analyze(); iMarker_Analyze++) { Marker_Analyze.push_back(config[iZone]->GetMarker_Analyze_TagBound(iMarker_Analyze)); @@ -158,43 +160,39 @@ void CMultizoneOutput::SetMultizoneHistoryOutputFields(const COutput* const* out Marker_Monitoring.push_back(config[iZone]->GetMarker_Monitoring_TagBound(iMarker_Monitoring)); } - /*--- Also add the PerSurface outputs ---*/ + /*--- Add the PerSurface outputs. ---*/ const auto& ZoneHistoryPerSurfaceFields = output[iZone]->GetHistoryPerSurfaceFields(); for (const auto& nameSinglezone : output[iZone]->GetHistoryOutputPerSurface_List()) { - if (nameSinglezone != "TIME_ITER" && nameSinglezone != "OUTER_ITER") { + const auto& field = ZoneHistoryPerSurfaceFields.at(nameSinglezone); - const auto& field = ZoneHistoryPerSurfaceFields.at(nameSinglezone); + name = nameSinglezone + zoneIndex; - name = nameSinglezone + zoneIndex; + /*--- Remove the unnecessary Marker name from the fieldName, i.e. "Avg_Massflow(inlet)"->"Avg_Massflow". ---*/ + string baseheader = field[0].fieldName; + std::string::size_type pos = baseheader.find('('); + if (pos != std::string::npos) + baseheader = baseheader.substr(0, pos); + else + SU2_MPI::Error("Cannot proccess PerSurface *_SURF history output: " + baseheader, CURRENT_FUNCTION); - // field[0].fieldName contains names like Avg_Massflow(fluid_outlet) but looking at CFlowOutput.cpp it is also: - // AddHistoryOutputPerSurface("SURFACE_MASSFLOW", "Avg_Massflow", ... without the markerTag already attached - // So first the fieldName for one of the markers (here the 0th) is taken and the markerTag in brackets is removed - string baseheader = field[0].fieldName; - std::string::size_type pos = baseheader.find('('); - if (pos != std::string::npos) - baseheader = baseheader.substr(0, pos); - else - SU2_MPI::Error("Cannot proccess PerSurface *_SURF history output.", CURRENT_FUNCTION); - - header = baseheader + zoneIndex; // field[i] where i is the marker - group = field[0].outputGroup; // Attach zone-index to the group after determining which group it is - - /*--- Determine whether nMaker_Analyze/Monitoring has to be used. ---*/ - vector Marker; - if (group == "FLOW_COEFF_SURF") - Marker = Marker_Analyze; - else if (group == "AERO_COEFF_SURF") - Marker = Marker_Monitoring; - else - SU2_MPI::Error("Per Surface output group unknown: " + group, CURRENT_FUNCTION); - - group += zoneIndex; - - AddHistoryOutputPerSurface(name, header, field[0].screenFormat, group, Marker, field[0].fieldType ); - } + header = baseheader + zoneIndex; + /*--- Attach zone-index to the group after determining which group it is. ---*/ + group = field[0].outputGroup; + + /*--- Determine whether Maker_Analyze/Monitoring has to be used. ---*/ + vector Marker; + if (group == "FLOW_COEFF_SURF") + Marker = Marker_Analyze; + else if (group == "AERO_COEFF_SURF") + Marker = Marker_Monitoring; + else + SU2_MPI::Error("Per Surface output group unknown: " + group, CURRENT_FUNCTION); + + group += zoneIndex; + + AddHistoryOutputPerSurface(name, header, field[0].screenFormat, group, Marker, field[0].fieldType ); } } AddHistoryOutput("COMBO", "ComboObj", ScreenOutputFormat::SCIENTIFIC, "COMBO", "Combined obj. function value.", HistoryFieldType::COEFFICIENT); From bdc59ffdc0c8a44c59dd2df0b0342d89548640de Mon Sep 17 00:00:00 2001 From: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com> Date: Tue, 1 Feb 2022 12:28:57 +0100 Subject: [PATCH 10/22] Apply suggestions from code review --- SU2_CFD/src/output/CMultizoneOutput.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/output/CMultizoneOutput.cpp b/SU2_CFD/src/output/CMultizoneOutput.cpp index 622c0cf0b177..4485520c5c6e 100644 --- a/SU2_CFD/src/output/CMultizoneOutput.cpp +++ b/SU2_CFD/src/output/CMultizoneOutput.cpp @@ -170,16 +170,18 @@ void CMultizoneOutput::SetMultizoneHistoryOutputFields(const COutput* const* out name = nameSinglezone + zoneIndex; /*--- Remove the unnecessary Marker name from the fieldName, i.e. "Avg_Massflow(inlet)"->"Avg_Massflow". ---*/ + /*--- Note that index zero in 'field[0]' refers to a specific Marker. Some attributes remain constant over the markers + like the first part of the name, the screenFormat and the fieldType. ---*/ string baseheader = field[0].fieldName; std::string::size_type pos = baseheader.find('('); if (pos != std::string::npos) baseheader = baseheader.substr(0, pos); else - SU2_MPI::Error("Cannot proccess PerSurface *_SURF history output: " + baseheader, CURRENT_FUNCTION); + SU2_MPI::Error("Cannot process PerSurface *_SURF history output: " + baseheader, CURRENT_FUNCTION); header = baseheader + zoneIndex; /*--- Attach zone-index to the group after determining which group it is. ---*/ - group = field[0].outputGroup; + group = field[0].outputGroup; /*--- Determine whether Maker_Analyze/Monitoring has to be used. ---*/ vector Marker; From 7e5893cd335e2af00dc327df7819fbccf153004f Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Tue, 1 Feb 2022 12:38:57 +0100 Subject: [PATCH 11/22] Add now written PerSurf values to Reg test_vals. --- TestCases/tutorials.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index e2ee0697457e..fa40656d3510 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -49,7 +49,7 @@ def main(): cht_incompressible_unsteady.cfg_dir = "../Tutorials/multiphysics/unsteady_cht/" cht_incompressible_unsteady.cfg_file = "cht_2d_3cylinders.cfg" cht_incompressible_unsteady.test_iter = 2 - cht_incompressible_unsteady.test_vals = [-2.659390, -2.533160, -0.080399, -0.080399, -0.080399, -12.421450, 0.0000e+00, 0.0000e+00, 2.3824e+02] #last 9 columns + cht_incompressible_unsteady.test_vals = [-2.659390, -2.533160, -0.080399, -0.080399, -0.080399, -12.421450, 0.0000e+00, 0.0, 0.0, 0.0, 0.0000e+00, 2.3824e+02] #last columns cht_incompressible_unsteady.su2_exec = "mpirun -n 2 SU2_CFD" cht_incompressible_unsteady.timeout = 1600 cht_incompressible_unsteady.multizone = True From 982e9fcfe9f48f4dc3b37c7fb621772a5155d8a6 Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Tue, 1 Feb 2022 14:52:14 +0100 Subject: [PATCH 12/22] Change a reg test to restart with flow.meta --- .../streamwise_periodic/chtPinArray_3d/configFluid.cfg | 7 ++++--- .../streamwise_periodic/chtPinArray_3d/configMaster.cfg | 9 +++++---- .../streamwise_periodic/chtPinArray_3d/configSolid.cfg | 7 ++++--- TestCases/parallel_regression.py | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configFluid.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configFluid.cfg index 41aa9ff855c9..74f2cb925f2c 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configFluid.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configFluid.cfg @@ -105,9 +105,10 @@ TIME_DISCRE_TURB= EULER_IMPLICIT % % --------------------------- CONVERGENCE PARAMETERS --------------------------% % -CONV_RESIDUAL_MINVAL= -26 -CONV_STARTITER= 100000000 +CONV_FIELD= RMS_TEMPERATURE +CONV_RESIDUAL_MINVAL= -18 +CONV_STARTITER= 100 % % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % -HISTORY_OUTPUT= ( ITER, RMS_RES, STREAMWISE_PERIODIC, FLOW_COEFF ) +%HISTORY_OUTPUT= ( ITER, RMS_RES, STREAMWISE_PERIODIC, FLOW_COEFF ) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg index d5bc1f77c299..b9a3700ec079 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg @@ -10,6 +10,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % SOLVER= MULTIPHYSICS +RESTART_SOL= YES % CONFIG_LIST = (configFluid.cfg, configSolid.cfg) % @@ -17,18 +18,18 @@ MARKER_ZONE_INTERFACE= (fluid_bottom_interface, solid_bottom_interface, fluid_pi % MARKER_CHT_INTERFACE= (fluid_bottom_interface, solid_bottom_interface, fluid_pin1, solid_pin1, fluid_pin2, solid_pin2, fluid_pin3, solid_pin3 ) % -OUTER_ITER = 15000 +OUTER_ITER = 31 % CONV_RESIDUAL_MINVAL= -26 % -SCREEN_OUTPUT= (OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1] ) +SCREEN_OUTPUT= (WALL_TIME, OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1] ) SCREEN_WRT_FREQ_OUTER= 100 % +HISTORY_OUTPUT= ( ITER, RMS_RES[0], RMS_RES[1], STREAMWISE_PERIODIC[0], FLOW_COEFF[0], HEAT[1] ) +% OUTPUT_FILES= (RESTART, PARAVIEW_MULTIBLOCK) OUTPUT_WRT_FREQ= 2500 % -%CHT_ROBIN= NO -% % Mesh input file MESH_FILENAME= 3D_chtPinArray_coarse.su2 % diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configSolid.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configSolid.cfg index 6f1a22914445..f5b8a682a716 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configSolid.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configSolid.cfg @@ -56,8 +56,9 @@ LINEAR_SOLVER_ITER= 15 % % --------------------------- CONVERGENCE PARAMETERS --------------------------% % -CONV_RESIDUAL_MINVAL= -20 -CONV_STARTITER= 10000000000 +CONV_FIELD= RMS_TEMPERATURE +CONV_RESIDUAL_MINVAL= -18 +CONV_STARTITER= 100 % % -------------------- HEAT NUMERICAL METHOD DEFINITION -----------------------% % @@ -66,4 +67,4 @@ TIME_DISCRE_HEAT= EULER_IMPLICIT % % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % -HISTORY_OUTPUT= (ITER, RMS_RES, HEAT) +%HISTORY_OUTPUT= (ITER, RMS_RES, HEAT) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 64a366562341..fcd80328b9a0 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1428,7 +1428,7 @@ def main(): sp_pinArray_3d_cht_mf_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_3d" sp_pinArray_3d_cht_mf_hf_tp.cfg_file = "configMaster.cfg" sp_pinArray_3d_cht_mf_hf_tp.test_iter = 30 - sp_pinArray_3d_cht_mf_hf_tp.test_vals = [0.511984, -3.063453, -0.451962, -0.008477, 214.707868, 365.670000] #last 7 lines + sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-13.380025, -9.992493, -32.000000, -0.009675, 99.879812, 4.1920e+02] sp_pinArray_3d_cht_mf_hf_tp.su2_exec = "mpirun -n 2 SU2_CFD" sp_pinArray_3d_cht_mf_hf_tp.timeout = 1600 sp_pinArray_3d_cht_mf_hf_tp.tol = 0.00001 From 8f7f84cf7cf0da1343c11bc437f2dbd45bd7d42f Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Tue, 1 Feb 2022 14:55:40 +0100 Subject: [PATCH 13/22] Tmp change of github workflow to load correct Testcases. --- .github/workflows/regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 3b670469fa65..38edb3d8933e 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -90,7 +90,7 @@ jobs: uses: docker://su2code/test-su2:20200303 with: # -t -c - args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t develop -c massflow_flowmeta -s ${{matrix.testscript}} unit_tests: runs-on: ubuntu-latest name: Unit Tests From 63804a834ebb97fc751b7bc05a496d94e223f4d6 Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Tue, 1 Feb 2022 15:21:51 +0100 Subject: [PATCH 14/22] Rmv WALL_TIME from screen out to make reg test work. --- .../streamwise_periodic/chtPinArray_3d/configMaster.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg index b9a3700ec079..e6eccb781f79 100644 --- a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg @@ -22,7 +22,7 @@ OUTER_ITER = 31 % CONV_RESIDUAL_MINVAL= -26 % -SCREEN_OUTPUT= (WALL_TIME, OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1] ) +SCREEN_OUTPUT= (OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1] ) SCREEN_WRT_FREQ_OUTER= 100 % HISTORY_OUTPUT= ( ITER, RMS_RES[0], RMS_RES[1], STREAMWISE_PERIODIC[0], FLOW_COEFF[0], HEAT[1] ) From 32b84273531d8dc53cea5b33e4452421e6a85df1 Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Tue, 1 Feb 2022 15:45:15 +0100 Subject: [PATCH 15/22] Fix reg tests that would pass where they should actually fail. When using WALL_TIME as the first SCREEN_OUTPUT field, in Testcase.py, the code would never reach the iter_missing=True block as the line would produce a ValueError for every line. And because the default was iter_missing=False and passed=True ... the test reports passed. Setting the defaults to the non-passed version fixes that issue. --- TestCases/TestCase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/TestCase.py b/TestCases/TestCase.py index 8dcee2fee986..89110ed90c0c 100644 --- a/TestCases/TestCase.py +++ b/TestCases/TestCase.py @@ -76,10 +76,10 @@ def __init__(self,tag_in): def run_test(self): print('==================== Start Test: %s ===================='%self.tag) - passed = True + passed = False exceed_tol = False timed_out = False - iter_missing = False + iter_missing = True start_solver = True # if root, add flag to mpirun From ed6b29cee6151687b474f58516c06561397d737e Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Tue, 1 Feb 2022 16:01:15 +0100 Subject: [PATCH 16/22] Revert passed=False as the code assumes True until proven otherwise ... which I believe is not clever programming, especially for regression tests. --- TestCases/TestCase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/TestCase.py b/TestCases/TestCase.py index 89110ed90c0c..438482adf9b4 100644 --- a/TestCases/TestCase.py +++ b/TestCases/TestCase.py @@ -76,7 +76,7 @@ def __init__(self,tag_in): def run_test(self): print('==================== Start Test: %s ===================='%self.tag) - passed = False + passed = True exceed_tol = False timed_out = False iter_missing = True From f7f4c6df9ba56c4cb903fc549eec19b2f4dfadf7 Mon Sep 17 00:00:00 2001 From: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com> Date: Wed, 2 Feb 2022 13:11:17 +0100 Subject: [PATCH 17/22] Cleanup suggestions from code review Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- SU2_CFD/src/output/CMultizoneOutput.cpp | 9 +++------ SU2_CFD/src/solvers/CSolver.cpp | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/SU2_CFD/src/output/CMultizoneOutput.cpp b/SU2_CFD/src/output/CMultizoneOutput.cpp index 4485520c5c6e..9b40ec25946b 100644 --- a/SU2_CFD/src/output/CMultizoneOutput.cpp +++ b/SU2_CFD/src/output/CMultizoneOutput.cpp @@ -115,9 +115,6 @@ void CMultizoneOutput::LoadMultizoneHistoryData(const COutput* const* output, co for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { SetHistoryOutputPerSurfaceValue(nameMultizone, item.second[iMarker].value, iMarker); - if (name == "COMBO") { - comboValue += item.second[iMarker].value; - } }// for iMarker }// for HistPerSurfFields } @@ -172,10 +169,10 @@ void CMultizoneOutput::SetMultizoneHistoryOutputFields(const COutput* const* out /*--- Remove the unnecessary Marker name from the fieldName, i.e. "Avg_Massflow(inlet)"->"Avg_Massflow". ---*/ /*--- Note that index zero in 'field[0]' refers to a specific Marker. Some attributes remain constant over the markers like the first part of the name, the screenFormat and the fieldType. ---*/ - string baseheader = field[0].fieldName; - std::string::size_type pos = baseheader.find('('); + string baseheader; + const auto pos = field[0].fieldName.find('('); if (pos != std::string::npos) - baseheader = baseheader.substr(0, pos); + baseheader = field[0].fieldName.substr(0, pos); else SU2_MPI::Error("Cannot process PerSurface *_SURF history output: " + baseheader, CURRENT_FUNCTION); diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 7fa0cb0dc10b..5d9b81c3dc5b 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -3510,7 +3510,6 @@ void CSolver::Read_SU2_Restart_Metadata(CGeometry *geometry, CConfig *config, bo } - if (config->GetDiscard_InFiles() == false) { if ((config->GetStreamwise_Periodic_PressureDrop() != SPPressureDrop_) && (rank == MASTER_NODE)) cout <<"WARNING: SU2 will use the STREAMWISE_PERIODIC_PRESSURE_DROP provided in the direct solution file: " << std::setprecision(16) << SPPressureDrop_ << endl; From 75746ac3e3a1ab6049a87ca9f0ac9f71c7eab671 Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Wed, 2 Feb 2022 13:13:53 +0100 Subject: [PATCH 18/22] Additional warning for mutlizone, if DV_MARKERs not found. Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- Common/src/CConfig.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 6b22c939589d..8a6ce623fa01 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -5733,11 +5733,16 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) { break; } } - // In case of multiple zones, the markers might appear only in zonal config and not in the Master. - // A loop over all zones would need to be included which is not straight forward as this can only be - // checked once all zonal configs are read. - if(!found && (nZone==1)) { - SU2_MPI::Error("DV_MARKER contains marker names that do not exist in the lists of BCs in the config file.", CURRENT_FUNCTION); + + if(!found) { + if (nZone==1) + SU2_MPI::Error("DV_MARKER contains marker names that do not exist in the lists of BCs in the config file.", CURRENT_FUNCTION); + // In case of multiple zones, the markers might appear only in zonal config and not in the Master. + // A loop over all zones would need to be included which is not straight forward as this can only be + // checked once all zonal configs are read. + else + cout << "Warning: DV_MARKER contains marker names that do not exist in the lists of BCs of the master config file.\n" << + "Make sure the marker names exist in the zonal config files" << endl; } } From 2cbbe237c6f758ef662281df054e57d7292203fc Mon Sep 17 00:00:00 2001 From: TobiKattmann Date: Wed, 2 Feb 2022 13:58:51 +0100 Subject: [PATCH 19/22] Pass vector of strings by reference. --- SU2_CFD/src/output/CMultizoneOutput.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/SU2_CFD/src/output/CMultizoneOutput.cpp b/SU2_CFD/src/output/CMultizoneOutput.cpp index 9b40ec25946b..7082f5aa5726 100644 --- a/SU2_CFD/src/output/CMultizoneOutput.cpp +++ b/SU2_CFD/src/output/CMultizoneOutput.cpp @@ -181,17 +181,19 @@ void CMultizoneOutput::SetMultizoneHistoryOutputFields(const COutput* const* out group = field[0].outputGroup; /*--- Determine whether Maker_Analyze/Monitoring has to be used. ---*/ - vector Marker; + vector* Marker; if (group == "FLOW_COEFF_SURF") - Marker = Marker_Analyze; + Marker = &Marker_Analyze; else if (group == "AERO_COEFF_SURF") - Marker = Marker_Monitoring; - else + Marker = &Marker_Monitoring; + else { + Marker = &Marker_Analyze; // dummy to suppress maybe-uninitialized warning SU2_MPI::Error("Per Surface output group unknown: " + group, CURRENT_FUNCTION); + } group += zoneIndex; - AddHistoryOutputPerSurface(name, header, field[0].screenFormat, group, Marker, field[0].fieldType ); + AddHistoryOutputPerSurface(name, header, field[0].screenFormat, group, *Marker, field[0].fieldType ); } } AddHistoryOutput("COMBO", "ComboObj", ScreenOutputFormat::SCIENTIFIC, "COMBO", "Combined obj. function value.", HistoryFieldType::COEFFICIENT); From 4baa963e53d3e8a419338f5dcc8321a4e20ab1de Mon Sep 17 00:00:00 2001 From: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com> Date: Wed, 2 Feb 2022 14:17:58 +0100 Subject: [PATCH 20/22] revert tmp changes to .github/workflows/regression.yml --- .github/workflows/regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 38edb3d8933e..3b670469fa65 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -90,7 +90,7 @@ jobs: uses: docker://su2code/test-su2:20200303 with: # -t -c - args: -b ${{github.ref}} -t develop -c massflow_flowmeta -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} unit_tests: runs-on: ubuntu-latest name: Unit Tests From 6e06a34668aff8631984cbddb93f7311627944f5 Mon Sep 17 00:00:00 2001 From: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com> Date: Wed, 2 Feb 2022 16:11:52 +0100 Subject: [PATCH 21/22] Only Write screen output on Master node Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- Common/src/CConfig.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 8a6ce623fa01..da29f9c0ae15 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -5740,8 +5740,8 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) { // In case of multiple zones, the markers might appear only in zonal config and not in the Master. // A loop over all zones would need to be included which is not straight forward as this can only be // checked once all zonal configs are read. - else - cout << "Warning: DV_MARKER contains marker names that do not exist in the lists of BCs of the master config file.\n" << + else if (rank == MASTER_NODE) + cout << "Warning: DV_MARKER contains marker names that do not exist in the lists of BCs of the master config file.\n" "Make sure the marker names exist in the zonal config files" << endl; } } From a4d0060bf55259eb8dc2f51f574a987633f2bd2c Mon Sep 17 00:00:00 2001 From: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com> Date: Wed, 2 Feb 2022 18:30:59 +0100 Subject: [PATCH 22/22] Update reg test value This is due to the previously merged PR #1530 where an NDIME error in the mesh was fixed (where the reg test values already changed) and as this PR makes the same case a restarted one... the values have to be adapted again --- 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 fcd80328b9a0..640d595a5f96 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1428,7 +1428,7 @@ def main(): sp_pinArray_3d_cht_mf_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_3d" sp_pinArray_3d_cht_mf_hf_tp.cfg_file = "configMaster.cfg" sp_pinArray_3d_cht_mf_hf_tp.test_iter = 30 - sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-13.380025, -9.992493, -32.000000, -0.009675, 99.879812, 4.1920e+02] + sp_pinArray_3d_cht_mf_hf_tp.test_vals = [-13.380025, -7.476945, -7.025285, -0.009675, 99.879812, 4.1920e+02] sp_pinArray_3d_cht_mf_hf_tp.su2_exec = "mpirun -n 2 SU2_CFD" sp_pinArray_3d_cht_mf_hf_tp.timeout = 1600 sp_pinArray_3d_cht_mf_hf_tp.tol = 0.00001