Skip to content

Python reader for FWH binary surface data#2761

Closed
riddhi1228 wants to merge 2 commits intosu2code:developfrom
riddhi1228:feature/fwh-binary-reader
Closed

Python reader for FWH binary surface data#2761
riddhi1228 wants to merge 2 commits intosu2code:developfrom
riddhi1228:feature/fwh-binary-reader

Conversation

@riddhi1228
Copy link

Adds SU2.io.fwh.FWHData, a pure-Python reader for the FWH binary surface data format. The committed reference file TestCases/unsteady/square_cylinder/fwh_bin.dat had no corresponding Python reader in the repository. This PR closes that gap.

Binary format (decoded from reference file)

Header : 3 × uint32 little-endian
           [0] start_time_us  — simulation time tag at first timestep
                                (inferred as microseconds; TBC with maintainers)
           [1] n_timesteps    — number of timesteps in file
           [2] n_points       — number of FWH surface points
Data   : n_timesteps × n_points × float32 little-endian
           pressure[t, i]  — static pressure at point i, timestep t (Pa)

Verified against fwh_bin.dat: n_t=50, n_pts=200, pressure range 825–1104 Pa, temporal RMS max ≈74 Pa — physically consistent with Ma=0.1 RANS flow past a square cylinder.

API

from SU2.io.fwh import FWHData
fwh = FWHData.from_file("fwh_bin.dat", time_step=0.0015)
# fwh.pressure          shape (50, 200), float32, Pa
# fwh.time              shape (50,), float64, seconds
# fwh.pressure_perturbation()   p' = p - p_mean
# fwh.pressure_rms()            per-point RMS of p'
# fwh.to_dataframe()            pandas DataFrame

Testing

17 pytest tests in SU2_PY/tests/test_fwh_reader.py:

  • Synthetic roundtrip (shape, values, time axis, edge cases)
  • Error handling (file not found, truncated file)
  • Regression guards against committed reference file

Notes

  • Pure Python, no rebuild required
  • Touches only SU2_PY/
  • This reader is intended as the data-ingest layer for the GSoC 2026 SU2PY_FWH aeroacoustic post-processor implementing the Ffowcs Williams–Hawkings integral formulation

cc @pcarruscag

…weepLib.py

string.join() was removed in Python 3. Replace with the equivalent
''.join() syntax. Also removes the now-unused 'import string' statement.

Fixes AttributeError: module 'string' has no attribute 'join' when
running polar sweep analysis on Python 3.
@riddhi1228 riddhi1228 changed the base branch from master to develop March 19, 2026 14:46
@pcarruscag
Copy link
Member

Please setup your AI tool properly and respect the PR description template

@pcarruscag pcarruscag closed this Mar 20, 2026
@riddhi1228
Copy link
Author

Sorry about that — I'll reopen using the proper PR description template. Thanks for the pointer.

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.

2 participants