Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 26 additions & 0 deletions SU2_CFD/include/output/CFlowOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,32 @@
*/
void SetFixedCLScreenOutput(const CConfig *config);

/*!
* \brief Check if the fixed CL driver changed the AoA at the current iteration
* (in finite difference mode this is the start of the finite difference step).
* \return <TRUE> if the AoA was changed.
*/
bool FixedCLStartFD() const {
return fabs(GetHistoryFieldValue("CL_DRIVER_COMMAND")) > EPS;
}

/*!
* \brief Check if the AoA was restored at the current iteration
* (in finite difference mode this is the end of the finite difference step).
* \return <TRUE> if the AoA is equal to the previous AoA.
*/
bool FixedCLEndFD() const {
return GetHistoryFieldValue("AOA") == GetHistoryFieldValue("PREV_AOA");
}

/*!
* \brief Store the iteration at which the finite difference step of the fixed CL driver starts and
* write the meta data file with the finite difference derivatives at its end.
* \note Called every iteration, independently of the screen output frequency.
* \param[in] config - Definition of the particular problem per zone.
*/
void SetFixedCLFiniteDifference(const CConfig *config);

/*!
* \brief Compute the ratio of the stochastic energy backscatter to the turbulent energy dissipation.
* \param iPoint - Index of the point.
Expand Down
4 changes: 4 additions & 0 deletions SU2_CFD/src/output/CFlowCompOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol

SetAerodynamicCoefficients(config, flow_solver);

/*--- Fixed CL finite difference step, uses the AOA set above. ---*/

if (config->GetFixed_CL_Mode()) SetFixedCLFiniteDifference(config);

if (config->GetViscous()) {
SetHistoryOutputValue("BUFFET", flow_solver->GetTotal_Buffet_Metric());
}
Expand Down
19 changes: 16 additions & 3 deletions SU2_CFD/src/output/CFlowOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4245,7 +4245,7 @@ void CFlowOutput::LoadTimeAveragedData(unsigned long iPoint, const CVariable *No
void CFlowOutput::SetFixedCLScreenOutput(const CConfig *config){
PrintingToolbox::CTablePrinter FixedCLSummary(&cout);

if (fabs(historyOutput_Map["CL_DRIVER_COMMAND"].value) > 1e-16){
if (FixedCLStartFD()){
FixedCLSummary.AddColumn("Fixed CL Mode", 40);
FixedCLSummary.AddColumn("Value", 30);
FixedCLSummary.SetAlign(PrintingToolbox::CTablePrinter::LEFT);
Expand All @@ -4255,15 +4255,14 @@ void CFlowOutput::SetFixedCLScreenOutput(const CConfig *config){
FixedCLSummary << "Previous AOA" << historyOutput_Map["PREV_AOA"].value;
if (config->GetFinite_Difference_Mode()){
FixedCLSummary << "Changed AoA by (Finite Difference step)" << historyOutput_Map["CL_DRIVER_COMMAND"].value;
lastInnerIter = curInnerIter - 1;
}
else
FixedCLSummary << "Changed AoA by" << historyOutput_Map["CL_DRIVER_COMMAND"].value;
FixedCLSummary.PrintFooter();
SetScreenHeader(config);
}

else if (config->GetFinite_Difference_Mode() && historyOutput_Map["AOA"].value == historyOutput_Map["PREV_AOA"].value){
else if (config->GetFinite_Difference_Mode() && FixedCLEndFD()){
FixedCLSummary.AddColumn("Fixed CL Mode (Finite Difference)", 40);
FixedCLSummary.AddColumn("Value", 30);
FixedCLSummary.SetAlign(PrintingToolbox::CTablePrinter::LEFT);
Expand All @@ -4276,6 +4275,20 @@ void CFlowOutput::SetFixedCLScreenOutput(const CConfig *config){
}
FixedCLSummary << "Delta CMz / Delta CL" << config->GetdCMz_dCL();
FixedCLSummary.PrintFooter();
}
}

void CFlowOutput::SetFixedCLFiniteDifference(const CConfig *config){

/*--- This runs every iteration, independently of the screen output frequency, otherwise the finite
* difference step can end without writing dCL/dAlpha and dCX/dCL to the meta data file. ---*/

if (!config->GetFinite_Difference_Mode()) return;

if (FixedCLStartFD()){
lastInnerIter = curInnerIter - 1;
}
else if (FixedCLEndFD()){
curInnerIter = lastInnerIter;
WriteMetaData(config);
curInnerIter = config->GetInnerIter();
Expand Down
4 changes: 4 additions & 0 deletions SU2_CFD/src/output/CNEMOCompOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,10 @@ void CNEMOCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol

SetAerodynamicCoefficients(config, NEMO_solver);

/*--- Fixed CL finite difference step, uses the AOA set above. ---*/

if (config->GetFixed_CL_Mode()) SetFixedCLFiniteDifference(config);

SetHeatCoefficients(config, NEMO_solver);

SetRotatingFrameCoefficients(NEMO_solver);
Expand Down
Loading