-
Notifications
You must be signed in to change notification settings - Fork 182
[BUGFIX] Tilt cosine law correction #1126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUGFIX] Tilt cosine law correction #1126
Conversation
|
Thanks for submitting this @mkrause-strath ! I'm working through it now. It's currently failing some of the tests, but I think this is appropriate and expected since the results in tilt should change. I'm going to make sure that everything is making sense there and possibly add one or two more tests; I'll push those to this branch. Once I've done that, I'll ask someone else for a review and we should be able to get this merged in. EDIT: the tests were indeed passing locally, and it's not really to do with the change to the tilt that caused the failure. I believe what happened is that cos(x)/cos(x) is evaluating to something that is not precisely 1 (numerical error), which causes a numerical difference in a test result that is supposed to be "equal". I have now allowed a numerical tolerance to be accepted, and I think the test will now pass. EDIT 2: I ended up also implementing the test bugfix in #1136, which is now merged. I've merged develop back into this branch, so that should no longer be an issue for this PR or future PRs. However, I'd still like to add a couple of tests to check that the (new) tilt behavior is working as expected. |
|
Interesting. I think I actually hit the same error on the yaw optimization test initially before making a fork. But then I also hit that same error just on the main branch if I remember correctly. I checked since I was suspicious that a tilt change would break a yaw optimization test. After I made the fork I didn't hit it so it must just be intermittent or exact environment dependent. |
|
Yeah, this is not quite as simple as I thought---I believe there is some numerical instability in the yaw optimization regression test with scipy that can make the optimizer move to a different (local) optimum. I'll look into this some more and see if I can figure out what's going on. |
|
Scrap that, it was actually fairly simple---the numerical difference was causing the optimizer to settle at a slightly different location. The |
|
Good catch @mkrause-strath ! I think you're talking about this line. I agree; this should also be updated according to the same argument. Yes, feel free to update that too when you have time. |
|
@misi9170 I have updated the way axial induction and thrust coefficient are calculated in the cosine-loss operation model. I have also updated some of the tests. However, some of the tests are still broken. Namely:
I think that's because these teste use hard-coded values for assertion. I'm unsure on the method for updating these tests. Another question. The expression cosd(tilt) or cosd(tilt_angles) is also used in some other places without any mention of the reference tilt. Examples:
I don't understand those operation/wake models enough to judge whether that's correct. So just asking the question to make sure this is fine? |
|
Thanks @mkrause-strath ! I'll take a look through this. Yes, for the regression tests, the comparisons are hardcoded by design---so I'll need to check that we expect those to change, and if they do, I'll update them. I can also look at the other places you pointed out. I need to look a bit more at the first one, but my gut reaction is that the later ones are currently correct---the wake development depends on the absolute value of the tilt angle, not whether the tilt angle is at the reference value or otherwise. |
|
Hi @mkrause-strath , I've now updated the regression tests. Looking through the places you've called out, I think the tilt angles should be used as they are. For the first, this is in the The latter two are indeed to do with wake formation rather than modifying prespecified curves, which depends on the absolute tilt, so I'm happy with how those are. I think this PR is now ready for final review and merger. P.S. Congratulations on your Masters! :) |
Thank you! Also thanks for checking out those other places and updating the tests. |
Bugfix for tilt cosine law correction
The cosine law correction is currently applied relative to the reference tilt of the turbine which is incorrect. Instead it should be applied according to the following expression:
See the full discussion here: #1124
Checks