Skip to content

WIP: Major update to free-space simulations#416

Open
chrisbrahms wants to merge 85 commits into
LupoLab:masterfrom
chrisbrahms:freepol
Open

WIP: Major update to free-space simulations#416
chrisbrahms wants to merge 85 commits into
LupoLab:masterfrom
chrisbrahms:freepol

Conversation

@chrisbrahms
Copy link
Copy Markdown
Collaborator

@chrisbrahms chrisbrahms commented Mar 3, 2026

This PR adds the following:

  1. Polarisation support everywhere, including free-space propagation. This has the effect of changing the array shapes by adding a second dimension which corresponds to polarisation. For radial symmetric this means the field arrays now have shape (Nω, Npol, Nr, [Nz]).
  2. For full 3D propagation I additionally switched the order of x and y dimensions. The array shape was previously (Nω, Ny, Nx, [Nz]) (i.e. it used the machine vision convention), but this gets confusing when everywhere else it's x first and y second. Full 3D arrays now have shape (Nω, Npol, Nx, Ny, [Nz]).
  3. New LinearOps cases for birefringent materials. In these cases, one needs to calculate kx from the internal crystal angle, but because the refractive index depends on the incident angle, this gets a bit complicated and needs to be done numerically via momentum conservation.
  4. A 2-D equivalent to Grid.FreeeGrid which only has an x-axis and no y-dimension. This is an in-between method of quickly simulating situations with spatial walk-off without needing to go (or before going) full 3D.
  5. χ2 nonlinearity through a new response function. This currently only works for field-resolved simulations. As far as I understand, it's not so straightforward to implement for envelope simulations.
  6. More consistent and flexible handling of crystals in PhysData, including a new crystals set of materials and access to birefringent refractive indices from sellmeier expansions.

This branch also includes a dramatic performance enhancement for radially symmetric propagation with envelope fields, which was anomalously slow due to an issue with the matrix multiplication inherent to the QDHT.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 29 out of 30 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/LinearOps.jl
Comment thread src/LinearOps.jl Outdated
Comment thread src/PhysData.jl
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 33 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Luna.jl
Comment thread src/NonlinearRHS.jl
Comment thread src/NonlinearRHS.jl
Comment thread src/NonlinearRHS.jl Outdated
Comment thread src/LinearOps.jl
Comment thread src/PhysData.jl
Comment thread src/LinearOps.jl
Comment thread src/NonlinearRHS.jl
Comment thread test/test_freespace.jl Outdated
Comment thread src/LinearOps.jl
@chrisbrahms chrisbrahms requested a review from jtravs March 9, 2026 15:01
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