-
Notifications
You must be signed in to change notification settings - Fork 65
Change EME validation to only depend on transverse grids (FXC-3746) #2968
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, no comments
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
|
29721a2 to
d4608ec
Compare
|
ok, I made sure the tests were actually testing the new limit, and I was able to reduce it to a more reasonable value. Still worth checking that it is large enough -- it is only a bit after this point that the mode solver monitor storage starts failing validation |
momchil-flex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! Field monitors that span the propagation direction will still be prohibited if too large right?
Yes on the basis of storage limits, which may be large compared to practical field computation limits, so maybe we want additional validation, not sure. Those are also included in FC cost maybe we wait and see if @FilipeFcp runs into anything |
|
Thanks @caseyflex It makes much more sense to me now that the validation depends on the mode planes rather than the waveguide length. Regarding the EMEFieldMonitor, it seems to be validating correctly (with a maximum of 50 GB). However, it appears there is no validation that considers the grid points in the mode plane and the number of grid cells. I’m running this model with 100 cells, close to the maximum limit, and I think it might run for a very long time. Is this intentional, or do you think we should also include a number_of_cells × grid_points validation? |
|
Great @FilipeFcp I think let’s validate num transverse grid and num EME cells separately, as they are used independently in the calculation. I think if you are running such a big simulation, you would expect it to be a bit slow, and that’s probably better than not allowing it! |
|
@FilipeFcp the estimates on your model seem not so bad. Is there anything strange that would make it take a long time? Like a large field monitor? |
d4608ec to
7a92896
Compare
7a92896 to
bebe10b
Compare
bebe10b to
3dfda51
Compare
Previously, EME validated based on the total number of grid points in the simulation. It is better to only validate based on the transverse grid points in the mode solver monitors. The max number of EME cells is handled elsewhere.
I'm not too sure about the numbers, the max here seems pretty large but it's consistent with the current unit tests. Let me know if you have suggestions for more reasonable max number of transverse grid points which would still handle applications of interest.
Greptile Overview
Updated On: 2025-11-05 20:17:05 UTC
Greptile Summary
Refactored EME simulation validation to check transverse grid points in mode solver monitors rather than total simulation grid points.
Key Changes:
MAX_GRID_CELLSconstant and validation check from_validate_size()methodMAX_MODE_NUM_CELLSconstant (2e8)_validate_modes_size()to raiseSetupErrorwhen transverse grid points exceedMAX_MODE_NUM_CELLSdiscretize_monitor()Impact:
This change makes the validation more targeted and appropriate for EME simulations, where the relevant constraint is the transverse grid resolution used for mode solving, not the total 3D simulation size.
Confidence Score: 5/5
Important Files Changed
File Analysis
Sequence Diagram
sequenceDiagram participant User participant EMESimulation participant validate_pre_upload participant _validate_size participant _validate_modes_size participant warn_mode_size User->>EMESimulation: Create simulation EMESimulation->>validate_pre_upload: Validate before upload validate_pre_upload->>_validate_size: Check frequency limits _validate_size-->>validate_pre_upload: OK validate_pre_upload->>_validate_modes_size: Check mode monitor sizes _validate_modes_size->>warn_mode_size: Check each monitor warn_mode_size->>EMESimulation: discretize_monitor(monitor) EMESimulation-->>warn_mode_size: Grid with num_cells warn_mode_size->>warn_mode_size: Calculate num_cells = prod(num_cells) alt num_cells > MAX_MODE_NUM_CELLS warn_mode_size-->>_validate_modes_size: Raise SetupError _validate_modes_size-->>validate_pre_upload: Error validate_pre_upload-->>User: Validation failed else num_cells > WARN_MODE_NUM_CELLS warn_mode_size-->>_validate_modes_size: Log warning else warn_mode_size-->>_validate_modes_size: OK end _validate_modes_size-->>validate_pre_upload: OK validate_pre_upload-->>User: Validation passed