@@ -232,7 +232,7 @@ def boundary_conditions():
232232@pytest .fixture (scope = "module" )
233233def monitors ():
234234 """Creates monitors of different types and sizes."""
235- temp_mnt1 = td .TemperatureMonitor (size = (1.6 , 2 , 3 ), name = "test" )
235+ temp_mnt1 = td .TemperatureMonitor (size = (1.6 , 2 , 3 ), name = "test" , unstructured = False )
236236 temp_mnt2 = td .TemperatureMonitor (size = (1.6 , 2 , 3 ), name = "tet" , unstructured = True )
237237 temp_mnt3 = td .TemperatureMonitor (
238238 center = (0 , 0.9 , 0 ), size = (1.6 , 0 , 3 ), name = "tri" , unstructured = True , conformal = True
@@ -241,7 +241,7 @@ def monitors():
241241 center = (0 , 0.9 , 0 ), size = (1.6 , 0 , 3 ), name = "empty" , unstructured = True , conformal = False
242242 )
243243
244- volt_mnt1 = td .SteadyPotentialMonitor (size = (1.6 , 2 , 3 ), name = "v_test" )
244+ volt_mnt1 = td .SteadyPotentialMonitor (size = (1.6 , 2 , 3 ), name = "v_test" , unstructured = False )
245245 volt_mnt2 = td .SteadyPotentialMonitor (size = (1.6 , 2 , 3 ), name = "v_tet" , unstructured = True )
246246 volt_mnt3 = td .SteadyPotentialMonitor (
247247 center = (0 , 0.9 , 0 ), size = (1.6 , 0 , 3 ), name = "v_tri" , unstructured = True , conformal = True
@@ -952,7 +952,7 @@ def test_freqs_validation():
952952 structures = [cathode , silicon , anode ]
953953
954954 volt_monitor = td .SteadyPotentialMonitor (
955- center = (0 , 0 , 0 ), size = (td .inf , td .inf , td .inf ), name = "voltage"
955+ center = (0 , 0 , 0 ), size = (td .inf , td .inf , td .inf ), name = "voltage" , unstructured = False
956956 )
957957
958958 charge_tolerance = td .ChargeToleranceSpec (rel_tol = 1e5 , abs_tol = 1e3 , max_iters = 400 )
@@ -1137,6 +1137,42 @@ def test_vertical_natural_convection():
11371137 )
11381138
11391139
1140+ def test_unstructured_default_warning ():
1141+ """Test that warning is issued when unstructured uses default (not explicitly set)."""
1142+ # Should warn: unstructured not set (defaults to False)
1143+ with AssertLogLevel ("WARNING" , contains_str = "default value of 'unstructured'" ):
1144+ td .TemperatureMonitor (size = (1 , 1 , 1 ), name = "test1" )
1145+
1146+ # Should NOT warn: unstructured explicitly set to False
1147+ with AssertLogLevel (None ):
1148+ td .TemperatureMonitor (size = (1 , 1 , 1 ), name = "test2" , unstructured = False )
1149+
1150+ # Should NOT warn: unstructured explicitly set to True
1151+ with AssertLogLevel (None ):
1152+ td .TemperatureMonitor (size = (1 , 1 , 1 ), name = "test3" , unstructured = True )
1153+
1154+ # Should warn: SteadyPotentialMonitor with default unstructured (not explicitly set)
1155+ with AssertLogLevel ("WARNING" , contains_str = "default value of 'unstructured'" ):
1156+ td .SteadyPotentialMonitor (size = (1 , 1 , 1 ), name = "test4" )
1157+
1158+ # Should NOT warn: SteadyPotentialMonitor with unstructured explicitly set to False
1159+ with AssertLogLevel (None ):
1160+ td .SteadyPotentialMonitor (size = (1 , 1 , 1 ), name = "test5" , unstructured = False )
1161+
1162+ # Should NOT warn: SteadyPotentialMonitor with unstructured explicitly set to True
1163+ with AssertLogLevel (None ):
1164+ td .SteadyPotentialMonitor (size = (1 , 1 , 1 ), name = "test6" , unstructured = True )
1165+
1166+ # Should NOT warn: monitors with unstructured: Literal[True] (always unstructured=True)
1167+ with AssertLogLevel (None ):
1168+ td .SteadyFreeCarrierMonitor (size = (1 , 1 , 1 ), name = "test7" )
1169+ td .SteadyEnergyBandMonitor (size = (1 , 1 , 1 ), name = "test8" )
1170+ td .SteadyCapacitanceMonitor (size = (1 , 1 , 1 ), name = "test9" )
1171+ td .SteadyElectricFieldMonitor (size = (1 , 1 , 1 ), name = "test10" )
1172+ td .SteadyCurrentDensityMonitor (size = (1 , 1 , 1 ), name = "test11" )
1173+ td .VolumeMeshMonitor (size = (1 , 1 , 1 ), name = "test12" )
1174+
1175+
11401176def test_heat_charge_monitors_validation (monitors ):
11411177 """Checks for no name and negative size in monitors."""
11421178 temp_mnt = monitors [0 ]
@@ -1164,7 +1200,7 @@ def test_monitor_crosses_medium(mediums, structures, heat_simulation, conduction
11641200
11651201 # Voltage monitor
11661202 volt_monitor = td .SteadyPotentialMonitor (
1167- center = (0 , 0 , 0 ), size = (td .inf , td .inf , td .inf ), name = "voltage"
1203+ center = (0 , 0 , 0 ), size = (td .inf , td .inf , td .inf ), name = "voltage" , unstructured = False
11681204 )
11691205 # A voltage monitor in a heat simulation should throw error if no ChargeConductorMedium is present
11701206 with pytest .raises (pd .ValidationError ):
@@ -1174,7 +1210,7 @@ def test_monitor_crosses_medium(mediums, structures, heat_simulation, conduction
11741210
11751211 # Temperature monitor
11761212 temp_monitor = td .TemperatureMonitor (
1177- center = (0 , 0 , 0 ), size = (td .inf , td .inf , td .inf ), name = "temperature"
1213+ center = (0 , 0 , 0 ), size = (td .inf , td .inf , td .inf ), name = "temperature" , unstructured = False
11781214 )
11791215 # A temperature monitor should throw error in a conduction simulation if no SolidSpec is present
11801216 with pytest .raises (pd .ValidationError ):
@@ -1184,7 +1220,9 @@ def test_monitor_crosses_medium(mediums, structures, heat_simulation, conduction
11841220
11851221 # check error is raised in voltage monitor doesn't cross a conducting medium
11861222 with pytest .raises (pd .ValidationError ):
1187- volt_mnt = td .SteadyPotentialMonitor (center = (0 , 0 , 0 ), size = (0 , td .inf , td .inf ))
1223+ volt_mnt = td .SteadyPotentialMonitor (
1224+ center = (0 , 0 , 0 ), size = (0 , td .inf , td .inf ), unstructured = False
1225+ )
11881226 _ = conduction_simulation .updated_copy (monitors = [volt_mnt ])
11891227
11901228
@@ -1365,7 +1403,7 @@ def test_sim_data_plotting(simulation_data):
13651403 heat_sim_data .updated_copy (data = [heat_sim_data .data [0 ]] * 2 )
13661404
13671405 # Test updating simulation data with invalid simulation
1368- temp_mnt = td .TemperatureMonitor (size = (1 , 2 , 3 ), name = "test" )
1406+ temp_mnt = td .TemperatureMonitor (size = (1 , 2 , 3 ), name = "test" , unstructured = False )
13691407 temp_mnt = temp_mnt .updated_copy (name = "test2" )
13701408
13711409 sim = heat_sim_data .simulation .updated_copy (monitors = [temp_mnt ])
@@ -1797,6 +1835,7 @@ def place_box(center_offset):
17971835 center = [0 , 0 , 0 ],
17981836 size = (td .inf , td .inf , td .inf ),
17991837 name = "test_monitor" ,
1838+ unstructured = False ,
18001839 )
18011840 ],
18021841 )
@@ -1846,7 +1885,10 @@ def test_sim_structure_extent(box_size, log_level):
18461885 grid_spec = td .UniformUnstructuredGrid (dl = 0.1 ),
18471886 monitors = [
18481887 td .SteadyPotentialMonitor (
1849- center = (0 , 0 , 0 ), size = (td .inf , td .inf , td .inf ), name = "test_monitor"
1888+ center = (0 , 0 , 0 ),
1889+ size = (td .inf , td .inf , td .inf ),
1890+ name = "test_monitor" ,
1891+ unstructured = False ,
18501892 )
18511893 ],
18521894 )
@@ -1993,8 +2035,8 @@ def test_simulation_with_multiple_sources_and_monitors(
19932035 ]
19942036
19952037 monitors = [
1996- td .TemperatureMonitor (size = (1.6 , 2 , 3 ), name = "temp_mnt1" ),
1997- td .SteadyPotentialMonitor (size = (1.6 , 2 , 3 ), name = "volt_mnt1" ),
2038+ td .TemperatureMonitor (size = (1.6 , 2 , 3 ), name = "temp_mnt1" , unstructured = False ),
2039+ td .SteadyPotentialMonitor (size = (1.6 , 2 , 3 ), name = "volt_mnt1" , unstructured = False ),
19982040 ]
19992041
20002042 boundary_spec = [
@@ -2036,7 +2078,7 @@ def test_dynamic_simulation_updates(heat_simulation):
20362078 assert updated_sim .center == new_center
20372079
20382080 # Add a new monitor
2039- new_monitor = td .TemperatureMonitor (size = (1 , 1 , 1 ), name = "new_temp_mnt" )
2081+ new_monitor = td .TemperatureMonitor (size = (1 , 1 , 1 ), name = "new_temp_mnt" , unstructured = False )
20402082 updated_sim = heat_simulation .updated_copy (
20412083 monitors = (* list (heat_simulation .monitors ), new_monitor )
20422084 )
@@ -2242,7 +2284,7 @@ def test_bandgap_monitor():
22422284def test_additional_edge_cases ():
22432285 """Test additional edge cases and error handling."""
22442286 # Attempt to create a monitor with zero size
2245- td .TemperatureMonitor (size = (0 , 0 , 0 ), name = "zero_size_mnt" )
2287+ td .TemperatureMonitor (size = (0 , 0 , 0 ), name = "zero_size_mnt" , unstructured = False )
22462288
22472289 # Create a simulation with overlapping structures
22482290 td .HeatChargeSimulation (
@@ -2652,6 +2694,7 @@ def test_heat_charge_simulation_plot():
26522694 center = (0 , 0 , 0 ),
26532695 size = (1 , 1 , 0 ),
26542696 name = "temp_mnt" ,
2697+ unstructured = False ,
26552698 )
26562699
26572700 # Create a HEAT simulation
0 commit comments