Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Points requested in calculate_wake are not used #62

Closed
ewquon opened this issue Feb 19, 2020 · 3 comments
Closed

Points requested in calculate_wake are not used #62

ewquon opened this issue Feb 19, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@ewquon
Copy link
Contributor

ewquon commented Feb 19, 2020

Bug description
Calling fi.calculate_wake(points=my_points) returns fi.floris.farm.flow_field.* that are not at the requested coordinates--the number of flowfield points differs from my_points. This is unexpected behavior.

Floris Version
commit 2833cc7

System Information (please complete the following information):
Mac High Sierra

Additional context

@rafmudaf rafmudaf added the bug Something isn't working label Feb 19, 2020
@rafmudaf rafmudaf self-assigned this Feb 19, 2020
@rafmudaf
Copy link
Collaborator

@ewquon could you share your input file and script? Or otherwise could you describe your farm layout and the points that you requested in my_points?

@ewquon
Copy link
Contributor Author

ewquon commented Mar 6, 2020

Example:

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

import floris.tools as wfct
from floris.utilities import Vec3 # to specify grid resolution

#===============================
# sampling parameters
D = 126.0
ds = 0.1 * D
x1 = np.arange(-3*D,800+10*D,ds)
y1 = np.arange(-3*D,630+3*D,ds)
z1 = np.arange(0,3*D,ds)
#===============================

fi = wfct.floris_interface.FlorisInterface("example_input.json")

x,y,z = np.meshgrid(x1,y1,z1,indexing='ij')  # expected output

# THIS WORKS:
print('reinit with res and bounds')
fi.floris.farm.flow_field.reinitialize_flow_field(
    with_resolution=Vec3(len(x1),len(y1),len(z1)), # why Vec3?
    bounds_to_set=[x1[0],x1[-1],y1[0],y1[-1],z1[0],z1[-1]]
)
fi.calculate_wake()
assert np.allclose(fi.floris.farm.flow_field.x, x)
assert np.allclose(fi.floris.farm.flow_field.y, y)
assert np.allclose(fi.floris.farm.flow_field.z, z)

# THIS DOES NOT WORK:
print('calc with pts')
points = np.stack((x.ravel(),y.ravel(),z.ravel()), axis=0)
fi.calculate_wake(points=points)
assert np.allclose(fi.floris.farm.flow_field.x, x)
assert np.allclose(fi.floris.farm.flow_field.y, y)
assert np.allclose(fi.floris.farm.flow_field.z, z)

Produces the following output:

Using default gauss deflection multipler of 1.2
reinit with res and bounds
/Users/equon/floris/floris/simulation/wake_deflection.py:218: RuntimeWarning: invalid value encountered in true_divide
  sigma_z0 = D * 0.5 * np.sqrt(uR / (U_local + u0))
/Users/equon/floris/floris/simulation/wake_velocity.py:510: RuntimeWarning: invalid value encountered in true_divide
  sigma_z0 = D * 0.5 * np.sqrt(uR / (U_local + u0))
calc with pts
Traceback (most recent call last):
  File "example_get_points_problem.py", line 38, in <module>
    assert np.allclose(fi.floris.farm.flow_field.x, x)
  File "<__array_function__ internals>", line 6, in allclose
  File "/Users/equon/.local/lib/python3.7/site-packages/numpy/core/numeric.py", line 2159, in allclose
    res = all(isclose(a, b, rtol=rtol, atol=atol, equal_nan=equal_nan))
  File "<__array_function__ internals>", line 6, in isclose
  File "/Users/equon/.local/lib/python3.7/site-packages/numpy/core/numeric.py", line 2260, in isclose
    return within_tol(x, y, atol, rtol)
  File "/Users/equon/.local/lib/python3.7/site-packages/numpy/core/numeric.py", line 2246, in within_tol
    return less_equal(abs(x-y), atol + rtol * abs(y))
ValueError: operands could not be broadcast together with shapes (388,110,30) (194,110,30)

@rafmudaf rafmudaf changed the title Bug report Points requested in calculate_wake are not used Apr 27, 2020
@bayc
Copy link
Collaborator

bayc commented Mar 1, 2022

This functionality is not included in the current FLORIS v3.0.

@bayc bayc closed this as completed Mar 1, 2022
lizagit pushed a commit to lizagit/floris that referenced this issue Jul 24, 2023
…ckground. Also in preparation for examples revamp and migration to jupyter notebooks (NREL#62)
rafmudaf pushed a commit to paulf81/floris that referenced this issue Dec 13, 2023
* update reg_tandem to mimic Jensen.

* Partway through solve; commiting to realign with 4d.

* Tandem reg test passing.

* Updated reg tests; all pass.

* Adding reg test for yaw_added_mixing; final values not yet in.

* Removing 5th dim

* Update print_test_values for 4d; add optional max findex to print.

* yaw_added_recovery test updated to include default 0 gain and nonzero gain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants