diff --git a/CHANGELOG.md b/CHANGELOG.md index 5192b5d72c..fb1ddf4948 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed frequency sampling of `TransmissionLineDataset` within `MicrowaveModeData` when using group index calculation. - Fixed DRC parsing for quoted categories in klayout plugin. - Removed mode solver warnings about evaluating permittivity of a `Medium2D`. +- Maximum number of grid points in an EME simulation is now based solely on transverse grid points. Maximum number of EME cells is unchanged. ### Removed - Removed deprecated `use_complex_fields` parameter from `TwoPhotonAbsorption` and `KerrNonlinearity`. Parameters `beta` and `n2` are now real-valued only, as is `n0` if specified. diff --git a/tests/test_components/test_eme.py b/tests/test_components/test_eme.py index bc2abcad78..c2c5d5a4af 100644 --- a/tests/test_components/test_eme.py +++ b/tests/test_components/test_eme.py @@ -412,16 +412,10 @@ def test_eme_simulation(): _ = sim.updated_copy(monitors=[monitor]) # test max sim size and freqs - sim_bad = sim.updated_copy(size=(1000, 1000, 1000)) + sim_bad = sim.updated_copy(size=(150, 150, 3)) with pytest.raises(SetupError): sim_bad.validate_pre_upload() - sim_bad = sim.updated_copy(size=(1000, 500, 3), monitors=[], store_port_modes=True) - with pytest.raises(SetupError): - sim_bad.validate_pre_upload() - sim_bad = sim.updated_copy(size=(1000, 500, 3), monitors=[], store_port_modes=False) - with pytest.raises(SetupError): - sim_bad.validate_pre_upload() - sim_bad = sim.updated_copy(size=(500, 500, 3), monitors=[]) + sim_bad = sim.updated_copy(size=(50, 50, 3), monitors=[]) with AssertLogLevel("WARNING", "slow-down"): sim_bad.validate_pre_upload() diff --git a/tidy3d/components/eme/simulation.py b/tidy3d/components/eme/simulation.py index 263a2cf434..84b3fec261 100644 --- a/tidy3d/components/eme/simulation.py +++ b/tidy3d/components/eme/simulation.py @@ -43,11 +43,11 @@ from .sweep import EMEFreqSweep, EMELengthSweep, EMEModeSweep, EMEPeriodicitySweep, EMESweepSpecType # maximum numbers of simulation parameters -MAX_GRID_CELLS = 20e9 WARN_MONITOR_DATA_SIZE_GB = 10 MAX_MONITOR_INTERNAL_DATA_SIZE_GB = 50 MAX_SIMULATION_DATA_SIZE_GB = 50 WARN_MODE_NUM_CELLS = 1e5 +MAX_MODE_NUM_CELLS = 5e6 # eme specific simulation parameters @@ -807,14 +807,6 @@ def _validate_monitor_setup(self) -> None: def _validate_size(self) -> None: """Ensures the simulation is within size limits before simulation is uploaded.""" - - num_comp_cells = self.num_cells / 2 ** (np.sum(np.abs(self.symmetry))) - if num_comp_cells > MAX_GRID_CELLS: - raise SetupError( - f"Simulation has {num_comp_cells:.2e} computational cells, " - f"a maximum of {MAX_GRID_CELLS:.2e} are allowed." - ) - num_freqs = len(self.freqs) if num_freqs > MAX_NUM_FREQS: raise SetupError( @@ -876,6 +868,12 @@ def _validate_modes_size(self) -> None: def warn_mode_size(monitor: AbstractModeMonitor, msg_header: str, custom_loc: list) -> None: """Warn if a mode component has a large number of points.""" num_cells = np.prod(self.discretize_monitor(monitor).num_cells) + if num_cells > MAX_MODE_NUM_CELLS: + raise SetupError( + msg_header + f"has {num_cells:.2e} computational cells " + "in the transverse directions, " + f"a maximum of {MAX_MODE_NUM_CELLS:.2e} are allowed." + ) if num_cells > WARN_MODE_NUM_CELLS: consolidated_logger.warning( msg_header + f"has a large number ({num_cells:1.2e}) of grid points. "