Skip to content
Snippets Groups Projects
Commit 3c4e5719 authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

Fix dh computation in JITStreamlineDistance and ensure float or complex in distance calculation

parent 632b8d75
Branches
Tags
No related merge requests found
......@@ -39,7 +39,8 @@ class StraightDistance():
ax.legend()
def setup(self, src_x_i, src_y_i, src_h_i, dst_xyh_j=None):
src_x_i, src_y_i, src_h_i = map(np.asarray, [src_x_i, src_y_i, src_h_i])
# +.0 ensures float or complex
src_x_i, src_y_i, src_h_i = [np.asarray(v) + .0 for v in [src_x_i, src_y_i, src_h_i]]
self.src_x_i, self.src_y_i, self.src_h_i = src_x_i, src_y_i, src_h_i
self.dx_ii = src_x_i - src_x_i[:, na]
......
......@@ -54,7 +54,7 @@ class JITStreamlineDistance(StraightDistance):
zip(dw_mj, dw_is, hcw_is, dist_xyz[:, :, 2], length_is)):
dw = dw_j > 0
hcw_mj[m, dw] += np.interp(dw_j[dw], dw_s, hcw_s)
dh_mj[m, dw] = np.interp(dw_j[dw], dw_s, dh_s)
dh_mj[m, dw] += np.interp(dw_j[dw], dw_s, dh_s)
dw_mj[m, dw] = np.interp(dw_j[dw], dw_s, length_s)
if len(np.shape(WD_il)) == 1:
......
......@@ -229,7 +229,6 @@ def test_dAEP_2wt():
ct_func=ct, power_func=power, power_unit='w')
wt.set_gradient_funcs(dpower, dct)
wfm = IEA37SimpleBastankhahGaussian(site, wt)
x, y = iea37_site.initial_position[np.array([0, 2, 5, 8, 14])].T
# plot 2 wt case
x, y = np.array([[0, 130 * 4], [0, 0]], dtype=float)
......
......@@ -27,7 +27,7 @@ def test_memory_usage():
x, y = site.initial_position.T
for wfm, mem_min, mem_max in [(NOJ(site, wt), 65, 90),
(All2AllIterative(site, wt, wake_deficitModel=NOJDeficit()), 525, 540)]:
(All2AllIterative(site, wt, wake_deficitModel=NOJDeficit()), 540, 600)]:
mem_usage, _ = memory_profiler.memory_usage(
(wfm, (x, y), {'wd': np.arange(0, 360, 4)}), interval=0.001, max_usage=True, retval=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment