-
Notifications
You must be signed in to change notification settings - Fork 10
Eagle density function for eco-constrained design setups #168
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
Merged
cfrontin
merged 36 commits into
NLRWindSystems:develop
from
cfrontin:feature/eco_eagles_field
Jan 21, 2026
+389
−7
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
1057a94
bring in the exclusions and their viz implications
cfrontin c08b5b7
added exclusion code
cfrontin 7a7110e
Apply suggestions from code review
cfrontin 11f2466
added eagle density code and tested it
cfrontin 469093d
fix filepath
cfrontin 923deb2
improved documentation, added and tested derivatives on eagles splines
cfrontin 6a7545f
black reformat
cfrontin 8191c9f
first tranche of copilot changes
cfrontin eabd1e9
second tranche of copilot fixes
cfrontin ec3255e
Apply suggestions from copilot code review
cfrontin 9b620cd
more consistent error messages
cfrontin c2bfb64
Merge branch 'feature/eco_eagles_field' of github.com:cfrontin/Ard in…
cfrontin 5f06bb4
black reformat
cfrontin 62d4eca
Merge branch 'develop' of github.com:WISDEM/Ard into feature/exclusions
cfrontin 133276d
Merge branch 'feature/exclusions' into feature/eco_eagles_field
cfrontin 44c1b37
new gold standard test, weird failure
cfrontin 8dd81f8
fixed value of the exclusion distance; still failing now on two: myst…
cfrontin bfc06f9
add a boundary test case that lights up the strange error
cfrontin 1a83abf
rename and add some tests
cfrontin 2b11ec6
added exclusion test even though it's in tatters
cfrontin 473c89a
debugging
jaredthomas68 31cbca9
use switch instead of pad to fix boundary in/out identification. also…
jaredthomas68 cd8ada3
black reformat
cfrontin 507a934
Merge branch 'feature/exclusions' into feature/exclusions
cfrontin 4eb52b5
Merge pull request #6 from jaredthomas68/feature/exclusions
cfrontin c7d9425
black reformat
cfrontin b551ff9
Merge branch 'feature/exclusions' into feature/eco_eagles_field
cfrontin 6682379
Merge branch 'develop' of github.com:WISDEM/Ard into feature/exclusions
cfrontin a821c2b
Merge branch 'feature/exclusions' into feature/eco_eagles_field
cfrontin 238b9f0
Merge branch 'develop' of github.com:WISDEM/Ard into feature/eco_eagl…
cfrontin 3ed37cd
address jared comments
cfrontin 7499864
Merge branch 'develop' of github.com:WISDEM/Ard into feature/eco_eagl…
cfrontin 9b86e2c
fix accidentally stashed and dropped changes
cfrontin 265d703
black reformat...
cfrontin 0187464
fix calling convention
cfrontin 3ddf3c5
black are you kidding me
cfrontin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| import numpy as np | ||
| from scipy.interpolate import RectBivariateSpline | ||
|
|
||
| import openmdao.api as om | ||
|
|
||
|
|
||
| class EagleDensityFunction(om.ExplicitComponent): | ||
| """ | ||
| OpenMDAO component to evaluate eagle presence density at turbine locations. | ||
|
|
||
| An Ard/OpenMDAO component that evaluates the eagle presence density metric | ||
| calculated by the National Laboratory of the Rockies's Stochastic Soaring | ||
| Raptor Simulator (SSRS) at the turbine locations. The eagle presence density | ||
| is an output of an SSRS simulation indicating the unit density function of | ||
| a raptor flying through the point during a given migratory period. | ||
|
|
||
| Options | ||
| ------- | ||
| modeling_options : dict | ||
| a modeling options dictionary (inherited from | ||
| `templates.LanduseTemplate`) | ||
|
|
||
| Inputs | ||
| ------ | ||
| x_turbines : np.ndarray | ||
| a 1-D numpy array that represents the x (i.e. Easting) coordinate of | ||
| the location of each of the turbines in the farm in meters | ||
| y_turbines : np.ndarray | ||
| a 1-D numpy array that represents the y (i.e. Northing) coordinate of | ||
| the location of each of the turbines in the farm in meters | ||
|
|
||
| Outputs | ||
| ------- | ||
| eagle_normalized_density : np.ndarray | ||
| a 1-D numpy array that represents the normalized eagle presence density | ||
| at each of the turbine locations (unitless) | ||
cfrontin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
|
|
||
| def initialize(self): | ||
| """Initialization of OM component.""" | ||
| self.options.declare("modeling_options") | ||
|
|
||
| def setup(self): | ||
| """Setup of OM component.""" | ||
|
|
||
| # load modeling options and turbine count | ||
| modeling_options = self.modeling_options = self.options["modeling_options"] | ||
|
|
||
| self.N_turbines = modeling_options["layout"]["N_turbines"] | ||
|
|
||
| # grab the eagle presence density settings | ||
| self.pres = self.modeling_options["eco"]["eagle_presence_density_map"] | ||
| self.eagle_density_function = RectBivariateSpline( | ||
| self.pres["x"], self.pres["y"], self.pres["normalized_presence_density"] | ||
| ) | ||
| self.eagle_density_function_dx = self.eagle_density_function.partial_derivative( | ||
| dx=1, dy=0 | ||
| ) | ||
| self.eagle_density_function_dy = self.eagle_density_function.partial_derivative( | ||
| dx=0, dy=1 | ||
| ) | ||
|
|
||
cfrontin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # add the full layout inputs | ||
| self.add_input( | ||
| "x_turbines", | ||
| np.zeros((self.N_turbines,)), | ||
| units="m", | ||
| desc="turbine location in x-direction", | ||
| ) | ||
| self.add_input( | ||
| "y_turbines", | ||
| np.zeros((self.N_turbines,)), | ||
| units="m", | ||
| desc="turbine location in y-direction", | ||
| ) | ||
|
|
||
| # add outputs that are universal | ||
| self.add_output( | ||
| "eagle_normalized_density", | ||
| np.zeros((self.N_turbines,)), | ||
| units=None, | ||
| desc="normalized eagle presence density", | ||
| ) | ||
|
|
||
| def setup_partials(self): | ||
| """Setup the OpenMDAO component partial derivatives.""" | ||
| self.declare_partials( | ||
| "eagle_normalized_density", | ||
| "x_turbines", | ||
| diagonal=True, | ||
| method="exact", | ||
| ) | ||
| self.declare_partials( | ||
| "eagle_normalized_density", | ||
| "y_turbines", | ||
| diagonal=True, | ||
| method="exact", | ||
| ) | ||
|
|
||
| def compute(self, inputs, outputs): | ||
| """ | ||
| Computation for the OM component. | ||
| """ | ||
|
|
||
| # unpack the turbine locations | ||
| x_turbines = inputs["x_turbines"] # m | ||
| y_turbines = inputs["y_turbines"] # m | ||
|
|
||
| # evaluate the density function at each turbine point | ||
| outputs["eagle_normalized_density"] = self.eagle_density_function( | ||
| x_turbines, | ||
| y_turbines, | ||
| grid=False, | ||
| ) | ||
|
|
||
| def compute_partials(self, inputs, partials): | ||
| """ | ||
| Compute the partials for the OM component | ||
| """ | ||
|
|
||
| # unpack the turbine locations | ||
| x_turbines = inputs["x_turbines"] # m | ||
| y_turbines = inputs["y_turbines"] # m | ||
|
|
||
| # evaluate the gradients for each variable | ||
| dfdx = self.eagle_density_function_dx(x_turbines, y_turbines, grid=False) | ||
| dfdy = self.eagle_density_function_dy(x_turbines, y_turbines, grid=False) | ||
| partials["eagle_normalized_density", "x_turbines"] = dfdx | ||
| partials["eagle_normalized_density", "y_turbines"] = dfdy | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| modeling_options: &modeling_options | ||
| windIO_plant: | ||
cfrontin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| layout: | ||
| N_turbines: 9 | ||
| eco: | ||
| eagle_presence_density_map: !include presence_density.yaml | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it just for migration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it's across the year, like the period of a wave but referring to southbound then northbound migratory flow. i snipped the language from their paper although it uses a fair amount of terminology of art and i was only skimming.