Enhancements for the fixed CL mode#780
Conversation
talbring
left a comment
There was a problem hiding this comment.
@jayantmukho Thanks for the improvements! Though I have some comments, see below.
| } else { | ||
| return ((Iter > 0) && Iter % config->GetVolume_Wrt_Freq() == 0); | ||
| if (config->GetFixed_CL_Mode() && config->GetFinite_Difference_Mode()) return false; | ||
| return ((Iter > 0) && Iter % config->GetVolume_Wrt_Freq() == 0) || force_writing; |
There was a problem hiding this comment.
This isn't the cleanest implementation but is the least intrusive as it is mostly contained in CFlowOutput. @talbring
The other way to do this (which I have a slight preference towards) would be to add an option to disable volume output completely in COutput itself. I would prefer it because it would be a more general function that could possibly be used in other situations as well. But it would be a pretty powerful option that might cause conflicts with other options/solvers if not handled with care.
Unfortunately, the way it is now, there is one state variable (Finite_Difference_Mode) that is stored in the config @pcarruscag . But everything else is contained in the solver
| void CFlowCompOutput::SetAdditionalScreenOutput(CConfig *config){ | ||
|
|
||
| if (config->GetFixed_CL_Mode()){ | ||
| SetFixedCLScreenOutput(config); | ||
| } | ||
| } | ||
|
|
||
| void CFlowCompOutput::SetFixedCLScreenOutput(CConfig *config){ | ||
| PrintingToolbox::CTablePrinter FixedCLSummary(&cout); | ||
|
|
||
| if (fabs(historyOutput_Map["CL_DRIVER_COMMAND"].value) > 1e-16){ | ||
| FixedCLSummary.AddColumn("Fixed CL Mode", 40); | ||
| FixedCLSummary.AddColumn("Value", 30); |
There was a problem hiding this comment.
I moved all the output to the CFlowCompOutput. I had to make a few new functions but I tried to copy the way the WriteAdditionalFiles function works. I hope this is what you had in mind @talbring
It prints everytime the angle of attack changes and looks like this:

| @@ -7320,71 +7310,51 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con | |||
| void CEulerSolver::SetFarfield_AoA(CGeometry *geometry, CSolver **solver_container, | |||
There was a problem hiding this comment.
This function got cleaned up, and now it does only SetFarfieldAoA (As opposed to perform all the logic for the Fixed CL mode). Moved all that to the FixedCL_Convergence function. Which now that I say out loud, should be name FixedCL_Driver or something of that sort
talbring
left a comment
There was a problem hiding this comment.
Thanks @jayantmukho. All of that looks good to me.
.travis.yml
Outdated
| before_script: | ||
| # Get the test cases | ||
| - git clone --depth=1 -b develop https://github.com/su2code/TestCases.git ./TestData | ||
| - git clone --depth=1 -b enhancement_fixed_cl https://github.com/su2code/TestCases.git ./TestData |
| * \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; |
| * \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; |
There was a problem hiding this comment.
Good idea to add a routine like that.
| su2double Cauchy_Value, /*!< \brief Summed value of the convergence indicator. */ | ||
| Cauchy_Func; /*!< \brief Current value of the convergence indicator at one iteration. */ | ||
| unsigned short Cauchy_Counter; /*!< \brief Number of elements of the Cauchy serial. */ | ||
| su2double *Cauchy_Serie; /*!< \brief Complete Cauchy serial. */ |
| } else { | ||
| return ((Iter > 0) && Iter % config->GetVolume_Wrt_Freq() == 0); | ||
| if (config->GetFixed_CL_Mode() && config->GetFinite_Difference_Mode()) return false; | ||
| return ((Iter > 0) && Iter % config->GetVolume_Wrt_Freq() == 0) || force_writing; |
| void CFlowCompOutput::SetAdditionalScreenOutput(CConfig *config){ | ||
|
|
||
| if (config->GetFixed_CL_Mode()){ | ||
| SetFixedCLScreenOutput(config); | ||
| } | ||
| } | ||
|
|
||
| void CFlowCompOutput::SetFixedCLScreenOutput(CConfig *config){ | ||
| PrintingToolbox::CTablePrinter FixedCLSummary(&cout); | ||
|
|
||
| if (fabs(historyOutput_Map["CL_DRIVER_COMMAND"].value) > 1e-16){ | ||
| FixedCLSummary.AddColumn("Fixed CL Mode", 40); | ||
| FixedCLSummary.AddColumn("Value", 30); |
|
In the process of the final merge which involves pulling corresponding TestCase and Tutorial branches into their develops as well. (and changing the travis.yml file) |
Proposed Changes
This is a simple enhancement of the fixed CL mode. Currently the Fixed CL mode only exits when the specified iteration limit is reached. With these changes, the mode is a little more robust and checks for the specified Residual or Cauchy convergence and additionally checks that the CL is converged to the target CL value to within CAUCHY_EPS.
I have currently preserved the Finite Differencing that occurs at the end of the Fixed CL mode. I am not sure why this is required and would like to get rid of it if possible. If there is a reason for the finite differencing to calculate dCL/dAlpha, please let me know.
PR Checklist
Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.