Skip to content

Commit c7cee9c

Browse files
committed
Remove SetRecording method from DAIteration. Call solver routine direct.
I.e. using the concept from the DAMultizoneDriver now in the SingleZoneDriver as well.
1 parent d6cf854 commit c7cee9c

File tree

9 files changed

+11
-82
lines changed

9 files changed

+11
-82
lines changed

SU2_CFD/include/iteration/CDiscAdjFEAIteration.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,18 +169,6 @@ class CDiscAdjFEAIteration final : public CIteration {
169169
void InitializeAdjoint(CSolver***** solver, CGeometry**** geometry, CConfig** config, unsigned short iZone,
170170
unsigned short iInst) override;
171171

172-
/*!
173-
* \brief Record a single iteration of the direct FEM system.
174-
* \param[in] solver - Container vector with all the solutions.
175-
* \param[in] geometry - Geometrical definition of the problem.
176-
* \param[in] config - Definition of the particular problem.
177-
* \param[in] val_iZone - Index of the zone.
178-
* \param[in] val_iInst - Index of the instance.
179-
* \param[in] kind_recording - The kind of recording (geometry or flow).
180-
*/
181-
void SetRecording(CSolver***** solver, CGeometry**** geometry, CConfig** config, unsigned short val_iZone,
182-
unsigned short val_iInst, RECORDING kind_recording) override;
183-
184172
/*!
185173
* \brief Compute necessary variables that depend on the variables in the numerics (E, Nu...)
186174
* \param[in] solver - Container vector with all the solutions.

SU2_CFD/include/iteration/CDiscAdjFluidIteration.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,6 @@ class CDiscAdjFluidIteration final : public CIteration {
165165
void RegisterOutput(CSolver***** solver, CGeometry**** geometry, CConfig** config,
166166
unsigned short iZone, unsigned short iInst) override;
167167

168-
/*!
169-
* \brief Record a single iteration of the direct mean flow system.
170-
* \param[in] solver - Container vector with all the solutions.
171-
* \param[in] geometry - Geometrical definition of the problem.
172-
* \param[in] config - Definition of the particular problem.
173-
* \param[in] val_iZone - Index of the zone.
174-
* \param[in] val_iInst - Index of the instance.
175-
* \param[in] kind_recording - The kind of recording (geometry or flow).
176-
*/
177-
void SetRecording(CSolver***** solver, CGeometry**** geometry, CConfig** config, unsigned short val_iZone,
178-
unsigned short val_iInst, RECORDING kind_recording) override;
179-
180168
/*!
181169
* \brief Compute necessary variables that depend on the conservative variables or the mesh node positions
182170
* (e.g. turbulent variables, normals, volumes).

SU2_CFD/include/iteration/CDiscAdjHeatIteration.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,6 @@ class CDiscAdjHeatIteration final : public CIteration {
148148
void RegisterOutput(CSolver***** solver, CGeometry**** geometry, CConfig** config,
149149
unsigned short iZone, unsigned short iInst) override;
150150

151-
/*!
152-
* \brief Record a single iteration of the direct FEM system.
153-
* \param[in] solver - Container vector with all the solutions.
154-
* \param[in] geometry - Geometrical definition of the problem.
155-
* \param[in] config - Definition of the particular problem.
156-
* \param[in] iZone - Index of the zone.
157-
* \param[in] iInst - Index of the instance.
158-
* \param[in] kind_recording - The kind of recording (geometry or flow).
159-
*/
160-
void SetRecording(CSolver***** solver, CGeometry**** geometry, CConfig** config,
161-
unsigned short iZone, unsigned short iInst, RECORDING kind_recording) override;
162-
163151
/*!
164152
* \brief Compute necessary variables that depend on the conservative variables or the mesh node positions
165153
* (e.g. turbulent variables, normals, volumes).

SU2_CFD/include/iteration/CIteration.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,4 @@ class CIteration {
291291

292292
virtual void RegisterOutput(CSolver***** solver, CGeometry**** geometry, CConfig** config,
293293
unsigned short iZone, unsigned short iInst) {}
294-
295-
virtual void SetRecording(CSolver***** solver, CGeometry**** geometry, CConfig** config, unsigned short val_iZone,
296-
unsigned short val_iInst, RECORDING kind_recording) {}
297294
};

SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,15 +569,14 @@ void CDiscAdjMultizoneDriver::SetRecording(RECORDING kind_recording, Kind_Tape t
569569

570570
AD::Reset();
571571

572-
/*--- Prepare for recording by resetting the flow solution to the initial converged solution---*/
572+
/*--- Prepare for recording by resetting the solution to the initial converged solution. ---*/
573573

574574
for(iZone = 0; iZone < nZone; iZone++) {
575575
for (unsigned short iSol=0; iSol < MAX_SOLS; iSol++) {
576576
auto solver = solver_container[iZone][INST_0][MESH_0][iSol];
577577
if (solver && solver->GetAdjoint()) {
578578
for (unsigned short iMesh = 0; iMesh <= config_container[iZone]->GetnMGLevels(); iMesh++) {
579-
iteration_container[iZone][INST_0]->SetRecording(solver_container, geometry_container, config_container,
580-
iZone, INST_0, kind_recording);
579+
solver->SetRecording(geometry_container[iZone][INST_0][iMesh], config_container[iZone]);
581580
}
582581
}
583582
}

SU2_CFD/src/drivers/CDiscAdjSinglezoneDriver.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,16 @@ void CDiscAdjSinglezoneDriver::SetRecording(RECORDING kind_recording){
240240

241241
AD::Reset();
242242

243-
/*--- Prepare for recording by resetting the solution to the initial converged solution---*/
243+
/*--- Prepare for recording by resetting the solution to the initial converged solution. ---*/
244244

245-
iteration->SetRecording(solver_container, geometry_container, config_container, ZONE_0, INST_0, kind_recording);
245+
for (unsigned short iSol=0; iSol < MAX_SOLS; iSol++) {
246+
auto solver = solver_container[ZONE_0][INST_0][MESH_0][iSol];
247+
if (solver && solver->GetAdjoint()) {
248+
for (unsigned short iMesh = 0; iMesh <= config_container[ZONE_0]->GetnMGLevels(); iMesh++) {
249+
solver->SetRecording(geometry_container[ZONE_0][INST_0][iMesh], config_container[ZONE_0]);
250+
}
251+
}
252+
}
246253

247254
if (rank == MASTER_NODE) {
248255
cout << "\n-------------------------------------------------------------------------\n";

SU2_CFD/src/iteration/CDiscAdjFEAIteration.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,6 @@ void CDiscAdjFEAIteration::IterateDiscAdj(CGeometry**** geometry, CSolver***** s
150150
solver[iZone][iInst][MESH_0][ADJFEA_SOL]->ExtractAdjoint_Variables(geometry[iZone][iInst][MESH_0], config[iZone]);
151151
}
152152

153-
void CDiscAdjFEAIteration::SetRecording(CSolver***** solver, CGeometry**** geometry, CConfig** config,
154-
unsigned short iZone, unsigned short iInst,
155-
RECORDING kind_recording) {
156-
/*--- Prepare for recording by resetting the solution to the initial converged solution ---*/
157-
158-
solver[iZone][iInst][MESH_0][ADJFEA_SOL]->SetRecording(geometry[iZone][iInst][MESH_0], config[iZone]);
159-
}
160-
161153
void CDiscAdjFEAIteration::RegisterInput(CSolver***** solver, CGeometry**** geometry, CConfig** config,
162154
unsigned short iZone, unsigned short iInst, RECORDING kind_recording) {
163155
if (kind_recording != RECORDING::MESH_COORDS) {

SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -470,30 +470,6 @@ void CDiscAdjFluidIteration::RegisterInput(CSolver***** solver, CGeometry**** ge
470470
END_SU2_OMP_PARALLEL
471471
}
472472

473-
void CDiscAdjFluidIteration::SetRecording(CSolver***** solver, CGeometry**** geometry, CConfig** config,
474-
unsigned short iZone, unsigned short iInst, RECORDING kind_recording) {
475-
476-
SU2_OMP_PARALLEL_(if(solver[iZone][iInst][MESH_0][ADJFLOW_SOL]->GetHasHybridParallel())) {
477-
478-
/*--- Prepare for recording by resetting the solution to the initial converged solution ---*/
479-
480-
for (auto iMesh = 0u; iMesh <= config[iZone]->GetnMGLevels(); iMesh++) {
481-
solver[iZone][iInst][iMesh][ADJFLOW_SOL]->SetRecording(geometry[iZone][iInst][iMesh], config[iZone]);
482-
}
483-
if (turbulent && !config[iZone]->GetFrozen_Visc_Disc()) {
484-
solver[iZone][iInst][MESH_0][ADJTURB_SOL]->SetRecording(geometry[iZone][iInst][MESH_0], config[iZone]);
485-
}
486-
if (config[iZone]->GetWeakly_Coupled_Heat()) {
487-
solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->SetRecording(geometry[iZone][iInst][MESH_0], config[iZone]);
488-
}
489-
if (config[iZone]->AddRadiation()) {
490-
solver[iZone][INST_0][MESH_0][ADJRAD_SOL]->SetRecording(geometry[iZone][INST_0][MESH_0], config[iZone]);
491-
}
492-
493-
}
494-
END_SU2_OMP_PARALLEL
495-
}
496-
497473
void CDiscAdjFluidIteration::SetDependencies(CSolver***** solver, CGeometry**** geometry, CNumerics****** numerics,
498474
CConfig** config, unsigned short iZone, unsigned short iInst,
499475
RECORDING kind_recording) {

SU2_CFD/src/iteration/CDiscAdjHeatIteration.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,6 @@ void CDiscAdjHeatIteration::RegisterInput(CSolver***** solver, CGeometry**** geo
200200
}
201201
}
202202

203-
void CDiscAdjHeatIteration::SetRecording(CSolver***** solver, CGeometry**** geometry, CConfig** config,
204-
unsigned short iZone, unsigned short iInst, RECORDING kind_recording) {
205-
/*--- Prepare for recording by resetting the solution to the initial converged solution ---*/
206-
solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->SetRecording(geometry[iZone][iInst][MESH_0], config[iZone]);
207-
}
208-
209203
void CDiscAdjHeatIteration::SetDependencies(CSolver***** solver, CGeometry**** geometry, CNumerics****** numerics,
210204
CConfig** config, unsigned short iZone, unsigned short iInst,
211205
RECORDING kind_recording) {

0 commit comments

Comments
 (0)