Generate Fuga LUTs on the fly with pyfuga#7
Merged
Conversation
Replace the hardcoded Fuga LUT stub with per-farm LUT generation so Fuga
works for any validation case, not just the one offshore D80 turbine the
stub's hand-built filename happened to encode.
- The old branch hardcoded z0=1e-5, zi=500, zlow=zhigh=70 and constructed a
LUT_path (z69.2-72.8...dx44.575) that could never match what get_luts
actually writes (single hub level -> _z70.0_; dx=D/4) -> FileNotFoundError
for any real farm.
- Derive the LUT atmosphere from the site: roughness z0 from the mean TI
(Fuga has no TI input; z0 = zhub*exp(-1/TI), the inversion PyWake uses),
inversion height zi from ABL_height, neutral stability. All overridable
via wind_deficit_model.fuga.{z0,zi,zeta0,nkz0,nbeta,nx,ny,cache_dir}.
- Probe pyfuga.paths.get_luts_path before generating -> a persistent,
content-addressed cache (~/.cache/wifa/fuga_luts or $WIFA_FUGA_LUT_DIR);
pyfuga reuses the costly preLUT stage across geometries.
- Pop use_effective_ws for FugaDeficit (it doesn't accept it) and thread
resource_dat through configure_wake_model/_configure_deficit_model as an
optional trailing kwarg (existing callers/tests unaffected).
Validated on Twin Groves TS (V82, D82/hub78): pywake_fuga = 9.7% wake loss,
mid-pack and physically sane (auto-derived z0=0.033 ~ farmland roughness).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Replaces the broken hardcoded Fuga LUT stub with per-farm LUT generation via pyfuga (pure-Python, conda-forge), so Fuga works for any validation farm.
Problem
The old
fugabranch hardcodedz0=1e-5(offshore),zi=500,zlow=zhigh=70, and hand-built aLUT_path(z69.2-72.8…dx44.575) that could never match whatget_lutsactually writes (single hub level →_z70.0_;dx=D/4). Any farm other than the encoded D80 case →FileNotFoundError.Change
z0from mean TI (Fuga has no TI knob;z0 = zhub·exp(-1/TI), the inversion PyWake uses at runtime),zifromABL_height, neutral stability — all overridable viawind_deficit_model.fuga.{z0,zi,zeta0,nkz0,nbeta,nx,ny,cache_dir}.pyfuga.paths.get_luts_pathbefore generating → persistent content-addressed cache (~/.cache/wifa/fuga_lutsor$WIFA_FUGA_LUT_DIR); the costly preLUT stage is reused across geometries.use_effective_wsforFugaDeficit(not accepted); threadresource_datthroughconfigure_wake_model/_configure_deficit_modelas an optional trailing kwarg (existing callers/tests unaffected — 204 submodel tests pass).Validation
Twin Groves TS (V82, D82/hub78):
pywake_fuga= 9.7% wake loss, mid-pack and physically sane (auto-derivedz0=0.033≈ farmland roughness).🤖 Generated with Claude Code