Skip to content

Fix plane-wave fields at the poles (ϑ = 0, π) - #29

Open
denizkuzucu wants to merge 1 commit into
HoBeZwe:masterfrom
denizkuzucu:fix/plane-wave-poles
Open

denizkuzucu wants to merge 1 commit into
HoBeZwe:masterfrom
denizkuzucu:fix/plane-wave-poles

Conversation

@denizkuzucu

Copy link
Copy Markdown
Contributor

Hi! In the plane-wave expansion, the associated Legendre functions were computed and divided by sinϑ. At the poles, the cutoff used to avoid division introduced jumps, and at exactly cosϑ = ±0.999999, none of the three branches is taken, so the field returns zero. This PR uses the angular functions πₙ = Pₙ¹(cosϑ)/sinϑ and τₙ = dPₙ¹(cosϑ)/dϑ (Bohren & Huffman, Absorption and Scattering of Light by Small Particles, Sec. 4.3).

  • π₁ = −1, π₂ = −3cosϑ, and πₙ₊₁ = ((2n+1) cosϑ πₙ − (n+1) πₙ₋₁) / n (same recurrence as before, only the start values are divided by sinϑ)
  • τₙ = n cosϑ πₙ − (n+1) πₙ₋₁

The existing sign convention (P₁¹ = −sinϑ) is kept, and the coefficients aₙ, bₙ, cₙ, and dₙ are unchanged.

A test is added to test/electromagnetics/planeWave.jl to check the continuity of E, H, and the far field near and exactly at the poles.

@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.40%. Comparing base (482f353) to head (aa3b8c4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #29      +/-   ##
==========================================
- Coverage   98.41%   98.40%   -0.02%     
==========================================
  Files          39       39              
  Lines        2206     2192      -14     
==========================================
- Hits         2171     2157      -14     
  Misses         35       35              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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