Skip to content

Commit 2f7c899

Browse files
authored
Merge branch 'develop' into update_config_template
2 parents 6e83a4b + 41d2522 commit 2f7c899

24 files changed

Lines changed: 59 additions & 28 deletions

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Kedar Naik
9898
Kürşat Yurt
9999
LaSerpe
100100
Lennaert Tol
101+
Liang Cheng
101102
Lisa Kusch
102103
Matteo Pini
103104
Max Aehle

Common/include/basic_types/ad_structure.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ inline void RegisterOutput(su2double& data) {}
7878
*/
7979
inline void ResizeAdjoints() {}
8080

81+
/*!
82+
* \brief Declare that the adjoints are being used, to protect against resizing.
83+
*
84+
* Should be used together with AD::EndUseAdjoints() to protect AD::SetDerivative() and AD::GetDerivative() calls,
85+
* multiple at once if possible.
86+
*/
87+
inline void BeginUseAdjoints() {}
88+
89+
/*!
90+
* \brief Declare that the adjoints are no longer being used.
91+
*/
92+
inline void EndUseAdjoints() {}
93+
8194
/*!
8295
* \brief Sets the adjoint value at index to val
8396
* \param[in] index - Position in the adjoint vector.
@@ -375,6 +388,10 @@ FORCEINLINE void Reset() {
375388

376389
FORCEINLINE void ResizeAdjoints() { AD::getTape().resizeAdjointVector(); }
377390

391+
FORCEINLINE void BeginUseAdjoints() { AD::getTape().beginUseAdjointVector(); }
392+
393+
FORCEINLINE void EndUseAdjoints() { AD::getTape().endUseAdjointVector(); }
394+
378395
FORCEINLINE void SetIndex(int& index, const su2double& data) { index = data.getIdentifier(); }
379396

380397
// WARNING: For performance reasons, this method does not perform bounds checking.

Common/include/parallelization/omp_structure.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ void omp_finalize();
189189
*/
190190

191191
#define BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS \
192-
SU2_OMP_BARRIER \
192+
SU2_OMP_BARRIER; \
193193
if (omp_in_parallel()) AD::StartNoSharedReading(); \
194194
SU2_OMP_MASTER
195195

196196
#define END_SU2_OMP_SAFE_GLOBAL_ACCESS \
197197
END_SU2_OMP_MASTER \
198198
if (omp_in_parallel()) AD::EndNoSharedReading(); \
199-
SU2_OMP_BARRIER
199+
SU2_OMP_BARRIER;
200200

201201
#define SU2_OMP_SAFE_GLOBAL_ACCESS(...) BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS{__VA_ARGS__} END_SU2_OMP_SAFE_GLOBAL_ACCESS
202202

Common/src/CConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7304,7 +7304,7 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
73047304
if (nMarker_Inlet_Species != 0) {
73057305
BoundaryTable << "Species Inlet boundary";
73067306
for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet_Species; iMarker_Inlet++) {
7307-
BoundaryTable << Marker_Inlet[iMarker_Inlet];
7307+
BoundaryTable << Marker_Inlet_Species[iMarker_Inlet];
73087308
if (iMarker_Inlet < nMarker_Inlet_Species-1) BoundaryTable << " ";
73097309
}
73107310
BoundaryTable.PrintFooter();

SU2_CFD/include/output/COutput.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,11 @@ class COutput {
806806
*/
807807
void SetCommonHistoryFields();
808808

809+
/*!
810+
* \brief Request the history fields common for all solvers.
811+
*/
812+
void RequestCommonHistory(bool dynamic);
813+
809814
/*!
810815
* \brief Parses user-defined outputs.
811816
*/

SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,9 @@ void CDiscAdjMultizoneDriver::SetAdjObjFunction() {
781781
}
782782
if (rank == MASTER_NODE) {
783783
AD::ResizeAdjoints();
784+
AD::BeginUseAdjoints();
784785
AD::SetDerivative(ObjFunc_Index, SU2_TYPE::GetValue(seeding));
786+
AD::EndUseAdjoints();
785787
}
786788
}
787789

SU2_CFD/src/iteration/CDiscAdjFEAIteration.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ void CDiscAdjFEAIteration::InitializeAdjoint(CSolver***** solver, CGeometry****
275275
/*--- Initialize the adjoints the conservative variables ---*/
276276

277277
AD::ResizeAdjoints();
278+
AD::BeginUseAdjoints();
278279
solver[iZone][iInst][MESH_0][ADJFEA_SOL]->SetAdjoint_Output(geometry[iZone][iInst][MESH_0], config[iZone]);
280+
AD::EndUseAdjoints();
279281
}
280282

281283
bool CDiscAdjFEAIteration::Monitor(COutput* output, CIntegration**** integration, CGeometry**** geometry,

SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ void CDiscAdjFluidIteration::InitializeAdjoint(CSolver***** solver, CGeometry***
361361
auto geometry0 = geometry[iZone][iInst][MESH_0];
362362

363363
AD::ResizeAdjoints();
364+
AD::BeginUseAdjoints();
364365

365366
SU2_OMP_PARALLEL_(if(solvers0[ADJFLOW_SOL]->GetHasHybridParallel())) {
366367

@@ -392,6 +393,8 @@ void CDiscAdjFluidIteration::InitializeAdjoint(CSolver***** solver, CGeometry***
392393

393394
}
394395
END_SU2_OMP_PARALLEL
396+
397+
AD::EndUseAdjoints();
395398
}
396399

397400
void CDiscAdjFluidIteration::RegisterInput(CSolver***** solver, CGeometry**** geometry, CConfig** config,

SU2_CFD/src/iteration/CDiscAdjHeatIteration.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ void CDiscAdjHeatIteration::InitializeAdjoint(CSolver***** solver, CGeometry****
159159
/*--- Initialize the adjoints the solution variables ---*/
160160

161161
AD::ResizeAdjoints();
162+
AD::BeginUseAdjoints();
162163
solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->SetAdjoint_Output(geometry[iZone][iInst][MESH_0], config[iZone]);
164+
AD::EndUseAdjoints();
163165
}
164166

165167
void CDiscAdjHeatIteration::RegisterInput(CSolver***** solver, CGeometry**** geometry, CConfig** config,

SU2_CFD/src/output/CAdjFlowCompOutput.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ CAdjFlowCompOutput::CAdjFlowCompOutput(CConfig *config, unsigned short nDim) : C
3636
/*--- Set the default history fields if nothing is set in the config file ---*/
3737

3838
if (nRequestedHistoryFields == 0) {
39-
requestedHistoryFields.emplace_back("ITER");
40-
requestedHistoryFields.emplace_back("RMS_RES");
39+
RequestCommonHistory(config->GetTime_Domain());
4140
requestedHistoryFields.emplace_back("SENSITIVITY");
4241
nRequestedHistoryFields = requestedHistoryFields.size();
4342
}

0 commit comments

Comments
 (0)