diff --git a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp index 3f15fdf49108..3125e783b476 100644 --- a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp @@ -35,14 +35,14 @@ CAdjFlowCompOutput::CAdjFlowCompOutput(CConfig *config, unsigned short nDim) : C /*--- Set the default history fields if nothing is set in the config file ---*/ - if (nRequestedHistoryFields == 0){ + if (nRequestedHistoryFields == 0) { requestedHistoryFields.emplace_back("ITER"); requestedHistoryFields.emplace_back("RMS_RES"); requestedHistoryFields.emplace_back("SENSITIVITY"); nRequestedHistoryFields = requestedHistoryFields.size(); } - if (nRequestedScreenFields == 0){ + if (nRequestedScreenFields == 0) { if (config->GetTime_Domain()) requestedScreenFields.emplace_back("TIME_ITER"); if (multiZone) requestedScreenFields.emplace_back("OUTER_ITER"); requestedScreenFields.emplace_back("INNER_ITER"); @@ -53,7 +53,7 @@ CAdjFlowCompOutput::CAdjFlowCompOutput(CConfig *config, unsigned short nDim) : C nRequestedScreenFields = requestedScreenFields.size(); } - if (nRequestedVolumeFields == 0){ + if (nRequestedVolumeFields == 0) { requestedVolumeFields.emplace_back("COORDINATES"); requestedVolumeFields.emplace_back("SOLUTION"); requestedVolumeFields.emplace_back("SENSITIVITY"); @@ -93,7 +93,7 @@ CAdjFlowCompOutput::CAdjFlowCompOutput(CConfig *config, unsigned short nDim) : C CAdjFlowCompOutput::~CAdjFlowCompOutput(void) {} -void CAdjFlowCompOutput::SetHistoryOutputFields(CConfig *config){ +void CAdjFlowCompOutput::SetHistoryOutputFields(CConfig *config) { /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the SOLUTION variables. /// DESCRIPTION: Root-mean square residual of the adjoint density. @@ -103,10 +103,13 @@ void CAdjFlowCompOutput::SetHistoryOutputFields(CConfig *config){ /// DESCRIPTION: Root-mean square residual of the adjoint momentum y-component. AddHistoryOutput("RMS_ADJ_MOMENTUM-Y", "rms[A_RhoV]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint momentum y-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the adjoint momentum z-component. - AddHistoryOutput("RMS_ADJ_MOMENTUM-Z", "rms[A_RhoW]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint momentum z-component.", HistoryFieldType::RESIDUAL); + if (nDim == 3) { + AddHistoryOutput("RMS_ADJ_MOMENTUM-Z", "rms[A_RhoW]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint momentum z-component.", HistoryFieldType::RESIDUAL); + } /// DESCRIPTION: Root-mean square residual of the adjoint energy. AddHistoryOutput("RMS_ADJ_ENERGY", "rms[A_E]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint energy.", HistoryFieldType::RESIDUAL); + AddHistoryOutputFields_AdjScalarRMS_RES(config); /// END_GROUP @@ -118,7 +121,9 @@ void CAdjFlowCompOutput::SetHistoryOutputFields(CConfig *config){ /// DESCRIPTION: Maximum residual of the adjoint momentum y-component AddHistoryOutput("MAX_ADJ_MOMENTUM-Y", "max[A_RhoV]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint momentum y-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the adjoint momentum z-component - AddHistoryOutput("MAX_ADJ_MOMENTUM-Z", "max[A_RhoW]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint momentum z-component", HistoryFieldType::RESIDUAL); + if (nDim == 3) { + AddHistoryOutput("MAX_ADJ_MOMENTUM-Z", "max[A_RhoW]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint momentum z-component", HistoryFieldType::RESIDUAL); + } /// DESCRIPTION: Maximum residual of the adjoint energy. AddHistoryOutput("MAX_ADJ_ENERGY", "max[A_E]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint energy.", HistoryFieldType::RESIDUAL); @@ -134,7 +139,9 @@ void CAdjFlowCompOutput::SetHistoryOutputFields(CConfig *config){ /// DESCRIPTION: BGS residual of the adjoint momentum y-component AddHistoryOutput("BGS_ADJ_MOMENTUM-Y", "bgs[A_RhoV]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint momentum y-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the adjoint momentum z-component - AddHistoryOutput("BGS_ADJ_MOMENTUM-Z", "bgs[A_RhoW]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint momentum z-component", HistoryFieldType::RESIDUAL); + if (nDim == 3) { + AddHistoryOutput("BGS_ADJ_MOMENTUM-Z", "bgs[A_RhoW]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint momentum z-component", HistoryFieldType::RESIDUAL); + } /// DESCRIPTION: BGS residual of the adjoint energy. AddHistoryOutput("BGS_ADJ_ENERGY", "bgs[A_E]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint energy.", HistoryFieldType::RESIDUAL); @@ -159,14 +166,14 @@ void CAdjFlowCompOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutputFields_AdjScalarLinsol(config); - if (config->GetDeform_Mesh()){ + if (config->GetDeform_Mesh()) { AddHistoryOutput("DEFORM_ITER", "DeformIter", ScreenOutputFormat::INTEGER, "DEFORM", "Linear solver iterations for the mesh deformation"); AddHistoryOutput("DEFORM_RESIDUAL", "DeformRes", ScreenOutputFormat::FIXED, "DEFORM", "Residual of the linear solver for the mesh deformation"); } } -void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver){ +void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) { CSolver* adjflow_solver = solver[ADJFLOW_SOL]; CSolver* mesh_solver = solver[MESH_SOL]; @@ -191,7 +198,7 @@ void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C SetHistoryOutputValue("MAX_ADJ_ENERGY", log10(adjflow_solver->GetRes_Max(3))); } - if (multiZone){ + if (multiZone) { SetHistoryOutputValue("BGS_ADJ_DENSITY", log10(adjflow_solver->GetRes_BGS(0))); SetHistoryOutputValue("BGS_ADJ_MOMENTUM-X", log10(adjflow_solver->GetRes_BGS(1))); SetHistoryOutputValue("BGS_ADJ_MOMENTUM-Y", log10(adjflow_solver->GetRes_BGS(2))); @@ -220,7 +227,7 @@ void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C LoadHistoryData_AdjScalar(config, solver); } -void CAdjFlowCompOutput::SetVolumeOutputFields(CConfig *config){ +void CAdjFlowCompOutput::SetVolumeOutputFields(CConfig *config) { // Grid coordinates AddVolumeOutput("COORD-X", "x", "COORDINATES", "x-component of the coordinate vector"); @@ -274,7 +281,7 @@ void CAdjFlowCompOutput::SetVolumeOutputFields(CConfig *config){ } -void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ +void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) { CVariable* Node_AdjFlow = solver[ADJFLOW_SOL]->GetNodes(); CPoint* Node_Geo = geometry->nodes; @@ -287,7 +294,7 @@ void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CS SetVolumeOutputValue("ADJ_DENSITY", iPoint, Node_AdjFlow->GetSolution(iPoint, 0)); SetVolumeOutputValue("ADJ_MOMENTUM-X", iPoint, Node_AdjFlow->GetSolution(iPoint, 1)); SetVolumeOutputValue("ADJ_MOMENTUM-Y", iPoint, Node_AdjFlow->GetSolution(iPoint, 2)); - if (nDim == 3){ + if (nDim == 3) { SetVolumeOutputValue("ADJ_MOMENTUM-Z", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); SetVolumeOutputValue("ADJ_ENERGY", iPoint, Node_AdjFlow->GetSolution(iPoint, 4)); } else { @@ -298,7 +305,7 @@ void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CS SetVolumeOutputValue("RES_ADJ_DENSITY", iPoint, Node_AdjFlow->GetSolution(iPoint, 0) - Node_AdjFlow->GetSolution_Old(iPoint, 0)); SetVolumeOutputValue("RES_ADJ_MOMENTUM-X", iPoint, Node_AdjFlow->GetSolution(iPoint, 1) - Node_AdjFlow->GetSolution_Old(iPoint, 1)); SetVolumeOutputValue("RES_ADJ_MOMENTUM-Y", iPoint, Node_AdjFlow->GetSolution(iPoint, 2) - Node_AdjFlow->GetSolution_Old(iPoint, 2)); - if (nDim == 3){ + if (nDim == 3) { SetVolumeOutputValue("RES_ADJ_MOMENTUM-Z", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); SetVolumeOutputValue("RES_ADJ_ENERGY", iPoint, Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); } else { @@ -313,14 +320,14 @@ void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CS LoadVolumeData_AdjScalar(config, solver, iPoint); } -void CAdjFlowCompOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){ +void CAdjFlowCompOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) { SetVolumeOutputValue("SENSITIVITY", iPoint, solver[ADJFLOW_SOL]->GetCSensitivity(iMarker, iVertex)); } -bool CAdjFlowCompOutput::SetInit_Residuals(const CConfig *config){ +bool CAdjFlowCompOutput::SetInit_Residuals(const CConfig *config) { return ((config->GetTime_Marching() != TIME_MARCHING::STEADY) && (curInnerIter == 0)) || ((config->GetTime_Marching() == TIME_MARCHING::STEADY) && (curInnerIter < 2)); diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index 74dfbebcfd1f..a87d03aa6cf5 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -41,14 +41,14 @@ CAdjFlowIncOutput::CAdjFlowIncOutput(CConfig *config, unsigned short nDim) : CAd /*--- Set the default history fields if nothing is set in the config file ---*/ - if (nRequestedHistoryFields == 0){ + if (nRequestedHistoryFields == 0) { requestedHistoryFields.emplace_back("ITER"); requestedHistoryFields.emplace_back("RMS_RES"); requestedHistoryFields.emplace_back("SENSITIVITY"); nRequestedHistoryFields = requestedHistoryFields.size(); } - if (nRequestedScreenFields == 0){ + if (nRequestedScreenFields == 0) { if (config->GetTime_Domain()) requestedScreenFields.emplace_back("TIME_ITER"); if (multiZone) requestedScreenFields.emplace_back("OUTER_ITER"); requestedScreenFields.emplace_back("INNER_ITER"); @@ -59,7 +59,7 @@ CAdjFlowIncOutput::CAdjFlowIncOutput(CConfig *config, unsigned short nDim) : CAd nRequestedScreenFields = requestedScreenFields.size(); } - if (nRequestedVolumeFields == 0){ + if (nRequestedVolumeFields == 0) { requestedVolumeFields.emplace_back("COORDINATES"); requestedVolumeFields.emplace_back("SOLUTION"); requestedVolumeFields.emplace_back("SENSITIVITY"); @@ -99,7 +99,7 @@ CAdjFlowIncOutput::CAdjFlowIncOutput(CConfig *config, unsigned short nDim) : CAd CAdjFlowIncOutput::~CAdjFlowIncOutput(void) {} -void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config){ +void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config) { /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the SOLUTION variables. /// DESCRIPTION: Root-mean square residual of the adjoint Pressure. @@ -109,9 +109,13 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config){ /// DESCRIPTION: Root-mean square residual of the adjoint Velocity y-component. AddHistoryOutput("RMS_ADJ_VELOCITY-Y", "rms[A_V]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint Velocity y-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the adjoint Velocity z-component. - AddHistoryOutput("RMS_ADJ_VELOCITY-Z", "rms[A_W]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint Velocity z-component.", HistoryFieldType::RESIDUAL); + if (nDim == 3) { + AddHistoryOutput("RMS_ADJ_VELOCITY-Z", "rms[A_W]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint Velocity z-component.", HistoryFieldType::RESIDUAL); + } /// DESCRIPTION: Maximum residual of the temperature. - AddHistoryOutput("RMS_ADJ_TEMPERATURE", "rms[A_T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); + if (heat || weakly_coupled_heat) { + AddHistoryOutput("RMS_ADJ_TEMPERATURE", "rms[A_T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); + } if (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW) { AddHistoryOutput("ADJOINT_SOLEXTRA", "Adjoint_SolExtra", ScreenOutputFormat::FIXED, "ADJOINT_SOLEXTRA", "Adjoint value of the first extra Solution.", HistoryFieldType::COEFFICIENT); @@ -119,7 +123,7 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutputFields_AdjScalarRMS_RES(config); - if (config->AddRadiation()){ + if (config->AddRadiation()) { /// DESCRIPTION: Root-mean square residual of the adjoint radiative energy tilde. AddHistoryOutput("RMS_ADJ_RAD_ENERGY", "rms[A_P1]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the P1 radiative energy.",HistoryFieldType::RESIDUAL); } @@ -133,9 +137,13 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config){ /// DESCRIPTION: Maximum residual of the adjoint Velocity y-component AddHistoryOutput("MAX_ADJ_VELOCITY-Y", "max[A_RhoV]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint Velocity y-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the adjoint Velocity z-component - AddHistoryOutput("MAX_ADJ_VELOCITY-Z", "max[A_RhoW]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint Velocity z-component", HistoryFieldType::RESIDUAL); + if (nDim == 3) { + AddHistoryOutput("MAX_ADJ_VELOCITY-Z", "max[A_RhoW]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint Velocity z-component", HistoryFieldType::RESIDUAL); + } /// DESCRIPTION: Maximum residual of the temperature. - AddHistoryOutput("MAX_ADJ_TEMPERATURE", "max[A_T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature.", HistoryFieldType::RESIDUAL); + if (heat || weakly_coupled_heat) { + AddHistoryOutput("MAX_ADJ_TEMPERATURE", "max[A_T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature.", HistoryFieldType::RESIDUAL); + } AddHistoryOutputFields_AdjScalarMAX_RES(config); /// END_GROUP @@ -148,13 +156,17 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config){ /// DESCRIPTION: BGS residual of the adjoint Velocity y-component AddHistoryOutput("BGS_ADJ_VELOCITY-Y", "bgs[A_RhoV]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint Velocity y-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the adjoint Velocity z-component - AddHistoryOutput("BGS_ADJ_VELOCITY-Z", "bgs[A_RhoW]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint Velocity z-component", HistoryFieldType::RESIDUAL); + if (nDim == 3) { + AddHistoryOutput("BGS_ADJ_VELOCITY-Z", "bgs[A_RhoW]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint Velocity z-component", HistoryFieldType::RESIDUAL); + } /// DESCRIPTION: BGS residual of the temperature. - AddHistoryOutput("BGS_ADJ_TEMPERATURE", "bgs[A_T]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); + if (heat || weakly_coupled_heat) { + AddHistoryOutput("BGS_ADJ_TEMPERATURE", "bgs[A_T]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); + } AddHistoryOutputFields_AdjScalarBGS_RES(config); - if (config->AddRadiation()){ + if (config->AddRadiation()) { /// DESCRIPTION: Root-mean square residual of the adjoint radiative energy tilde. AddHistoryOutput("BGS_ADJ_RAD_ENERGY", "bgs[A_P1]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the P1 radiative energy.",HistoryFieldType::RESIDUAL); } @@ -178,7 +190,7 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutputFields_AdjScalarLinsol(config); - if (config->GetDeform_Mesh()){ + if (config->GetDeform_Mesh()) { AddHistoryOutput("DEFORM_ITER", "DeformIter", ScreenOutputFormat::INTEGER, "DEFORM", "Linear solver iterations for the mesh deformation"); AddHistoryOutput("DEFORM_RESIDUAL", "DeformRes", ScreenOutputFormat::FIXED, "DEFORM", "Residual of the linear solver for the mesh deformation"); } @@ -198,15 +210,15 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS if (nDim == 3) { SetHistoryOutputValue("RMS_ADJ_VELOCITY-Z", log10(adjflow_solver->GetRes_RMS(3))); } - if (weakly_coupled_heat){ + if (weakly_coupled_heat) { SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_RMS(0))); } - if (heat){ + if (heat) { if (nDim == 3) SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_RMS(4))); else SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_RMS(3))); } - if (config->AddRadiation()){ + if (config->AddRadiation()) { SetHistoryOutputValue("RMS_ADJ_RAD_ENERGY", log10(adjrad_solver->GetRes_RMS(0))); } @@ -220,30 +232,30 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS if (nDim == 3) { SetHistoryOutputValue("MAX_ADJ_VELOCITY-Z", log10(adjflow_solver->GetRes_Max(3))); } - if (weakly_coupled_heat){ + if (weakly_coupled_heat) { SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_Max(0))); } - if (heat){ + if (heat) { if (nDim == 3) SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_Max(4))); else SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_Max(3))); } - if (multiZone){ + if (multiZone) { SetHistoryOutputValue("BGS_ADJ_PRESSURE", log10(adjflow_solver->GetRes_BGS(0))); SetHistoryOutputValue("BGS_ADJ_VELOCITY-X", log10(adjflow_solver->GetRes_BGS(1))); SetHistoryOutputValue("BGS_ADJ_VELOCITY-Y", log10(adjflow_solver->GetRes_BGS(2))); if (nDim == 3) { SetHistoryOutputValue("BGS_ADJ_VELOCITY-Z", log10(adjflow_solver->GetRes_BGS(3))); } - if (weakly_coupled_heat){ + if (weakly_coupled_heat) { SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_BGS(0))); } - if (heat){ + if (heat) { if (nDim == 3) SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_BGS(4))); else SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjflow_solver->GetRes_BGS(3))); } - if (config->AddRadiation()){ + if (config->AddRadiation()) { SetHistoryOutputValue("BGS_ADJ_RAD_ENERGY", log10(adjrad_solver->GetRes_BGS(0))); } } @@ -265,15 +277,15 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS LoadHistoryData_AdjScalar(config, solver); } -void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config){ +void CAdjFlowIncOutput::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) + if (nDim == 3) { AddVolumeOutput("COORD-Z", "z", "COORDINATES", "z-component of the coordinate vector"); - + } /// BEGIN_GROUP: SOLUTION, DESCRIPTION: The SOLUTION variables of the adjoint solver. /// DESCRIPTION: Adjoint Pressure. AddVolumeOutput("ADJ_PRESSURE", "Adjoint_Pressure", "SOLUTION", "Adjoint pressure"); @@ -281,25 +293,26 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("ADJ_VELOCITY-X", "Adjoint_Velocity_x", "SOLUTION", "x-component of the adjoint velocity vector"); /// DESCRIPTION: Adjoint Velocity y-component. AddVolumeOutput("ADJ_VELOCITY-Y", "Adjoint_Velocity_y", "SOLUTION", "y-component of the adjoint velocity vector"); - if (nDim == 3) + if (nDim == 3) { /// DESCRIPTION: Adjoint Velocity z-component. AddVolumeOutput("ADJ_VELOCITY-Z", "Adjoint_Velocity_z", "SOLUTION", "z-component of the adjoint velocity vector"); - + } AddVolumeOutput("ADJ_TEMPERATURE", "Adjoint_Temperature", "SOLUTION", "Adjoint temperature"); SetVolumeOutputFields_AdjScalarSolution(config); - if (config->AddRadiation()){ + if (config->AddRadiation()) { AddVolumeOutput("ADJ_P1_ENERGY", "Adjoint_Energy(P1)", "SOLUTION", "Adjoint radiative energy"); } /// END_GROUP // Grid velocity - if (config->GetDynamic_Grid()){ + if (config->GetDynamic_Grid()) { AddVolumeOutput("GRID_VELOCITY-X", "Grid_Velocity_x", "GRID_VELOCITY", "x-component of the grid velocity vector"); AddVolumeOutput("GRID_VELOCITY-Y", "Grid_Velocity_y", "GRID_VELOCITY", "y-component of the grid velocity vector"); - if (nDim == 3 ) + if (nDim == 3 ) { AddVolumeOutput("GRID_VELOCITY-Z", "Grid_Velocity_z", "GRID_VELOCITY", "z-component of the grid velocity vector"); + } } /// BEGIN_GROUP: RESIDUAL, DESCRIPTION: Residuals of the SOLUTION variables. @@ -309,15 +322,16 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("RES_ADJ_VELOCITY-X", "Residual_Adjoint_Velocity_x", "RESIDUAL", "Residual of the adjoint x-velocity"); /// DESCRIPTION: Residual of the adjoint Velocity y-component. AddVolumeOutput("RES_ADJ_VELOCITY-Y", "Residual_Adjoint_Velocity_y", "RESIDUAL", "Residual of the adjoint y-velocity"); - if (nDim == 3) + if (nDim == 3) { /// DESCRIPTION: Residual of the adjoint Velocity z-component. AddVolumeOutput("RES_ADJ_VELOCITY-Z", "Residual_Adjoint_Velocity_z", "RESIDUAL", "Residual of the adjoint z-velocity"); + } /// DESCRIPTION: Residual of the adjoint energy. AddVolumeOutput("RES_ADJ_TEMPERATURE", "Residual_Adjoint_Heat", "RESIDUAL", "Residual of the adjoint temperature"); SetVolumeOutputFields_AdjScalarResidual(config); - if (config->AddRadiation()){ + if (config->AddRadiation()) { AddVolumeOutput("RES_P1_ENERGY", "Residual_Adjoint_Energy_P1", "RESIDUAL", "Residual of adjoint radiative energy"); } /// END_GROUP @@ -327,42 +341,44 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("SENSITIVITY-X", "Sensitivity_x", "SENSITIVITY", "x-component of the sensitivity vector"); /// DESCRIPTION: Sensitivity y-component. AddVolumeOutput("SENSITIVITY-Y", "Sensitivity_y", "SENSITIVITY", "y-component of the sensitivity vector"); - if (nDim == 3) + if (nDim == 3) { /// DESCRIPTION: Sensitivity z-component. AddVolumeOutput("SENSITIVITY-Z", "Sensitivity_z", "SENSITIVITY", "z-component of the sensitivity vector"); + } /// DESCRIPTION: Sensitivity in normal direction. AddVolumeOutput("SENSITIVITY", "Surface_Sensitivity", "SENSITIVITY", "sensitivity in normal direction"); /// END_GROUP } -void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ +void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) { CVariable* Node_AdjFlow = solver[ADJFLOW_SOL]->GetNodes(); CVariable* Node_AdjHeat = nullptr; CVariable* Node_AdjRad = nullptr; CPoint* Node_Geo = geometry->nodes; - if (weakly_coupled_heat){ + if (weakly_coupled_heat) { Node_AdjHeat = solver[ADJHEAT_SOL]->GetNodes(); } - if (config->GetKind_RadiationModel() != RADIATION_MODEL::NONE){ + if (config->GetKind_RadiationModel() != RADIATION_MODEL::NONE) { Node_AdjRad = solver[ADJRAD_SOL]->GetNodes(); } SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(iPoint, 0)); SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(iPoint, 1)); - if (nDim == 3) + if (nDim == 3) { SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2)); + } SetVolumeOutputValue("ADJ_PRESSURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 0)); SetVolumeOutputValue("ADJ_VELOCITY-X", iPoint, Node_AdjFlow->GetSolution(iPoint, 1)); SetVolumeOutputValue("ADJ_VELOCITY-Y", iPoint, Node_AdjFlow->GetSolution(iPoint, 2)); - if (nDim == 3){ + if (nDim == 3) { SetVolumeOutputValue("ADJ_VELOCITY-Z", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); } - if (weakly_coupled_heat){ + if (weakly_coupled_heat) { SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(iPoint, 0)); } else { @@ -371,7 +387,7 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo } // Radiation - if (config->AddRadiation()){ + if (config->AddRadiation()) { SetVolumeOutputValue("ADJ_P1_ENERGY", iPoint, Node_AdjRad->GetSolution(iPoint, 0)); } @@ -379,33 +395,34 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo SetVolumeOutputValue("RES_ADJ_PRESSURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 0) - Node_AdjFlow->GetSolution_Old(iPoint, 0)); SetVolumeOutputValue("RES_ADJ_VELOCITY-X", iPoint, Node_AdjFlow->GetSolution(iPoint, 1) - Node_AdjFlow->GetSolution_Old(iPoint, 1)); SetVolumeOutputValue("RES_ADJ_VELOCITY-Y", iPoint, Node_AdjFlow->GetSolution(iPoint, 2) - Node_AdjFlow->GetSolution_Old(iPoint, 2)); - if (nDim == 3){ + if (nDim == 3) { SetVolumeOutputValue("RES_ADJ_VELOCITY-Z", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); } else { SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); } - if (config->AddRadiation()){ + if (config->AddRadiation()) { SetVolumeOutputValue("RES_P1_ENERGY", iPoint, Node_AdjRad->GetSolution(iPoint, 0) - Node_AdjRad->GetSolution_Old(iPoint, 0)); } SetVolumeOutputValue("SENSITIVITY-X", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 0)); SetVolumeOutputValue("SENSITIVITY-Y", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 1)); - if (nDim == 3) + if (nDim == 3) { SetVolumeOutputValue("SENSITIVITY-Z", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 2)); + } LoadVolumeData_AdjScalar(config, solver, iPoint); } -void CAdjFlowIncOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){ +void CAdjFlowIncOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) { SetVolumeOutputValue("SENSITIVITY", iPoint, solver[ADJFLOW_SOL]->GetCSensitivity(iMarker, iVertex)); } -bool CAdjFlowIncOutput::SetInit_Residuals(const CConfig *config){ +bool CAdjFlowIncOutput::SetInit_Residuals(const CConfig *config) { return (config->GetTime_Marching() != TIME_MARCHING::STEADY && (curInnerIter == 0))|| (config->GetTime_Marching() == TIME_MARCHING::STEADY && (curTimeIter < 2)); diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 16051fe71fc6..ad7c50042d18 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -268,7 +268,7 @@ def main(): discadj_fsi.cfg_dir = "disc_adj_fsi" discadj_fsi.cfg_file = "config.cfg" discadj_fsi.test_iter = 6 - discadj_fsi.test_vals = [6.000000, -1.559957, -3.080711, 0.000440, -1.063100] + discadj_fsi.test_vals = [6.000000, -1.949946, -3.080711, 0.000440, -1.063100] test_list.append(discadj_fsi) # Multi physics framework @@ -276,9 +276,9 @@ 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 = [-3.479484, 0.127482, -1.303589, 7.5407e-09, 2.3244] + discadj_fsi2.test_vals = [-4.349355, 0.127482, -1.303589, 0.000000, 2.324400] discadj_fsi2.test_vals_aarch64 = [-3.479505, 0.127953, -1.303589, 7.5407e-09, 2.3244] - discadj_fsi2.tol = 1e-16 + discadj_fsi2.tol = 0.00001 test_list.append(discadj_fsi2) ################################### @@ -290,7 +290,7 @@ def main(): discadj_cht.cfg_dir = "coupled_cht/disc_adj_incomp_2d" discadj_cht.cfg_file = "cht_2d_3cylinders.cfg" discadj_cht.test_iter = 10 - discadj_cht.test_vals = [-2.364408, -3.085549, -3.085516, -3.085511] + discadj_cht.test_vals = [-2.955510, -3.085549, -3.085516, -3.085511] test_list.append(discadj_cht) # 2D DA cht streamwise periodic case, 2 zones, avg temp objective diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index edebb37e0d18..6ce4f0b86936 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -212,7 +212,7 @@ def main(): discadj_fsi.cfg_dir = "disc_adj_fsi" discadj_fsi.cfg_file = "config.cfg" discadj_fsi.test_iter = 6 - discadj_fsi.test_vals = [6, -1.572702, -3.084381, 4.3990e-04, -1.0631] #last 5 columns + discadj_fsi.test_vals = [6.000000, -1.965877, -3.084381, 0.000440, -1.063100] #last 5 columns test_list.append(discadj_fsi) ################################### @@ -224,7 +224,7 @@ def main(): discadj_cht.cfg_dir = "coupled_cht/disc_adj_incomp_2d" discadj_cht.cfg_file = "cht_2d_3cylinders.cfg" discadj_cht.test_iter = 10 - discadj_cht.test_vals = [-2.364405, -3.085551, -3.085518, -3.085513] #last 4 columns + discadj_cht.test_vals = [-2.955506, -3.085551, -3.085518, -3.085513] #last 4 columns test_list.append(discadj_cht) ######################################