Skip to content

Commit

Permalink
Merge branch 'develop' into pyprecomp
Browse files Browse the repository at this point in the history
  • Loading branch information
gbarter committed Apr 29, 2024
2 parents bae98d7 + 344d133 commit d01c746
Show file tree
Hide file tree
Showing 77 changed files with 1,229 additions and 1,523 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI_WISDEM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ jobs:
- name: Run coveralls
if: contains( matrix.os, 'ubuntu') && contains( matrix.python-version, '3.10')
#uses: coverallsapp/github-action@v2
# This also works, https://github.com/AndreMiras/coveralls-python-action
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coveralls --service=github
build_pip:
name: Pip Build-Test (${{ matrix.os }} Python ${{ matrix.python-version }})
Expand Down
9 changes: 6 additions & 3 deletions wisdem/ccblade/Polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1684,8 +1684,11 @@ def _find_slope(x, y, xi=None, x0=None, window=None, method="max", opts=None, nI
dx = x[im + 1] - x[im - 1]
if np.abs(dx) > 1e-7:
a = (y[im + 1] - y[im - 1]) / dx
yi = np.interp(xi, x, y)
x0 = xi - yi / a
if a != 0.:
yi = np.interp(xi, x, y)
x0 = xi - yi / a
else:
x0 = xi
else:
a = np.inf
x0 = xi
Expand Down Expand Up @@ -2004,4 +2007,4 @@ def smooth_heaviside(x, k=1, rng=(-np.inf, np.inf), method="exp"):


if __name__ == "__main__":
pass
pass
114 changes: 57 additions & 57 deletions wisdem/ccblade/ccblade_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def setup(self):
self.declare_partials("presweepTip", "presweep_in", val=1.0, rows=[0], cols=[n_span - 1])

def compute(self, inputs, outputs):
Rtip = inputs["Rtip"]
precone = inputs["precone"]
Rtip = inputs["Rtip"][0]
precone = inputs["precone"][0]

outputs["precurveTip"] = inputs["precurve_in"][-1]
outputs["presweepTip"] = inputs["presweep_in"][-1]
Expand Down Expand Up @@ -270,27 +270,27 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs):
r = inputs["r"]
chord = inputs["chord"]
theta = inputs["theta"]
Rhub = inputs["Rhub"]
Rtip = inputs["Rtip"]
hub_height = inputs["hub_height"]
precone = inputs["precone"]
tilt = inputs["tilt"]
yaw = inputs["yaw"]
Rhub = inputs["Rhub"][0]
Rtip = inputs["Rtip"][0]
hub_height = inputs["hub_height"][0]
precone = inputs["precone"][0]
tilt = inputs["tilt"][0]
yaw = inputs["yaw"][0]
precurve = inputs["precurve"]
precurveTip = inputs["precurveTip"]
precurveTip = inputs["precurveTip"][0]
B = discrete_inputs["nBlades"]
rho = inputs["rho"]
mu = inputs["mu"]
shearExp = inputs["shearExp"]
rho = inputs["rho"][0]
mu = inputs["mu"][0]
shearExp = inputs["shearExp"][0]
nSector = discrete_inputs["nSector"]
tiploss = discrete_inputs["tiploss"]
hubloss = discrete_inputs["hubloss"]
wakerotation = discrete_inputs["wakerotation"]
usecd = discrete_inputs["usecd"]
V_load = inputs["V_load"]
Omega_load = inputs["Omega_load"]
pitch_load = inputs["pitch_load"]
azimuth_load = inputs["azimuth_load"]
V_load = inputs["V_load"][0]
Omega_load = inputs["Omega_load"][0]
pitch_load = inputs["pitch_load"][0]
azimuth_load = inputs["azimuth_load"][0]

if len(precurve) == 0:
precurve = np.zeros_like(r)
Expand Down Expand Up @@ -559,28 +559,28 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs):
inputs["chord"],
np.zeros_like(inputs["chord"]),
af,
inputs["Rhub"],
inputs["Rtip"],
inputs["Rhub"][0],
inputs["Rtip"][0],
discrete_inputs["nBlades"],
inputs["rho"],
inputs["mu"],
inputs["precone"],
inputs["tilt"],
inputs["yaw"],
inputs["shearExp"],
inputs["hub_height"],
inputs["rho"][0],
inputs["mu"][0],
inputs["precone"][0],
inputs["tilt"][0],
inputs["yaw"][0],
inputs["shearExp"][0],
inputs["hub_height"][0],
discrete_inputs["nSector"],
inputs["precurve"],
inputs["precurveTip"],
inputs["precurveTip"][0],
inputs["presweep"],
inputs["presweepTip"],
inputs["presweepTip"][0],
discrete_inputs["tiploss"],
discrete_inputs["hubloss"],
discrete_inputs["wakerotation"],
discrete_inputs["usecd"],
)

Omega = inputs["tsr"] * inputs["Uhub"] / inputs["r"][-1] * 30.0 / np.pi
Omega = inputs["tsr"][0] * inputs["Uhub"][0] / inputs["r"][-1] * 30.0 / np.pi

if self.options["opt_options"]["design_variables"]["blade"]["aero_shape"]["twist"]["inverse"]:
if self.options["opt_options"]["design_variables"]["blade"]["aero_shape"]["twist"]["flag"]:
Expand Down Expand Up @@ -647,7 +647,7 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs):
ccblade.inverse_analysis = False

# Call ccblade at azimuth 0 deg
loads, _ = ccblade.distributedAeroLoads(inputs["Uhub"][0], Omega[0], inputs["pitch"][0], 0.0)
loads, _ = ccblade.distributedAeroLoads(inputs["Uhub"][0], Omega, inputs["pitch"][0], 0.0)

# Call ccblade evaluate (averaging across azimuth)
myout, _ = ccblade.evaluate([inputs["Uhub"]], [Omega], [inputs["pitch"]], coefficients=True)
Expand Down Expand Up @@ -768,28 +768,28 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs):
r = inputs["r"]
chord = inputs["chord"]
theta = inputs["theta"]
Rhub = inputs["Rhub"]
Rtip = inputs["Rtip"]
hub_height = inputs["hub_height"]
precone = inputs["precone"]
tilt = inputs["tilt"]
yaw = inputs["yaw"]
Rhub = inputs["Rhub"][0]
Rtip = inputs["Rtip"][0]
hub_height = inputs["hub_height"][0]
precone = inputs["precone"][0]
tilt = inputs["tilt"][0]
yaw = inputs["yaw"][0]
precurve = inputs["precurve"]
precurveTip = inputs["precurveTip"]
precurveTip = inputs["precurveTip"][0]
presweep = inputs["presweep"]
presweepTip = inputs["presweepTip"]
presweepTip = inputs["presweepTip"][0]
B = discrete_inputs["nBlades"]
rho = inputs["rho"]
mu = inputs["mu"]
shearExp = inputs["shearExp"]
rho = inputs["rho"][0]
mu = inputs["mu"][0]
shearExp = inputs["shearExp"][0]
nSector = discrete_inputs["nSector"]
tiploss = discrete_inputs["tiploss"]
hubloss = discrete_inputs["hubloss"]
wakerotation = discrete_inputs["wakerotation"]
usecd = discrete_inputs["usecd"]
V_load = inputs["V_load"]
Omega_load = inputs["Omega_load"]
pitch_load = inputs["pitch_load"]
V_load = inputs["V_load"][0]
Omega_load = inputs["Omega_load"][0]
pitch_load = inputs["pitch_load"][0]

if len(precurve) == 0:
precurve = np.zeros_like(r)
Expand Down Expand Up @@ -846,28 +846,28 @@ def compute_partials(self, inputs, J, discrete_inputs):
r = inputs["r"]
chord = inputs["chord"]
theta = inputs["theta"]
Rhub = inputs["Rhub"]
Rtip = inputs["Rtip"]
hub_height = inputs["hub_height"]
precone = inputs["precone"]
tilt = inputs["tilt"]
yaw = inputs["yaw"]
Rhub = inputs["Rhub"][0]
Rtip = inputs["Rtip"][0]
hub_height = inputs["hub_height"][0]
precone = inputs["precone"][0]
tilt = inputs["tilt"][0]
yaw = inputs["yaw"][0]
precurve = inputs["precurve"]
precurveTip = inputs["precurveTip"]
precurveTip = inputs["precurveTip"][0]
presweep = inputs["presweep"]
presweepTip = inputs["presweepTip"]
presweepTip = inputs["presweepTip"][0]
B = discrete_inputs["nBlades"]
rho = inputs["rho"]
mu = inputs["mu"]
shearExp = inputs["shearExp"]
rho = inputs["rho"][0]
mu = inputs["mu"][0]
shearExp = inputs["shearExp"][0]
nSector = discrete_inputs["nSector"]
tiploss = discrete_inputs["tiploss"]
hubloss = discrete_inputs["hubloss"]
wakerotation = discrete_inputs["wakerotation"]
usecd = discrete_inputs["usecd"]
V_load = inputs["V_load"]
Omega_load = inputs["Omega_load"]
pitch_load = inputs["pitch_load"]
V_load = inputs["V_load"][0]
Omega_load = inputs["Omega_load"][0]
pitch_load = inputs["pitch_load"][0]

if len(precurve) == 0:
precurve = np.zeros_like(r)
Expand Down
26 changes: 13 additions & 13 deletions wisdem/commonse/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ def compute(self, inputs, outputs):
z = inputs["z"]
if isinstance(z, float) or isinstance(z, np.float_):
z = np.array([z])
zref = float(inputs["zref"])
z0 = float(inputs["z0"])
zref = float(inputs["zref"][0])
z0 = float(inputs["z0"][0])

# velocity
idx = z > z0
Expand Down Expand Up @@ -264,9 +264,9 @@ def compute(self, inputs, outputs):
z = inputs["z"]
if isinstance(z, float) or isinstance(z, np.float_):
z = np.array([z])
zref = float(inputs["zref"])
z0 = float(inputs["z0"])
z_roughness = float(inputs["z_roughness"]) / 1e3 # convert to m
zref = float(inputs["zref"][0])
z0 = float(inputs["z0"][0])
z_roughness = float(inputs["z_roughness"][0]) / 1e3 # convert to m

# find velocity
idx = np.where(z - z0 > z_roughness)[0]
Expand All @@ -278,10 +278,10 @@ def compute_partials(self, inputs, J):
z = inputs["z"]
if isinstance(z, float) or isinstance(z, np.float_):
z = np.array([z])
zref = float(inputs["zref"])
z0 = float(inputs["z0"])
z_roughness = float(inputs["z_roughness"]) / 1e3
Uref = float(inputs["Uref"])
zref = float(inputs["zref"][0])
z0 = float(inputs["z0"][0])
z_roughness = float(inputs["z_roughness"][0]) / 1e3
Uref = float(inputs["Uref"][0])
npts = self.options["nPoints"]

dU_dUref = np.zeros(npts)
Expand Down Expand Up @@ -510,11 +510,11 @@ def setup(self):
self.declare_partials("k", ["d0", "depth"])

def compute(self, inputs, outputs):
G = float(inputs["G"])
nu = float(inputs["nu"])
depth = float(inputs["depth"])
G = float(inputs["G"][0])
nu = float(inputs["nu"][0])
depth = float(inputs["depth"][0])
h = np.linspace(depth, 0.0, self.options["npts"])
r0 = 0.5 * float(inputs["d0"])
r0 = 0.5 * float(inputs["d0"][0])
# vertical
eta = 1.0 + 0.6 * (1.0 - nu) * h / r0
k_z = 4 * G * r0 * eta / (1.0 - nu)
Expand Down
8 changes: 4 additions & 4 deletions wisdem/commonse/wind_wave_drag.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def compute(self, inputs, outputs):
q = 0.5 * rho * U**2

# Reynolds number and drag
if float(inputs["cd_usr"]) < 0.0:
if float(inputs["cd_usr"][0]) < 0.0:
Re = rho * U * d / mu
cd, dcd_dRe = cylinderDrag(Re)
else:
Expand Down Expand Up @@ -312,7 +312,7 @@ def compute_partials(self, inputs, J):
q = 0.5 * rho * U**2

# Reynolds number and drag
if float(inputs["cd_usr"]) < 0.0:
if float(inputs["cd_usr"][0]) < 0.0:
Re = rho * U * d / mu
cd, dcd_dRe = cylinderDrag(Re)
else:
Expand Down Expand Up @@ -446,7 +446,7 @@ def compute(self, inputs, outputs):
# q0= 0.5*rho*U0**2

# Reynolds number and drag
if float(inputs["cd_usr"]) < 0.0:
if float(inputs["cd_usr"][0]) < 0.0:
Re = rho * U * d / mu
cd, dcd_dRe = cylinderDrag(Re)
else:
Expand Down Expand Up @@ -516,7 +516,7 @@ def compute_partials(self, inputs, J):
# q0= 0.5*rho*U0**2

# Reynolds number and drag
if float(inputs["cd_usr"]) < 0.0:
if float(inputs["cd_usr"][0]) < 0.0:
cd = inputs["cd_usr"] * np.ones_like(d)
Re = 1.0
dcd_dRe = 0.0
Expand Down

0 comments on commit d01c746

Please sign in to comment.