Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rafmudaf committed Feb 25, 2022
2 parents ef4934e + 4050924 commit 6e856e5
Show file tree
Hide file tree
Showing 60 changed files with 3,699 additions and 2,888 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ can install with `pip` or `conda`, as shown below.
pip install floris==1.1.0 # Specified version number
# Using conda...
conda install floris # Latest version
conda install floris=1.1.0 # Specified version number
conda install -c conda-forge floris # Latest version
conda install -c conda-forge floris=1.1.0 # Specified version number
To download the source code and use the local code, download the project
Expand Down
4 changes: 2 additions & 2 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ version, specify that as shown below.
pip install floris==1.1.0 # Specified version number
# Using conda...
conda install floris # Latest version
conda install floris=1.1.0 # Specified version number
conda install -c conda-forge floris # Latest version
conda install -c conda-forge floris=1.1.0 # Specified version number
After installation, the FLORIS package can by imported in a Python
Expand Down
2 changes: 1 addition & 1 deletion examples/_getting_started/example_01_basic_adjustments.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
def plot_slice_shortcut(fi, ax, title):
# Get horizontal plane at default height (hub-height)
hor_plane = fi.get_hor_plane()
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax, minSpeed=4.0, maxSpeed=8.0)
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax, minSpeed=4.0, maxSpeed=8.0title=title)


# Define a plot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See https://floris.readthedocs.io for documentation


import matplotlib.pyplot as plt

import floris.tools as wfct

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,24 @@
# of the models for an aligned and yaw case to show some differences
for idx, (fi, name) in enumerate(
zip(
[fi_jensen,fi_turbopark, fi_mz, fi_gauss, fi_gch], ["Jensen", "TurbOPark", "Multizone", "Gaussian", "GCH"]
[fi_jensen, fi_turbopark, fi_mz, fi_gauss, fi_gch],
["Jensen", "TurbOPark", "Multizone", "Gaussian", "GCH"],
)
):

# Aligned case
fi.calculate_wake(yaw_angles=[0])
ax = axarr[0, idx]
hor_plane = fi.get_hor_plane()
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax,minSpeed=4,maxSpeed=8)
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax, minSpeed=4, maxSpeed=8)
ax.set_title(name)
axarr[0, 0].set_ylabel("Aligned")

# Yawed case
fi.calculate_wake(yaw_angles=[25])
ax = axarr[1, idx]
hor_plane = fi.get_hor_plane()
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax,minSpeed=4,maxSpeed=8)
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax, minSpeed=4, maxSpeed=8)
axarr[1, 0].set_ylabel("Yawed")


Expand Down
3 changes: 0 additions & 3 deletions examples/aep_calculation/compute_aep.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@
import os

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

import floris.tools as wfct
import floris.tools.cut_plane as cp
import floris.tools.wind_rose as rose
import floris.tools.power_rose as pr
import floris.tools.visualization as vis
from floris.tools.optimization.scipy.yaw_wind_rose import YawOptimizationWindRose


Expand Down
2 changes: 0 additions & 2 deletions examples/aep_calculation/compute_aep_no_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
import matplotlib.pyplot as plt

import floris.tools as wfct
import floris.tools.cut_plane as cp
import floris.tools.wind_rose as rose
import floris.tools.power_rose as pr
import floris.tools.visualization as vis


# Instantiate the FLORIS object
Expand Down
2 changes: 0 additions & 2 deletions examples/change_turbine/show_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

# Show the grid points in hetergenous flow calculation

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import

Expand Down
5 changes: 0 additions & 5 deletions examples/compare_models/_setup_floris_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@

# Setup a dictionary of FLORIS cases to use consistently across these examples

import copy
import pickle

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

import floris.tools as wfct


Expand Down
2 changes: 0 additions & 2 deletions examples/compare_models/compare_double_wake_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
import pickle

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

import floris.tools as wfct


# Define some helper functions
Expand Down
95 changes: 57 additions & 38 deletions examples/gch_comparisons/five_turbine/test_tune_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
# See read the https://floris.readthedocs.io for documentation


import numpy as np
import matplotlib

matplotlib.use('tkagg')
import floris.tools as wfct
import numpy as np

print('Running FLORIS with no yaw...')

matplotlib.use("tkagg")

print("Running FLORIS with no yaw...")
# Instantiate the FLORIS object

N = 10
Expand Down Expand Up @@ -47,12 +49,16 @@
for j in range(N):
for k in range(N):
for l in range(N):
print(count, 'out of ', N ** 4)
print(count, "out of ", N ** 4)
count = count + 1
fi.floris.farm.flow_field.wake.velocity_model.ti_initial = ti_initial[i]
fi.floris.farm.flow_field.wake.velocity_model.ti_constant = ti_constant[j]
fi.floris.farm.flow_field.wake.velocity_model.ti_constant = ti_constant[
j
]
fi.floris.farm.flow_field.wake.velocity_model.ti_ai = ti_ai[k]
fi.floris.farm.flow_field.wake.velocity_model.ti_downstream = ti_downstream[l]
fi.floris.farm.flow_field.wake.velocity_model.ti_downstream = (
ti_downstream[l]
)

# fi.reinitialize_flow_field(layout_array=(layout_x, layout_y),wind_direction=wind_direction)
fi.reinitialize_flow_field(turbulence_intensity=0.09)
Expand All @@ -79,11 +85,13 @@
power_opt = fi.get_farm_power()
SOWFA_opt_hi = 1000 * np.array([988.4, 1030.0, 1443.8, 1141.8])
GCH_opt_hi = fi.get_turbine_power()[1:]
gain_hi = 100. * (power_opt - power_initial) / power_initial
print('==========================================')
gain_hi = 100.0 * (power_opt - power_initial) / power_initial
print("==========================================")
print(ti_initial[i], ti_constant[j], ti_ai[k], ti_downstream[l])
print('Total Power Gain HI TI = %.1f%%' %
(100. * (power_opt - power_initial) / power_initial))
print(
"Total Power Gain HI TI = %.1f%%"
% (100.0 * (power_opt - power_initial) / power_initial)
)
# print('==========================================')

# # =============================================================================
Expand All @@ -100,7 +108,7 @@

# Initial power output
power_initial = fi.get_farm_power()
SOWFA_base = 1000 * np.array([654.7, 764.8, 825., 819.8])
SOWFA_base = 1000 * np.array([654.7, 764.8, 825.0, 819.8])
GCH_base = fi.get_turbine_power()[1:]

# Perform optimization
Expand All @@ -112,33 +120,44 @@
SOWFA_opt = 1000 * np.array([929.8, 1083.5, 1425.5, 1105.1])
GCH_opt = fi.get_turbine_power()[1:]
# print('==========================================')
gain_low = 100. * (power_opt - power_initial) / power_initial
print('Total Power Gain Low TI = %.1f%%' %
(100. * (power_opt - power_initial) / power_initial))
gain_low = 100.0 * (power_opt - power_initial) / power_initial
print(
"Total Power Gain Low TI = %.1f%%"
% (100.0 * (power_opt - power_initial) / power_initial)
)
# print('==========================================')
err = np.sum(
(SOWFA_base - GCH_base) ** 2 + (SOWFA_opt - GCH_opt) ** 2 + (SOWFA_base_hi - GCH_base_hi) ** 2 + (
SOWFA_opt_hi - GCH_opt_hi) ** 2) / (10 ** 3)
print('err = ', err, minErr)
(SOWFA_base - GCH_base) ** 2
+ (SOWFA_opt - GCH_opt) ** 2
+ (SOWFA_base_hi - GCH_base_hi) ** 2
+ (SOWFA_opt_hi - GCH_opt_hi) ** 2
) / (10 ** 3)
print("err = ", err, minErr)
if err < minErr:
minErr = err
print('found min error: ', i, j, k, l)
print("found min error: ", i, j, k, l)
opt_params[0] = i
opt_params[1] = j
opt_params[2] = k
opt_params[3] = l

print('Optimal parameters:')
print("Optimal parameters:")
print(opt_params)
print('ti_initial = ', ti_initial[int(opt_params[0])])
print('ti_constant = ', ti_constant[int(opt_params[1])])
print('ti_ai = ', ti_ai[int(opt_params[2])])
print('ti_downstream = ', ti_downstream[int(opt_params[3])])

fi.floris.farm.flow_field.wake.velocity_model.ti_initial = ti_initial[int(opt_params[0])]
fi.floris.farm.flow_field.wake.velocity_model.ti_constant = ti_constant[int(opt_params[1])]
print("ti_initial = ", ti_initial[int(opt_params[0])])
print("ti_constant = ", ti_constant[int(opt_params[1])])
print("ti_ai = ", ti_ai[int(opt_params[2])])
print("ti_downstream = ", ti_downstream[int(opt_params[3])])

fi.floris.farm.flow_field.wake.velocity_model.ti_initial = ti_initial[
int(opt_params[0])
]
fi.floris.farm.flow_field.wake.velocity_model.ti_constant = ti_constant[
int(opt_params[1])
]
fi.floris.farm.flow_field.wake.velocity_model.ti_ai = ti_ai[int(opt_params[2])]
fi.floris.farm.flow_field.wake.velocity_model.ti_downstream = ti_downstream[int(opt_params[3])]
fi.floris.farm.flow_field.wake.velocity_model.ti_downstream = ti_downstream[
int(opt_params[3])
]

# HI TI
fi.reinitialize_flow_field(turbulence_intensity=0.09)
Expand All @@ -150,11 +169,13 @@
fi.reinitialize_flow_field()
fi.calculate_wake(yaw_angles=yaw_angles)
power_opt = fi.get_farm_power()
gain_hi = 100. * (power_opt - power_initial) / power_initial
print('==========================================')
gain_hi = 100.0 * (power_opt - power_initial) / power_initial
print("==========================================")
print(ti_initial[i], ti_constant[j], ti_ai[k], ti_downstream[l])
print('Total Power Gain HI TI = %.1f%%' %
(100. * (power_opt - power_initial) / power_initial))
print(
"Total Power Gain HI TI = %.1f%%"
% (100.0 * (power_opt - power_initial) / power_initial)
)
# print('==========================================')

# LOW TI
Expand All @@ -169,10 +190,8 @@
fi.reinitialize_flow_field()
fi.calculate_wake(yaw_angles=yaw_angles)
power_opt = fi.get_farm_power()
gain_low = 100. * (power_opt - power_initial) / power_initial
print('Total Power Gain Low TI = %.1f%%' %
(100. * (power_opt - power_initial) / power_initial))




gain_low = 100.0 * (power_opt - power_initial) / power_initial
print(
"Total Power Gain Low TI = %.1f%%"
% (100.0 * (power_opt - power_initial) / power_initial)
)
93 changes: 0 additions & 93 deletions examples/optimization/scipy/controls_optimization/optimize_yaw.py

This file was deleted.

Loading

0 comments on commit 6e856e5

Please sign in to comment.