WISDEM / CCBlade

A blade element momentum method for analyzing wind turbine aerodynamic performance that is robust (guaranteed convergence), fast (superlinear convergence rate), and smooth (continuously differentiable).
Other
43 stars 39 forks source link

Gradient unit test and evaluate method #15

Closed ghost closed 4 years ago

ghost commented 5 years ago

Hi,

I installed CCBlade and it seems to work when running the unittest without gradients (I also tried without creating an instance of CCBlade and CCAirfoil and it seem to work as expected). But when running the unittest for gradients I get an error for almost all the cases (only showing the last one):

ERROR: test_dpitch3 (__main__.TestGradientsFreestreamArray)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_gradients.py", line 2135, in setUp
    = self.rotor.evaluate(self.Uinf, self.Omega, self.pitch, coefficient=False)
TypeError: evaluate() got an unexpected keyword argument 'coefficient'

----------------------------------------------------------------------

It seems like there might have been an API change from coefficient to coefficients. Adding the s solves that part of the problem.

But the unittest still dose not pass without errors. The last unittest error now looks like:

ERROR: test_dpitch3 (__main__.TestGradientsFreestreamArray)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_gradients.py", line 2135, in setUp
    = self.rotor.evaluate(self.Uinf, self.Omega, self.pitch, coefficients=False)
ValueError: too many values to unpack (expected 6)

----------------------------------------------------------------------

And by looking into the code it seems like there has been made two changes to the return statement of the evaluate method since the unittest was made.

  1. The flap root bending moment has been added (M, CM)
  2. It returns both coefficients and real values when coefficients=True, opposed to returning only coefficients.

I guess that it is "just" a matter of adding M and CM to the output? Is there a preferred behaviour for when coefficients=True?

ptrbortolotti commented 5 years ago

Dear kenneth-loenbaek, thanks for your message and for your interest in CCBlade. You are right, the unit test got broken after changing the keyword coefficient to coefficients and adding the moment coefficient as an output. Our apologies for not fixing that. The good news is that this piece of code is soon to be deprecated, as we have been working hard to make the development of wisdem complaint to a rigorous git workflow (https://www.atlassian.com/git/tutorials/comparing-workflows) To do so, we are moving to a single repository, that you can find in the openmdao2 branch of https://github.com/WISDEM/WISDEM. The code here works and feel free to use it already today. In the next weeks and months we will implement a series of unit tests that each commit will have to successfully pass. I hope this helps. Best regards, Pietro Bortolotti

gbarter commented 4 years ago

This has been fixed thanks to @whophil !