@@ -298,7 +298,7 @@ def test_abc_boundaries_simulations():
298
298
min_steps_per_wvl = 10 ,
299
299
wavelength = wvl_um ,
300
300
),
301
- sources = [],
301
+ sources = [mode_source ],
302
302
run_time = 1e-20 ,
303
303
boundary_spec = td .BoundarySpec .all_sides (td .ABCBoundary ()),
304
304
)
@@ -313,7 +313,7 @@ def test_abc_boundaries_simulations():
313
313
min_steps_per_wvl = 10 ,
314
314
wavelength = wvl_um ,
315
315
),
316
- sources = [],
316
+ sources = [mode_source ],
317
317
medium = td .AnisotropicMedium (xx = td .Medium (), yy = td .Medium (), zz = td .Medium ()),
318
318
run_time = 1e-20 ,
319
319
boundary_spec = td .BoundarySpec .all_sides (td .ABCBoundary ()),
@@ -332,7 +332,7 @@ def test_abc_boundaries_simulations():
332
332
min_steps_per_wvl = 10 ,
333
333
wavelength = wvl_um ,
334
334
),
335
- sources = [],
335
+ sources = [mode_source ],
336
336
structures = [box_crossing_boundary ],
337
337
run_time = 1e-20 ,
338
338
boundary_spec = td .BoundarySpec (
@@ -349,7 +349,7 @@ def test_abc_boundaries_simulations():
349
349
min_steps_per_wvl = 10 ,
350
350
wavelength = wvl_um ,
351
351
),
352
- sources = [],
352
+ sources = [mode_source ],
353
353
structures = [box_crossing_boundary ],
354
354
run_time = 1e-20 ,
355
355
boundary_spec = td .BoundarySpec .all_sides (td .ABCBoundary (permittivity = 2 )),
@@ -363,7 +363,7 @@ def test_abc_boundaries_simulations():
363
363
min_steps_per_wvl = 10 ,
364
364
wavelength = wvl_um ,
365
365
),
366
- sources = [],
366
+ sources = [mode_source ],
367
367
structures = [box_crossing_boundary ],
368
368
run_time = 1e-20 ,
369
369
boundary_spec = td .BoundarySpec .all_sides (td .ABCBoundary ()),
@@ -376,7 +376,7 @@ def test_abc_boundaries_simulations():
376
376
min_steps_per_wvl = 10 ,
377
377
wavelength = wvl_um ,
378
378
),
379
- sources = [],
379
+ sources = [mode_source ],
380
380
structures = [box_crossing_boundary .updated_copy (geometry = td .Box (size = (1 , 1 , 1 )))],
381
381
run_time = 1e-20 ,
382
382
boundary_spec = td .BoundarySpec .all_sides (td .ABCBoundary ()),
@@ -393,7 +393,7 @@ def test_abc_boundaries_simulations():
393
393
min_steps_per_wvl = 10 ,
394
394
wavelength = wvl_um ,
395
395
),
396
- sources = [],
396
+ sources = [mode_source ],
397
397
medium = td .CustomMedium (
398
398
permittivity = td .SpatialDataArray (
399
399
[[[2 , 3 ]]], coords = {"x" : [0 ], "y" : [0 ], "z" : [0 , 1 ]}
@@ -412,7 +412,7 @@ def test_abc_boundaries_simulations():
412
412
min_steps_per_wvl = 10 ,
413
413
wavelength = wvl_um ,
414
414
),
415
- sources = [],
415
+ sources = [mode_source ],
416
416
structures = [box_crossing_boundary ],
417
417
run_time = 1e-20 ,
418
418
boundary_spec = td .BoundarySpec .all_sides (td .ABCBoundary ()),
@@ -467,3 +467,69 @@ def test_abc_boundaries_simulations():
467
467
td .ModeABCBoundary (plane = td .Box (size = (1 , 1 , 0 )))
468
468
),
469
469
)
470
+ # error if no frequency
471
+ with pytest .raises (pydantic .ValidationError ):
472
+ _ = td .Simulation (
473
+ center = [0 , 0 , 0 ],
474
+ size = [1 , 1 , 1 ],
475
+ grid_spec = td .GridSpec .auto (
476
+ min_steps_per_wvl = 10 ,
477
+ wavelength = wvl_um ,
478
+ ),
479
+ sources = [],
480
+ run_time = 1e-20 ,
481
+ boundary_spec = td .BoundarySpec .all_sides (
482
+ td .ModeABCBoundary (plane = td .Box (size = (1 , 1 , 0 )))
483
+ ),
484
+ )
485
+ # error if no frequency for automatic abc from interesected mediums
486
+ with pytest .raises (pydantic .ValidationError ):
487
+ _ = td .Simulation (
488
+ center = [0 , 0 , 0 ],
489
+ size = [1 , 1 , 1 ],
490
+ grid_spec = td .GridSpec .auto (
491
+ min_steps_per_wvl = 10 ,
492
+ wavelength = wvl_um ,
493
+ ),
494
+ sources = [],
495
+ run_time = 1e-20 ,
496
+ boundary_spec = td .BoundarySpec .all_sides (td .ABCBoundary ()),
497
+ )
498
+ # ok if abc with permittivity only
499
+ _ = td .Simulation (
500
+ center = [0 , 0 , 0 ],
501
+ size = [1 , 1 , 1 ],
502
+ grid_spec = td .GridSpec .auto (
503
+ min_steps_per_wvl = 10 ,
504
+ wavelength = wvl_um ,
505
+ ),
506
+ sources = [],
507
+ run_time = 1e-20 ,
508
+ boundary_spec = td .BoundarySpec .all_sides (td .ABCBoundary (permittivity = 2 )),
509
+ )
510
+ _ = td .Simulation (
511
+ center = [0 , 0 , 0 ],
512
+ size = [1 , 1 , 1 ],
513
+ grid_spec = td .GridSpec .auto (
514
+ min_steps_per_wvl = 10 ,
515
+ wavelength = wvl_um ,
516
+ ),
517
+ sources = [],
518
+ run_time = 1e-20 ,
519
+ boundary_spec = td .BoundarySpec .all_sides (td .ABCBoundary (permittivity = 2 , conductivity = 0 )),
520
+ )
521
+ # not ok if non-zerp conductivity
522
+ with pytest .raises (pydantic .ValidationError ):
523
+ _ = td .Simulation (
524
+ center = [0 , 0 , 0 ],
525
+ size = [1 , 1 , 1 ],
526
+ grid_spec = td .GridSpec .auto (
527
+ min_steps_per_wvl = 10 ,
528
+ wavelength = wvl_um ,
529
+ ),
530
+ sources = [],
531
+ run_time = 1e-20 ,
532
+ boundary_spec = td .BoundarySpec .all_sides (
533
+ td .ABCBoundary (permittivity = 2 , conductivity = 1e-5 )
534
+ ),
535
+ )
0 commit comments