Skip to content

Feat/farfield from aedtresults binary#7835

Open
apham-simutech wants to merge 4 commits into
ansys:mainfrom
apham-simutech:feat/farfield-from-aedtresults-binary
Open

Feat/farfield from aedtresults binary#7835
apham-simutech wants to merge 4 commits into
ansys:mainfrom
apham-simutech:feat/farfield-from-aedtresults-binary

Conversation

@apham-simutech

Copy link
Copy Markdown
Contributor

FEAT: Get far field from binary ffd in aedtresults (#7574)

Description

Reconstruct an antenna far field directly from the binary radiation-surface data
that HFSS already stores in .aedtresults, instead of making the solver
re-export an .ffd file.

HFSS writes the tangential E/H on the radiation boundary as a small triangle
mesh (current.sf_msh) plus one complex field file per driven source
(fields.sf_fld_<k>). This PR adds
ansys/aedt/core/visualization/advanced/farfield_binary.py, which decodes those
files and applies a near-field-to-far-field (Stratton–Chu / Love) transform,
returning a standard FfdSolutionData (via a generated .ffd +
pyaedt_antenna_metadata.json) that the existing reader and plotting code consume
unchanged.

Highlights:

  • Hfss.get_antenna_data(use_existing_binary=True) — locates the
    radiation-surface folder for the requested frequency and reconstructs the far
    field with no solver round-trip; falls back to the regular export when a
    design stores no surface fields (for example a CA-DDM / 3D-component design).
  • Per-element array output (far_field_data_from_aedtresults(per_element=True))
    — writes one de-embedded element-pattern .ffd per source on the fitted
    lattice, so FfdSolutionData superposes and steers the array itself.
  • Supports single antennas, explicit (multi-port) arrays, and FA-DDM solves.
    Component-array DDM is detected and routed to the normal export path.

Validation (offline, against AEDT's own far field): single patch 0.999 pattern
correlation; a 1×5 explicit array and a 4×4 FA-DDM array reconstructed to corr
1.0
at scan angles up to 45°; and end-to-end via
get_antenna_data(use_existing_binary=True) on a solved single-patch project
(reconstructed peak matches the far-field report). The reader is pure file parsing
(no AEDT backend calls), so it needs no minimum-version gating.

Application: hfss
AEDT-Version: 26.1
Platform: windows

Issue linked

Closes #7574"Get farfield from binary ffd": consume the binary far-field data
already present in .aedtresults instead of exporting a new .ffd on each
get_antenna_data call.

Note for reviewers: there is no literal .ffd file in .aedtresults; the
radiated-field data is stored as the radiation-surface mesh + tangential E/H
(current.sf_msh + fields.sf_fld_<k>). This PR consumes those and
reconstructs the far field via NF2FF, returning the same FfdSolutionData the
export path produces.

Checklist

  • I have tested my changes locally.
  • I have added necessary documentation or updated existing documentation.
  • I have followed the coding style guidelines of this project.
  • I have added appropriate tests (unit, integration, system).
  • I have reviewed my changes before submitting this pull request.
  • I have linked the issue(s) that are solved by the PR if any.
  • I have assigned this PR to myself.
  • I have added the minimum version decorator to any new backend method implemented.
  • I have agreed with the Contributor License Agreement (CLA).

apham-simutech and others added 4 commits June 25, 2026 00:51
…tresults

Add ansys/aedt/core/visualization/advanced/farfield_binary.py, which obtains an
antenna far field directly from the binary surface fields HFSS stores in
.aedtresults, without making the solver re-export an .ffd.

HFSS writes the tangential E/H on the radiation boundary as a small triangle mesh
(current.sf_msh) plus one complex field file per driven source
(fields.sf_fld_<k>). The new RadiationSurface class decodes those files and a
near-field-to-far-field (Stratton-Chu / Love) transform reconstructs the pattern;
far_field_data_from_aedtresults writes a standard .ffd plus a
pyaedt_antenna_metadata.json and returns an FfdSolutionData, so the existing
reader and plotting code consume the result unchanged.

Validated offline against AEDT's own far field (0.999 pattern correlation for a
single patch). Multi-source helpers (combined_field, element_positions,
steering_weights) cover explicit and FA-DDM arrays; the FA-DDM "_D0" unit-cell
suffix is auto-detected. Component-array DDM (CA-DDM) designs persist no surface
fields, so callers must fall back to the regular export there (documented in the
module).

Unit tests run without a live AEDT session using a small synthetic surface
fixture. A follow-up can wire this into Hfss.get_antenna_data(use_existing_binary)
and emit one .ffd per element so FfdSolutionData's interactive array scanning
applies.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rray output

Build on the binary radiation-surface reader with the two integration pieces.

Hfss.get_antenna_data(use_existing_binary=True): locate the radiation-surface
folder for the requested frequency (find_radiation_surface_folder) and return an
FfdSolutionData reconstructed from the stored surface fields, skipping the solver
export. When no surface fields exist (for example a CA-DDM design) it falls back
to the regular export. Verified end to end on a solved single-patch project: the
reconstructed peak matches AEDT's far-field report.

Per-element array output (far_field_data_from_aedtresults(per_element=True)):
write one de-embedded element-pattern .ffd per source, referenced to its regular
lattice site, plus array metadata (array_dimension, lattice_vector, cell names),
so FfdSolutionData superposes and steers the array itself. Validated against a
direct reconstruction for a 1x5 explicit array and a 4x4 FA-DDM array at scan
angles up to 45 deg (correlation 1.0 with a fresh reader per scan).

The NF2FF inner loop is factored into a shared _spherical_basis, and
element_far_fields reuses the per-direction phase across sources. Four unit tests
added (grid fit, per-element emission, folder discovery); all run without a live
AEDT session.

Note: combine_farfield mutates each element's stored phase on every call, so a
fresh FfdSolutionData (or a phase reset) is needed between scan angles. A
system-level test needs a CI example project that stores surface fields.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…the API

Bring the new module in line with the PyAnsys developer guide and PyAEDT
contribution standards:

- Docstrings pass the repository numpydoc validation (tool.numpydoc_validation):
  method summaries start with an infinitive verb (SS05), return descriptions are
  capitalised and terminated (RT04/RT05), and the section order is correct. Added
  Parameters/Returns to element_positions and steering_weights.
- Documented the public API (RadiationSurface, far_field_data_from_aedtresults,
  find_radiation_surface_folder, parse_surface_mesh_header) under the Farfield
  section of doc/source/API/visualization/advanced.rst, with usage examples
  matching the surrounding style.

ruff (check + format), codespell, blacken-docs and numpydoc validation all pass
on the changed files; the unit tests remain green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@apham-simutech
apham-simutech requested a review from a team as a code owner June 25, 2026 05:46
@ansys-cla-bot

ansys-cla-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

All Contributor License Agreement (CLA) signatures have been captured successfully. Thanks for contributing!

@Samuelopez-ansys

Copy link
Copy Markdown
Member

Hi @apham-simutech , thank you for your cotribution! This is high level! Please could you sign the CLA?

Then I will review the code and cherry pick it.

Thank you!

@apham-simutech

Copy link
Copy Markdown
Contributor Author

@cla-bot rerun

@apham-simutech

Copy link
Copy Markdown
Contributor Author

@Samuelopez-ansys I filled out the CLA. I'm not sure why it is still failing.

@Samuelopez-ansys

Copy link
Copy Markdown
Member

@SMoraisAnsys @MaxJPRey, Do you know why the CLA is failing? @apham-simutech filled out it.

@SMoraisAnsys

Copy link
Copy Markdown
Collaborator

I'm working on a fix

@SMoraisAnsys

Copy link
Copy Markdown
Collaborator

@cla-bot rerun

1 similar comment
@SMoraisAnsys

Copy link
Copy Markdown
Collaborator

@cla-bot rerun

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.

Get farfield from binary ffd

3 participants