Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
b44ab34
Adding routines to provide direct access to the indices of a computat…
oleburghardt Nov 14, 2018
fce0218
Adapted doxygen information on AD extensions.
oleburghardt Nov 14, 2018
6ce7ef8
Added variable data structures to set and extract gradients with exte…
oleburghardt Nov 14, 2018
4e158db
First changes on discrete adjoint solver level to use explicitly stor…
oleburghardt Nov 14, 2018
c357bdc
Added missing (important) lines for first changes on discrete adjoint…
oleburghardt Nov 14, 2018
c1df4d2
Simple data structures to update adjoint solutions for multiple zones.
oleburghardt Nov 15, 2018
458ac29
Update travis for developping.
oleburghardt Nov 16, 2018
72f36ff
Discrete adjoint multizone driver file (counterpart of driver_direct_…
oleburghardt Nov 16, 2018
349b25e
Updating travis for development.
oleburghardt Nov 16, 2018
344f936
Adding the possibility to store (adjoint vector) indices of the point…
oleburghardt Nov 19, 2018
e077902
Merge branch 'develop' into feature_ad_extensions
oleburghardt Nov 19, 2018
7b20aab
Missing initialisation.
oleburghardt Nov 19, 2018
dda2de5
Allocation fix.
oleburghardt Nov 20, 2018
2168034
Merge branch 'develop' into feature_ad_extensions
oleburghardt Nov 28, 2018
8609b53
Improved naming of new AD routines.
oleburghardt Nov 28, 2018
f1e6106
Merge branch 'develop' into feature_discadj_multiphysics
oleburghardt Dec 7, 2018
a8808a0
Merge branch 'develop' into feature_discadj_multiphysics
oleburghardt Dec 7, 2018
9c4dde2
Merge branch 'feature_ad_extensions' into feature_discadj_multiphysics
oleburghardt Dec 7, 2018
8d03108
Some important corrections for the new AD functions.
oleburghardt Jan 10, 2019
c1eceba
Some overall important corrections and bugfixes for multizone discret…
oleburghardt Jan 10, 2019
edd432b
Code for saving coordinate indices within point variables, too. Not u…
oleburghardt Jan 10, 2019
f0a66cd
Multizone Discrete Adjoint Driver code.
oleburghardt Jan 10, 2019
ab45a8e
Replaced ZoneSpecific-booleans by Multizone booleans for the multizon…
oleburghardt Jan 10, 2019
0372841
Two further small corrections.
oleburghardt Jan 10, 2019
8a4f8cc
Initialising the multizone discrete adjoint driver.
oleburghardt Jan 10, 2019
ff65507
Merge feature_discadj_multiphysics
talbring Jan 10, 2019
9d12d85
Bugfix.
oleburghardt Jan 10, 2019
f76d3ba
Merge remote-tracking branch 'origin/feature_discadj_multiphysics' in…
talbring Jan 10, 2019
fa13349
Added output routine for adjoint multiphysics
talbring Jan 10, 2019
9da3efe
Fixed output pointer
talbring Jan 10, 2019
07ecc0b
Some temp. fixes
talbring Jan 10, 2019
6a7b536
Merge branch 'feature_input_output' into sc_develop
talbring Jan 11, 2019
84b7aea
Added disc adj heat output
talbring Jan 11, 2019
d3c9efe
Added missing check for cht wall interface
talbring Jan 11, 2019
b131a1d
Added missing file
talbring Jan 11, 2019
4a2de0f
Bugfix for flow adjoint in output structure.
oleburghardt Feb 1, 2019
d2fa505
Some further small bug fixes.
oleburghardt Feb 1, 2019
6efe243
Registering also mesh coordinate variables by new interface when runn…
oleburghardt Feb 1, 2019
0f7c926
Added missing CHT_WALL_INTERFACE in grid deformation.
oleburghardt Feb 1, 2019
1734b71
Small change.
oleburghardt Feb 1, 2019
0a27f6c
Added boolean to get information whether a solver is a direct or an a…
oleburghardt Feb 1, 2019
938d0d1
Some changes in discrete adjoint multizone driver.
oleburghardt Feb 1, 2019
4e4a081
Condensing some data handling routines in discrete adjoint via !=NULL.
oleburghardt Feb 1, 2019
10b5629
Adding adjoint temperature to new output for the incompressible case.
oleburghardt Feb 1, 2019
54c10d4
Merge branch 'feature_input_output' into sc_develop
talbring Mar 20, 2019
627ade8
Changed name CONSERVATIVE to SOLUTION also in discrete adjoint heat o…
oleburghardt Mar 25, 2019
0e3c960
Merge branch 'feature_input_output' into sc_develop
talbring Apr 4, 2019
4387be8
Small bugfixes.
oleburghardt Apr 4, 2019
b0dfe10
Two small screen output fixes.
oleburghardt Apr 4, 2019
71429c1
Memory bug fixes for multiphysics discrete adjoints.
oleburghardt Apr 9, 2019
cf2d767
Driver output improvements for multiphysics discrete adjoint.
oleburghardt Apr 9, 2019
8bf1379
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
talbring Apr 10, 2019
0a8e2e7
Adding checks that linear solvers will not be skipped during recordin…
oleburghardt Apr 11, 2019
5f1950f
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Apr 12, 2019
b272eb4
Merge remote-tracking branch 'origin/feature_input_output' into sc_de…
talbring Apr 16, 2019
764d795
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
talbring Apr 16, 2019
af52d0f
Added missing BGS res
talbring Apr 16, 2019
10850b8
Adding missing header file
talbring Apr 16, 2019
81cc722
Merge remote-tracking branch 'origin/feature_input_output' into sc_de…
talbring Apr 17, 2019
b13a0ba
Merge remote-tracking branch 'origin/feature_input_output' into sc_de…
talbring Apr 17, 2019
958d66f
Merge remote-tracking branch 'origin/feature_input_output' into sc_de…
talbring Apr 18, 2019
340e662
Small after merge fix
talbring Apr 18, 2019
9805d99
Fix related to 0a8e2e70dfea4ebf45325620bd20cbe48a3ff144.
oleburghardt Apr 19, 2019
d756640
Small fix.
oleburghardt Apr 23, 2019
b6109e3
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Apr 24, 2019
273f8b2
Fixing some include locations and updating Xcode project.
economon Apr 24, 2019
cf763bb
Small changes and added heat flux at surface grid points to heat solver.
economon Apr 25, 2019
5132501
Fix for multizone mesh writing
talbring Apr 26, 2019
46009de
Merge remote-tracking branch 'origin/feature_input_output' into sc_de…
talbring May 6, 2019
d48d94c
Small fix.
oleburghardt May 6, 2019
541df9d
Merge branch 'sc_develop' of https://github.com/su2code/SU2 into sc_d…
oleburghardt May 6, 2019
f83168f
Resolve two incorrectly merged lines of code.
oleburghardt May 6, 2019
961e27c
Adding avg. temperature to multiphysics discrete adjoint. This will b…
oleburghardt May 6, 2019
1316ec2
Start changing objective function calculation in output driver (outpu…
oleburghardt Jun 17, 2019
5db3823
Added option to use multiphysics discrete adjoint (when not default).
oleburghardt Jun 17, 2019
e632133
Replace multiphysics booleans by own ones for discrete adjoint.
oleburghardt Jun 19, 2019
99a35fe
Small changes (just for development).
oleburghardt Jun 19, 2019
c7f2df0
Direct AD output for per-surface output.
oleburghardt Jun 19, 2019
3e78524
Merge branch 'feature_input_output' into sc_develop
talbring Jun 26, 2019
25d56d9
Small fix.
oleburghardt Jun 26, 2019
527f4ad
Merge branch 'feature_input_output' into sc_develop
talbring Jun 26, 2019
d46fc20
Merge branch 'sc_develop' of github.com:su2code/SU2 into sc_develop
talbring Jun 26, 2019
e7b5aa7
Fixed missing bgs residual
talbring Jun 26, 2019
b8d9c0c
Small fix.
oleburghardt Jun 26, 2019
6779109
Small fix in Makefile.
oleburghardt Jun 26, 2019
0adad6b
Merge branch 'feature_input_output' into sc_develop
talbring Jun 27, 2019
8508ab3
Merge branch 'sc_develop' of github.com:su2code/SU2 into sc_develop
talbring Jun 27, 2019
1b18223
Direct derivatives for per-surface output.
oleburghardt Jul 4, 2019
98d19be
Bugfix (incompressible adjoint output writing heat adjoints even if I…
oleburghardt Jul 25, 2019
59ce7cc
Small change.
oleburghardt Jul 29, 2019
1fc03d1
Merge branch 'feature_input_output' into sc_develop
oleburghardt Jul 29, 2019
24c2380
Fix some stuff that got lost during merge.
oleburghardt Jul 30, 2019
0973aa2
Small output improvement.
oleburghardt Jul 31, 2019
493a559
Start adding an option to use zone-specific tapes.
oleburghardt Aug 1, 2019
b7b5cbd
Added config option for full or zone-specific tapes. Some bugfixes.
oleburghardt Aug 1, 2019
61c1db6
Adapting objective function recording to new output structure (part 2…
oleburghardt Aug 5, 2019
edfe789
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 5, 2019
8602c3f
Change naming from ADJ_HEAT to ADJ_TEMPERATURE throughout all files.
oleburghardt Aug 5, 2019
c5c6d1c
Merge bugfix
oleburghardt Aug 5, 2019
d36c173
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 7, 2019
193f8fe
Remove DV_MARKER check which gives a false positive for new multizone…
oleburghardt Aug 8, 2019
960144f
Some fixes.
oleburghardt Aug 8, 2019
e38db62
Replacing coupled CHT test case.
oleburghardt Aug 8, 2019
f07dac7
Adding coupled discrete adjoint CHT test case.
oleburghardt Aug 8, 2019
ee1a3fd
Missing files for coupled discrete adjoint CHT test case.
oleburghardt Aug 16, 2019
092c69d
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 19, 2019
dcac8fd
Some adaptions to new namings.
oleburghardt Aug 19, 2019
f1c722f
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 20, 2019
2cda96b
Adapting to new solver namings.
oleburghardt Aug 21, 2019
a8b7a75
Adapting heated cylinders test case.
oleburghardt Aug 21, 2019
f65c630
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 21, 2019
09f2f89
Bugfix.
oleburghardt Aug 21, 2019
4520e7e
Adapting regression test values for heated cylinder test case.
oleburghardt Aug 21, 2019
4b9a3ca
Adding inner loops for coupled adjoint computations.
oleburghardt Aug 22, 2019
d580222
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 23, 2019
8a447d8
Changing regression test values for discrete adjoint heat due to chan…
oleburghardt Aug 23, 2019
f6480c6
Adapt regression test file to output name changes (temperature instea…
oleburghardt Aug 23, 2019
ffe265d
Change a naming and improving some comments.
oleburghardt Aug 26, 2019
4c7ce15
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 26, 2019
d62edcb
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 26, 2019
8ae9eb5
Fix option in regression test file.
oleburghardt Aug 26, 2019
0be4efd
Update .travis.yml
oleburghardt Aug 26, 2019
496abfb
Removing unnecessary config options in CHT regression test (to align …
oleburghardt Aug 27, 2019
68dd51a
Merge branch 'sc_develop' of https://github.com/su2code/SU2 into sc_d…
oleburghardt Aug 27, 2019
3ba483d
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 27, 2019
0b82505
Update .travis.yml
talbring Aug 27, 2019
c73c645
Tidying up some line breaks.
oleburghardt Aug 27, 2019
fcb8864
Replacing hard-coded value for adjoint inner iteration by a config op…
oleburghardt Aug 27, 2019
3eba591
Merge branch 'sc_develop' of https://github.com/su2code/SU2 into sc_d…
oleburghardt Aug 27, 2019
7afaafe
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 28, 2019
f4fbfd0
Merge corrections for name changes.
oleburghardt Aug 28, 2019
83e074e
Remove some unused variables.
oleburghardt Aug 28, 2019
f001e5e
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 28, 2019
216b178
Resolve merge conflicts.
oleburghardt Aug 28, 2019
893d617
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 28, 2019
b6df9cc
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Aug 28, 2019
7e12f77
Small fix.
oleburghardt Aug 28, 2019
c7c10a5
Some improvements (comments, less error-prone data handling).
oleburghardt Aug 29, 2019
f99505b
Change name from Solution_Iter to Solution_Outer and restructuring Ru…
oleburghardt Aug 30, 2019
0f3b986
Some reorganization of the Run()-routine (to ease integration of FSI,…
oleburghardt Sep 5, 2019
7cc712f
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Sep 5, 2019
c727a6d
Fixing minor merge issues.
oleburghardt Sep 5, 2019
1284b64
Remove INNER_ITER_ADJOINT and make it use INNER_ITER instead.
oleburghardt Sep 6, 2019
0a8f4ef
Remove TapeActive-Booleans inside linear solver calls as there is no …
oleburghardt Sep 6, 2019
670f95a
Some corrections (namings, comments) for routines in AD namespace.
oleburghardt Sep 6, 2019
aa2da94
Change Set_AdjIndices to SetAdjIndices for variable classes accordingly.
oleburghardt Sep 6, 2019
3a9c134
Small changes for AD routines in geometry variable class.
oleburghardt Sep 9, 2019
7f3eed1
Remove CDisAdjMultizoneDriver::Output-overload (not needed for now, p…
oleburghardt Sep 9, 2019
b4a5395
Adding some const declarations.
oleburghardt Sep 9, 2019
78ad7f7
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Sep 10, 2019
bd315f5
Correct include paths.
oleburghardt Sep 10, 2019
d3d1067
Added an enumaration declaration for tape positions (used for coupled…
oleburghardt Sep 16, 2019
58c0664
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Sep 18, 2019
d0d975b
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Sep 18, 2019
203b234
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Sep 18, 2019
93848da
Some alignments for multizone output.
oleburghardt Sep 18, 2019
bbb66fa
Name clarifications for add/copy routines on driver level.
oleburghardt Sep 18, 2019
b37f082
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Sep 25, 2019
352ac66
Adapt coupled_cht test cases to recent output structure changes.
oleburghardt Sep 26, 2019
c1107ca
Removing some unused variables.
oleburghardt Sep 26, 2019
f0dabbe
Adapting coupled_cht AD regression test values as they also now cover…
oleburghardt Sep 26, 2019
8b8cd17
Merge branch 'feature_input_output' of https://github.com/su2code/SU2…
oleburghardt Sep 27, 2019
200733b
Some merge conflicts.
oleburghardt Sep 27, 2019
3b5067a
Merge branch 'develop' of https://github.com/su2code/SU2 into sc_develop
oleburghardt Oct 2, 2019
2a75156
Merge fix.
oleburghardt Oct 2, 2019
beb2701
Remove old SU2_CFD/src/output_adjoint_heat.cpp
oleburghardt Oct 4, 2019
c7c818a
Use an enum class for different kinds of tapes.
oleburghardt Oct 4, 2019
5db776a
Some requested changes for comments and commented code.
oleburghardt Oct 4, 2019
bf6934a
ComputeResidual_Multizone fix for multizone discrete adjoints.
oleburghardt Oct 4, 2019
fee6393
Remove SetAdj_ObjFunc from InitializeAdjoint (preferably done on driv…
oleburghardt Oct 4, 2019
f944f5a
Small comment improvement.
oleburghardt Oct 4, 2019
76dd925
Remove option for CFL number in solids (covered by split config files…
oleburghardt Oct 4, 2019
a07bef0
Add boolean option to distinguish between CHT boundary method (Neuman…
oleburghardt Oct 4, 2019
30c7f15
Including Robin/Neumann BC option in CHT boundary condition method.
oleburghardt Oct 4, 2019
b4587e3
Remove extra spaces.
oleburghardt Oct 4, 2019
4ed37b5
Added missed allocation for variables used in ComputeResidual_Multizone.
oleburghardt Oct 4, 2019
0ed3d8b
Put PrintStatistics for AD into an option, some other improvements.
oleburghardt Oct 4, 2019
9ac45d9
Enabling multizone mode using one zone
talbring Oct 7, 2019
60b55ff
Some simplifications and removal of discrete adjoint multiphysics con…
oleburghardt Oct 7, 2019
9b02b38
Further simplifications within discrete adjoint multiphysics driver.
oleburghardt Oct 7, 2019
5a8d848
Merge branch 'develop' of https://github.com/su2code/SU2 into sc_develop
oleburghardt Oct 8, 2019
a74efbd
Doxygen and grammar fixes.
oleburghardt Oct 8, 2019
8833f43
Adding override identifiers, some other fixes.
oleburghardt Oct 8, 2019
7f7c3c4
Nitpicky part.
oleburghardt Oct 8, 2019
9adcc03
Reference value (temperature and heat fluxes) cleanup for heat solver.
oleburghardt Oct 9, 2019
cda8a25
Conjugate heat interface cleanup (part 1/2), using reference values f…
oleburghardt Oct 9, 2019
3ec8fd0
Conjugate heat interface cleanup (part 2/2).
oleburghardt Oct 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions Common/include/ad_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,42 @@ namespace AD{
bool TapeActive();

/*!
* \brief Registers the variable as an input. I.e. as a leaf of the computational graph.
* \brief Prints out tape statistics.
*/
void PrintStatistics();

/*!
* \brief Registers the variable as an input and saves internal data (indices). I.e. as a leaf of the computational graph.
* \param[in] data - The variable to be registered as input.
*/
void RegisterInput(su2double &data);

/*!
* \brief Registers the variable as an input. I.e. as a leaf of the computational graph.
* \param[in] data - The variable to be registered as input.
*/
void RegisterInput_intIndexBased(su2double &data);

/*!
* \brief Registers the variable as an output. I.e. as the root of the computational graph.
* \param[in] data - The variable to be registered as output.
*/
void RegisterOutput(su2double &data);

/*!
* \brief Sets the adjoint value at index to val
* \param[in] index - Position in the adjoint vector.
* \param[in] val - adjoint value to be set.
*/
void SetDerivative(int index, const double val);

/*!
* \brief Extracts the adjoint value at index
* \param[in] index - position in the adjoint vector where the derivative will be extracted.
* \return Derivative value.
*/
double GetDerivative(int index);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return missing, although obvious


/*!
* \brief Clears the currently stored adjoints but keeps the computational graph.
*/
Expand All @@ -84,7 +109,14 @@ namespace AD{
/*!
* \brief Computes the adjoints, i.e. the derivatives of the output with respect to the input variables.
*/
void ComputeAdjoint();
void ComputeAdjoint();

/*!
* \brief Computes the adjoints, i.e. the derivatives of the output with respect to the input variables.
* \param[in] enter - Position where we start evaluating the tape.
* \param[in] leave - Position where we stop evaluating the tape.
*/
void ComputeAdjoint(unsigned short enter, unsigned short leave);
Comment on lines +114 to +119
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to have more documentation on the AD functionality, especially with these new routines added related to tape indices. Can you please add something to the docs on the 'Advanced AD Techniques' page (or in your tutorial)? At the moment, folks have to learn the system mostly by looking through the code


/*!
* \brief Reset the tape structure to be ready for a new recording.
Expand Down Expand Up @@ -209,6 +241,17 @@ namespace AD{
*/
void EndExtFunc();

/*!
* \brief Evaluates and saves gradient data from a variable.
* \param[in] data - variable whose gradient information will be extracted.
* \param[in] index - where obtained gradient information will be stored.
*/
void SetAdjIndex(int &index, const su2double &data);

/*!
* \brief Pushes back the current tape position to the tape position's vector.
*/
void Push_TapePosition();
}

/*--- Macro to begin and end sections with a passive tape ---*/
Expand Down
54 changes: 50 additions & 4 deletions Common/include/ad_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ namespace AD{

extern su2double::TapeType::Position StartPosition, EndPosition;

extern std::vector<su2double::TapeType::Position> TapePositions;

extern std::vector<su2double::GradientData> localInputValues;

extern std::vector<su2double*> localOutputValues;
Expand All @@ -77,6 +79,8 @@ namespace AD{
inline void RegisterInput(su2double &data) {AD::globalTape.registerInput(data);
inputValues.push_back(data.getGradientData());}

inline void RegisterInput_intIndexBased(su2double &data) {AD::globalTape.registerInput(data);}

inline void RegisterOutput(su2double& data) {AD::globalTape.registerOutput(data);}

inline void ResetInput(su2double &data) {data.getGradientData() = su2double::GradientData();}
Expand All @@ -85,19 +89,43 @@ namespace AD{

inline void StopRecording() {AD::globalTape.setPassive();}

inline bool TapeActive() {return AD::globalTape.isActive();}
inline bool TapeActive() { return AD::globalTape.isActive(); }

inline void PrintStatistics() {AD::globalTape.printStatistics();}

inline void ClearAdjoints() {AD::globalTape.clearAdjoints(); }

inline void ComputeAdjoint() {AD::globalTape.evaluate();
adjointVectorPosition = 0;}

inline void ComputeAdjoint(unsigned short enter, unsigned short leave) {
AD::globalTape.evaluate(TapePositions[enter], TapePositions[leave]);
if (leave == 0) {
adjointVectorPosition = 0;
}
}

inline void Reset() {
globalTape.reset();
if (inputValues.size() != 0) {
globalTape.reset();
adjointVectorPosition = 0;
inputValues.clear();
}
if (TapePositions.size() != 0) {
TapePositions.clear();
}
}

inline void SetAdjIndex(int &index, const su2double &data) {
index = data.getGradientData();
}

inline void SetDerivative(int index, const double val) {
AD::globalTape.setGradient(index, val);
}

inline double GetDerivative(int index) {
return AD::globalTape.getGradient(index);
}

inline void SetPreaccIn(const su2double &data) {
Expand Down Expand Up @@ -167,6 +195,10 @@ namespace AD{
}
}

inline void Push_TapePosition() {
TapePositions.push_back(AD::globalTape.getPosition());
}

inline void EndPreacc(){
if (PreaccActive) {
PreaccHelper.finish(false);
Expand Down Expand Up @@ -239,18 +271,30 @@ namespace AD{

inline void RegisterInput(su2double &data) {}

inline void RegisterInput_intIndexBased(su2double &data) {}

inline void RegisterOutput(su2double& data) {}

inline void StartRecording() {}

inline void StopRecording() {}

inline bool TapeActive() {return false;}
inline bool TapeActive() { return false; }

inline void PrintStatistics() {}

inline void ClearAdjoints() {}

inline void ComputeAdjoint() {}

inline void ComputeAdjoint(unsigned short enter, unsigned short leave) {}

inline void SetAdjIndex(int &index, const su2double &data) {}

inline void SetDerivative(int index, const double val) {}

inline double GetDerivative(int position) { return 0.0; }

inline void Reset() {}

inline void ResetInput(su2double &data) {}
Expand All @@ -270,7 +314,9 @@ namespace AD{
inline void StartPreacc() {}

inline void EndPreacc() {}


inline void Push_TapePosition() {}

inline void StartExtFunc(bool storePrimalInput, bool storePrimalOutput){}

inline void SetExtFuncIn(const su2double &data) {}
Expand Down
33 changes: 23 additions & 10 deletions Common/include/config_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ class CConfig {
CFLRedCoeff_AdjFlow, /*!< \brief CFL reduction coefficient for the adjoint problem. */
CFLRedCoeff_AdjTurb, /*!< \brief CFL reduction coefficient for the adjoint problem. */
CFLFineGrid, /*!< \brief CFL of the finest grid. */
CFLSolid, /*!< \brief CFL in (heat) solid solvers. */
Max_DeltaTime, /*!< \brief Max delta time. */
Unst_CFL; /*!< \brief Unsteady CFL number. */
bool ReorientElements; /*!< \brief Flag for enabling element reorientation. */
Expand Down Expand Up @@ -758,6 +757,7 @@ class CConfig {
Wrt_SharpEdges, /*!< \brief Write residuals to solution file */
Wrt_Halo, /*!< \brief Write rind layers in solution files */
Wrt_Performance, /*!< \brief Write the performance summary at the end of a calculation. */
Wrt_AD_Statistics, /*!< \brief Write the tape statistics (discrete adjoint). */
Wrt_MeshQuality, /*!< \brief Write the mesh quality statistics to the visualization files. */
Wrt_InletFile, /*!< \brief Write a template inlet profile file */
Wrt_Slice, /*!< \brief Write 1D slice of a 2D cartesian solution */
Expand Down Expand Up @@ -874,6 +874,7 @@ class CConfig {
bool Sine_Load; /*!< \brief option for sine load */
su2double *SineLoad_Coeff; /*!< \brief Stores the load coefficient */
su2double Thermal_Diffusivity; /*!< \brief Thermal diffusivity used in the heat solver. */
bool CHT_Robin; /*!< \brief Option for boundary condition method at CHT interfaces. */
su2double Cyclic_Pitch, /*!< \brief Cyclic pitch for rotorcraft simulations. */
Collective_Pitch; /*!< \brief Collective pitch for rotorcraft simulations. */
su2double Mach_Motion; /*!< \brief Mach number based on mesh velocity and freestream quantities. */
Expand Down Expand Up @@ -975,7 +976,8 @@ class CConfig {
Nonphys_Reconstr; /*!< \brief Current number of non-physical reconstructions for 2nd-order upwinding. */
bool ParMETIS; /*!< \brief Boolean for activating ParMETIS mode (while testing). */
unsigned short DirectDiff; /*!< \brief Direct Differentation mode. */
bool DiscreteAdjoint; /*!< \brief AD-based discrete adjoint mode. */
bool DiscreteAdjoint, /*!< \brief AD-based discrete adjoint mode. */
FullTape; /*!< \brief Full tape mode for coupled discrete adjoints. */
unsigned long Wrt_Surf_Freq_DualTime; /*!< \brief Writing surface solution frequency for Dual Time. */
su2double Const_DES; /*!< \brief Detached Eddy Simulation Constant. */
unsigned short Kind_HybridRANSLES; /*!< \brief Kind of Hybrid RANS/LES. */
Expand Down Expand Up @@ -1404,7 +1406,7 @@ class CConfig {
/*!
* \brief Constructor of the class which reads the input file.
*/
CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_software, unsigned short val_nZone, bool verb_high);
CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_software, bool verb_high);

/*!
* \brief Constructor of the class which reads the input file and uses default options from another config.
Expand Down Expand Up @@ -2757,13 +2759,6 @@ class CConfig {
* \return CFL number for each grid.
*/
su2double GetCFL(unsigned short val_mesh);

/*!
* \brief Get the Courant Friedrich Levi number for solid solvers.
* \param[in] val_mesh - Index of the mesh were the CFL is applied.
* \return CFL number for each grid.
*/
su2double GetCFL_Solid(void);

/*!
* \brief Get the Courant Friedrich Levi number for each grid.
Expand Down Expand Up @@ -3252,6 +3247,12 @@ class CConfig {
* \return <code>TRUE</code> means that the performance summary will be written at the end of a calculation.
*/
bool GetWrt_Performance(void);

/*!
* \brief Get information about the computational graph (e.g. memory usage) when using AD in reverse mode.
* \return <code>TRUE</code> means that the tape statistics will be written after each recording.
*/
bool GetWrt_AD_Statistics(void);

/*!
* \brief Get information about writing the mesh quality metrics to the visualization files.
Expand Down Expand Up @@ -8434,6 +8435,12 @@ class CConfig {
* \return the discrete adjoint indicator.
*/
bool GetDiscrete_Adjoint(void);

/*!
* \brief Get the indicator whether we want to use full (coupled) tapes.
* \return the full tape indicator.
*/
bool GetFull_Tape(void);

/*!
* \brief Get the indicator whether we want to benchmark the MPI performance of FSI problems
Expand Down Expand Up @@ -8940,6 +8947,12 @@ class CConfig {
*/
bool GetWeakly_Coupled_Heat(void);

/*!
* \brief Get the boundary condition method for CHT.
* \return YES if Robin BC is used.
*/
bool GetCHT_Robin(void);

/*!
* \brief Check if values passed to the BC_HeatFlux-Routine are already integrated.
* \return YES if the passed values is the integrated heat flux over the marker's surface.
Expand Down
8 changes: 6 additions & 2 deletions Common/include/config_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,6 @@ inline unsigned short CConfig::GetGeometryMode(void) { return GeometryMode; }

inline su2double CConfig::GetCFL(unsigned short val_mesh) { return CFL[val_mesh]; }

inline su2double CConfig::GetCFL_Solid(void) { return CFLSolid; }

inline void CConfig::SetCFL(unsigned short val_mesh, su2double val_cfl) { CFL[val_mesh] = val_cfl; }

inline su2double CConfig::GetUnst_CFL(void) { return Unst_CFL; }
Expand Down Expand Up @@ -1669,6 +1667,8 @@ inline bool CConfig::GetWrt_Halo(void) { return Wrt_Halo; }

inline bool CConfig::GetWrt_Performance(void) { return Wrt_Performance; }

inline bool CConfig::GetWrt_AD_Statistics(void) { return Wrt_AD_Statistics; }

inline bool CConfig::GetWrt_MeshQuality(void) { return Wrt_MeshQuality; }

inline bool CConfig::GetWrt_InletFile(void) { return Wrt_InletFile; }
Expand Down Expand Up @@ -1905,6 +1905,8 @@ inline unsigned short CConfig::GetDirectDiff() { return DirectDiff;}

inline bool CConfig::GetDiscrete_Adjoint() { return DiscreteAdjoint;}

inline bool CConfig::GetFull_Tape() { return FullTape; }

inline unsigned short CConfig::GetRiemann_Solver_FEM(void) {return Riemann_Solver_FEM;}

inline su2double CConfig::GetQuadrature_Factor_Straight(void) {return Quadrature_Factor_Straight;}
Expand All @@ -1925,6 +1927,8 @@ inline bool CConfig::GetJacobian_Spatial_Discretization_Only(void) {return Jacob

inline bool CConfig::GetWeakly_Coupled_Heat(void) { return Weakly_Coupled_Heat; }

inline bool CConfig::GetCHT_Robin(void) { return CHT_Robin; }

inline bool CConfig::GetIntegrated_HeatFlux(void) { return Integrated_HeatFlux; }

inline bool CConfig::GetAD_Mode(void) { return AD_Mode;}
Expand Down
22 changes: 21 additions & 1 deletion Common/include/dual_grid_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ class CPoint : public CDualGrid {
unsigned short nNeighbor; /*!< \brief Number of neighbors. */
bool Flip_Orientation; /*!< \brief Flip the orientation of the normal. */
su2double MaxLength; /*!< \brief The maximum cell-center to cell-center length. */
int *Input_AdjIndices, /*!< \brief Indices of Coord variables in the adjoint vector. */
*Output_AdjIndices; /*!< \brief Indices of Coord variables in the adjoint vector after having been updated. */

public:

Expand Down Expand Up @@ -289,7 +291,25 @@ class CPoint : public CDualGrid {
* \param[in] val_dim - Position to store the coordinate.
* \param[in] val_coord - Coordinate for val_dim.
*/
void SetCoord(unsigned short val_dim, su2double val_coord);
void SetCoord(unsigned short val_dim, su2double val_coord);

/*!
* \brief Set the adjoint vector indices of Coord vector.
* \param[in] input - Save them to the input or output indices vector.
*/
void SetAdjIndices(bool input);

/*!
* \brief Set the adjoint values of the (geometric) coordinates.
* \param[in] adj_sol - Adjoint values of the Coord variables.
*/
void SetAdjointSolution(const su2double *adj_sol);

/*!
* \brief Get the adjoint values of the (geometric) coordinates.
* \param[in] adj_sol - Adjoint values of the Coord variables.
*/
su2double GetAdjointSolution(unsigned short iDim);

/*!
* \brief Get the coordinates of the control volume.
Expand Down
1 change: 1 addition & 0 deletions Common/src/ad_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace AD {

su2double::TapeType& globalTape = su2double::getGlobalTape();
su2double::TapeType::Position StartPosition, EndPosition;
std::vector<su2double::TapeType::Position> TapePositions;

bool Status = false;
bool PreaccActive = false;
Expand Down
Loading