Skip to content

Commit

Permalink
Merge pull request #554 from su2code/bugfix_DualTime1st_DiscAdj
Browse files Browse the repository at this point in the history
Bugfix DiscAdjFluid: DualTimeStepping 1st order
  • Loading branch information
rsanfer authored Jul 24, 2018
2 parents 190f1a4 + 1b657f9 commit da96d8e
Show file tree
Hide file tree
Showing 5 changed files with 437 additions and 7 deletions.
2 changes: 1 addition & 1 deletion SU2_CFD/src/driver_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3719,7 +3719,7 @@ void CDriver::Output(unsigned long ExtIter) {

/*--- Export Surface Solution File for Unsteady Simulations ---*/
/*--- When calculate mean/fluctuation option will be available, delete the following part ---*/
if ((config_container[ZONE_0]->GetUnsteady_Simulation() == DT_STEPPING_2ND) && (ExtIter % config_container[ZONE_0]->GetWrt_Surf_Freq_DualTime() == 0)) {
if ((config_container[ZONE_0]->GetUnsteady_Simulation() == DT_STEPPING_2ND) && (ExtIter % config_container[ZONE_0]->GetWrt_Surf_Freq_DualTime() == 0) && config_container[ZONE_0]->GetWrt_Csv_Sol()) {
output->SetSurfaceCSV_Flow(config_container[ZONE_0], geometry_container[ZONE_0][INST_0][MESH_0], solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL], ExtIter, ZONE_0, INST_0);}

}
Expand Down
14 changes: 9 additions & 5 deletions SU2_CFD/src/iteration_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1825,9 +1825,13 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output,

if ((ExtIter > 0) && dual_time){

/*--- Load solution timestep n - 2 ---*/

LoadUnsteady_Solution(geometry_container, solver_container,config_container, val_iInst, val_iZone, Direct_Iter - 2);
/*--- Load solution timestep n-1 | n-2 for DualTimestepping 1st | 2nd order ---*/
if (dual_time_1st){
LoadUnsteady_Solution(geometry_container, solver_container,config_container, val_iInst, val_iZone, Direct_Iter - 1);
} else {
LoadUnsteady_Solution(geometry_container, solver_container,config_container, val_iInst, val_iZone, Direct_Iter - 2);
}


/*--- Temporarily store the loaded solution in the Solution_Old array ---*/

Expand All @@ -1854,9 +1858,9 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output,
/*--- Set Solution at timestep n-1 to the previously loaded solution ---*/
for (iMesh=0; iMesh<=config_container[val_iZone]->GetnMGLevels();iMesh++) {
for(iPoint=0; iPoint<geometry_container[val_iZone][val_iInst][iMesh]->GetnPoint();iPoint++) {
solver_container[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(solver_container[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->GetSolution_time_n1());
solver_container[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(solver_container[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->GetSolution_Old());
if (turbulent) {
solver_container[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(solver_container[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->GetSolution_time_n1());
solver_container[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(solver_container[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->GetSolution_Old());
}
}
}
Expand Down
Loading

0 comments on commit da96d8e

Please sign in to comment.