Skip to content
Merged
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
4 changes: 2 additions & 2 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ class CConfig {
unsigned short DirectDiff; /*!< \brief Direct Differentation mode. */
bool DiscreteAdjoint; /*!< \brief AD-based discrete adjoint mode. */
su2double Const_DES; /*!< \brief Detached Eddy Simulation Constant. */
unsigned short Kind_WindowFct; /*!< \brief Type of window (weight) function for objective functional. */
WINDOW_FUNCTION Kind_WindowFct; /*!< \brief Type of window (weight) function for objective functional. */
unsigned short Kind_HybridRANSLES; /*!< \brief Kind of Hybrid RANS/LES. */
unsigned short Kind_RoeLowDiss; /*!< \brief Kind of Roe scheme with low dissipation for unsteady flows. */
bool QCR; /*!< \brief Spalart-Allmaras with Quadratic Constitutive Relation, 2000 version (SA-QCR2000) . */
Expand Down Expand Up @@ -5211,7 +5211,7 @@ class CConfig {
* \brief Get Index of the window function used as weight in the cost functional
* \return
*/
WINDOW_FUNCTION GetKindWindow(void) const { return static_cast<WINDOW_FUNCTION>(Kind_WindowFct); }
WINDOW_FUNCTION GetKindWindow(void) const { return Kind_WindowFct; }

/*!
* \brief Get the name of the file with the forces breakdown of the problem.
Expand Down
18 changes: 9 additions & 9 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,17 +925,17 @@ static const MapType<string, ENUM_SGS_MODEL> SGS_Model_Map = {
/*!
* \brief Types of window (weight) functions for cost functional
*/
enum WINDOW_FUNCTION {
SQUARE = 0, /*!< \brief No weight function (order 1)*/
HANN = 1, /*!< \brief Hann-type weight function (order 3) */
HANN_SQUARE = 2, /*!< \brief Hann-squared type weight function (order 5)*/
BUMP = 3, /*!< \brief bump type weight function (exponential order of convergence) */
enum class WINDOW_FUNCTION {
SQUARE, /*!< \brief No weight function (order 1)*/
HANN, /*!< \brief Hann-type weight function (order 3) */
HANN_SQUARE, /*!< \brief Hann-squared type weight function (order 5)*/
BUMP, /*!< \brief bump type weight function (exponential order of convergence) */
};
static const MapType<string, WINDOW_FUNCTION> Window_Map = {
MakePair("SQUARE", SQUARE)
MakePair("HANN", HANN)
MakePair("HANN_SQUARE", HANN_SQUARE)
MakePair("BUMP", BUMP)
MakePair("SQUARE", WINDOW_FUNCTION::SQUARE)
MakePair("HANN", WINDOW_FUNCTION::HANN)
MakePair("HANN_SQUARE", WINDOW_FUNCTION::HANN_SQUARE)
MakePair("BUMP", WINDOW_FUNCTION::BUMP)
};

/*!
Expand Down
2 changes: 1 addition & 1 deletion Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2677,7 +2677,7 @@ void CConfig::SetConfig_Options() {
addUnsignedLongOption("WINDOW_START_ITER", StartWindowIteration, 0);

/* DESCRIPTION: Window (weight) function for the cost-functional in the reverse sweep */
addEnumOption("WINDOW_FUNCTION", Kind_WindowFct,Window_Map, SQUARE);
addEnumOption("WINDOW_FUNCTION", Kind_WindowFct, Window_Map, WINDOW_FUNCTION::SQUARE);

/* DESCRIPTION: DES Constant */
addDoubleOption("DES_CONST", Const_DES, 0.65);
Expand Down
7 changes: 0 additions & 7 deletions SU2_CFD/include/output/CAdjFlowIncOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,4 @@ class CAdjFlowIncOutput final: public COutput {
*/
bool SetInit_Residuals(CConfig *config) override;

/*!
* \brief Check whether the averaged values should be updated
* \param[in] config - Definition of the particular problem.
* \return <TRUE> averages should be updated.
*/
bool SetUpdate_Averages(CConfig *config) override;

};
7 changes: 0 additions & 7 deletions SU2_CFD/include/output/CAdjFlowOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,4 @@ class CAdjFlowCompOutput final: public COutput {
*/
bool SetInit_Residuals(CConfig *config) override;

/*!
* \brief Check whether the averaged values should be updated
* \param[in] config - Definition of the particular problem.
* \return <TRUE> averages should be updated.
*/
bool SetUpdate_Averages(CConfig *config) override;

};
1 change: 1 addition & 0 deletions SU2_CFD/include/output/CElasticityOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,5 @@ class CElasticityOutput final: public COutput {
* \return <TRUE> if the residuals should be initialized.
*/
bool SetInit_Residuals(CConfig *config) override;

};
7 changes: 0 additions & 7 deletions SU2_CFD/include/output/CFlowCompFEMOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,4 @@ class CFlowCompFEMOutput final: public CFlowOutput {
*/
bool SetInit_Residuals(CConfig *config) override;

/*!
* \brief Check whether the averaged values should be updated
* \param[in] config - Definition of the particular problem.
* \return <TRUE> averages should be updated.
*/
bool SetUpdate_Averages(CConfig *config) override;

};
7 changes: 0 additions & 7 deletions SU2_CFD/include/output/CFlowCompOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,6 @@ class CFlowCompOutput final: public CFlowOutput {
*/
bool SetInit_Residuals(CConfig *config) override;

/*!
* \brief Check whether the averaged values should be updated
* \param[in] config - Definition of the particular problem.
* \return <TRUE> averages should be updated.
*/
bool SetUpdate_Averages(CConfig *config) override;

/*!
* \brief Write any additional output defined for the current solver.
* \param[in] config - Definition of the particular problem per zone.
Expand Down
7 changes: 0 additions & 7 deletions SU2_CFD/include/output/CFlowIncOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,4 @@ class CFlowIncOutput final: public CFlowOutput {
*/
bool SetInit_Residuals(CConfig *config) override;

/*!
* \brief Check whether the averaged values should be updated
* \param[in] config - Definition of the particular problem.
* \return <TRUE> averages should be updated.
*/
bool SetUpdate_Averages(CConfig *config) override;

};
7 changes: 0 additions & 7 deletions SU2_CFD/include/output/CNEMOCompOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,6 @@ class CNEMOCompOutput final: public CFlowOutput {
*/
bool SetInit_Residuals(CConfig *config) override;

/*!
* \brief Check whether the averaged values should be updated
* \param[in] config - Definition of the particular problem.
* \return <TRUE> averages should be updated.
*/
bool SetUpdate_Averages(CConfig *config) override;

/*!
* \brief Write any additional output defined for the current solver.
* \param[in] config - Definition of the particular problem per zone.
Expand Down
13 changes: 6 additions & 7 deletions SU2_CFD/include/output/COutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,12 @@ class COutput {
return (iIter % iFreq == 0);
}

/*!
* \brief OutputScreenAndHistory
* \param[in] config - Definition of the particular problem.
*/
void OutputScreenAndHistory(CConfig *config);

/*!
* \brief Set the history fields common for all solvers.
* \param[in] config - Definition of the particular problem.
Expand Down Expand Up @@ -735,13 +741,6 @@ class COutput {
*/
inline virtual bool SetInit_Residuals(CConfig *config) {return false;}

/*!
* \brief Check whether the averaged values should be updated
* \param[in] config - Definition of the particular problem.
* \return <TRUE> averages should be updated.
*/
inline virtual bool SetUpdate_Averages(CConfig *config){return false;}

/*!
* \brief Set the values of the volume output fields for a surface point.
* \param[in] config - Definition of the particular problem.
Expand Down
69 changes: 37 additions & 32 deletions SU2_CFD/include/output/tools/CWindowingTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#pragma once

#include <vector>
#include <limits>
#include "../../../../Common/include/option_structure.hpp"

class CWindowingTools{
Expand All @@ -38,7 +39,7 @@ class CWindowingTools{
* \param endTimeIter - Number of time steps to average over
* \return Value of the window-weight-function at time curTimeIter with time-frame endTimeIter
*/
su2double GetWndWeight(WINDOW_FUNCTION windowId, unsigned long curTimeIter, unsigned long endTimeIter) const;
static su2double GetWndWeight(WINDOW_FUNCTION windowId, unsigned long curTimeIter, unsigned long endTimeIter);

protected:
// Long time windows
Expand All @@ -47,74 +48,78 @@ class CWindowingTools{
* \param endTimeIter - Number of time steps to average over
* \return Value of the window-weight-function at time curTimeIter with end-time endTimeIter
*/
su2double HannWindow(unsigned long curTimeIter, unsigned long endTimeIter) const;
static su2double HannWindow(unsigned long curTimeIter, unsigned long endTimeIter);

/*! \brief Returns the value of the Hann-Square-window function at time-step i with given end-time endTimeIter.
* \param curTimeIter - Current time iteration of the solver
* \param endTimeIter - Number of time steps to average over
* \return Value of the window-weight-function at time curTimeIter with end-time endTimeIter
*/
su2double HannSquaredWindow(unsigned long curTimeIter, unsigned long endTimeIter) const;
static su2double HannSquaredWindow(unsigned long curTimeIter, unsigned long endTimeIter);

/*! \brief Returns the value of the Bump-window function at time-step i with given end-time endTimeIter.
* \param curTimeIter - Current time iteration of the solver
* \param endTimeIter - Number of time steps to average over
* \return Value of the window-weight-function at time curTimeIter with end-time endTimeIter
*/
su2double BumpWindow(unsigned long curTimeIter, unsigned long endTimeIter) const;
static su2double BumpWindow(unsigned long curTimeIter, unsigned long endTimeIter);
};

class CWindowedAverage:CWindowingTools{
private:
su2double val; /*!< \brief Value of the windowed-time average (of the instantaneous output) from starting time to the current time iteration. */
std::vector<su2double> values; /*!< \brief Vector of instantatneous output values from starting time to the current time iteration.*/
su2double val = 0.0; /*!< \brief Value of the windowed-time average (of the instantaneous output) from starting time to the current time iteration. */
std::vector<su2double> values; /*!< \brief Vector of instantatneous output values from starting time to the current time iteration.*/
unsigned long lastTimeIter = std::numeric_limits<unsigned long>::max();

public:
CWindowedAverage();

/*! \brief Returns the value of windowed-time average (of the instantaneous output) from starting time to the current time iteration
* \return val
*/
inline su2double GetVal() const{
return val;
};

/*! \brief Resets the value of windowed-time average (of the instantaneous output) from starting time to the current time iteration to 0.
*/
void Reset();
/*!
* \brief Returns the value of windowed-time average (of the instantaneous output) from starting time to the current time iteration
*/
inline su2double GetVal() const { return val; }

/*! \brief Adds the instantaneous output of the current iteration to the values-vector, if the current iteration is greater or equal to the starting iteration.
* \param valIn - value of the instantaneous output, that should be added
* \param currentIter - current time Iteration
* \param startIter - iteration to start the windowed-time average.
*/
/*!
*\brief Resets the value of windowed-time average (of the instantaneous output) from starting time to the current time iteration to 0.
*/
inline void Reset() {
val = 0.0;
values.clear();
lastTimeIter = std::numeric_limits<unsigned long>::max();
}

/*!
* \brief Adds the instantaneous output of the current iteration to the values-vector, if the current iteration is greater or equal to the starting iteration.
* \param valIn - value of the instantaneous output, that should be added
* \param currentIter - current time Iteration
* \param startIter - iteration to start the windowed-time average.
*/
void addValue(su2double valIn, unsigned long curTimeIter,unsigned long startIter = 0);

/*! \brief Computes a windowed-time average of the values stored in the vector "values" using the windowing-function specified in enum windowId
* and stores it in "val".
* \param windowId - specified windowing-function
* \return windowed-time average of the values stored in the vector "values"
*/
/*!
* \brief Computes a windowed-time average of the values stored in the vector "values" using the windowing-function specified in enum windowId
* and stores it in "val".
* \param windowId - specified windowing-function
* \return windowed-time average of the values stored in the vector "values"
*/
su2double WindowedUpdate(WINDOW_FUNCTION windowId);

private:
/*! \brief Computes a Square-windowed-time average of the values stored in the vector "values" with the Midpoint-integration rule (for consistency with the adjoint solver).
* \return Squarewindowed-time average of the values stored in the vector "values"
*/
su2double NoWindowing();
su2double NoWindowing() const;

/*! \brief Computes a Hann-windowed-time average of the values stored in the vector "values" with the Midpoint-integration rule (for consistency with the adjoint solver).
* \return Squarewindowed-time average of the values stored in the vector "values"
*/
su2double HannWindowing();
su2double HannWindowing() const;

/*! \brief Computes a Hann-Square-windowed-time average of the values stored in the vector "values" with the Midpoint-integration rule (for consistency with the adjoint solver).
* \return Squarewindowed-time average of the values stored in the vector "values"
*/
su2double HannSquaredWindowing();
su2double HannSquaredWindowing() const;

/*! \brief Computes a Bump-windowed-time average of the values stored in the vector "values" with the Midpoint-integration rule (for consistency with the adjoint solver).
* \return Squarewindowed-time average of the values stored in the vector "values"
*/
su2double BumpWindowing();
su2double BumpWindowing() const;
};
8 changes: 0 additions & 8 deletions SU2_CFD/src/output/CAdjFlowCompOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,3 @@ bool CAdjFlowCompOutput::SetInit_Residuals(CConfig *config){
((config->GetTime_Marching() == TIME_MARCHING::STEADY) && (curInnerIter < 2));

}

bool CAdjFlowCompOutput::SetUpdate_Averages(CConfig *config){
return false;

// return (config->GetUnsteady_Simulation() != STEADY && !dualtime);

}

7 changes: 0 additions & 7 deletions SU2_CFD/src/output/CAdjFlowIncOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,3 @@ bool CAdjFlowIncOutput::SetInit_Residuals(CConfig *config){
(config->GetTime_Marching() == TIME_MARCHING::STEADY && (curTimeIter < 2));

}

bool CAdjFlowIncOutput::SetUpdate_Averages(CConfig *config){
return false;

// return (config->GetUnsteady_Simulation() != STEADY && !dualtime);

}
9 changes: 0 additions & 9 deletions SU2_CFD/src/output/CFlowCompFEMOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,3 @@ bool CFlowCompFEMOutput::SetInit_Residuals(CConfig *config){
(config->GetTime_Marching() == TIME_MARCHING::STEADY && (curTimeIter < 2));

}

bool CFlowCompFEMOutput::SetUpdate_Averages(CConfig *config){
return false;

// return (config->GetUnsteady_Simulation() != STEADY && !dualtime);

}


7 changes: 0 additions & 7 deletions SU2_CFD/src/output/CFlowCompOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,13 +724,6 @@ bool CFlowCompOutput::SetInit_Residuals(CConfig *config){

}

bool CFlowCompOutput::SetUpdate_Averages(CConfig *config){

return (config->GetTime_Marching() != TIME_MARCHING::STEADY && (curInnerIter == config->GetnInner_Iter() - 1 || convergence));

}


void CFlowCompOutput::SetAdditionalScreenOutput(CConfig *config){

if (config->GetFixed_CL_Mode()){
Expand Down
6 changes: 0 additions & 6 deletions SU2_CFD/src/output/CFlowIncOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,3 @@ bool CFlowIncOutput::SetInit_Residuals(CConfig *config){
(config->GetTime_Marching() == TIME_MARCHING::STEADY && (curInnerIter < 2));

}

bool CFlowIncOutput::SetUpdate_Averages(CConfig *config){

return (config->GetTime_Marching() != TIME_MARCHING::STEADY && (curInnerIter == config->GetnInner_Iter() - 1 || convergence));

}
6 changes: 0 additions & 6 deletions SU2_CFD/src/output/CNEMOCompOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,12 +696,6 @@ bool CNEMOCompOutput::SetInit_Residuals(CConfig *config){

}

bool CNEMOCompOutput::SetUpdate_Averages(CConfig *config){

return (config->GetTime_Marching() != TIME_MARCHING::STEADY && (curInnerIter == config->GetnInner_Iter() - 1 || convergence));

}

void CNEMOCompOutput::SetAdditionalScreenOutput(CConfig *config){

if (config->GetFixed_CL_Mode()){
Expand Down
Loading