Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "wisdem"
version = "4.2.5"
version = "4.2.6"
description = "Wind-Plant Integrated System Design & Engineering Model"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
25 changes: 18 additions & 7 deletions wisdem/ccblade/ccblade.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,16 @@ def max_eff(self, Re):
aoa_end = 40

alpha = np.deg2rad(np.linspace(aoa_start, aoa_end, num=201))
cl = np.array([self.cl_spline.ev(aoa, Re) for aoa in alpha])
cd = np.array([self.cd_spline.ev(aoa, Re) for aoa in alpha])
cl = np.array([self.cl_spline.ev(aoa, Re) for aoa in alpha]).flatten()
cd = np.array([self.cd_spline.ev(aoa, Re) for aoa in alpha]).flatten()

if np.max(cl) < 1.e-3: # Cylinder
alpha_Emax = 0.
cl_Emax = self.cl_spline.ev(alpha_Emax, Re)
cd_Emax = self.cd_spline.ev(alpha_Emax, Re)
if isinstance(cl_Emax, np.ndarray):
cl_Emax = cl_Emax.item()
cd_Emax = cd_Emax.item()
Emax = cl_Emax / cd_Emax
else:
Eff = [cli / cdi for cli, cdi, in zip(cl, cd)]
Expand Down Expand Up @@ -139,14 +142,17 @@ def awayfromstall(self, Re, margin):
else:
alpha = np.deg2rad(np.linspace(aoa_start, aoa_end, num=201))
cl = [self.cl_spline.ev(aoa, Re) for aoa in alpha]
cd = [self.cd_spline.ev(aoa, Re) for aoa in alpha]
#cd = [self.cd_spline.ev(aoa, Re) for aoa in alpha]

i_stall = np.argmax(cl)
alpha_stall = alpha[i_stall]
alpha_op = alpha_stall - np.deg2rad(margin)

cl_op = self.cl_spline.ev(alpha_op, Re)
cd_op = self.cd_spline.ev(alpha_op, Re)
if isinstance(cl_op, np.ndarray):
cl_op = cl_op.item()
cd_op = cd_op.item()
Eff_op = cl_op / cd_op

# print Emax, np.deg2rad(alpha_Emax), cl_Emax, cd_Emax
Expand Down Expand Up @@ -175,11 +181,16 @@ def evaluate(self, alpha, Re, return_cm=False):
also uses a small amount of smoothing to help remove spurious multiple solutions.
"""

cl = self.cl_spline.ev(alpha, Re)[0]
cd = self.cd_spline.ev(alpha, Re)[0]

cl = self.cl_spline.ev(alpha, Re)
cd = self.cd_spline.ev(alpha, Re)
if isinstance(cl, np.ndarray):
cl = cl.item()
cd = cd.item()

if self.use_cm and return_cm:
cm = self.cm_spline.ev(alpha, Re)[0]
cm = self.cm_spline.ev(alpha, Re)
if isinstance(cm, np.ndarray):
cm = cm.item()
return cl, cd, cm
else:
return cl, cd
Expand Down
4 changes: 2 additions & 2 deletions wisdem/optimization_drivers/nsga2_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def run(self):
desvar_new = design_vars_fronts[0][median_idx, :]
for name in desvars:
i, j = self._desvar_idx[name]
self.set_design_var(name, desvar_new[i:j])
self._set_design_var(name, desvar_new[i:j])
with RecordingDebugging(self._get_name(), self.iter_count, self) as rec:
self._run_solve_nonlinear()
rec.abs = 0.0
Expand Down Expand Up @@ -471,7 +471,7 @@ def objective_callback(self, x):
out_of_bounds = False
for name in self._designvars:
i, j = self._desvar_idx[name]
self.set_design_var(name, x[i:j])
self._set_design_var(name, x[i:j])

# Check that design variables are within bounds
if (
Expand Down
Loading