Allow user to set npts
, backwardsearch
in solve
#29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While using CCBlade.jl for some propeller optimization work, I ran into this interesting problem where, for a certain combination of inputs, multiple solutions to the BEMT equation exist. Usually CCBlade.jl will find the desired solution (the one that corresponds to the most-reasonable local angle of attack value) but every once in a while it gets unlucky and finds a "bad" solution, which significantly changes the usual integrated outputs (thrust, torque etc) for that particular iteration. This bothers the optimizer and slows convergence of the optimization.
Here's a script that makes two small changes to one of the CCBlade.jl test cases and shows the presence of the multiple solutions:
The two changes to the test case are:
-1.2
and1.2
CCBlade.DuSeligEggers()
rotation correction is usedThe script plots the BEMT residual for a range of
phi
values for each radial station and for three different axial velocities. It happens that the inner-most radial station shows the multiple solution issue for the30.0 m/s
axial velocity case. Here's that plot:The left-hand column shows the residual as a function of
phi
, and the right-hand column shows the residual as a function ofalpha
, the local angle of attack. You can see that the bottom plot shows three solutions exist.The workaround that I found was to allow the user to set a few parameters that control the sign-change search that CCBlade.jl does in the
solve
function. Specifically:npts
allows the user to set the number ofphi
points evaluated during the sign change searchforcebackwardsearch
, whentrue
, forcessolve
to search from highphi
values to lowepsilon_everywhere
, whentrue
, tellssolve
to avoid evaluating the residual atpi/2
,-pi/2
etc.I set the default values for these parameters to what they are currently, FYI, so hopefully this PR wouldn't change the current behavior.