Skip to content

Generate Fuga LUTs on the fly with pyfuga#7

Merged
bjarketol merged 1 commit into
flow-model-chainfrom
fuga-lut-pyfuga
Jun 9, 2026
Merged

Generate Fuga LUTs on the fly with pyfuga#7
bjarketol merged 1 commit into
flow-model-chainfrom
fuga-lut-pyfuga

Conversation

@bjarketol

Copy link
Copy Markdown
Owner

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 fuga branch hardcoded z0=1e-5 (offshore), zi=500, zlow=zhigh=70, and hand-built 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). Any farm other than the encoded D80 case → FileNotFoundError.

Change

  • Derive the LUT atmosphere from the site: z0 from mean TI (Fuga has no TI knob; z0 = zhub·exp(-1/TI), the inversion PyWake uses at runtime), 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 → persistent content-addressed cache (~/.cache/wifa/fuga_luts or $WIFA_FUGA_LUT_DIR); the costly preLUT stage is reused across geometries.
  • Pop use_effective_ws for FugaDeficit (not accepted); thread resource_dat through configure_wake_model/_configure_deficit_model as 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-derived z0=0.033 ≈ farmland roughness).

🤖 Generated with Claude Code

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>
@bjarketol bjarketol merged commit df41fe9 into flow-model-chain Jun 9, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant