diff --git a/Common/include/dual_grid_structure.hpp b/Common/include/dual_grid_structure.hpp index 94bd81a44f37..17d97b3d55aa 100644 --- a/Common/include/dual_grid_structure.hpp +++ b/Common/include/dual_grid_structure.hpp @@ -810,12 +810,24 @@ class CPoint : public CDualGrid { */ void SetAdjointCoord(su2double *adj_coor); + /*! + * \brief Set the adjoint values of the coordinates. + * \param[in] adj_sol - The adjoint values of the coordinates. + */ + void SetAdjointCoord_intIndexBased(su2double *adj_coor); + /*! * \brief Get the adjoint values of the coordinates. * \param[in] adj_sol - The adjoint values of the coordinates. */ void GetAdjointCoord(su2double *adj_coor); + /*! + * \brief Get the adjoint values of the coordinates. + * \param[in] adj_sol - The adjoint values of the coordinates. + */ + void GetAdjointCoord_intIndexBased(su2double *adj_coor); + }; /*! diff --git a/Common/include/dual_grid_structure.inl b/Common/include/dual_grid_structure.inl index 7878e909cc62..55b9a8d9716a 100644 --- a/Common/include/dual_grid_structure.inl +++ b/Common/include/dual_grid_structure.inl @@ -263,14 +263,23 @@ inline void CPoint::SetZeroValues(void) { } inline void CPoint::AddNormal(su2double *val_face_normal) { } inline void CPoint::SetAdjointCoord(su2double *adj_coor){ - for (unsigned short iDim = 0; iDim < nDim; iDim++) - SU2_TYPE::SetDerivative(Coord[iDim], SU2_TYPE::GetValue(adj_coor[iDim])); + for (unsigned short iDim = 0; iDim < nDim; iDim++) + SU2_TYPE::SetDerivative(Coord[iDim], SU2_TYPE::GetValue(adj_coor[iDim])); +} + +inline void CPoint::SetAdjointCoord_intIndexBased(su2double *adj_coor){ + for (unsigned short iDim = 0; iDim < nDim; iDim++) + AD::SetDerivative(Output_AdjIndices[iDim], SU2_TYPE::GetValue(adj_coor[iDim])); } inline void CPoint::GetAdjointCoord(su2double *adj_coor){ - for (unsigned short iDim = 0; iDim < nDim; iDim++){ - adj_coor[iDim] = SU2_TYPE::GetDerivative(Coord[iDim]); - } + for (unsigned short iDim = 0; iDim < nDim; iDim++) + adj_coor[iDim] = SU2_TYPE::GetDerivative(Coord[iDim]); +} + +inline void CPoint::GetAdjointCoord_intIndexBased(su2double *adj_coor){ + for (unsigned short iDim = 0; iDim < nDim; iDim++) + adj_coor[iDim] = AD::GetDerivative(Input_AdjIndices[iDim]); } inline unsigned short CEdge::GetnNodes() { return 2; } diff --git a/Common/src/config_structure.cpp b/Common/src/config_structure.cpp index 82a30b545fef..68d765f17e2f 100644 --- a/Common/src/config_structure.cpp +++ b/Common/src/config_structure.cpp @@ -902,6 +902,8 @@ void CConfig::SetConfig_Options() { /*!\brief WEAKLY_COUPLED_HEAT_EQUATION \n DESCRIPTION: Enable heat equation for incompressible flows. \ingroup Config*/ addBoolOption("WEAKLY_COUPLED_HEAT_EQUATION", Weakly_Coupled_Heat, NO); + addBoolOption("ADJ_FSI", FSI_Problem, NO); + /*\brief AXISYMMETRIC \n DESCRIPTION: Axisymmetric simulation \n DEFAULT: false \ingroup Config */ addBoolOption("AXISYMMETRIC", Axisymmetric, false); /* DESCRIPTION: Add the gravity force */ @@ -1692,7 +1694,7 @@ void CConfig::SetConfig_Options() { /*!\par CONFIG_CATEGORY: Input/output files and formats \ingroup Config */ /*--- Options related to input/output files and formats ---*/ - /*!\brief OUTPUT_FORMAT \n DESCRIPTION: I/O format for output plots. \n OPTIONS: see \link Output_Map \endlink \n DEFAULT: TECPLOT \ingroup Config */ + /*!\brief OUTPUT_FORMAT \n DESCRIPTION: I/O format for output plots. \n OPTIONS: see \link TabOutput_Map \endlink \n DEFAULT: TECPLOT \ingroup Config */ addEnumOption("TABULAR_FORMAT", Tab_FileFormat, TabOutput_Map, TAB_CSV); /*!\brief ACTDISK_JUMP \n DESCRIPTION: The jump is given by the difference in values or a ratio */ addEnumOption("ACTDISK_JUMP", ActDisk_Jump, Jump_Map, DIFFERENCE); @@ -2875,8 +2877,7 @@ void CConfig::SetnZone(){ nZone = GetnZone(Mesh_FileName, Mesh_FileFormat); - } - + } } void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_izone, unsigned short val_nDim) { @@ -3136,27 +3137,6 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ if ((ContinuousAdjoint && !MG_AdjointFlow) || (TimeMarching == TIME_STEPPING)) { nMGLevels = 0; } - - /*--- If Fluid Structure Interaction, set the solver for each zone. - *--- ZONE_0 is the zone of the fluid. - *--- All the other zones are structure. - *--- This will allow us to define multiple physics structural problems */ - - if (Kind_Solver == FLUID_STRUCTURE_INTERACTION) { - if (val_izone == 0) {Kind_Solver = Kind_Solver_Fluid_FSI; FSI_Problem = true;} - - else {Kind_Solver = Kind_Solver_Struc_FSI; FSI_Problem = true; - Kind_Linear_Solver = Kind_Linear_Solver_FSI_Struc; - Kind_Linear_Solver_Prec = Kind_Linear_Solver_Prec_FSI_Struc; - Linear_Solver_Error = Linear_Solver_Error_FSI_Struc; - Linear_Solver_Iter = Linear_Solver_Iter_FSI_Struc; - // Discrete adjoint linear solver - Kind_DiscAdj_Linear_Solver = Kind_DiscAdj_Linear_Solver_FSI_Struc; - Kind_DiscAdj_Linear_Prec = Kind_DiscAdj_Linear_Prec_FSI_Struc;} - - Multizone_Residual = true; - } - else { FSI_Problem = false; } if (Kind_Solver == EULER || Kind_Solver == NAVIER_STOKES || @@ -6035,10 +6015,10 @@ void CConfig::SetOutput(unsigned short val_software, unsigned short val_izone) { } else { if (Time_Domain) { - cout << "Static structural analysis." << endl; + cout << "Dynamic structural analysis."<< endl; + cout << "Time step provided by the user for the dynamic analysis(s): "<< Delta_DynTime << "." << endl; } else { - cout << "Dynamic structural analysis."<< endl; - cout << "Time step provided by the user for the dynamic analysis(s): "<< Delta_DynTime << "." << endl; + cout << "Static structural analysis." << endl; } } diff --git a/QuickStart/inv_NACA0012.cfg b/QuickStart/inv_NACA0012.cfg index 3d160fc0136f..de54004a7bc2 100644 --- a/QuickStart/inv_NACA0012.cfg +++ b/QuickStart/inv_NACA0012.cfg @@ -19,6 +19,7 @@ SOLVER= EULER % Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) MATH_PROBLEM= DIRECT % + % Restart solution (NO, YES) RESTART_SOL= NO SCREEN_OUTPUT=(INNER_ITER, WALL_TIME, RMS_DENSITY, LIFT, DRAG, CAUCHY_SENS_PRESS, CAUCHY_DRAG) diff --git a/SU2_CFD/include/drivers/CDriver.hpp b/SU2_CFD/include/drivers/CDriver.hpp index 2c3040d7be0c..3ea9da7e2dce 100644 --- a/SU2_CFD/include/drivers/CDriver.hpp +++ b/SU2_CFD/include/drivers/CDriver.hpp @@ -1111,6 +1111,7 @@ class CHBDriver : public CFluidDriver { class CDiscAdjFSIDriver : public CDriver { COutputLegacy* output_legacy; + CIteration** direct_iteration; unsigned short RecordingState; unsigned short CurrentRecording; /*!< \brief Stores the current status of the recording. */ @@ -1153,6 +1154,17 @@ class CDiscAdjFSIDriver : public CDriver { */ ~CDiscAdjFSIDriver(void); + /*! + * \brief Launch the computation for FSI adjoint (legacy) driver + */ + inline void StartSolver(){ + + /*--- Run the solver. ---*/ + if (rank == MASTER_NODE) + cout << endl <<"------------------------------ Begin Solver -----------------------------" << endl; + Run(); + } + /*! * \brief Run a Discrete Adjoint iteration for the FSI problem. * \param[in] iteration_container - Container vector with all the iteration methods. @@ -1343,11 +1355,6 @@ class CDiscAdjFSIDriver : public CDriver { void Postprocess(unsigned short ZONE_FLOW, unsigned short ZONE_STRUCT); - /*! - * \brief Overload, does nothing but avoids updates in adjoint FSI problems before the iteration - */ - void Update(void); - /*! * \brief Overload, does nothing but avoids dynamic mesh updates in adjoint FSI problems before the iteration */ diff --git a/SU2_CFD/include/solver_structure.hpp b/SU2_CFD/include/solver_structure.hpp index 7ee8ac1faa46..d48fb201c88d 100644 --- a/SU2_CFD/include/solver_structure.hpp +++ b/SU2_CFD/include/solver_structure.hpp @@ -12644,7 +12644,19 @@ class CDiscAdjSolver : public CSolver { */ void LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo); + /*! + * \brief Compute the multizone residual. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ void ComputeResidual_Multizone(CGeometry *geometry, CConfig *config); + + /*! + * \brief Store the BGS solution in the previous subiteration in the corresponding vector. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + void UpdateSolution_BGS(CGeometry *geometry, CConfig *config); }; @@ -12790,7 +12802,7 @@ class CDiscAdjFEASolver : public CSolver { * \param[in] geometry - The geometrical definition of the problem. */ void RegisterObj_Func(CConfig *config); - + /*! * \brief Set the surface sensitivity. * \param[in] geometry - Geometrical definition of the problem. @@ -12991,7 +13003,19 @@ class CDiscAdjFEASolver : public CSolver { */ void LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo); + /*! + * \brief Compute the multizone residual. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ void ComputeResidual_Multizone(CGeometry *geometry, CConfig *config); + + /*! + * \brief Store the BGS solution in the previous subiteration in the corresponding vector. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + void UpdateSolution_BGS(CGeometry *geometry, CConfig *config); }; diff --git a/SU2_CFD/src/SU2_CFD.cpp b/SU2_CFD/src/SU2_CFD.cpp index d6fe18f845ae..c59cfb8f8bf8 100644 --- a/SU2_CFD/src/SU2_CFD.cpp +++ b/SU2_CFD/src/SU2_CFD.cpp @@ -106,7 +106,6 @@ int main(int argc, char *argv[]) { solver types from the config, instantiate the appropriate driver for the problem and perform all the preprocessing. ---*/ - if (!dry_run){ if ((!config->GetMultizone_Problem() && (config->GetTime_Marching() != HARMONIC_BALANCE) && !turbo) diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 2e9e0ceec4f1..f2a38dc546db 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -5067,23 +5067,23 @@ CDiscAdjFSIDriver::CDiscAdjFSIDriver(char* confFile, direct_iteration = new CIteration*[nZone]; unsigned short iZone; -// for (iZone = 0; iZone < nZone; iZone++){ -// switch (config_container[iZone]->GetKind_Solver()) { -// case DISC_ADJ_INC_RANS: case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: -// case DISC_ADJ_RANS: case DISC_ADJ_EULER: case DISC_ADJ_NAVIER_STOKES: -// direct_iteration[iZone] = new CFluidIteration(config_container[iZone]); -// nVar_Flow = solver_container[iZone][INST_0][MESH_0][ADJFLOW_SOL]->GetnVar(); -// flow_criteria = config_container[iZone]->GetMinLogResidual_BGS_F(); -// flow_criteria_rel = config_container[iZone]->GetOrderMagResidual_BGS_F(); -// break; -// case DISC_ADJ_FEM: -// direct_iteration[iZone] = new CFEAIteration(config_container[iZone]); -// nVar_Struct = solver_container[iZone][INST_0][MESH_0][ADJFEA_SOL]->GetnVar(); -// structure_criteria = config_container[iZone]->GetMinLogResidual_BGS_S(); -// structure_criteria_rel = config_container[iZone]->GetOrderMagResidual_BGS_S(); -// break; -// } -// } + for (iZone = 0; iZone < nZone; iZone++){ + switch (config_container[iZone]->GetKind_Solver()) { + case DISC_ADJ_INC_RANS: case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: + case DISC_ADJ_RANS: case DISC_ADJ_EULER: case DISC_ADJ_NAVIER_STOKES: + direct_iteration[iZone] = new CFluidIteration(config_container[iZone]); + nVar_Flow = solver_container[iZone][INST_0][MESH_0][ADJFLOW_SOL]->GetnVar(); + flow_criteria = -8.0; // Temporarily hard coded until adapted into new structure + flow_criteria_rel = 3.0; + break; + case DISC_ADJ_FEM: + direct_iteration[iZone] = new CFEAIteration(config_container[iZone]); + nVar_Struct = solver_container[iZone][INST_0][MESH_0][ADJFEA_SOL]->GetnVar(); + structure_criteria = -8.0; + structure_criteria_rel = 3.0; + break; + } + } init_res_flow = new su2double[nVar_Flow]; init_res_struct = new su2double[nVar_Struct]; @@ -5182,8 +5182,9 @@ CDiscAdjFSIDriver::CDiscAdjFSIDriver(char* confFile, myfile_res.close(); } + output_legacy = new COutputLegacy(config_container[ZONE_0]); -// /*--- TODO: This is a workaround until the TestCases.py script incorporates new classes for nested loops. ---*/ + /*--- TODO: This is a workaround until the TestCases.py script incorporates new classes for nested loops. ---*/ // config_container[ZONE_0]->SetnExtIter(1); // config_container[ZONE_1]->SetnExtIter(1); ConvHist_file = NULL; @@ -5212,10 +5213,6 @@ CDiscAdjFSIDriver::~CDiscAdjFSIDriver(void) { } -void CDiscAdjFSIDriver::Update(){ - -} - void CDiscAdjFSIDriver::DynamicMeshUpdate(unsigned long ExtIter){ } @@ -5230,13 +5227,12 @@ void CDiscAdjFSIDriver::Run( ) { unsigned long IntIter = 0; for (iZone = 0; iZone < nZone; iZone++) config_container[iZone]->SetInnerIter(IntIter); unsigned long iOuterIter = 0; for (iZone = 0; iZone < nZone; iZone++) config_container[iZone]->SetOuterIter(iOuterIter); - unsigned long nOuterIter = config_container[ZONE_FLOW]->GetnIterFSI(); + unsigned long nOuterIter = driver_config->GetnOuter_Iter(); ofstream myfile_struc, myfile_flow, myfile_geo; Preprocess(ZONE_FLOW, ZONE_STRUCT, ALL_VARIABLES); - for (iOuterIter = 0; iOuterIter < nOuterIter && !BGS_Converged; iOuterIter++){ if (rank == MASTER_NODE){ @@ -5271,6 +5267,7 @@ void CDiscAdjFSIDriver::Run( ) { /*--- Check convergence of the BGS method ---*/ BGS_Converged = BGSConvergence(iOuterIter, ZONE_FLOW, ZONE_STRUCT); + } @@ -6057,10 +6054,10 @@ void CDiscAdjFSIDriver::Iterate_Block(unsigned short ZONE_FLOW, switch (kind_recording){ case FLOW_CONS_VARS: - nIntIter = config_container[ZONE_FLOW]->GetUnst_nIntIter(); + nIntIter = config_container[ZONE_FLOW]->GetnInner_Iter(); break; case FEA_DISP_VARS: - nIntIter = config_container[ZONE_STRUCT]->GetDyn_nIntIter(); + nIntIter = config_container[ZONE_STRUCT]->GetnInner_Iter(); break; case MESH_COORDS: case FEM_CROSS_TERM_GEOMETRY: @@ -6321,9 +6318,8 @@ void CDiscAdjFSIDriver::ConvergenceHistory(unsigned long IntIter, unsigned long BGS_Iter = config_container[ZONE_FLOW]->GetOuterIter(); -// if (rank == MASTER_NODE) -// if ((!config_container[ZONE_0]->GetMultizone_Problem() && !config_container[ZONE_0]->GetSinglezone_Driver())) -// output_container[ZONE_0]->GetLegacyOutput()->SetConvHistory_Header(&ConvHist_file[ZONE_0][INST_0], config_container[ZONE_0], ZONE_0, INST_0); + if (rank == MASTER_NODE) + output_legacy->SetConvHistory_Header(&ConvHist_file[ZONE_0][INST_0], config_container[ZONE_0], ZONE_0, INST_0); if (kind_recording == FLOW_CONS_VARS) { @@ -6336,23 +6332,23 @@ void CDiscAdjFSIDriver::ConvergenceHistory(unsigned long IntIter, if (IntIter % config_container[ZONE_FLOW]->GetWrt_Con_Freq() == 0){ /*--- Output the flow convergence ---*/ /*--- This is temporary as it requires several changes in the output structure ---*/ + unsigned short nVar_Flow = solver_container[ZONE_FLOW][INST_0][MESH_0][ADJFLOW_SOL]->GetnVar(); cout.width(8); cout << IntIter; cout.width(11); cout << BGS_Iter + 1; cout.precision(6); cout.setf(ios::fixed, ios::floatfield); cout.width(15); cout << log10(solver_container[ZONE_FLOW][INST_0][MESH_0][ADJFLOW_SOL]->GetRes_RMS(0)); - cout.width(15); cout << log10(solver_container[ZONE_FLOW][INST_0][MESH_0][ADJFLOW_SOL]->GetRes_RMS(1)); + cout.width(15); cout << log10(solver_container[ZONE_FLOW][INST_0][MESH_0][ADJFLOW_SOL]->GetRes_RMS(nVar_Flow-1)); cout << endl; } } } -// if (kind_recording == FEA_DISP_VARS) { -// if ((!config_container[ZONE_0]->GetMultizone_Problem() && !config_container[ZONE_0]->GetSinglezone_Driver())) -// /*--- Set the convergence criteria (only residual possible) ---*/ -// output_container[ZONE_0]->GetLegacyOutput()->SetConvHistory_Body(NULL, geometry_container, solver_container, config_container, integration_container, true, 0.0, ZONE_STRUCT, INST_0); + if (kind_recording == FEA_DISP_VARS) { + /*--- Set the convergence criteria (only residual possible) ---*/ + output_legacy->SetConvHistory_Body(NULL, geometry_container, solver_container, config_container, integration_container, true, 0.0, ZONE_STRUCT, INST_0); -// } + } } @@ -6428,22 +6424,17 @@ bool CDiscAdjFSIDriver::BGSConvergence(unsigned long IntIter, if (rank == MASTER_NODE){ - cout << endl << "-------------------------------------------------------------------------" << endl; - cout << endl; - cout << "Convergence summary for BGS iteration "; - cout << IntIter << endl; - cout << endl; + cout << "\n-------------------------------------------------------------------------\n\n"; + cout << "Convergence summary for BGS iteration " << IntIter << "\n\n"; /*--- TODO: This is a workaround until the TestCases.py script incorporates new classes for nested loops. ---*/ - cout << "Iter[ID]" << " BGSRes[Psi_Rho]" << " BGSRes[Psi_E]" << " BGSRes[Psi_Ux]" << " BGSRes[Psi_Uy]" << endl; + cout << "Iter[ID]" << " BGSRes[Psi_Rho]" << " BGSRes[Psi_E]" << " BGSRes[Psi_Ux]" << " BGSRes[Psi_Uy]\n"; cout.precision(6); cout.setf(ios::fixed, ios::floatfield); - cout.width(8); cout << IntIter*1000; - cout.width(17); cout << residual_flow[0]; - cout.width(15); cout << residual_flow[nVar_Flow-1]; - cout.width(16); cout << residual_struct[0]; - cout.width(16); cout << residual_struct[1]; - cout << endl; - cout << endl; - cout << "-------------------------------------------------------------------------" << endl; + cout << "|"; cout.width(8); cout << IntIter*1000; + cout << "|"; cout.width(17); cout << residual_flow[0]; + cout << "|"; cout.width(15); cout << residual_flow[nVar_Flow-1]; + cout << "|"; cout.width(16); cout << residual_struct[0]; + cout << "|"; cout.width(16); cout << residual_struct[1]; + cout << "|"; cout << "\n\n-------------------------------------------------------------------------" << endl; bool write_history = true; diff --git a/SU2_CFD/src/solver_adjoint_discrete.cpp b/SU2_CFD/src/solver_adjoint_discrete.cpp index 3aac9731a57f..716c92471b43 100644 --- a/SU2_CFD/src/solver_adjoint_discrete.cpp +++ b/SU2_CFD/src/solver_adjoint_discrete.cpp @@ -487,7 +487,8 @@ void CDiscAdjSolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *confi /*--- Set the old solution ---*/ - if(!config->GetMultizone_Problem()) nodes->Set_OldSolution(); + if(!config->GetMultizone_Problem() || config->GetFSI_Simulation()) + nodes->Set_OldSolution(); for (iPoint = 0; iPoint < nPoint; iPoint++) { @@ -639,7 +640,10 @@ void CDiscAdjSolver::ExtractAdjoint_Geometry(CGeometry *geometry, CConfig *confi /*--- Extract the adjoint solution ---*/ - geometry->node[iPoint]->GetAdjointCoord(Solution_Geometry); + if (config->GetMultizone_Problem()) + geometry->node[iPoint]->GetAdjointCoord_intIndexBased(Solution_Geometry); + else + geometry->node[iPoint]->GetAdjointCoord(Solution_Geometry); /*--- Store the adjoint solution ---*/ @@ -695,7 +699,7 @@ void CDiscAdjSolver::ExtractAdjoint_CrossTerm(CGeometry *geometry, CConfig *conf /*--- Extract the adjoint solution ---*/ - direct_solver->GetNodes()->GetAdjointSolution(iPoint,Solution); + direct_solver->GetNodes()->GetAdjointSolution_intIndexBased(iPoint,Solution); for (iVar = 0; iVar < nVar; iVar++) nodes->SetCross_Term_Derivative(iPoint,iVar, Solution[iVar]); @@ -713,7 +717,10 @@ void CDiscAdjSolver::ExtractAdjoint_CrossTerm_Geometry(CGeometry *geometry, CCon /*--- Extract the adjoint solution ---*/ - geometry->node[iPoint]->GetAdjointCoord(Solution_Geometry); + if (config->GetMultizone_Problem()) + geometry->node[iPoint]->GetAdjointCoord_intIndexBased(Solution_Geometry); + else + geometry->node[iPoint]->GetAdjointCoord(Solution_Geometry); for (iDim = 0; iDim < nDim; iDim++) nodes->SetGeometry_CrossTerm_Derivative(iPoint,iDim, Solution_Geometry[iDim]); @@ -731,7 +738,10 @@ void CDiscAdjSolver::ExtractAdjoint_CrossTerm_Geometry_Flow(CGeometry *geometry, /*--- Extract the adjoint solution ---*/ - geometry->node[iPoint]->GetAdjointCoord(Solution_Geometry); + if (config->GetMultizone_Problem()) + geometry->node[iPoint]->GetAdjointCoord_intIndexBased(Solution_Geometry); + else + geometry->node[iPoint]->GetAdjointCoord(Solution_Geometry); for (iDim = 0; iDim < nDim; iDim++) nodes->SetGeometry_CrossTerm_Derivative_Flow(iPoint,iDim, Solution_Geometry[iDim]); @@ -751,7 +761,7 @@ void CDiscAdjSolver::SetAdjoint_Output(CGeometry *geometry, CConfig *config) { for (iPoint = 0; iPoint < nPoint; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - if(config->GetMultizone_Problem()) { + if(config->GetMultizone_Problem() && !fsi) { Solution[iVar] = nodes->Get_BGSSolution_k(iPoint,iVar); } else { @@ -1087,7 +1097,7 @@ void CDiscAdjSolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig *con /*--- Compute the BGS solution (adding the cross term) ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++){ for (iVar = 0; iVar < nVar; iVar++){ - if(config->GetMultizone_Problem()) { + if(config->GetMultizone_Problem() && !config->GetFSI_Simulation()) { bgs_sol = nodes->GetSolution(iPoint,iVar); } else { @@ -1110,3 +1120,18 @@ void CDiscAdjSolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig *con SetResidual_BGS(geometry, config); } + +void CDiscAdjSolver::UpdateSolution_BGS(CGeometry *geometry, CConfig *config){ + + unsigned long iPoint; + unsigned short iVar; + + /*--- To nPoint: The solution must be communicated beforehand ---*/ + /*--- As there might be crossed dependencies, we need to use the full BGS solution and not just the node Solution ---*/ + for (iPoint = 0; iPoint < nPoint; iPoint++){ + for (iVar = 0; iVar < nVar; iVar++) + nodes->Set_BGSSolution_k(iPoint, iVar, nodes->Get_BGSSolution(iPoint, iVar)); + } + +} + diff --git a/SU2_CFD/src/solver_adjoint_elasticity.cpp b/SU2_CFD/src/solver_adjoint_elasticity.cpp index c3ec97ab7d7e..8f99c3941410 100644 --- a/SU2_CFD/src/solver_adjoint_elasticity.cpp +++ b/SU2_CFD/src/solver_adjoint_elasticity.cpp @@ -983,6 +983,21 @@ void CDiscAdjFEASolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig * } +void CDiscAdjFEASolver::UpdateSolution_BGS(CGeometry *geometry, CConfig *config){ + + unsigned long iPoint; + unsigned short iVar; + + /*--- To nPoint: The solution must be communicated beforehand ---*/ + /*--- As there are geometrical crossed dependencies, we need to use the full BGS solution and not just the node Solution ---*/ + for (iPoint = 0; iPoint < nPoint; iPoint++){ + for (iVar = 0; iVar < nVar; iVar++) + nodes->Set_BGSSolution_k(iPoint, iVar, nodes->Get_BGSSolution(iPoint, iVar)); + } + +} + + void CDiscAdjFEASolver::BC_Clamped_Post(CGeometry *geometry, CNumerics *numerics, CConfig *config, unsigned short val_marker) { unsigned long iPoint, iVertex; diff --git a/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp b/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp index 94b5b3c1d608..cc6daa2473af 100644 --- a/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp @@ -59,7 +59,7 @@ CDiscAdjFEAVariable::CDiscAdjFEAVariable(const su2double *disp, const su2double } if (config->GetMultizone_Problem()) - Set_BGSSolution_k(); + Solution_BGS_k.resize(nPoint,nDim) = su2double(0.0); /*--- Nothing else to allocate ---*/ if (!unsteady) return; diff --git a/SU2_CFD/src/variables/CDiscAdjVariable.cpp b/SU2_CFD/src/variables/CDiscAdjVariable.cpp index c8ef81878871..09460b592ab9 100644 --- a/SU2_CFD/src/variables/CDiscAdjVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjVariable.cpp @@ -78,7 +78,7 @@ CDiscAdjVariable::CDiscAdjVariable(const su2double* sol, unsigned long npoint, u if (config->GetMultizone_Problem()) { Solution_BGS.resize(nPoint,nVar) = su2double(0.0); - Set_BGSSolution_k(); + Solution_BGS_k.resize(nPoint,nVar) = su2double(0.0); } } diff --git a/TestCases/TestCase.py b/TestCases/TestCase.py index 36293383743b..a7b26c6f3764 100644 --- a/TestCases/TestCase.py +++ b/TestCases/TestCase.py @@ -231,7 +231,7 @@ def run_filediff(self): # Assemble the shell command to run logfilename = '%s.log' % os.path.splitext(self.cfg_file)[0] - command = "%s -f %s > %s 2>&1" % (self.su2_exec, self.cfg_file, logfilename) + command = "%s %s > %s 2>&1" % (self.su2_exec, self.cfg_file, logfilename) # Run SU2 workdir = os.getcwd() diff --git a/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg b/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg index 00ba0cae1050..c60a35fde8f2 100755 --- a/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg +++ b/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg @@ -1,152 +1,13 @@ -% Physics -------------------------------------------------------------- % -SOLVER= FLUID_STRUCTURE_INTERACTION +SOLVER= MULTIPHYSICS MATH_PROBLEM= DISCRETE_ADJOINT -% -SURFACE_MOVEMENT= FLUID_STRUCTURE_STATIC -FSI_FLUID_PROBLEM= EULER -KIND_TURB_MODEL= NONE -FSI_STRUCTURAL_PROBLEM= ELASTICITY -% -% Optimization --------------------------------------------------------- % -GRAD_OBJFUNC_FILENAME= of_grad.dat -OBJECTIVE_FUNCTION= REFERENCE_NODE -REFERENCE_NODE= 234 -REFERENCE_NODE_DISPLACEMENT= (0.0, 0.0) -REFERENCE_NODE_PENALTY= 1.0 -DESIGN_VARIABLE_FEA= YOUNG_MODULUS -% -% Compressible free-stream conditions ---------------------------------- % -MACH_NUMBER= 0.8 -AOA= 2.5 -INIT_OPTION= TD_CONDITIONS -FREESTREAM_OPTION= TEMPERATURE_FS -FREESTREAM_PRESSURE= 101325.0 -FREESTREAM_TEMPERATURE= 273.15 -REYNOLDS_LENGTH= 0.5 -% -% Fluid properties ----------------------------------------------------- % -FLUID_MODEL= IDEAL_GAS -GAMMA_VALUE= 1.4 -GAS_CONSTANT= 287.87 -VISCOSITY_MODEL= CONSTANT_VISCOSITY -MU_CONSTANT= 1.716E-5 -% -% Solid properties ----------------------------------------------------- % -MATERIAL_MODEL= NEO_HOOKEAN -ELASTICITY_MODULUS= 7E9 -POISSON_RATIO= 0.35 -MATERIAL_DENSITY= 2700.0 -% -% Boundary conditions -------------------------------------------------- % -% fluid -MARKER_FAR= ( farfield ) -MARKER_EULER= ( leading_edge, pressure_side, suction_side) -% interface -% this needs to appear before the normal load marker +CONFIG_LIST=(configFlow.cfg, configFEA.cfg) + MARKER_ZONE_INTERFACE= (pressure_side,pressure_side_s, suction_side,suction_side_s) + CONSERVATIVE_INTERPOLATION= NO -% solid -MARKER_CLAMPED = ( clamped ) -% this needs to be here to make SU2 cfg happy -MARKER_PRESSURE= ( pressure_side_s,0.0, suction_side_s,0.0 ) -MARKER_FLUID_LOAD= ( pressure_side_s, suction_side_s, clamped) -% -MARKER_MOVING= ( leading_edge, pressure_side, suction_side ) -% -% Post processing and monitoring --------------------------------------- % -REF_ORIGIN_MOMENT_X= -0.125 -REF_ORIGIN_MOMENT_Y= 0.00 -REF_ORIGIN_MOMENT_Z= 0.00 -REF_LENGTH= 0.5 -REF_AREA= 0.5 -MARKER_PLOTTING= ( leading_edge, pressure_side, suction_side ) -MARKER_MONITORING= ( leading_edge, pressure_side, suction_side ) -MARKER_DESIGNING= ( leading_edge, pressure_side, suction_side ) -% -% Common numerics settings --------------------------------------------- % -REF_DIMENSIONALIZATION= DIMENSIONAL -NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 15.0 -% -% Flow numerics -------------------------------------------------------- % -CONV_NUM_METHOD_FLOW= JST -JST_SENSOR_COEFF= ( 0.5, 0.02 ) -TIME_DISCRE_FLOW= EULER_IMPLICIT -% -% Solid numerics ------------------------------------------------------- % -GEOMETRIC_CONDITIONS= LARGE_DEFORMATIONS -FORMULATION_ELASTICITY_2D= PLANE_STRESS -% -% Linear solvers ------------------------------------------------------- % -LINEAR_SOLVER= BCGSTAB -LINEAR_SOLVER_PREC= ILU -LINEAR_SOLVER_ERROR= 1E-3 -LINEAR_SOLVER_ITER= 1000 -DISCADJ_LIN_SOLVER= BCGSTAB -DISCADJ_LIN_PREC= ILU -% Multigrid -MGLEVEL= 2 -MGCYCLE= V_CYCLE -MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) -MG_POST_SMOOTH= ( 0, 0, 0, 0 ) -MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) -MG_DAMP_RESTRICTION= 0.75 -MG_DAMP_PROLONGATION= 0.75 -% -FSI_LINEAR_SOLVER_STRUC= CONJUGATE_GRADIENT -FSI_LINEAR_SOLVER_PREC_STRUC= ILU -FSI_LINEAR_SOLVER_ERROR_STRUC= 1E-8 -FSI_LINEAR_SOLVER_ITER_STRUC= 1000 -FSI_DISCADJ_LIN_SOLVER_STRUC = CONJUGATE_GRADIENT -FSI_DISCADJ_LIN_PREC_STRUC = ILU -% -DEFORM_LINEAR_SOLVER= CONJUGATE_GRADIENT -DEFORM_LINEAR_SOLVER_PREC= ILU -DEFORM_LINEAR_SOLVER_ERROR= 1e-8 -DEFORM_LINEAR_SOLVER_ITER= 1000 -% -% Convergence criteria ------------------------------------------------- % -% interaction -EXT_ITER= 1 -TIME_ITER= 1 -FSI_ITER= 9 -BGS_RELAXATION= FIXED_PARAMETER -STAT_RELAX_PARAMETER= 0.7 -CONV_RESIDUAL_MINVAL_FSI= -4 -% fluid -UNST_INT_ITER= 51 -CONV_CRITERIA= RESIDUAL -CONV_STARTITER= 0 -CONV_RESIDUAL_MINVAL= -9 -% solid -NONLINEAR_FEM_INT_ITER= 11 -% grid deformation -DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME -% -% In\Out --------------------------------------------------------------- % + +ADJ_FSI= YES +OUTER_ITER= 9 MESH_FILENAME= mesh.su2 -MESH_FORMAT= SU2 -% -RESTART_SOL= NO -SOLUTION_FILENAME= solution_fluid.dat -SOLUTION_STRUCTURE_FILENAME= solution_solid.dat -SOLUTION_ADJ_FILENAME= adjoint_fluid.dat -SOLUTION_ADJ_STRUCTURE_FILENAME= adjoint_solid.dat -WRT_SOL_FREQ= 999999 -RESTART_FILENAME= solution_fluid.dat -RESTART_STRUCTURE_FILENAME= solution_solid.dat -RESTART_ADJ_FILENAME= adjoint_fluid.dat -RESTART_ADJ_STRUCTURE_FILENAME= adjoint_solid.dat -% -TABULAR_FORMAT= CSV -VOLUME_FILENAME= fluid -VOLUME_ADJ_FILENAME= adjoint_fluid -SURFACE_FILENAME= surface_fluid -SURFACE_ADJ_FILENAME= adjoint_surface_fluid -% -VOLUME_STRUCTURE_FILENAME= solid -VOLUME_ADJ_STRUCTURE_FILENAME= adjoint_solid -% -WRT_CON_FREQ= 10 -CONV_FILENAME= history +OBJECTIVE_FUNCTION= REFERENCE_NODE diff --git a/TestCases/disc_adj_fsi/Airfoil_2d/configFEA.cfg b/TestCases/disc_adj_fsi/Airfoil_2d/configFEA.cfg new file mode 100755 index 000000000000..2b14922dece4 --- /dev/null +++ b/TestCases/disc_adj_fsi/Airfoil_2d/configFEA.cfg @@ -0,0 +1,70 @@ +% Physics -------------------------------------------------------------- % +SOLVER= ELASTICITY +% +SURFACE_MOVEMENT= FLUID_STRUCTURE_STATIC +% +% Optimization --------------------------------------------------------- % +GRAD_OBJFUNC_FILENAME= of_grad.dat +OBJECTIVE_FUNCTION= REFERENCE_NODE +REFERENCE_NODE= 234 +REFERENCE_NODE_DISPLACEMENT= (0.0, 0.0) +REFERENCE_NODE_PENALTY= 1.0 +DESIGN_VARIABLE_FEA= YOUNG_MODULUS +% +% Solid properties ----------------------------------------------------- % +MATERIAL_MODEL= NEO_HOOKEAN +ELASTICITY_MODULUS= 7E9 +POISSON_RATIO= 0.35 +MATERIAL_DENSITY= 2700.0 +% +% Boundary conditions -------------------------------------------------- % +% interface +% this needs to appear before the normal load marker +CONSERVATIVE_INTERPOLATION= NO +% solid +MARKER_CLAMPED = ( clamped ) +% this needs to be here to make SU2 cfg happy +MARKER_PRESSURE= ( pressure_side_s,0.0, suction_side_s,0.0 ) +MARKER_FLUID_LOAD= ( pressure_side_s, suction_side_s, clamped) +% +MARKER_MOVING= ( leading_edge, pressure_side, suction_side ) +% +% Solid numerics ------------------------------------------------------- % +GEOMETRIC_CONDITIONS= LARGE_DEFORMATIONS +FORMULATION_ELASTICITY_2D= PLANE_STRESS +% +% Linear solvers ------------------------------------------------------- % +LINEAR_SOLVER= CONJUGATE_GRADIENT +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-8 +LINEAR_SOLVER_ITER= 1000 +DISCADJ_LIN_SOLVER= CONJUGATE_GRADIENT +DISCADJ_LIN_PREC= ILU +% +% Convergence criteria ------------------------------------------------- % +% interaction +BGS_RELAXATION= FIXED_PARAMETER +STAT_RELAX_PARAMETER= 0.7 +% solid +INNER_ITER= 11 +% grid deformation +DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME +% +% In\Out --------------------------------------------------------------- % +MESH_FILENAME= mesh.su2 +MESH_FORMAT= SU2 +% +RESTART_SOL= NO +SOLUTION_FILENAME= solution_solid.dat +SOLUTION_ADJ_FILENAME= adjoint_solid.dat +WRT_SOL_FREQ= 999999 +RESTART_FILENAME= solution_solid.dat +RESTART_ADJ_FILENAME= adjoint_solid.dat +% +TABULAR_FORMAT= CSV +VOLUME_FILENAME= solid +VOLUME_ADJ_FILENAME= adjoint_solid +% +WRT_CON_FREQ= 10 +CONV_FILENAME= history + diff --git a/TestCases/disc_adj_fsi/Airfoil_2d/configFlow.cfg b/TestCases/disc_adj_fsi/Airfoil_2d/configFlow.cfg new file mode 100755 index 000000000000..76bb6ac65545 --- /dev/null +++ b/TestCases/disc_adj_fsi/Airfoil_2d/configFlow.cfg @@ -0,0 +1,112 @@ +% Physics -------------------------------------------------------------- % +SOLVER= EULER +% +SURFACE_MOVEMENT= FLUID_STRUCTURE_STATIC +KIND_TURB_MODEL= NONE +% +% Optimization --------------------------------------------------------- % +GRAD_OBJFUNC_FILENAME= of_grad.dat +% +% Compressible free-stream conditions ---------------------------------- % +MACH_NUMBER= 0.8 +AOA= 2.5 +INIT_OPTION= TD_CONDITIONS +FREESTREAM_OPTION= TEMPERATURE_FS +FREESTREAM_PRESSURE= 101325.0 +FREESTREAM_TEMPERATURE= 273.15 +REYNOLDS_LENGTH= 0.5 +% +% Fluid properties ----------------------------------------------------- % +FLUID_MODEL= IDEAL_GAS +GAMMA_VALUE= 1.4 +GAS_CONSTANT= 287.87 +VISCOSITY_MODEL= CONSTANT_VISCOSITY +MU_CONSTANT= 1.716E-5 +% +% Solid properties ----------------------------------------------------- % +MATERIAL_MODEL= NEO_HOOKEAN +ELASTICITY_MODULUS= 7E9 +POISSON_RATIO= 0.35 +MATERIAL_DENSITY= 2700.0 +% +% Boundary conditions -------------------------------------------------- % +% fluid +MARKER_FAR= ( farfield ) +MARKER_EULER= ( leading_edge, pressure_side, suction_side) +% +MARKER_MOVING= ( leading_edge, pressure_side, suction_side ) +% +% Post processing and monitoring --------------------------------------- % +REF_ORIGIN_MOMENT_X= -0.125 +REF_ORIGIN_MOMENT_Y= 0.00 +REF_ORIGIN_MOMENT_Z= 0.00 +REF_LENGTH= 0.5 +REF_AREA= 0.5 +MARKER_PLOTTING= ( leading_edge, pressure_side, suction_side ) +MARKER_MONITORING= ( leading_edge, pressure_side, suction_side ) +MARKER_DESIGNING= ( leading_edge, pressure_side, suction_side ) +% +% Common numerics settings --------------------------------------------- % +REF_DIMENSIONALIZATION= DIMENSIONAL +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 15.0 +% +% Flow numerics -------------------------------------------------------- % +CONV_NUM_METHOD_FLOW= JST +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +TIME_DISCRE_FLOW= EULER_IMPLICIT +% +% Linear solvers ------------------------------------------------------- % +LINEAR_SOLVER= BCGSTAB +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-3 +LINEAR_SOLVER_ITER= 1000 +DISCADJ_LIN_SOLVER= BCGSTAB +DISCADJ_LIN_PREC= ILU +% Multigrid +MGLEVEL= 2 +MGCYCLE= V_CYCLE +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +MG_DAMP_RESTRICTION= 0.75 +MG_DAMP_PROLONGATION= 0.75 +% +DEFORM_LINEAR_SOLVER= CONJUGATE_GRADIENT +DEFORM_LINEAR_SOLVER_PREC= ILU +DEFORM_LINEAR_SOLVER_ERROR= 1e-8 +DEFORM_LINEAR_SOLVER_ITER= 1000 +% +% Convergence criteria ------------------------------------------------- % +% interaction +TIME_ITER= 1 +BGS_RELAXATION= FIXED_PARAMETER +STAT_RELAX_PARAMETER= 0.7 +% fluid +INNER_ITER= 51 +CONV_CRITERIA= RESIDUAL +CONV_STARTITER= 0 +CONV_RESIDUAL_MINVAL= -9 +% grid deformation +DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME +% +% In\Out --------------------------------------------------------------- % +MESH_FILENAME= mesh.su2 +MESH_FORMAT= SU2 +% +RESTART_SOL= NO +SOLUTION_FILENAME= solution_fluid.dat +SOLUTION_ADJ_FILENAME= adjoint_fluid.dat +WRT_SOL_FREQ= 999999 +RESTART_FILENAME= solution_fluid.dat +RESTART_ADJ_FILENAME= adjoint_fluid.dat +% +TABULAR_FORMAT= CSV +VOLUME_FILENAME= fluid +VOLUME_ADJ_FILENAME= adjoint_fluid +SURFACE_FILENAME= surface_fluid +SURFACE_ADJ_FILENAME= adjoint_surface_fluid +% +WRT_CON_FREQ= 10 +CONV_FILENAME= history + diff --git a/TestCases/disc_adj_fsi/Airfoil_2d/grad_young.opt.ref b/TestCases/disc_adj_fsi/Airfoil_2d/grad_young.opt.ref index e00dfbaeb752..ad247c099fee 100644 --- a/TestCases/disc_adj_fsi/Airfoil_2d/grad_young.opt.ref +++ b/TestCases/disc_adj_fsi/Airfoil_2d/grad_young.opt.ref @@ -1,2 +1,2 @@ INDEX GRAD -0 -1.735284970747917e-03 +0 -1.735284958051538e-03 diff --git a/TestCases/disc_adj_fsi/config.cfg b/TestCases/disc_adj_fsi/config.cfg new file mode 100644 index 000000000000..97bc1d1a159f --- /dev/null +++ b/TestCases/disc_adj_fsi/config.cfg @@ -0,0 +1,11 @@ +SOLVER= MULTIPHYSICS +MATH_PROBLEM= DISCRETE_ADJOINT +CONFIG_LIST=(configFlow.cfg, configFEA.cfg) + +MARKER_ZONE_INTERFACE = (UpperWall, UpperWallS, LowerWall, LowerWallS) + +ADJ_FSI= YES +OUTER_ITER= 4 +MESH_FILENAME= mesh.su2 + +OBJECTIVE_FUNCTION = REFERENCE_GEOMETRY diff --git a/TestCases/disc_adj_fsi/configFEA.cfg b/TestCases/disc_adj_fsi/configFEA.cfg new file mode 100644 index 000000000000..47dcba8fcdc5 --- /dev/null +++ b/TestCases/disc_adj_fsi/configFEA.cfg @@ -0,0 +1,83 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% SU2 configuration file % +% Case description: Regression test for coupled adjoints % +% Author: R.Sanchez % +% Institution: Imperial College London % +% Date: 2017.11.29 % +% File Version 6.2.0 "Falcon" % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +SOLVER= ELASTICITY + +MATH_PROBLEM= DISCRETE_ADJOINT + +RESTART_SOL= NO + +PRESTRETCH = YES +PRESTRETCH_FILENAME = prestretch.dat + +DE_EFFECTS = YES +ELECTRIC_FIELD_CONST = 4.25E-11 +ELECTRIC_FIELD_DIR = (0.0,1.0) +ELECTRIC_FIELD_MOD = 20E5 + +REFERENCE_GEOMETRY = YES +REFERENCE_GEOMETRY_FILENAME = reference_geometry.dat +REFERENCE_GEOMETRY_FORMAT = SU2 + +WRT_BINARY_RESTART=NO +READ_BINARY_RESTART=NO + +STAT_RELAX_PARAMETER= 1.0 +BGS_RELAXATION = FIXED_PARAMETER +PREDICTOR_ORDER=0 + +GEOMETRIC_CONDITIONS= LARGE_DEFORMATIONS +MATERIAL_MODEL= NEO_HOOKEAN +MATERIAL_COMPRESSIBILITY= COMPRESSIBLE + +ELASTICITY_MODULUS=34150 +POISSON_RATIO=0.0 +MATERIAL_DENSITY=402.287 +FORMULATION_ELASTICITY_2D = PLANE_STRESS + +NONLINEAR_FEM_SOLUTION_METHOD = NEWTON_RAPHSON +INNER_ITER= 5 + +MARKER_CLAMPED = ( Clamped_Right, Clamped_Left ) +MARKER_PRESSURE= ( LowerWallS, 0, UpperWallS, 0) +MARKER_FLUID_LOAD= ( LowerWallS, UpperWallS) + +WRT_CON_FREQ= 1 +WRT_CON_FREQ_DUALTIME= 1 +WRT_SOL_FREQ= 1 +WRT_SOL_FREQ_DUALTIME= 5 + +LINEAR_SOLVER= CONJUGATE_GRADIENT +LINEAR_SOLVER_PREC= JACOBI +LINEAR_SOLVER_ERROR= 1E-9 +LINEAR_SOLVER_ITER= 50000 + +DISCADJ_LIN_SOLVER = CONJUGATE_GRADIENT +DISCADJ_LIN_PREC = JACOBI + +CONV_CRITERIA= RESIDUAL +CONV_RESIDUAL_MINVAL= -10 +CONV_STARTITER= 10 +CONV_CAUCHY_ELEMS= 100 +CONV_CAUCHY_EPS= 1E-5 + +VOLUME_FILENAME= results_beam + +CONV_FILENAME= history + +BREAKDOWN_FILENAME= forces_breakdown.dat +SOLUTION_FILENAME= solution_beam.dat +RESTART_FILENAME= restart_beam.dat +SOLUTION_ADJ_FILENAME= solution_flow_adj.dat +RESTART_ADJ_FILENAME= restart_flow_adj.dat + +WRT_SRF_SOL = NO + +MESH_FORMAT= SU2 +TABULAR_FORMAT= CSV diff --git a/TestCases/disc_adj_fsi/configAD_fsi.cfg b/TestCases/disc_adj_fsi/configFlow.cfg similarity index 62% rename from TestCases/disc_adj_fsi/configAD_fsi.cfg rename to TestCases/disc_adj_fsi/configFlow.cfg index 331d66c83ce7..0eb03e997d22 100644 --- a/TestCases/disc_adj_fsi/configAD_fsi.cfg +++ b/TestCases/disc_adj_fsi/configFlow.cfg @@ -7,68 +7,21 @@ % File Version 6.2.0 "Falcon" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -SOLVER= FLUID_STRUCTURE_INTERACTION -FSI_FLUID_PROBLEM = NAVIER_STOKES -FSI_STRUCTURAL_PROBLEM = ELASTICITY +SOLVER= NAVIER_STOKES MATH_PROBLEM= DISCRETE_ADJOINT RESTART_SOL= NO -PRESTRETCH = YES -PRESTRETCH_FILENAME = prestretch.dat - -DE_EFFECTS = YES -ELECTRIC_FIELD_CONST = 4.25E-11 -ELECTRIC_FIELD_DIR = (0.0,1.0) -ELECTRIC_FIELD_MOD = 20E5 - -OBJECTIVE_FUNCTION = REFERENCE_GEOMETRY - - -SURFACE_MOVEMENT= FLUID_STRUCTURE_STATIC -REFERENCE_GEOMETRY = YES -REFERENCE_GEOMETRY_FILENAME = reference_geometry.dat -REFERENCE_GEOMETRY_FORMAT = SU2 - -DISCADJ_LIN_SOLVER= FGMRES -DISCADJ_LIN_PREC= JACOBI -FSI_DISCADJ_LIN_SOLVER_STRUC = CONJUGATE_GRADIENT -FSI_DISCADJ_LIN_PREC_STRUC = JACOBI - WRT_BINARY_RESTART=NO READ_BINARY_RESTART=NO -MESH_FILENAME= mesh.su2 - -EXT_ITER= 1 -FSI_ITER= 4 +INNER_ITER= 50 STAT_RELAX_PARAMETER= 1.0 BGS_RELAXATION = FIXED_PARAMETER PREDICTOR_ORDER=0 -MARKER_ZONE_INTERFACE = (UpperWall, UpperWallS, LowerWall, LowerWallS) -CONSERVATIVE_INTERPOLATION = YES - -GEOMETRIC_CONDITIONS= LARGE_DEFORMATIONS -MATERIAL_MODEL= NEO_HOOKEAN -MATERIAL_COMPRESSIBILITY= COMPRESSIBLE - -ELASTICITY_MODULUS=34150 -POISSON_RATIO=0.0 -MATERIAL_DENSITY=402.287 -FORMULATION_ELASTICITY_2D = PLANE_STRESS - -NONLINEAR_FEM_SOLUTION_METHOD = NEWTON_RAPHSON -NONLINEAR_FEM_INT_ITER = 5 - -MARKER_CLAMPED = ( Clamped_Right, Clamped_Left ) -MARKER_PRESSURE= ( LowerWallS, 0, UpperWallS, 0) -MARKER_FLUID_LOAD= ( LowerWallS, UpperWallS) - -UNST_INT_ITER= 50 - AOA= 4.0 SIDESLIP_ANGLE= 0.0 REYNOLDS_NUMBER= 2500 @@ -90,33 +43,9 @@ REYNOLDS_LENGTH=0.1366 MARKER_HEATFLUX= ( Wall, 0.0, UpperWall, 0.0, LowerWall, 0.0) MARKER_FAR = ( Farfield ) - MARKER_PLOTTING= ( UpperWall, LowerWall, Wall) MARKER_MONITORING= ( UpperWall, LowerWall, Wall) - -VOLUME_FILENAME= results_flow -VOLUME_STRUCTURE_FILENAME= results_beam - -CONV_FILENAME= history - -BREAKDOWN_FILENAME= forces_breakdown.dat - -SOLUTION_FILENAME= solution_flow.dat -SOLUTION_STRUCTURE_FILENAME= solution_beam.dat - -RESTART_FILENAME= restart_flow.dat -RESTART_STRUCTURE_FILENAME= restart_beam.dat - -SOLUTION_ADJ_FILENAME= solution_flow_adj.dat -RESTART_ADJ_FILENAME= restart_flow_adj.dat - -SOLUTION_ADJ_STRUCTURE_FILENAME= solution_flow_adj.dat -RESTART_ADJ_STRUCTURE_FILENAME= restart_flow_adj.dat - -WRT_SRF_SOL = NO - -MESH_FORMAT= SU2 -TABULAR_FORMAT= CSV +SURFACE_MOVEMENT= FLUID_STRUCTURE_STATIC WRT_CON_FREQ= 1 WRT_CON_FREQ_DUALTIME= 1 @@ -139,10 +68,8 @@ LINEAR_SOLVER_PREC= LU_SGS LINEAR_SOLVER_ERROR= 1E-6 LINEAR_SOLVER_ITER= 2 -FSI_LINEAR_SOLVER_STRUC = CONJUGATE_GRADIENT -FSI_LINEAR_SOLVER_PREC_STRUC = JACOBI -FSI_LINEAR_SOLVER_ERROR_STRUC = 1E-9 -FSI_LINEAR_SOLVER_ITER_STRUC = 50000 +DISCADJ_LIN_SOLVER= FGMRES +DISCADJ_LIN_PREC= JACOBI CONV_NUM_METHOD_FLOW= ROE MUSCL_FLOW= YES @@ -157,3 +84,15 @@ CONV_STARTITER= 10 CONV_CAUCHY_ELEMS= 100 CONV_CAUCHY_EPS= 1E-5 +VOLUME_FILENAME= results_flow +CONV_FILENAME= history +BREAKDOWN_FILENAME= forces_breakdown.dat +SOLUTION_FILENAME= solution_flow.dat +RESTART_FILENAME= restart_flow.dat +SOLUTION_ADJ_FILENAME= solution_flow_adj.dat +RESTART_ADJ_FILENAME= restart_flow_adj.dat + +WRT_SRF_SOL = NO + +MESH_FORMAT= SU2 +TABULAR_FORMAT= CSV diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index bd1995839977..7b849e9e47f0 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -264,16 +264,16 @@ def main(): ### Coupled FSI Adjoint ### ################################### -# # Structural model -# discadj_fsi = TestCase('discadj_fsi') -# discadj_fsi.cfg_dir = "disc_adj_fsi" -# discadj_fsi.cfg_file = "configAD_fsi.cfg" -# discadj_fsi.test_iter = 3000 -# discadj_fsi.test_vals = [0.958848,-0.157183,0.658415,1.302076] #last 4 columns -# discadj_fsi.su2_exec = "parallel_computation.py -f" -# discadj_fsi.timeout = 1600 -# discadj_fsi.tol = 0.00001 -# test_list.append(discadj_fsi) + # Structural model + discadj_fsi = TestCase('discadj_fsi') + discadj_fsi.cfg_dir = "disc_adj_fsi" + discadj_fsi.cfg_file = "config.cfg" + discadj_fsi.test_iter = 3000 + discadj_fsi.test_vals = [0.958848,-0.157601,0.726660,1.303625] #last 4 columns + discadj_fsi.su2_exec = "mpirun -n 2 SU2_CFD_AD" + discadj_fsi.timeout = 1600 + discadj_fsi.tol = 0.00001 + test_list.append(discadj_fsi) ################################### ### Coupled CHT Adjoint ### @@ -305,7 +305,7 @@ def main(): discadj_topol_optim.cfg_dir = "fea_topology" discadj_topol_optim.cfg_file = "config.cfg" discadj_topol_optim.test_iter = 0 - discadj_topol_optim.su2_exec = "parallel_computation.py" + discadj_topol_optim.su2_exec = "parallel_computation.py -f" discadj_topol_optim.timeout = 1600 discadj_topol_optim.reference_file = "grad_ref_node.dat.ref" discadj_topol_optim.test_file = "grad_ref_node.dat" @@ -316,16 +316,16 @@ def main(): ### Coupled FSI Adjoint ### ################################### -# discadj_fsi2 = TestCase('discadj_fsi_airfoil') -# discadj_fsi2.cfg_dir = "disc_adj_fsi/Airfoil_2d" -# discadj_fsi2.cfg_file = "config.cfg" -# discadj_fsi2.test_iter = 0 -# discadj_fsi2.su2_exec = "parallel_computation.py" -# discadj_fsi2.timeout = 1600 -# discadj_fsi2.reference_file = "grad_young.opt.ref" -# discadj_fsi2.test_file = "grad_young.opt" -# pass_list.append(discadj_fsi2.run_filediff()) -# test_list.append(discadj_fsi2) + discadj_fsi2 = TestCase('discadj_fsi_airfoil') + discadj_fsi2.cfg_dir = "disc_adj_fsi/Airfoil_2d" + discadj_fsi2.cfg_file = "config.cfg" + discadj_fsi2.test_iter = 0 + discadj_fsi2.su2_exec = "mpirun -n 2 SU2_CFD_AD" + discadj_fsi2.timeout = 1600 + discadj_fsi2.reference_file = "grad_young.opt.ref" + discadj_fsi2.test_file = "grad_young.opt" + pass_list.append(discadj_fsi2.run_filediff()) + test_list.append(discadj_fsi2) # Tests summary print('==================================================================') diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 19e15e8c9ce4..9067007c5a26 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -1491,7 +1491,7 @@ def main(): contadj_euler_py.cfg_dir = "cont_adj_euler/naca0012" contadj_euler_py.cfg_file = "inv_NACA0012.cfg" contadj_euler_py.test_iter = 10 - contadj_euler_py.su2_exec = "continuous_adjoint.py" + contadj_euler_py.su2_exec = "continuous_adjoint.py -f" contadj_euler_py.timeout = 1600 contadj_euler_py.reference_file = "of_grad_cd.dat.ref" contadj_euler_py.test_file = "of_grad_cd.dat" @@ -1517,7 +1517,7 @@ def main(): contadj_multi_py.cfg_dir = "cont_adj_euler/wedge" contadj_multi_py.cfg_file = "inv_wedge_ROE_multiobj.cfg" contadj_multi_py.test_iter = 10 - contadj_multi_py.su2_exec = "continuous_adjoint.py" + contadj_multi_py.su2_exec = "continuous_adjoint.py -f" contadj_multi_py.timeout = 1600 contadj_multi_py.new_output = True contadj_multi_py.reference_file = "of_grad_combo.dat.ref" diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index d0a9be91b4ff..5e1424227309 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -250,15 +250,15 @@ def main(): ################################### # Structural model -# discadj_fsi = TestCase('discadj_fsi') -# discadj_fsi.cfg_dir = "disc_adj_fsi" -# discadj_fsi.cfg_file = "configAD_fsi.cfg" -# discadj_fsi.test_iter = 3000 -# discadj_fsi.test_vals = [0.958848,-0.157183,0.658415,1.302076] #last 4 columns -# discadj_fsi.su2_exec = "SU2_CFD_AD" -# discadj_fsi.timeout = 1600 -# discadj_fsi.tol = 0.00001 -# test_list.append(discadj_fsi) + discadj_fsi = TestCase('discadj_fsi') + discadj_fsi.cfg_dir = "disc_adj_fsi" + discadj_fsi.cfg_file = "config.cfg" + discadj_fsi.test_iter = 3000 + discadj_fsi.test_vals = [0.958848,-0.157601,0.726660,1.303625] #last 4 columns + discadj_fsi.su2_exec = "SU2_CFD_AD" + discadj_fsi.timeout = 1600 + discadj_fsi.tol = 0.00001 + test_list.append(discadj_fsi) ################################### ### Coupled CHT Adjoint ### @@ -290,7 +290,7 @@ def main(): discadj_euler_py.cfg_dir = "cont_adj_euler/naca0012" discadj_euler_py.cfg_file = "inv_NACA0012.cfg" discadj_euler_py.test_iter = 10 - discadj_euler_py.su2_exec = "discrete_adjoint.py" + discadj_euler_py.su2_exec = "discrete_adjoint.py -f" discadj_euler_py.timeout = 1600 discadj_euler_py.reference_file = "of_grad_cd_disc.dat.ref" discadj_euler_py.test_file = "of_grad_cd.dat" @@ -302,7 +302,7 @@ def main(): discadj_multiple_ffd_py.cfg_dir = "multiple_ffd/naca0012" discadj_multiple_ffd_py.cfg_file = "inv_NACA0012_ffd.cfg" discadj_multiple_ffd_py.test_iter = 9 - discadj_multiple_ffd_py.su2_exec = "discrete_adjoint.py" + discadj_multiple_ffd_py.su2_exec = "discrete_adjoint.py -f" discadj_multiple_ffd_py.timeout = 1600 discadj_multiple_ffd_py.reference_file = "of_grad_cd.dat.ref" discadj_multiple_ffd_py.test_file = "of_grad_cd.dat" @@ -314,7 +314,7 @@ def main(): directdiff_euler_py.cfg_dir = "cont_adj_euler/naca0012" directdiff_euler_py.cfg_file = "inv_NACA0012_FD.cfg" directdiff_euler_py.test_iter = 10 - directdiff_euler_py.su2_exec = "direct_differentiation.py" + directdiff_euler_py.su2_exec = "direct_differentiation.py -f" directdiff_euler_py.timeout = 1600 directdiff_euler_py.reference_file = "of_grad_directdiff.dat.ref" directdiff_euler_py.test_file = "DIRECTDIFF/of_grad_directdiff.dat" @@ -326,7 +326,7 @@ def main(): directdiff_multiple_ffd_py.cfg_dir = "multiple_ffd/naca0012" directdiff_multiple_ffd_py.cfg_file = "inv_NACA0012_ffd.cfg" directdiff_multiple_ffd_py.test_iter = 9 - directdiff_multiple_ffd_py.su2_exec = "direct_differentiation.py" + directdiff_multiple_ffd_py.su2_exec = "direct_differentiation.py -f" directdiff_multiple_ffd_py.timeout = 1600 directdiff_multiple_ffd_py.reference_file = "of_grad_directdiff.dat.ref" directdiff_multiple_ffd_py.test_file = "DIRECTDIFF/of_grad_directdiff.dat"