Skip to content

Commit ae3ab31

Browse files
Merge branch 'develop' into feature_preconditioning
2 parents f1744c0 + 5627e49 commit ae3ab31

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

Common/include/basic_types/ad_structure.hpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ inline void StartRecording() {}
5252
* \brief Pause the recording of the operations and involved variables.
5353
* If called, all operations occuring after the call will not be stored on the computational graph.
5454
*/
55-
inline void PauseRecording() {}
55+
inline bool PauseRecording() { return false; }
5656

5757
/*!
5858
* \brief Resume the recording of the operations and variables after the recording had been paused.
5959
*/
60-
inline void ResumeRecording() {}
60+
inline void ResumeRecording(bool wasActive) { (void)wasActive; }
6161

6262
/*!
6363
* \brief Stops the recording of the operations and variables.
@@ -413,9 +413,19 @@ FORCEINLINE void ResetInput(su2double& data) { data = data.getValue(); }
413413

414414
FORCEINLINE void StartRecording() { AD::getTape().setActive(); }
415415

416-
FORCEINLINE void PauseRecording() { AD::getTape().setPassive(); }
416+
FORCEINLINE bool PauseRecording() {
417+
if (AD::getTape().isActive()) {
418+
AD::getTape().setPassive();
419+
return true;
420+
}
421+
return false;
422+
}
417423

418-
FORCEINLINE void ResumeRecording() { AD::getTape().setActive(); }
424+
FORCEINLINE void ResumeRecording(bool wasActive) {
425+
if (wasActive) {
426+
AD::getTape().setActive();
427+
}
428+
}
419429

420430
FORCEINLINE void StopRecording() { AD::getTape().setPassive(); }
421431

SU2_CFD/include/solvers/CFVMFlowSolverBase.inl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,11 @@ void CFVMFlowSolverBase<V, R>::ComputeVorticityAndStrainMag(const CConfig& confi
673673
AD::SetPreaccOut(StrainMag(iPoint));
674674
AD::EndPreacc();
675675

676-
/*--- Max is not differentiable, so we not register them for preacc. ---*/
677-
strainMax = SU2_TYPE::GetValue(max(strainMax, StrainMag(iPoint)));
678-
omegaMax = SU2_TYPE::GetValue(max(omegaMax, GeometryToolbox::Norm(3, Vorticity)));
676+
/*--- The derivative with respect to strainMax and omegaMax is not required. ---*/
677+
bool wa = AD::PauseRecording();
678+
strainMax = max(strainMax, StrainMag(iPoint));
679+
omegaMax = max(omegaMax, GeometryToolbox::Norm(3, Vorticity));
680+
AD::ResumeRecording(wa);
679681
}
680682
END_SU2_OMP_FOR
681683

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ project('SU2', 'c', 'cpp',
66
default_options: ['buildtype=release',
77
'warning_level=0',
88
'c_std=c99',
9-
'cpp_std=c++11'])
9+
'cpp_std=c++17'])
1010

1111
fsmod = import('fs')
1212
if not fsmod.exists('su2preconfig.timestamp')

0 commit comments

Comments
 (0)