Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e5824ba
improving the fixed_cl mode
jayantmukho Jul 9, 2019
695b103
Merge branch 'fix_set_ffd_script' into enhancement_fixed_cl
jayantmukho Jul 9, 2019
458d123
removed AoA update during the FD section
jayantmukho Jul 12, 2019
79a93df
Merge branch 'develop' into enhancement_fixed_cl
jayantmukho Aug 8, 2019
960c4ef
removed forcing residual convergence for fixed_cl mode
jayantmukho Aug 8, 2019
f773594
Merge branch 'develop' into enhancement_fixed_cl
jayantmukho Aug 21, 2019
5d7a30c
revert to constant K
jayantmukho Aug 21, 2019
21ab4a5
Merge branch 'develop' into enhancement_fixed_cl
jayantmukho Aug 27, 2019
db9387e
clean up
jayantmukho Aug 28, 2019
e295750
indentation fixes [ci skip]
jayantmukho Sep 10, 2019
8e8af6b
Merge branch 'develop' into enhancement_fixed_cl
jayantmukho Sep 11, 2019
da91901
fully functional, not pretty yet
jayantmukho Sep 12, 2019
ab89114
some cleanup, works for normal driver and singleZoneDriver
jayantmukho Sep 12, 2019
4f6975b
need to fix behavior when iteration limit is reached
jayantmukho Sep 12, 2019
0a4c4ff
fixed segault in testcase, more cleanup
jayantmukho Sep 13, 2019
c644d0b
New options added in TestCase [ci skip]
jayantmukho Sep 13, 2019
aa87eb1
Fixed behavior for max iter and for when ITER_DCL_DALPHA=0
jayantmukho Sep 13, 2019
2716ba8
making continuous adjoint implementation consistent
jayantmukho Sep 19, 2019
9444f92
removed fixed cl from incompressible solver
jayantmukho Sep 20, 2019
af9cfee
some changes to test case config file
jayantmukho Sep 20, 2019
50a57b9
added option to config file
jayantmukho Sep 20, 2019
618d6f4
changed regression test values
jayantmukho Sep 20, 2019
db033ec
reverted integration_time.cpp back to develop status
jayantmukho Sep 20, 2019
5581ab5
fixing some testcase config files
jayantmukho Sep 20, 2019
b935833
removed UPDATE_ALPHA as an option [ci skip]
jayantmukho Sep 20, 2019
d2d2c6f
changed regression test values
jayantmukho Sep 20, 2019
7c4a3b4
Merge branch 'develop' into enhancement_fixed_cl
jayantmukho Sep 23, 2019
21228f3
fixing continuous adjoint regression values
jayantmukho Sep 23, 2019
290bcbe
better implementation of SetFarfieldAoA
jayantmukho Sep 24, 2019
272d606
Merge branch 'develop' into enhancement_fixed_cl
jayantmukho Sep 24, 2019
f7166cc
changing travis.yml to use enhancement_fixed_cl branch of tutorials
jayantmukho Sep 24, 2019
ef4d75e
additional comments
jayantmukho Sep 26, 2019
d83c356
typo fix in config_template.cfg
jayantmukho Sep 26, 2019
0163c8d
initial merge with output structure [ci skip]
jayantmukho Sep 30, 2019
9ad2588
changes to fix compile time errors
jayantmukho Sep 30, 2019
789571d
Merge branch 'feature_input_output' into enhancement_fixed_cl
jayantmukho Sep 30, 2019
b318e90
fixed makefile and changed fixed cl testcase convergence options [ci …
jayantmukho Sep 30, 2019
b8cb659
allowed changing screen output for FD
jayantmukho Oct 1, 2019
68014f8
merge with feature_input_output
jayantmukho Oct 1, 2019
80a75de
small changes to make multipoint optimizations work
jayantmukho Oct 1, 2019
74150a7
Merge branch 'develop' into enhancement_fixed_cl
jayantmukho Oct 2, 2019
54b9165
Merge branch 'develop' into enhancement_fixed_cl
jayantmukho Oct 3, 2019
b0614ea
add ability to change writing frequency
jayantmukho Oct 7, 2019
0f2794d
adding CL_Convergence as a Output Field [ci skip]
jayantmukho Oct 10, 2019
c10de4e
Changed name to DELTA_CL and added it as default for fixed cl mode [c…
jayantmukho Oct 10, 2019
b073f87
Fixed segfault [ci skip]
jayantmukho Oct 10, 2019
e0155b9
added disabling output for finite difference mode [ci skip]
jayantmukho Oct 11, 2019
201d406
fixed output, it works now [ci skip]
jayantmukho Oct 11, 2019
98fefe0
moved all output to CFlowCompOutput [ci skip]
jayantmukho Oct 15, 2019
f1a9f19
code cleanup [ci skip]
jayantmukho Oct 15, 2019
f6d3797
fixes [ci skip]
jayantmukho Oct 15, 2019
a1279a4
more cleanup [ci skip]
jayantmukho Oct 15, 2019
7f2c13e
changed travis to point to enhancemen_fixed_cl tutorial branch
jayantmukho Oct 15, 2019
3ba26f2
small fix [ci skip]
jayantmukho Oct 15, 2019
f4afeee
Merge branch 'develop' into enhancement_fixed_cl
jayantmukho Oct 15, 2019
593b7b2
small fix [ci skip]
jayantmukho Oct 15, 2019
775597c
update testcase
jayantmukho Oct 17, 2019
fd4d8c9
reverting makefile
jayantmukho Oct 17, 2019
530cf67
changed travis to point to corresponding TestCases branch
jayantmukho Oct 17, 2019
5600e3d
multipoint fixes
jayantmukho Oct 18, 2019
de09502
fixing some flow.meta output issues
jayantmukho Oct 21, 2019
3caeac6
fixing regression values
jayantmukho Oct 21, 2019
45d7e37
small bug fixes
jayantmukho Oct 22, 2019
c65812b
fix regression test vals
jayantmukho Oct 22, 2019
46da8cd
Merge branch 'develop' into enhancement_fixed_cl
jayantmukho Oct 22, 2019
6a83788
final clean ups
jayantmukho Oct 22, 2019
6682e40
Merge branch 'develop' into enhancement_fixed_cl
jayantmukho Oct 22, 2019
388ba7d
reverting travis back to develop
jayantmukho Oct 22, 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
48 changes: 34 additions & 14 deletions Common/include/config_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,16 +615,17 @@ class CConfig {
su2double Total_CD; /*!< \brief Specify a target CL instead of AoA (external flow only). */
su2double dCL_dAlpha; /*!< \brief value of dCl/dAlpha. */
su2double dCM_diH; /*!< \brief value of dCM/dHi. */
unsigned long Iter_Fixed_CL; /*!< \brief Iterations to re-evaluate the angle of attack (external flow only). */
unsigned long Iter_Fixed_CM; /*!< \brief Iterations to re-evaluate the angle of attack (external flow only). */
unsigned long Iter_Fixed_NetThrust; /*!< \brief Iterations to re-evaluate the angle of attack (external flow only). */
unsigned long Iter_dCL_dAlpha; /*!< \brief Number of iterations to evaluate dCL_dAlpha. */
unsigned long Update_Alpha; /*!< \brief Iterations to re-evaluate the angle of attack (external flow only). */
unsigned long Update_iH; /*!< \brief Iterations to re-evaluate the angle of attack (external flow only). */
unsigned long Update_BCThrust; /*!< \brief Iterations to re-evaluate the angle of attack (external flow only). */
su2double dNetThrust_dBCThrust; /*!< \brief value of dCl/dAlpha. */
su2double dNetThrust_dBCThrust; /*!< \brief value of dNetThrust/dBCThrust. */
bool Update_BCThrust_Bool; /*!< \brief Boolean flag for whether to update the AoA for fixed lift mode on a given iteration. */
bool Update_AoA; /*!< \brief Boolean flag for whether to update the AoA for fixed lift mode on a given iteration. */
unsigned long Update_AoA_Iter_Limit; /*!< \brief Limit on number of iterations between AoA updates for fixed lift mode */
bool Finite_Difference_Mode;
bool Update_HTPIncidence; /*!< \brief Boolean flag for whether to update the AoA for fixed lift mode on a given iteration. */
su2double ChargeCoeff; /*!< \brief Charge coefficient (just for poisson problems). */
unsigned short Cauchy_Func_Flow, /*!< \brief Function where to apply the convergence criteria in the flow problem. */
Expand Down Expand Up @@ -8246,12 +8247,6 @@ class CConfig {
*/
su2double GetdCL_dAlpha(void);

/*!
* \brief Get the value of iterations to re-evaluate the angle of attack.
* \return Number of iterations.
*/
unsigned long GetUpdate_Alpha(void);

/*!
* \brief Number of iterations to evaluate dCL_dAlpha.
* \return Number of iterations.
Expand All @@ -8264,12 +8259,6 @@ class CConfig {
*/
su2double GetdCM_diH(void);

/*!
* \brief Get the value of iterations to re-evaluate the angle of attack.
* \return Number of iterations.
*/
unsigned long GetIter_Fixed_CL(void);

/*!
* \brief Get the value of iterations to re-evaluate the angle of attack.
* \return Number of iterations.
Expand Down Expand Up @@ -8311,6 +8300,23 @@ class CConfig {
* \return <code>TRUE</code> if we should update the AoA for fixed lift mode; otherwise <code>FALSE</code>.
*/
bool GetUpdate_AoA(void);

/*!
* \brief Get the maximum number of iterations between AoA updates for fixed C_L mode
* \return Number of maximum iterations between AoA updates
*/
unsigned long GetUpdate_AoA_Iter_Limit(void);

/*!
* \brief Get whether at the end of finite differencing (Fixed CL mode)
* \return boolean indicating end of finite differencing mode (Fixed CL mode)
*/
bool GetFinite_Difference_Mode(void);

/*!
* \brief Set whether at the end of finite differencing (Fixed CL mode)
*/
void SetFinite_Difference_Mode(bool val_fd_mode);

/*!
* \brief Set the current number of non-physical nodes in the solution.
Expand Down Expand Up @@ -9214,13 +9220,27 @@ class CConfig {
* \return
*/
unsigned long GetHistory_Wrt_Freq(unsigned short iter);

/*!
* \brief SetHistory_Wrt_Freq_Inner
* \param[in] iter: index for Time (0), Outer (1), or Inner (2) iterations
* \param[in] nIter: Number of iterations
*/
void SetHistory_Wrt_Freq(unsigned short iter, unsigned long nIter);

/*!
* \brief GetScreen_Wrt_Freq_Inner
* \return
*/
unsigned long GetScreen_Wrt_Freq(unsigned short iter);

/*!
* \brief SetScreen_Wrt_Freq_Inner
* \param[in] iter: index for Time (0), Outer (1), or Inner (2) iterations
* \param[in] nIter: Number of iterations
*/
void SetScreen_Wrt_Freq(unsigned short iter, unsigned long nIter);

/*!
* \brief GetScreen_Wrt_Freq_Inner
* \return
Expand Down
14 changes: 10 additions & 4 deletions Common/include/config_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1769,14 +1769,16 @@ inline su2double CConfig::GetdCM_diH(void) {return dCM_diH; }

inline unsigned long CConfig::GetIter_Fixed_NetThrust(void) {return Iter_Fixed_NetThrust; }

inline unsigned long CConfig::GetIter_Fixed_CL(void) { return Iter_Fixed_CL; }

inline unsigned long CConfig::GetUpdate_Alpha(void) {return Update_Alpha; }

inline unsigned long CConfig::GetIter_dCL_dAlpha(void) {return Iter_dCL_dAlpha; }

inline bool CConfig::GetUpdate_AoA(void) { return Update_AoA; }

inline unsigned long CConfig::GetUpdate_AoA_Iter_Limit(void) { return Update_AoA_Iter_Limit; }

inline bool CConfig::GetFinite_Difference_Mode(void) { return Finite_Difference_Mode; }

inline void CConfig::SetFinite_Difference_Mode(bool val_fd_mode) { Finite_Difference_Mode = val_fd_mode; }

inline bool CConfig::GetUpdate_BCThrust_Bool(void) { return Update_BCThrust_Bool; }

inline void CConfig::SetUpdate_AoA(bool val_update) { Update_AoA = val_update; }
Expand Down Expand Up @@ -2074,8 +2076,12 @@ inline su2double CConfig::Get_StartTime() {return StartTime;}

inline unsigned long CConfig::GetHistory_Wrt_Freq(unsigned short iter) {return HistoryWrtFreq[iter];}

inline void CConfig::SetHistory_Wrt_Freq(unsigned short iter, unsigned long nIter) { HistoryWrtFreq[iter] = nIter;}

inline unsigned long CConfig::GetScreen_Wrt_Freq(unsigned short iter) {return ScreenWrtFreq[iter];}

inline void CConfig::SetScreen_Wrt_Freq(unsigned short iter, unsigned long nIter) { ScreenWrtFreq[iter] = nIter;}

inline unsigned long CConfig::GetVolume_Wrt_Freq() {return VolumeWrtFreq;}

inline unsigned short* CConfig::GetVolumeOutputFiles() {return VolumeOutputFiles;}
Expand Down
40 changes: 25 additions & 15 deletions Common/src/config_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1097,8 +1097,8 @@ void CConfig::SetConfig_Options() {
addDoubleOption("DCL_DALPHA", dCL_dAlpha, 0.2);
/* DESCRIPTION: Damping factor for fixed CL mode. */
addDoubleOption("DCM_DIH", dCM_diH, 0.05);
/* DESCRIPTION: Number of times Alpha is updated in a fix CL problem. */
addUnsignedLongOption("UPDATE_ALPHA", Update_Alpha, 5);
/* DESCRIPTION: Maximum number of iterations between AoA updates for fixed CL problem. */
addUnsignedLongOption("UPDATE_AOA_ITER_LIMIT", Update_AoA_Iter_Limit, 200);
/* DESCRIPTION: Number of times Alpha is updated in a fix CL problem. */
addUnsignedLongOption("UPDATE_IH", Update_iH, 5);
/* DESCRIPTION: Number of iterations to evaluate dCL_dAlpha . */
Expand Down Expand Up @@ -2947,9 +2947,8 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
}

/*--- Initialize the AoA and Sideslip variables for the incompressible
solver. This is typically unused (often internal flows). This also
is necessary to avoid any issues with the AoA adjustments for the
compressible code for fixed lift mode (including the adjoint). ---*/
solver. This is typically unused (often internal flows). Also fixed CL
mode for incompressible flows is not implemented ---*/

if (Kind_Solver == INC_EULER ||
Kind_Solver == INC_NAVIER_STOKES ||
Expand All @@ -2976,6 +2975,10 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_

SetAoA(alpha);
SetAoS(beta);

if (Fixed_CL_Mode) {
SU2_MPI::Error(string("Fixed CL mode not implemented for the incompressible solver. \n"), CURRENT_FUNCTION);
}

}

Expand Down Expand Up @@ -3128,7 +3131,7 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
}
}

/*--- The that Discard_InFiles is false, owerwise the gradient could be wrong ---*/
/*--- Ensure that Discard_InFiles is false, owerwise the gradient could be wrong ---*/

if ((ContinuousAdjoint || DiscreteAdjoint) && Fixed_CL_Mode && !Eval_dOF_dCX)
Discard_InFiles = false;
Expand Down Expand Up @@ -3360,6 +3363,7 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
}
}
}

/*--- The Line Search should be applied only in the deformation stage. ---*/

if (Kind_SU2 != SU2_DEF) {
Expand Down Expand Up @@ -3892,7 +3896,6 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_

/*--- Evaluate when the Cl should be evaluated ---*/

Iter_Fixed_CL = SU2_TYPE::Int(nInnerIter / (su2double(Update_Alpha)+1));
Iter_Fixed_CM = SU2_TYPE::Int(nInnerIter / (su2double(Update_iH)+1));
Iter_Fixed_NetThrust = SU2_TYPE::Int(nInnerIter / (su2double(Update_BCThrust)+1));

Expand All @@ -3903,7 +3906,6 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
CFL[0] = CFL[0] * CFLRedCoeff_AdjFlow;
CFL_AdaptParam[2] *= CFLRedCoeff_AdjFlow;
CFL_AdaptParam[3] *= CFLRedCoeff_AdjFlow;
Iter_Fixed_CL = SU2_TYPE::Int(su2double (Iter_Fixed_CL) / CFLRedCoeff_AdjFlow);
Iter_Fixed_CM = SU2_TYPE::Int(su2double (Iter_Fixed_CM) / CFLRedCoeff_AdjFlow);
Iter_Fixed_NetThrust = SU2_TYPE::Int(su2double (Iter_Fixed_NetThrust) / CFLRedCoeff_AdjFlow);
}
Expand All @@ -3916,7 +3918,9 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
Kappa_Flow[1] = Kappa_AdjFlow[1];
}

if (Iter_Fixed_CL == 0) { Iter_Fixed_CL = nInnerIter+1; Update_Alpha = 0; }
if (Update_AoA_Iter_Limit == 0 && Fixed_CL_Mode) {
SU2_MPI::Error("ERROR: Please specify non-zero UPDATE_AOA_ITER_LIMIT.", CURRENT_FUNCTION);
}
if (Iter_Fixed_CM == 0) { Iter_Fixed_CM = nInnerIter+1; Update_iH = 0; }
if (Iter_Fixed_NetThrust == 0) { Iter_Fixed_NetThrust = nInnerIter+1; Update_BCThrust = 0; }

Expand Down Expand Up @@ -4197,17 +4201,23 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
}


/*--- If it is a fixed mode problem, then we will add 100 iterations to
/*--- If it is a fixed mode problem, then we will add Iter_dCL_dAlpha iterations to
evaluate the derivatives with respect to a change in the AoA and CL ---*/

if (!ContinuousAdjoint & !DiscreteAdjoint) {
if ((Fixed_CL_Mode) || (Fixed_CM_Mode)) {
ConvCriteria = RESIDUAL;
nInnerIter += Iter_dCL_dAlpha;
MinLogResidual = -24;
}
if (Fixed_CL_Mode) nInnerIter += Iter_dCL_dAlpha;

if (Fixed_CM_Mode) {
nInnerIter += Iter_dCL_dAlpha;
ConvCriteria = RESIDUAL;
MinLogResidual = -24;
}
}

/* --- Set Finite Difference mode to false by default --- */

Finite_Difference_Mode = false;

/* --- Throw error if UQ used for any turbulence model other that SST --- */

if (Kind_Solver == RANS && Kind_Turb_Model != SST && Kind_Turb_Model != SST_SUST && using_uq){
Expand Down
11 changes: 11 additions & 0 deletions SU2_CFD/include/iteration_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,17 @@ virtual bool Monitor(COutput *output,
*/
void InitializeVortexDistribution(unsigned long &nVortex, vector<su2double>& x0, vector<su2double>& y0, vector<su2double>& vort_strength, vector<su2double>& r_core);


/*!
* \brief Fixed CL monitoring function
* \author J. Mukhopadhaya
* \param[in] output - Pointer to the COutput class.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver - Pointer to the flow solver
* \param[in] config - Definition of the particular problem.
* \return Boolean indicating weather calculation should be stopped
*/
bool MonitorFixed_CL(COutput *output, CGeometry *geometry, CSolver **solver, CConfig *config);
};


Expand Down
17 changes: 17 additions & 0 deletions SU2_CFD/include/output/CFlowCompOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class CFlowCompOutput final: public CFlowOutput {
private:

unsigned short turb_model; //!< Kind of turbulence model
unsigned long lastInnerIter;

public:

Expand Down Expand Up @@ -118,5 +119,21 @@ class CFlowCompOutput final: public CFlowOutput {
*/
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.
*/
void SetAdditionalScreenOutput(CConfig *config) override;
Copy link
Member

Choose a reason for hiding this comment

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

Good idea to add a routine like that.


/*!
* \brief Write additional output for fixed CL mode.
* \param[in] config - Definition of the particular problem per zone.
*/
void SetFixedCLScreenOutput(CConfig *config);

/*!
* \brief Determines if the history file output.
* \param[in] config - Definition of the particular problem.
*/
bool WriteHistoryFile_Output(CConfig *config) override;
};
6 changes: 3 additions & 3 deletions SU2_CFD/include/output/CFlowOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,9 @@ class CFlowOutput : public COutput{

/*!
* \brief Write information to meta data file
* \param[in] output - Container holding the output instances per zone.
* \param[in] config - Definition of the particular problem per zone.
*/
void WriteMetaData(CConfig *config, CGeometry *geometry);
void WriteMetaData(CConfig *config);

/*!
* \brief Write any additional files defined for the current solver.
Expand All @@ -122,8 +121,9 @@ class CFlowOutput : public COutput{
* \brief Determines if the the volume output should be written.
* \param[in] config - Definition of the particular problem.
* \param[in] Iter - Current iteration index.
* \param[in] force_writing - boolean that forces writing of volume output
*/
bool WriteVolume_Output(CConfig *config, unsigned long Iter) override;
bool WriteVolume_Output(CConfig *config, unsigned long Iter, bool force_writing) override;
Copy link
Member

Choose a reason for hiding this comment

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

I am fine with that change!


/*!
* \brief Write the forces breakdown file
Expand Down
9 changes: 8 additions & 1 deletion SU2_CFD/include/output/COutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,9 @@ class COutput {
* \brief Determines if the the volume output should be written.
* \param[in] config - Definition of the particular problem.
* \param[in] Iter - Current iteration index.
* \param[in] force_writing - boolean that forces writing of volume output
*/
virtual bool WriteVolume_Output(CConfig *config, unsigned long Iter);
virtual bool WriteVolume_Output(CConfig *config, unsigned long Iter, bool force_writing);

/*!
* \brief Set the values of the volume output fields for a point.
Expand Down Expand Up @@ -782,5 +783,11 @@ class COutput {
*/
inline virtual void WriteAdditionalFiles(CConfig *config, CGeometry* geometry, CSolver** solver_container){}

/*!
* \brief Write any additional output defined for the current solver.
* \param[in] config - Definition of the particular problem per zone.
*/
inline virtual void SetAdditionalScreenOutput(CConfig *config){}

};

Loading