Skip to content

Commit

Permalink
Refactor BEM class (#30)
Browse files Browse the repository at this point in the history
* TST, CLN: Remove loss functions from BEM class

- Easier to test.
- Functions like this should be outside a class, to make it light and prevent technical debt.

* BUG, BLD: Add __init__.py file to `bem` module

* BLD: Add `bem` imports

* BUG: Fix import

* ENH: Include `model` module with the BEM implementation

* TST: Use fixture for airfoil polars

* ENH, TST: `Propeller` class updated with a new `Section` object

* TST: Improve test coverage

* BLD: Include `pytest-cov` in dev requirements

* DOC: Fill docstrings

* ENH: Include radii distribution of the sections

* DOC, CLN: General changes

* ENH: Refactor BEM class

* TST: Remove versioneer files from test coverage

* ENH: Make homogeneous the usage of degrees and radians

The best solution for the moment that I have found is to only convert from deg to rad just before calling a trigonometric method (or approximation, like in the lift coefficient).

Like that, it becomes easy to debug (we are used to read degrees, not radians) and the code is "robust'. Ideally there should be a class that defines `Angle` and computes correctly the trigonometric functions.

* TST: Fix tests, they were not using correctly the new degrees/radians standard

* ENH: Prevent division by zero

* TST: Introduce unitary tests for model

* Run tests: they do not assert against anything (is a nonlinear equation, that is why I have built a solver in the first place).
* Reproduce: these tests check if we are getting the same results as the last time the code was editted. It is a guide to detect if existing bugs alter the result in a meaningful way.
  • Loading branch information
KikeM authored Sep 20, 2020
1 parent dbcd554 commit a6eb895
Show file tree
Hide file tree
Showing 14 changed files with 1,100 additions and 472 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
omit = *version*
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pytest==6.0.2
pytest-cov==2.10.1
black==20.8b1
pip-chill==1.0.0
pdbpp==0.10.2
9 changes: 4 additions & 5 deletions src/pybem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
__version__ = get_versions()["version"]
del get_versions

# Blade Element Method
from pybem.bem.model import BladeElementMethod

# Core
from pybem.models.propeller import Propeller
from pybem.models.airfoils import Airfoil
from pybem.models.flight_conditions import FlightConditions


# Blade Element Method
from pybem.bem import BladeElementMethod
from pybem.models.propeller import Propeller, Section
Loading

0 comments on commit a6eb895

Please sign in to comment.