-
Notifications
You must be signed in to change notification settings - Fork 830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore in discrete adjoint bits #1257
Conversation
Making vars const. Moving declaration of boolean or loop vars directly to where they are used. Some typos, line breaks fixed.
@@ -376,7 +371,7 @@ void CDiscAdjSolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *confi | |||
|
|||
if (time_n_needed) { | |||
SU2_OMP_FOR_STAT(omp_chunk_size) | |||
for (auto iPoint = 0u; iPoint < nPoint; iPoint++) { | |||
for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this iPoint change from 0u to 0ul is less of a necessity then rather a consistency thing
StopCalc = FinalTimeReached || MaxIterationsReached; | ||
return (FinalTimeReached || MaxIterationsReached); | ||
} | ||
|
||
return StopCalc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StopCalc is class data and was returned to itself, so I made the function to not use that var
/*--- Read the target pressure for inverse design. ---------------------------------------------*/ | ||
/*--- TODO: This routine should be taken out of output, and made general for multiple zones. ---*/ | ||
// if (config_container[iZone]->GetInvDesign_Cp() == YES) | ||
// output[iZone]->SetCp_InverseDesign(solver_container[iZone][INST_0][MESH_0][FLOW_SOL], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed all the inverse design stuff that was commented out in multiple places
|
||
/*--- For the unsteady adjoint, load direct solutions from restart files. ---*/ | ||
|
||
if (config[val_iZone]->GetTime_Marching() != TIME_MARCHING::STEADY) { | ||
Direct_Iter = SU2_TYPE::Int(config[val_iZone]->GetUnst_AdjointIter()) - SU2_TYPE::Int(TimeIter) - 2; | ||
const int Direct_Iter = SU2_TYPE::Int(config[val_iZone]->GetUnst_AdjointIter()) - SU2_TYPE::Int(TimeIter) - 2 + dual_time; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now consistent with CDiscAdjFluidIteration.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun fact, SU2_TYPE::Int implies a cast to su2double, followed cast to int, yeyy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are those casts via SU2_TYPE methods even for
@cvencro Merging this will most likely result in some conflicts with #1260 which are hopefully easy to resolve as it is mostly stylistic stuff without any real changes to the code. @pcarruscag I reverted CDiscADjVariable.hpp/cpp and will readd the briefs in #1260 |
SU2_CFD/src/drivers/CDriver.cpp
Outdated
MDOFs += (su2double)DOFsPerPoint*(su2double)geometry_container[iZone][INST_0][MESH_0]->GetGlobal_nPoint()/(1.0e6); | ||
MDOFsDomain += (su2double)DOFsPerPoint*(su2double)geometry_container[iZone][INST_0][MESH_0]->GetGlobal_nPointDomain()/(1.0e6); | ||
Mpoints += static_cast<su2double>(geometry_container[iZone][INST_0][MESH_0]->GetGlobal_nPoint())/(1.0e6); | ||
MpointsDomain += static_cast<su2double>(geometry_container[iZone][INST_0][MESH_0]->GetGlobal_nPointDomain())/(1.0e6); | ||
MDOFs += static_cast<su2double>(DOFsPerPoint)*static_cast<su2double>(geometry_container[iZone][INST_0][MESH_0]->GetGlobal_nPoint())/(1.0e6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The casts are not really needed.
if (dual_time) { | ||
for (auto iVar = 0u; iVar < nVar; iVar++) { | ||
Solution[iVar] += nodes->GetDual_Time_Derivative(iPoint,iVar); | ||
} | ||
} | ||
|
||
/*--- Set the adjoint values of the primal (TK::??) solution. ---*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
dTdn = -(nodes->GetSolution(Point_Normal,0) - Twall)/dist_ij; | ||
dTdn = -(nodes->GetTemperature(Point_Normal) - Twall)/dist_ij; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
const int Direct_Iter = SU2_TYPE::Int(config[val_iZone]->GetUnst_AdjointIter()) - SU2_TYPE::Int(TimeIter) - 2 + dual_time; | ||
const int Direct_Iter = static_cast<int>(config[val_iZone]->GetUnst_AdjointIter()) - static_cast<int>(TimeIter) - 2 + dual_time; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Hi all,
As I am stepping through DA cases with my debugger I am cleaning some things left and right. No major changes.
config->GetBool
directly to the conditional instead of making it a var and using it 1 timePR Checklist