Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Near2Far refactor phase 1: changes to storage and access of far fields #557

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

shashwat-sh
Copy link
Contributor

@shashwat-sh shashwat-sh commented Oct 31, 2022

  • Near2far data structures now store E,H rather than N,L
  • Significant refactoring and simplifications to how fields are accessed and re-projected to new distances

Previous behaviour:

  • All data structures had a fields method which returned fields in a coordinate system that depended on the monitor, e.g. spherical for the angle monitor, Cartesian for the Cartesian monitor
  • Radar cross section method was available for only the angle monitor
  • All these methods took an argument r to project fields to that given distance

New behaviour

  • All data structures have the following methods:
    • fields_spherical
    • fields_cartesian
    • radar_cross_section
    • power
      so that all quantities are available for all monitors, and in both coordinate systems.
  • By default, fields are projected to a distance of 1m.
  • Re-projection to a different distance is no longer done with an argument. Instead, one explicitly calls renormalize_fields(distance) so that all fields stored in the data become renormalized to the new distance.
    • The field data structures' coordinates will be updated to remember this new distance. This way, one can re-project as many times as they want. Each time, the old phase is removed, the new phase is applied, and the field data coordinates are updated.

Rationale:

  • Make things simple, explicit, and uniform for all three types of monitors.
  • Unify the interface as much as possible in anticipation of exact projections, in which case everything can stay the same, except renormalize_fields won't be available because the phase is "baked into" the exact Green's function.

Backend PR: #557

Copy link
Collaborator

@momchil-flex momchil-flex left a comment

Choose a reason for hiding this comment

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

I think this makes a lot of sense now!

tidy3d/components/data/monitor_data.py Outdated Show resolved Hide resolved
tidy3d/updater.py Outdated Show resolved Hide resolved
…simplifications in how fields are accessed and re-projected to new distances

- renamed plane_distance and axis to proj_distance and proj_axis for all n2f monitors for consistency; fixed a couple data bugs

- near2far data coords now also include projection distance infrmation

- removed r as an argument in all n2f data methods - will instead allow re-normalizing explicitly

- refactored and simplified n2f data field computation routines

- added renormalization functions to allow re-projecting far fields
@shashwat-sh shashwat-sh merged commit a6d2c89 into develop Nov 2, 2022
@tylerflex tylerflex deleted the shash/field_proj_1_storeEH branch May 16, 2023 14:21
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.

3 participants