From 36e7f6911b695ff1cb4740eb0255c134b41b3e1b Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Fri, 28 Apr 2023 20:40:57 -0700 Subject: [PATCH 1/7] allow simple custom outputs for all output classes and allow them to be used for primal and adjoint variables --- SU2_CFD/include/output/CFlowOutput.hpp | 5 ++- SU2_CFD/include/output/COutput.hpp | 12 ++++++ SU2_CFD/src/output/CAdjElasticityOutput.cpp | 2 + SU2_CFD/src/output/CAdjFlowCompOutput.cpp | 2 + SU2_CFD/src/output/CAdjFlowIncOutput.cpp | 2 + SU2_CFD/src/output/CAdjFlowOutput.cpp | 2 + SU2_CFD/src/output/CAdjHeatOutput.cpp | 1 + SU2_CFD/src/output/CElasticityOutput.cpp | 3 ++ SU2_CFD/src/output/CFlowCompFEMOutput.cpp | 1 + SU2_CFD/src/output/CFlowOutput.cpp | 23 +++++++++-- SU2_CFD/src/output/CHeatOutput.cpp | 2 + SU2_CFD/src/output/COutput.cpp | 39 ++++++++++++++++++- TestCases/disc_adj_fsi/Airfoil_2d/config.cfg | 2 +- .../disc_adj_fsi/Airfoil_2d/configFEA.cfg | 7 +++- TestCases/parallel_regression_AD.py | 4 +- 15 files changed, 95 insertions(+), 12 deletions(-) diff --git a/SU2_CFD/include/output/CFlowOutput.hpp b/SU2_CFD/include/output/CFlowOutput.hpp index a3893cfb23cf..dcab274bf021 100644 --- a/SU2_CFD/include/output/CFlowOutput.hpp +++ b/SU2_CFD/include/output/CFlowOutput.hpp @@ -215,7 +215,8 @@ class CFlowOutput : public CFVMOutput{ * \brief Helper for custom outputs, converts variable names to indices and pointers which are then used * to evaluate the custom expressions. */ - void ConvertVariableSymbolsToIndices(const CPrimitiveIndices& idx, CustomOutput& output) const; + void ConvertVariableSymbolsToIndices(const CPrimitiveIndices& idx, bool allowSkip, + CustomOutput& output) const; /*! * \brief Compute value of the Q criteration for vortex idenfitication @@ -296,7 +297,7 @@ class CFlowOutput : public CFVMOutput{ * \param[in] force_writing - boolean that forces writing of volume output * \param[in] iFile - index to the file that we need to consider for volume output */ - bool WriteVolumeOutput(CConfig *config, unsigned long Iter, bool force_writing, unsigned short iFile) override; + bool WriteVolumeOutput(CConfig *config, unsigned long Iter, bool force_writing, unsigned short iFile) override; /*! * \brief Write the forces breakdown file * \param[in] config - Definition of the particular problem per zone. diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 2b2b093fbc99..bee30933850b 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -223,6 +223,10 @@ class COutput { We store pointers to the required outputs to speed-up access. ---*/ std::vector otherOutputs; + /*--- For discrete adjoint we may need to skip some expressions because there is one output class + for the primal solver and one for the discrete adjoint (each with different variables). ---*/ + bool skip = false; + /*--- For evaluation, "vars" is a functor (i.e. has operator()) that returns the value of a variable at a given point. For example, it can be a wrapper to the primitives pointer, in which case varIndices needs to be setup with primitive indices. ---*/ @@ -807,6 +811,14 @@ class COutput { */ void SetCustomOutputs(const CConfig *config); + /*! + * \brief Evaluates function-type custom outputs. + * Derived classes can use this to compute simple expressions of other outputs if they + * do not implement surface averages. This should be called just before evaluating the + * custom objective function. + */ + void ComputeSimpleCustomOutputs(const CConfig *config); + /*! * \brief Load values of the history fields common for all solvers. * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/src/output/CAdjElasticityOutput.cpp b/SU2_CFD/src/output/CAdjElasticityOutput.cpp index e30f2895f654..5be89b6b2cb5 100644 --- a/SU2_CFD/src/output/CAdjElasticityOutput.cpp +++ b/SU2_CFD/src/output/CAdjElasticityOutput.cpp @@ -172,6 +172,8 @@ inline void CAdjElasticityOutput::LoadHistoryData(CConfig *config, CGeometry *ge SetHistoryOutputValue("BGS_ADJ_DISP_Z", log10(solver[ADJFEA_SOL]->GetRes_BGS(2))); } } + + ComputeSimpleCustomOutputs(config); } void CAdjElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ diff --git a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp index 7555b7ca6c34..8804f203b7f3 100644 --- a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp @@ -225,6 +225,8 @@ void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C } LoadHistoryDataAdjScalar(config, solver); + + ComputeSimpleCustomOutputs(config); } void CAdjFlowCompOutput::SetVolumeOutputFields(CConfig *config) { diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index 6b58c2206b23..25ff3365250d 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -275,6 +275,8 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS } LoadHistoryDataAdjScalar(config, solver); + + ComputeSimpleCustomOutputs(config); } void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config) { diff --git a/SU2_CFD/src/output/CAdjFlowOutput.cpp b/SU2_CFD/src/output/CAdjFlowOutput.cpp index bf80b6c807fa..4ef01b6c16c9 100644 --- a/SU2_CFD/src/output/CAdjFlowOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowOutput.cpp @@ -172,6 +172,8 @@ void CAdjFlowOutput::LoadHistoryDataAdjScalar(const CConfig* config, const CSolv SetHistoryOutputValue("LINSOL_ITER_SPECIES", adjspecies_solver->GetIterLinSolver()); SetHistoryOutputValue("LINSOL_RESIDUAL_SPECIES", log10(adjspecies_solver->GetResLinSolver())); } + + ComputeSimpleCustomOutputs(config); } void CAdjFlowOutput::SetVolumeOutputFieldsAdjScalarSolution(const CConfig* config) { diff --git a/SU2_CFD/src/output/CAdjHeatOutput.cpp b/SU2_CFD/src/output/CAdjHeatOutput.cpp index 65d5679b8cad..3e0cbcaf50c6 100644 --- a/SU2_CFD/src/output/CAdjHeatOutput.cpp +++ b/SU2_CFD/src/output/CAdjHeatOutput.cpp @@ -142,6 +142,7 @@ void CAdjHeatOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv SetHistoryOutputValue("DEFORM_RESIDUAL", log10(solver[MESH_SOL]->System.GetResidual())); } + ComputeSimpleCustomOutputs(config); } void CAdjHeatOutput::SetVolumeOutputFields(CConfig *config){ diff --git a/SU2_CFD/src/output/CElasticityOutput.cpp b/SU2_CFD/src/output/CElasticityOutput.cpp index 365901ba5485..fe5efe5b390c 100644 --- a/SU2_CFD/src/output/CElasticityOutput.cpp +++ b/SU2_CFD/src/output/CElasticityOutput.cpp @@ -146,6 +146,9 @@ void CElasticityOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS SetHistoryOutputValue("VOLUME_FRACTION", fea_solver->GetTotal_OFVolFrac()); SetHistoryOutputValue("TOPOL_DISCRETENESS", fea_solver->GetTotal_OFDiscreteness()); } + + ComputeSimpleCustomOutputs(config); + /*--- Keep this as last, since it uses the history values that were set. ---*/ SetCustomAndComboObjectives(FEA_SOL, config, solver); diff --git a/SU2_CFD/src/output/CFlowCompFEMOutput.cpp b/SU2_CFD/src/output/CFlowCompFEMOutput.cpp index 91ce4393034d..4a919c9278b6 100644 --- a/SU2_CFD/src/output/CFlowCompFEMOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompFEMOutput.cpp @@ -263,6 +263,7 @@ void CFlowCompFEMOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C SetAerodynamicCoefficients(config, flow_solver); + ComputeSimpleCustomOutputs(config); } bool CFlowCompFEMOutput::SetInitResiduals(const CConfig *config){ diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index bff61c408c9f..25de58c53fa6 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -745,7 +745,7 @@ void CFlowOutput::SetAnalyzeSurfaceSpeciesVariance(const CSolver* const*solver, SetHistoryOutputValue("SURFACE_SPECIES_VARIANCE", Tot_Surface_SpeciesVariance); } -void CFlowOutput::ConvertVariableSymbolsToIndices(const CPrimitiveIndices& idx, +void CFlowOutput::ConvertVariableSymbolsToIndices(const CPrimitiveIndices& idx, const bool allowSkip, CustomOutput& output) const { const auto nameToIndex = PrimitiveNameToIndexMap(idx); @@ -796,23 +796,38 @@ void CFlowOutput::ConvertVariableSymbolsToIndices(const CPrimitiveIndicesGetDiscrete_Adjoint(); const bool axisymmetric = config->GetAxisymmetric(); const auto* flowNodes = su2staticcast_p(solver[FLOW_SOL]->GetNodes()); for (auto& output : customOutputs) { + if (output.skip) continue; + if (output.varIndices.empty()) { + const bool allowSkip = adjoint && (output.type == OperationType::FUNCTION); + /*--- Setup indices for the symbols in the expression. ---*/ const auto primIdx = CPrimitiveIndices(config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE, config->GetNEMOProblem(), nDim, config->GetnSpecies()); - ConvertVariableSymbolsToIndices(primIdx, output); + ConvertVariableSymbolsToIndices(primIdx, allowSkip, output); + if (output.skip) continue; /*--- Convert marker names to their index (if any) in this rank. Or probe locations to nearest points. ---*/ diff --git a/SU2_CFD/src/output/CHeatOutput.cpp b/SU2_CFD/src/output/CHeatOutput.cpp index 6150f2534808..eccba6e70e98 100644 --- a/SU2_CFD/src/output/CHeatOutput.cpp +++ b/SU2_CFD/src/output/CHeatOutput.cpp @@ -89,6 +89,8 @@ void CHeatOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver SetHistoryOutputValue("LINSOL_RESIDUAL", log10(heat_solver->GetResLinSolver())); SetHistoryOutputValue("CFL_NUMBER", config->GetCFL(MESH_0)); + ComputeSimpleCustomOutputs(config); + /*--- Keep this as last, since it uses the history values that were set. ---*/ SetCustomAndComboObjectives(HEAT_SOL, config, solver); } diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 7c76bbf50bc0..db83dc1e3224 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -2135,7 +2135,7 @@ bool COutput::WriteVolumeOutput(CConfig *config, unsigned long Iter, bool force_ return ((Iter % config->GetVolumeOutputFrequency(iFile) == 0)) || force_writing; } return ((Iter > 0) && (Iter % config->GetVolumeOutputFrequency(iFile) == 0)) || force_writing; - + } void COutput::SetCommonHistoryFields() { @@ -2287,6 +2287,43 @@ void COutput::SetCustomOutputs(const CConfig* config) { } +void COutput::ComputeSimpleCustomOutputs(const CConfig *config) { + const bool adjoint = config->GetDiscrete_Adjoint(); + + for (auto& output : customOutputs) { + if (output.type != OperationType::FUNCTION) continue; + + if (output.varIndices.empty()) { + output.varIndices.reserve(output.varSymbols.size()); + output.otherOutputs.reserve(output.varSymbols.size()); + + for (const auto& var : output.varSymbols) { + output.varIndices.push_back(output.varIndices.size()); + output.otherOutputs.push_back(GetPtrToHistoryOutput(var)); + if (output.otherOutputs.back() == nullptr) { + if (!adjoint) { + // In primal mode all functions must be valid. + SU2_MPI::Error("Invalid history output (" + var + ") used in function " + output.name, CURRENT_FUNCTION); + } else { + if (rank == MASTER_NODE) { + std::cout << "Info: Ignoring function " + output.name + " because it may be used by the primal/adjoint " + "solver.\n If the function is ignored twice it is invalid." << std::endl; + } + output.skip = true; + break; + } + } + } + } + if (output.skip) continue; + + auto Functor = [&](unsigned long i) { + return *output.otherOutputs[i]; + }; + SetHistoryOutputValue(output.name, output.Eval(Functor)); + } +} + void COutput::LoadCommonHistoryData(const CConfig *config) { SetHistoryOutputValue("TIME_STEP", config->GetDelta_UnstTimeND()*config->GetTime_Ref()); diff --git a/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg b/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg index a484a26c79b6..c35de2da2633 100755 --- a/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg +++ b/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg @@ -13,6 +13,6 @@ MESH_FILENAME= mesh.su2 OBJECTIVE_FUNCTION= CUSTOM_OBJFUNC -SCREEN_OUTPUT= OUTER_ITER, AVG_BGS_RES[0], AVG_BGS_RES[1], LINSOL_RESIDUAL[0], SENS_E_0[1], SENS_NU_0[1] +SCREEN_OUTPUT= OUTER_ITER, AVG_BGS_RES[0], AVG_BGS_RES[1], LINSOL_RESIDUAL[0], sens_e[1], SENS_NU_0[1] %WRT_ZONE_CONV=YES diff --git a/TestCases/disc_adj_fsi/Airfoil_2d/configFEA.cfg b/TestCases/disc_adj_fsi/Airfoil_2d/configFEA.cfg index 625809928eb9..80502871ff20 100755 --- a/TestCases/disc_adj_fsi/Airfoil_2d/configFEA.cfg +++ b/TestCases/disc_adj_fsi/Airfoil_2d/configFEA.cfg @@ -7,7 +7,7 @@ REFERENCE_NODE= 234 REFERENCE_NODE_DISPLACEMENT= (0.0, 0.0) REFERENCE_NODE_PENALTY= 1.0 DESIGN_VARIABLE_FEA= YOUNG_MODULUS -CUSTOM_OBJFUNC= '1e2 * (1e3 * REFERENCE_NODE + TOPOL_COMPLIANCE)' +CUSTOM_OBJFUNC= '1e2 * (ref_node + TOPOL_COMPLIANCE)' % Solid properties ----------------------------------------------------- % MATERIAL_MODEL= NEO_HOOKEAN @@ -41,7 +41,10 @@ INCREMENTAL_LOAD= YES % In\Out --------------------------------------------------------------- % MESH_FILENAME= mesh.su2 MESH_FORMAT= SU2 - +% Scale SENS_E_0 to avoid a very small value in the regression test. +% Test using custom outputs for the adjoint and primal solver. +CUSTOM_OUTPUTS= 'sens_e : Function{1e8 * SENS_E_0};\ + ref_node : Function{1e3 * REFERENCE_NODE}' RESTART_SOL= NO SOLUTION_FILENAME= solution_solid.dat SOLUTION_ADJ_FILENAME= adjoint_solid.dat diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 61c79202fb80..ebe91bf93373 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -276,8 +276,8 @@ def main(): discadj_fsi2.cfg_dir = "disc_adj_fsi/Airfoil_2d" discadj_fsi2.cfg_file = "config.cfg" discadj_fsi2.test_iter = 8 - discadj_fsi2.test_vals = [-4.349377, 0.192713, -1.303589, 7.5407e-09, 2.3244] - discadj_fsi2.test_vals_aarch64 = [-3.479505, 0.127953, -1.303589, 7.5407e-09, 2.3244] + discadj_fsi2.test_vals = [-4.349377, 0.192713, -1.303589, 0.75407, 2.3244] + discadj_fsi2.test_vals_aarch64 = [-3.479505, 0.127953, -1.303589, 0.75407, 2.3244] discadj_fsi2.tol = 0.00001 test_list.append(discadj_fsi2) From f9fcdff892931b11d1ca1795b51ee7c44ac81a05 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Fri, 28 Apr 2023 20:45:00 -0700 Subject: [PATCH 2/7] check custom output type --- SU2_CFD/src/output/COutput.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index db83dc1e3224..90d9f3ef9253 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -2291,7 +2291,10 @@ void COutput::ComputeSimpleCustomOutputs(const CConfig *config) { const bool adjoint = config->GetDiscrete_Adjoint(); for (auto& output : customOutputs) { - if (output.type != OperationType::FUNCTION) continue; + if (output.type != OperationType::FUNCTION) { + if (adjoint) continue; + SU2_MPI::Error("The current solver can only use 'Function' custom outputs.", CURRENT_FUNCTION); + } if (output.varIndices.empty()) { output.varIndices.reserve(output.varSymbols.size()); From 930a25e35c17097d3a1e04ee3cf5f73f39e04554 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 29 Apr 2023 14:45:22 -0700 Subject: [PATCH 3/7] using the surface averages in a discrete adjoint case --- Common/include/CConfig.hpp | 1 - SU2_CFD/src/output/CFlowOutput.cpp | 2 +- .../DAspecies3_primitiveVenturi.cfg | 5 +++++ TestCases/tutorials.py | 1 - 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 626b8c30f9a3..f8f7d01e73e7 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -8658,7 +8658,6 @@ class CConfig { unsigned short GetKind_Average(void) const { return Kind_Average; } /*! - * * \brief Get the direct differentation method. * \return direct differentiation method. */ diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 25de58c53fa6..5a3664a02642 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -739,8 +739,8 @@ void CFlowOutput::SetAnalyzeSurfaceSpeciesVariance(const CSolver* const*solver, for (unsigned short iMarker_Analyze = 0; iMarker_Analyze < nMarker_Analyze; iMarker_Analyze++) { su2double SpeciesVariance = Surface_SpeciesVariance_Total[iMarker_Analyze]; SetHistoryOutputPerSurfaceValue("SURFACE_SPECIES_VARIANCE", SpeciesVariance, iMarker_Analyze); + config->SetSurface_Species_Variance(iMarker_Analyze, SpeciesVariance); Tot_Surface_SpeciesVariance += SpeciesVariance; - config->SetSurface_Species_Variance(iMarker_Analyze, Tot_Surface_SpeciesVariance); } SetHistoryOutputValue("SURFACE_SPECIES_VARIANCE", Tot_Surface_SpeciesVariance); } diff --git a/TestCases/species_transport/venturi_primitive_3species/DAspecies3_primitiveVenturi.cfg b/TestCases/species_transport/venturi_primitive_3species/DAspecies3_primitiveVenturi.cfg index f7c31afcc12c..f58be145625f 100644 --- a/TestCases/species_transport/venturi_primitive_3species/DAspecies3_primitiveVenturi.cfg +++ b/TestCases/species_transport/venturi_primitive_3species/DAspecies3_primitiveVenturi.cfg @@ -14,6 +14,11 @@ SOLVER= INC_RANS KIND_TURB_MODEL= SST % +CUSTOM_OUTPUTS= 'avg_species_0 : AreaAvg{SPECIES[0]}[outlet];\ + avg_species_1 : AreaAvg{SPECIES[1]}[outlet];\ + var_species : AreaAvg{pow(SPECIES[0] - avg_species_0, 2) +\ + pow(SPECIES[1] - avg_species_1, 2)}[outlet]' +CUSTOM_OBJFUNC= 'var_species' OBJECTIVE_FUNCTION= SURFACE_SPECIES_VARIANCE OBJECTIVE_WEIGHT= 1.0 % diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 0b730dcddda1..3759a48e7820 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -92,7 +92,6 @@ def main(): species3_primitiveVenturi.test_vals = [-6.074971, -5.306648, -5.150960, -5.959416, -1.625107, -6.343704, -6.460033, 5.000000, -0.808413, 5.000000, -2.325029, 5.000000, -0.274923, 1.646091, 0.499028, 0.601019, 0.546044] test_list.append(species3_primitiveVenturi) - # 3 species (2 eq) primitive venturi mixing DAspecies3_primitiveVenturi = TestCase('DAspecies3_primitiveVenturi') DAspecies3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" From c9d656cda9315a605367b7b11cf295ac6718dec9 Mon Sep 17 00:00:00 2001 From: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Date: Sat, 29 Apr 2023 15:01:49 -0700 Subject: [PATCH 4/7] Apply suggestions from code review --- SU2_CFD/src/output/CFlowOutput.cpp | 4 ++-- SU2_CFD/src/output/COutput.cpp | 2 +- .../DAspecies3_primitiveVenturi.cfg | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 5a3664a02642..d297ca6fb992 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -798,11 +798,11 @@ void CFlowOutput::ConvertVariableSymbolsToIndices(const CPrimitiveIndices Date: Sun, 30 Apr 2023 15:01:47 -0700 Subject: [PATCH 5/7] remove configs that are in tutorials --- .../DAspecies3_primitiveVenturi.cfg | 146 ------------------ .../species3_primitiveVenturi.cfg | 138 ----------------- 2 files changed, 284 deletions(-) delete mode 100644 TestCases/species_transport/venturi_primitive_3species/DAspecies3_primitiveVenturi.cfg delete mode 100644 TestCases/species_transport/venturi_primitive_3species/species3_primitiveVenturi.cfg diff --git a/TestCases/species_transport/venturi_primitive_3species/DAspecies3_primitiveVenturi.cfg b/TestCases/species_transport/venturi_primitive_3species/DAspecies3_primitiveVenturi.cfg deleted file mode 100644 index 6ab9176cd75d..000000000000 --- a/TestCases/species_transport/venturi_primitive_3species/DAspecies3_primitiveVenturi.cfg +++ /dev/null @@ -1,146 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% SU2 configuration file % -% Case description: Discrete Adjiont Species mixing with 3 species % -% Author: T. Kattmann % -% Institution: Bosch Thermotechniek B.V. % -% Date: 2021/10/14 % -% File Version 7.5.1 "Blackbird" % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% -% -SOLVER= INC_RANS -KIND_TURB_MODEL= SST -% -CUSTOM_OUTPUTS= 'avg_species_0 : AreaAvg{SPECIES[0]}[outlet];\ - avg_species_1 : AreaAvg{SPECIES[1]}[outlet];\ - var_species : AreaAvg{pow(SPECIES[0] - avg_species_0, 2) +\ - pow(SPECIES[1] - avg_species_1, 2)}[outlet]' -CUSTOM_OBJFUNC= 'var_species' -OBJECTIVE_FUNCTION= CUSTOM_OBJFUNC -OBJECTIVE_WEIGHT= 1.0 -% -% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% -% -INC_DENSITY_MODEL= CONSTANT -INC_DENSITY_INIT= 1.1766 -% -INC_VELOCITY_INIT= ( 1.00, 0.0, 0.0 ) -% -INC_ENERGY_EQUATION= YES -INC_TEMPERATURE_INIT= 300.0 -% -INC_NONDIM= INITIAL_VALUES -% -% -------------------- FLUID PROPERTIES ------------------------------------- % -% -FLUID_MODEL= CONSTANT_DENSITY -% -CONDUCTIVITY_MODEL= CONSTANT_CONDUCTIVITY -THERMAL_CONDUCTIVITY_CONSTANT= 0.0357 -% -PRANDTL_LAM= 0.72 -TURBULENT_CONDUCTIVITY_MODEL= NONE -PRANDTL_TURB= 0.90 -% -VISCOSITY_MODEL= CONSTANT_VISCOSITY -MU_CONSTANT= 1.716E-5 -% -% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% -% -MARKER_HEATFLUX= ( wall, 0.0 ) -MARKER_SYM= ( axis ) -% -SPECIFIED_INLET_PROFILE= NO -INLET_FILENAME= inlet_venturi.dat -INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET -MARKER_INLET= ( gas_inlet, 300, 1.0, 1.0, 0.0, 0.0,\ - air_axial_inlet, 300, 1.0, 0.0, -1.0, 0.0 ) -SPECIES_USE_STRONG_BC= YES -MARKER_INLET_SPECIES= (gas_inlet, 0.5, 0.5,\ - air_axial_inlet, 0.6, 0.0 ) -% -INC_OUTLET_TYPE= PRESSURE_OUTLET -MARKER_OUTLET= ( outlet, 0.0 ) -% -% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% -% -NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -% -% Note that the CFL-Number was dramatically reduced compared to the primal. -% This was necessary to ensure proper convergence. It is not necessary to do -% this for a reasonably accurate gradient validation though. -CFL_NUMBER= 500 -CFL_REDUCTION_SPECIES= 1.0 -CFL_REDUCTION_TURB= 1.0 -% -% Run commented Iter for good results -ITER= 50 -% -% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% -% -LINEAR_SOLVER= FGMRES -LINEAR_SOLVER_PREC= ILU -LINEAR_SOLVER_ERROR= 1E-8 -LINEAR_SOLVER_ITER= 20 -% -% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% -% -CONV_NUM_METHOD_FLOW= FDS -MUSCL_FLOW= YES -SLOPE_LIMITER_FLOW = NONE -TIME_DISCRE_FLOW= EULER_IMPLICIT -% -% -------------------- SCALAR TRANSPORT ---------------------------------------% -% -KIND_SCALAR_MODEL= SPECIES_TRANSPORT -DIFFUSIVITY_MODEL= CONSTANT_DIFFUSIVITY -DIFFUSIVITY_CONSTANT= 0.001 -% -CONV_NUM_METHOD_SPECIES= SCALAR_UPWIND -MUSCL_SPECIES= NO -SLOPE_LIMITER_SPECIES = NONE -% -TIME_DISCRE_SPECIES= EULER_IMPLICIT -% -SPECIES_INIT= 1.0, 0.0 -SPECIES_CLIPPING= YES -SPECIES_CLIPPING_MIN= 0.0, 0.0 -SPECIES_CLIPPING_MAX= 1.0, 1.0 -% -% -------------------- TURBULENT TRANSPORT ---------------------------------------% -% -CONV_NUM_METHOD_TURB= SCALAR_UPWIND -MUSCL_TURB= NO -% -% --------------------------- CONVERGENCE PARAMETERS --------------------------% -% -CONV_FIELD= RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_TKE, RMS_SPECIES -CONV_RESIDUAL_MINVAL= -18 -CONV_STARTITER= 10 -% -% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% -% -MESH_FILENAME= primitiveVenturi.su2 -SCREEN_OUTPUT= INNER_ITER WALL_TIME RMS_ADJ_PRESSURE RMS_ADJ_VELOCITY-X RMS_ADJ_VELOCITY-Y RMS_ADJ_TKE RMS_ADJ_DISSIPATION RMS_ADJ_SPECIES_0 RMS_ADJ_SPECIES_1 -SCREEN_WRT_FREQ_INNER= 10 -% -HISTORY_OUTPUT= ITER RMS_RES LINSOL -CONV_FILENAME= history -MARKER_ANALYZE= outlet -MARKER_ANALYZE_AVERAGE= MASSFLUX -% -OUTPUT_FILES= RESTART_ASCII, PARAVIEW -VOLUME_OUTPUT= RESIDUAL, PRIMITIVE -OUTPUT_WRT_FREQ= 1000 -% -GRAD_OBJFUNC_FILENAME= of_grad.csv -% -RESTART_SOL= NO -READ_BINARY_RESTART= NO -RESTART_FILENAME= restart -SOLUTION_FILENAME= solution -% -WRT_PERFORMANCE= YES diff --git a/TestCases/species_transport/venturi_primitive_3species/species3_primitiveVenturi.cfg b/TestCases/species_transport/venturi_primitive_3species/species3_primitiveVenturi.cfg deleted file mode 100644 index 7237f760404c..000000000000 --- a/TestCases/species_transport/venturi_primitive_3species/species3_primitiveVenturi.cfg +++ /dev/null @@ -1,138 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% SU2 configuration file % -% Case description: Species mixing with 3 species, i.e. 2 transport equations % -% Author: T. Kattmann % -% Institution: Bosch Thermotechniek B.V. % -% Date: 2021/10/14 % -% File Version 7.5.1 "Blackbird" % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% -% -SOLVER= INC_RANS -KIND_TURB_MODEL= SST -% -% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% -% -INC_DENSITY_MODEL= CONSTANT -INC_DENSITY_INIT= 1.1766 -% -INC_VELOCITY_INIT= ( 1.00, 0.0, 0.0 ) -% -INC_ENERGY_EQUATION= YES -INC_TEMPERATURE_INIT= 300.0 -% -INC_NONDIM= INITIAL_VALUES -% -% -------------------- FLUID PROPERTIES ------------------------------------- % -% -FLUID_MODEL= CONSTANT_DENSITY -% -CONDUCTIVITY_MODEL= CONSTANT_CONDUCTIVITY -THERMAL_CONDUCTIVITY_CONSTANT= 0.0357 -% -PRANDTL_LAM= 0.72 -TURBULENT_CONDUCTIVITY_MODEL= NONE -PRANDTL_TURB= 0.90 -% -VISCOSITY_MODEL= CONSTANT_VISCOSITY -MU_CONSTANT= 1.716E-5 -% -% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% -% -MARKER_HEATFLUX= ( wall, 0.0 ) -MARKER_SYM= ( axis ) -% -SPECIFIED_INLET_PROFILE= NO -INLET_FILENAME= inlet_venturi.dat -INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET -MARKER_INLET= ( gas_inlet, 300, 1.0, 1.0, 0.0, 0.0,\ - air_axial_inlet, 300, 1.0, 0.0, -1.0, 0.0 ) -SPECIES_USE_STRONG_BC= NO -MARKER_INLET_SPECIES= (gas_inlet, 0.5, 0.5,\ - air_axial_inlet, 0.6, 0.0 ) -% -INC_OUTLET_TYPE= PRESSURE_OUTLET -MARKER_OUTLET= ( outlet, 0.0 ) -% -% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% -% -NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -% -CFL_NUMBER= 2000 -CFL_REDUCTION_SPECIES= 1.0 -CFL_REDUCTION_TURB= 1.0 -% -% Run commented Iter for good results -ITER= 1000 -% -% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% -% -LINEAR_SOLVER= FGMRES -LINEAR_SOLVER_PREC= ILU -LINEAR_SOLVER_ERROR= 1E-8 -LINEAR_SOLVER_ITER= 5 -% -% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% -% -CONV_NUM_METHOD_FLOW= FDS -MUSCL_FLOW= YES -SLOPE_LIMITER_FLOW = NONE -TIME_DISCRE_FLOW= EULER_IMPLICIT -% -% -------------------- SCALAR TRANSPORT ---------------------------------------% -% -KIND_SCALAR_MODEL= SPECIES_TRANSPORT -DIFFUSIVITY_MODEL= CONSTANT_DIFFUSIVITY -DIFFUSIVITY_CONSTANT= 0.001 -% -CONV_NUM_METHOD_SPECIES= SCALAR_UPWIND -MUSCL_SPECIES= NO -SLOPE_LIMITER_SPECIES = NONE -% -TIME_DISCRE_SPECIES= EULER_IMPLICIT -% -SPECIES_INIT= 1.0, 0.0 -SPECIES_CLIPPING= YES -SPECIES_CLIPPING_MIN= 0.0, 0.0 -SPECIES_CLIPPING_MAX= 1.0, 1.0 -% -% -------------------- TURBULENT TRANSPORT ---------------------------------------% -% -CONV_NUM_METHOD_TURB= SCALAR_UPWIND -MUSCL_TURB= NO -% -% --------------------------- CONVERGENCE PARAMETERS --------------------------% -% -CONV_FIELD= RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_TKE, RMS_SPECIES -CONV_RESIDUAL_MINVAL= -18 -CONV_STARTITER= 10 -% -% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% -% -MESH_FILENAME= primitiveVenturi.su2 -SCREEN_OUTPUT= INNER_ITER WALL_TIME \ - RMS_PRESSURE RMS_VELOCITY-X RMS_VELOCITY-Y RMS_TKE RMS_DISSIPATION RMS_SPECIES_0 RMS_SPECIES_1 \ - LINSOL_ITER LINSOL_RESIDUAL \ - LINSOL_ITER_TURB LINSOL_RESIDUAL_TURB \ - LINSOL_ITER_SPECIES LINSOL_RESIDUAL_SPECIES \ - SURFACE_SPECIES_0 -SCREEN_WRT_FREQ_INNER= 10 -% -HISTORY_OUTPUT= ITER RMS_RES LINSOL SPECIES_COEFF SPECIES_COEFF_SURF -CONV_FILENAME= history -MARKER_ANALYZE= gas_inlet, air_axial_inlet, outlet -MARKER_ANALYZE_AVERAGE= AREA -% -OUTPUT_FILES= RESTART_ASCII, PARAVIEW_MULTIBLOCK -VOLUME_OUTPUT= RESIDUAL, PRIMITIVE -OUTPUT_WRT_FREQ= 1000 -% -RESTART_SOL= NO -READ_BINARY_RESTART= NO -RESTART_FILENAME= restart -SOLUTION_FILENAME= solution -% -WRT_PERFORMANCE= YES From 84e44a38ee8e11dabec55ebc985b2ee2c5e54cd1 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 30 Apr 2023 15:04:07 -0700 Subject: [PATCH 6/7] change branch --- .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 76545cdb2747..13f883fcc3c2 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -128,7 +128,7 @@ jobs: uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136 with: # -t -c - args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t avoid_duplicated_config -c develop -s ${{matrix.testscript}} - name: Cleanup uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136 with: From e219c058f3ba5980a8f458bc98500e67c3eb7db6 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 30 Apr 2023 16:08:50 -0700 Subject: [PATCH 7/7] update residuals --- .github/workflows/regression.yml | 2 +- TestCases/tutorials.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 13f883fcc3c2..76545cdb2747 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -128,7 +128,7 @@ jobs: uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136 with: # -t -c - args: -b ${{github.ref}} -t avoid_duplicated_config -c develop -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} - name: Cleanup uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136 with: diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 3759a48e7820..b2bb04b6e889 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -97,8 +97,8 @@ def main(): DAspecies3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport" DAspecies3_primitiveVenturi.cfg_file = "DAspecies3_primitiveVenturi.cfg" DAspecies3_primitiveVenturi.test_iter = 50 - DAspecies3_primitiveVenturi.test_vals = [-8.528844, -7.799649, -7.783477, -7.482502, -12.140092, -12.250169, -11.455523] - DAspecies3_primitiveVenturi.test_vals_aarch64 = [-8.528880, -7.799682, -7.783516, -7.482532, -12.140123, -12.250169, -11.455523] + DAspecies3_primitiveVenturi.test_vals = [-8.422882, -7.699257, -7.683269, -7.411648, -12.064694, -12.205189, -11.368995] + DAspecies3_primitiveVenturi.test_vals_aarch64 = [-8.422882, -7.699257, -7.683269, -7.411648, -12.064694, -12.205189, -11.368995] DAspecies3_primitiveVenturi.command = TestCase.Command("mpirun -n 2", "SU2_CFD_AD") test_list.append(DAspecies3_primitiveVenturi)