Skip to content

Commit

Permalink
Feature/compute performance (#32)
Browse files Browse the repository at this point in the history
* ENH: Implement correct parametrization of the dimensionless radii bounds

* CLN, TST: Remove old tests from previous version

* ENH, TST: Include force and torque coefficient calculation

* TST: Update test outcome values based on realistic J values

* DOC, CLN: Clean up and update documentation
  • Loading branch information
emvalbuena authored Sep 25, 2020
1 parent a6eb895 commit 37ed1e2
Show file tree
Hide file tree
Showing 13 changed files with 386 additions and 2,659 deletions.
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

117 changes: 61 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,74 @@
# pybem


[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![Build Status](https://travis-ci.org/KikeM/pybem.svg?branch=master)](https://travis-ci.org/KikeM/pybem)

Blade Element Method implementation for propeller calculations.

## Iteration process

![Robust Iteration steps](robust_iteration.png)

## Quickstart

```python
import matplotlib.pyplot as plt

import numpy as np
from pybem import BladeElementMethod

bem = BladeElementMethod()

# Quick polar
# -----------------------------
def cl(alpha):

from math import pi

return 2*pi*(alpha)
## Installation

def cd(cl):

return 0.012 + 0.05 * cl**2

alpha = np.linspace(-40, 40, 50)
alpha_r = np.deg2rad(alpha)

cl_alpha = cl(alpha_r)
cd_polar = cd(cl_alpha)

# -------------------------------
To run it as a user, simply invoke `pip`:
```bash
pip install .
```

# Lenghts
D = 0.152 * 2 # meters
r_tip = D / 2.0
r_hub = r_tip * 0.15
### For developers

# Propeller
# ---------------------------------
r = np.linspace(r_hub, r_tip)
beta = np.linspace(80, 50)
chord = 0.2 * r
# ---------------------------------
If you want to contribute to the library, or tweak it to your own needs, install it in developer mode, including the development libraries:
```bash
pip install -e . --requirement requirements-dev.txt
```

# Load airfoil
bem.load_airfoil(alpha, cl_alpha, cd_polar)
## Quickstart

# Load advance ratio
J = 1
bem.load_similarity(J = J)
Running the code consists of easy and uncoupled steps:
1. Declare the airfoil sections with their corresponding geometrical definition.
1. Create a propeller by putting together the sections and the number of blades.
1. Create a solver by putting together the propeller and a advance ratio.
1. Solve the flow.
1. Compute the force and torque coefficients.

prop = bem.load_propeller(dist_r=r, dist_beta=beta, dist_chord = chord, n_blades = 4)
bem.set_tip_loss(True)
Here is an example with an airfoil defined by an analytical lift and drag polars.

# Test!
_r = r[25] / D
phi0 = np.arctan(J/_r)
phi0 = np.rad2deg(phi0)
phi = bem.compute_inflow_angle(_r, phi0)
```
```python
from pybem.models import Propeller, Section, BaseAirfoil
from pybem.bem import BladeElementMethod

# Define known sections
sections = [
Section(
name="Hub",
r=0.3,
beta=60,
chord=0.4,
airfoil=BaseAirfoil(cl_coeff=1.0, cd_coeff=1e-2),
),
Section(
name="Middle",
r=0.6,
beta=45,
chord=0.35,
airfoil=BaseAirfoil(cl_coeff=0.85, cd_coeff=1e-3),
),
Section(
name="Tip",
r=1.2,
beta=30,
chord=0.2,
airfoil=BaseAirfoil(cl_coeff=0.5, cd_coeff=1e-3),
),
]

# Define propeller
B = 6
propeller = Propeller(B=B, sections=sections)

# Define flow conditions and BEM method
J = 0.2
bem = BladeElementMethod(J=J, propeller=propeller, tip_loss=False, hub_loss=False)

# Solve
bem.solve()

# Compute forces
CT, CQ = bem.integrate_forces()
```
Loading

0 comments on commit 37ed1e2

Please sign in to comment.