Skip to content

Commit

Permalink
Merge branch 'develop' into update_config_template
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfooted authored Oct 26, 2023
2 parents 6e83a4b + 41d2522 commit 2f7c899
Show file tree
Hide file tree
Showing 24 changed files with 59 additions and 28 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Kedar Naik
Kürşat Yurt
LaSerpe
Lennaert Tol
Liang Cheng
Lisa Kusch
Matteo Pini
Max Aehle
Expand Down
17 changes: 17 additions & 0 deletions Common/include/basic_types/ad_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ inline void RegisterOutput(su2double& data) {}
*/
inline void ResizeAdjoints() {}

/*!
* \brief Declare that the adjoints are being used, to protect against resizing.
*
* Should be used together with AD::EndUseAdjoints() to protect AD::SetDerivative() and AD::GetDerivative() calls,
* multiple at once if possible.
*/
inline void BeginUseAdjoints() {}

/*!
* \brief Declare that the adjoints are no longer being used.
*/
inline void EndUseAdjoints() {}

/*!
* \brief Sets the adjoint value at index to val
* \param[in] index - Position in the adjoint vector.
Expand Down Expand Up @@ -375,6 +388,10 @@ FORCEINLINE void Reset() {

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

FORCEINLINE void BeginUseAdjoints() { AD::getTape().beginUseAdjointVector(); }

FORCEINLINE void EndUseAdjoints() { AD::getTape().endUseAdjointVector(); }

FORCEINLINE void SetIndex(int& index, const su2double& data) { index = data.getIdentifier(); }

// WARNING: For performance reasons, this method does not perform bounds checking.
Expand Down
4 changes: 2 additions & 2 deletions Common/include/parallelization/omp_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ void omp_finalize();
*/

#define BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS \
SU2_OMP_BARRIER \
SU2_OMP_BARRIER; \
if (omp_in_parallel()) AD::StartNoSharedReading(); \
SU2_OMP_MASTER

#define END_SU2_OMP_SAFE_GLOBAL_ACCESS \
END_SU2_OMP_MASTER \
if (omp_in_parallel()) AD::EndNoSharedReading(); \
SU2_OMP_BARRIER
SU2_OMP_BARRIER;

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

Expand Down
2 changes: 1 addition & 1 deletion Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7304,7 +7304,7 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
if (nMarker_Inlet_Species != 0) {
BoundaryTable << "Species Inlet boundary";
for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet_Species; iMarker_Inlet++) {
BoundaryTable << Marker_Inlet[iMarker_Inlet];
BoundaryTable << Marker_Inlet_Species[iMarker_Inlet];
if (iMarker_Inlet < nMarker_Inlet_Species-1) BoundaryTable << " ";
}
BoundaryTable.PrintFooter();
Expand Down
5 changes: 5 additions & 0 deletions SU2_CFD/include/output/COutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,11 @@ class COutput {
*/
void SetCommonHistoryFields();

/*!
* \brief Request the history fields common for all solvers.
*/
void RequestCommonHistory(bool dynamic);

/*!
* \brief Parses user-defined outputs.
*/
Expand Down
2 changes: 2 additions & 0 deletions SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,9 @@ void CDiscAdjMultizoneDriver::SetAdjObjFunction() {
}
if (rank == MASTER_NODE) {
AD::ResizeAdjoints();
AD::BeginUseAdjoints();
AD::SetDerivative(ObjFunc_Index, SU2_TYPE::GetValue(seeding));
AD::EndUseAdjoints();
}
}

Expand Down
2 changes: 2 additions & 0 deletions SU2_CFD/src/iteration/CDiscAdjFEAIteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ void CDiscAdjFEAIteration::InitializeAdjoint(CSolver***** solver, CGeometry****
/*--- Initialize the adjoints the conservative variables ---*/

AD::ResizeAdjoints();
AD::BeginUseAdjoints();
solver[iZone][iInst][MESH_0][ADJFEA_SOL]->SetAdjoint_Output(geometry[iZone][iInst][MESH_0], config[iZone]);
AD::EndUseAdjoints();
}

bool CDiscAdjFEAIteration::Monitor(COutput* output, CIntegration**** integration, CGeometry**** geometry,
Expand Down
3 changes: 3 additions & 0 deletions SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ void CDiscAdjFluidIteration::InitializeAdjoint(CSolver***** solver, CGeometry***
auto geometry0 = geometry[iZone][iInst][MESH_0];

AD::ResizeAdjoints();
AD::BeginUseAdjoints();

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

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

}
END_SU2_OMP_PARALLEL

AD::EndUseAdjoints();
}

void CDiscAdjFluidIteration::RegisterInput(CSolver***** solver, CGeometry**** geometry, CConfig** config,
Expand Down
2 changes: 2 additions & 0 deletions SU2_CFD/src/iteration/CDiscAdjHeatIteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ void CDiscAdjHeatIteration::InitializeAdjoint(CSolver***** solver, CGeometry****
/*--- Initialize the adjoints the solution variables ---*/

AD::ResizeAdjoints();
AD::BeginUseAdjoints();
solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->SetAdjoint_Output(geometry[iZone][iInst][MESH_0], config[iZone]);
AD::EndUseAdjoints();
}

void CDiscAdjHeatIteration::RegisterInput(CSolver***** solver, CGeometry**** geometry, CConfig** config,
Expand Down
3 changes: 1 addition & 2 deletions SU2_CFD/src/output/CAdjFlowCompOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ CAdjFlowCompOutput::CAdjFlowCompOutput(CConfig *config, unsigned short nDim) : C
/*--- Set the default history fields if nothing is set in the config file ---*/

if (nRequestedHistoryFields == 0) {
requestedHistoryFields.emplace_back("ITER");
requestedHistoryFields.emplace_back("RMS_RES");
RequestCommonHistory(config->GetTime_Domain());
requestedHistoryFields.emplace_back("SENSITIVITY");
nRequestedHistoryFields = requestedHistoryFields.size();
}
Expand Down
3 changes: 1 addition & 2 deletions SU2_CFD/src/output/CAdjFlowIncOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ CAdjFlowIncOutput::CAdjFlowIncOutput(CConfig *config, unsigned short nDim) : CAd
/*--- Set the default history fields if nothing is set in the config file ---*/

if (nRequestedHistoryFields == 0) {
requestedHistoryFields.emplace_back("ITER");
requestedHistoryFields.emplace_back("RMS_RES");
RequestCommonHistory(config->GetTime_Domain());
requestedHistoryFields.emplace_back("SENSITIVITY");
nRequestedHistoryFields = requestedHistoryFields.size();
}
Expand Down
3 changes: 1 addition & 2 deletions SU2_CFD/src/output/CAdjHeatOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ CAdjHeatOutput::CAdjHeatOutput(CConfig *config, unsigned short nDim) : COutput(c
/*--- Set the default history fields if nothing is set in the config file ---*/

if (nRequestedHistoryFields == 0){
requestedHistoryFields.emplace_back("ITER");
requestedHistoryFields.emplace_back("RMS_RES");
RequestCommonHistory(config->GetTime_Domain());
requestedHistoryFields.emplace_back("SENSITIVITY");
nRequestedHistoryFields = requestedHistoryFields.size();
}
Expand Down
3 changes: 1 addition & 2 deletions SU2_CFD/src/output/CElasticityOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ CElasticityOutput::CElasticityOutput(CConfig *config, unsigned short nDim) : COu

/*--- Default fields for screen output ---*/
if (nRequestedHistoryFields == 0){
requestedHistoryFields.emplace_back("ITER");
requestedHistoryFields.emplace_back("RMS_RES");
RequestCommonHistory(dynamic);
nRequestedHistoryFields = requestedHistoryFields.size();
}

Expand Down
3 changes: 1 addition & 2 deletions SU2_CFD/src/output/CFlowCompFEMOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ CFlowCompFEMOutput::CFlowCompFEMOutput(CConfig *config, unsigned short nDim) : C
/*--- Set the default history fields if nothing is set in the config file ---*/

if (nRequestedHistoryFields == 0){
requestedHistoryFields.emplace_back("ITER");
requestedHistoryFields.emplace_back("RMS_RES");
RequestCommonHistory(config->GetTime_Domain());
nRequestedHistoryFields = requestedHistoryFields.size();
}
if (nRequestedScreenFields == 0){
Expand Down
3 changes: 1 addition & 2 deletions SU2_CFD/src/output/CFlowCompOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ CFlowCompOutput::CFlowCompOutput(const CConfig *config, unsigned short nDim) : C
/*--- Set the default history fields if nothing is set in the config file ---*/

if (nRequestedHistoryFields == 0){
requestedHistoryFields.emplace_back("ITER");
requestedHistoryFields.emplace_back("RMS_RES");
RequestCommonHistory(config->GetTime_Domain());
nRequestedHistoryFields = requestedHistoryFields.size();
}
if (nRequestedScreenFields == 0){
Expand Down
3 changes: 1 addition & 2 deletions SU2_CFD/src/output/CFlowIncOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ CFlowIncOutput::CFlowIncOutput(CConfig *config, unsigned short nDim) : CFlowOutp
/*--- Set the default history fields if nothing is set in the config file ---*/

if (nRequestedHistoryFields == 0){
requestedHistoryFields.emplace_back("ITER");
requestedHistoryFields.emplace_back("RMS_RES");
RequestCommonHistory(config->GetTime_Domain());
nRequestedHistoryFields = requestedHistoryFields.size();
}

Expand Down
3 changes: 1 addition & 2 deletions SU2_CFD/src/output/CHeatOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ CHeatOutput::CHeatOutput(CConfig *config, unsigned short nDim) : CFVMOutput(conf
/*--- Set the default history fields if nothing is set in the config file ---*/

if (nRequestedHistoryFields == 0){
requestedHistoryFields.emplace_back("ITER");
requestedHistoryFields.emplace_back("RMS_RES");
RequestCommonHistory(config->GetTime_Domain());
nRequestedHistoryFields = requestedHistoryFields.size();
}
if (nRequestedScreenFields == 0){
Expand Down
1 change: 1 addition & 0 deletions SU2_CFD/src/output/CMultizoneOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ CMultizoneOutput::CMultizoneOutput(const CConfig* driver_config, const CConfig*

if (nRequestedHistoryFields == 0){
requestedHistoryFields.emplace_back("ITER");
if (config[ZONE_0]->GetTime_Domain()) requestedHistoryFields.emplace_back("CUR_TIME");
for (iZone = 0; iZone < nZone; iZone++){
requestedHistoryFields.emplace_back(bgs_res_name + "[" + PrintingToolbox::to_string(iZone) + "]");
requestedHistoryFields.emplace_back("AVG_RES[" + PrintingToolbox::to_string(iZone) + "]");
Expand Down
3 changes: 1 addition & 2 deletions SU2_CFD/src/output/CNEMOCompOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ CNEMOCompOutput::CNEMOCompOutput(const CConfig *config, unsigned short nDim) : C
/*--- Set the default history fields if nothing is set in the config file ---*/

if (nRequestedHistoryFields == 0){
requestedHistoryFields.emplace_back("ITER");
requestedHistoryFields.emplace_back("RMS_RES");
RequestCommonHistory(config->GetTime_Domain());
nRequestedHistoryFields = requestedHistoryFields.size();
}
if (nRequestedScreenFields == 0){
Expand Down
7 changes: 7 additions & 0 deletions SU2_CFD/src/output/COutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2017,6 +2017,13 @@ void COutput::SetCommonHistoryFields() {

}

void COutput::RequestCommonHistory(bool dynamic) {

requestedHistoryFields.emplace_back("ITER");
if (dynamic) requestedHistoryFields.emplace_back("CUR_TIME");
requestedHistoryFields.emplace_back("RMS_RES");
}

void COutput::SetCustomOutputs(const CConfig* config) {

const auto& inputString = config->GetCustomOutputs();
Expand Down
2 changes: 1 addition & 1 deletion externals/codi
2 changes: 1 addition & 1 deletion externals/mel
8 changes: 4 additions & 4 deletions meson_scripts/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def init_submodules(

# This information of the modules is used if projects was not cloned using git
# The sha tag must be maintained manually to point to the correct commit
sha_version_codi = "8ee822a9b0bb8235a2494467b774e27fb64ff14f"
sha_version_codi = "eee1b5eea2ded8126c34c1415e3b9cf15a3e70f2"
github_repo_codi = "https://github.com/scicompkl/CoDiPack"
sha_version_medi = "aafc2d1966ba1233640af737e71c77c1a86183fd"
github_repo_medi = "https://github.com/SciCompKL/MeDiPack"
Expand All @@ -67,9 +67,9 @@ def init_submodules(
github_repo_ninja = "https://github.com/ninja-build/ninja"
sha_version_mpp = "5ff579f43781cae07411e5ab46291c9971536be6"
github_repo_mpp = "https://github.com/mutationpp/Mutationpp"
sha_version_coolprop = "0ce42fcf3bb2c373512bc825a4f0c1973a78f307"
sha_version_coolprop = "bafdea1f39ee873a6bb9833e3a21fe41f90b85e8"
github_repo_coolprop = "https://github.com/CoolProp/CoolProp"
sha_version_mel = "2484cd3258ef800a10e361016cb341834ee7930b"
sha_version_mel = "46205ab019e5224559091375a6d71aabae6bc5b9"
github_repo_mel = "https://github.com/pcarruscag/MEL"
sha_version_mlpcpp = "665c45b7d3533c977eb1f637918d5b8b75c07d3b"
github_repo_mlpcpp = "https://github.com/EvertBunschoten/MLPCpp"
Expand Down Expand Up @@ -218,7 +218,7 @@ def submodule_status(path, sha_commit):
cwd=sys.path[0],
)
# to update CoolProp external libraries
if sha_commit == "0ce42fcf3bb2c373512bc825a4f0c1973a78f307":
if "CoolProp" in path:
# update coolprop
original_path = os.getcwd()
print("update CoolProp")
Expand Down
2 changes: 1 addition & 1 deletion subprojects/CoolProp
Submodule CoolProp updated 104 files

0 comments on commit 2f7c899

Please sign in to comment.