Skip to content

refactor potential field (boundary) construction - #33

Open
ackl wants to merge 2 commits into
RobertJaro:mainfrom
ackl:pot_field_greens_refactor
Open

refactor potential field (boundary) construction#33
ackl wants to merge 2 commits into
RobertJaro:mainfrom
ackl:pot_field_greens_refactor

Conversation

@ackl

@ackl ackl commented Jul 22, 2026

Copy link
Copy Markdown

for a current use case i'm importing the nf2 methods for calculating potential field values and i saw some areas that could be cleaned up a bit:

This PR consolidates the FFT and direct green's function potential field implementations behind a common API and simplifies the responsibilities of it's callers. i used the Low & Lou analytical field to test before and after the changes on this branch and the values are equal

  • centralises greens function evaluation in compute_scalar_potential

  • route both fft and direct boundary construction through get_potential_boundary

    • adds only_top argument so the responsibility of extracting just the top face isnt in the loader.py module
  • consolidate PotentialBoundaryDataset and PotentialTopBoundaryDataset

    • forward the configured potential field method from yaml properly (only_top arg wasn't being passed but thedocs imply it should be)
  • get_fft_potential_field has been trimmed down a bit so we don't have to create the intermediate *_ext numpy arrays

    • i don't really get what the HxB[0, 0] = -1j HyB[0, 0] = -1j assignments are for, so i've left it in for now

the following methods get_potential, get_potential_top, load_fft_potential_field_boundary have been removed and are replaced with get_potential_field, get_potential_boundary(..., only_top=True), load_potential_field_boundary(..., only_top=True).

ackl added 2 commits July 22, 2026 16:09
* centralize Greens function evaluation in compute_scalar_potential
* route FFT and direct boundary construction through get_potential_boundary
* consolidate full and top potential boundary datasets
* simplify loader responsibilities

BREAKING CHANGE: remove get_potential, get_potential_top, load_fft_potential_field_boundary,
Use get_potential_field or get_potential_boundary instead.
* 'method' key in yaml config was not being wired thru to potential field
  construction code, despite docs saying that setting 'direct' in the config
  should be able to use the green's function fallback
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