@@ -133,12 +133,32 @@ def mediums():
133
133
name = "insulator_medium" ,
134
134
)
135
135
136
+ semiconductor_medium = td .MultiPhysicsMedium (
137
+ optical = td .Medium (
138
+ permittivity = 5 ,
139
+ conductivity = 0.01 ,
140
+ heat_spec = td .SolidSpec (
141
+ capacity = 2 ,
142
+ conductivity = 3 ,
143
+ ),
144
+ ),
145
+ charge = td .SemiconductorMedium (
146
+ N_c = 1e10 ,
147
+ N_v = 1e10 ,
148
+ E_g = 1 ,
149
+ mobility_n = td .ConstantMobilityModel (mu = 1500 ),
150
+ mobility_p = td .ConstantMobilityModel (mu = 1500 ),
151
+ ),
152
+ name = "solid_medium" ,
153
+ )
154
+
136
155
return {
137
156
"fluid_medium" : fluid_medium ,
138
157
"solid_medium" : solid_medium ,
139
158
"solid_no_heat" : solid_no_heat ,
140
159
"solid_no_elect" : solid_no_elect ,
141
160
"insulator_medium" : insulator_medium ,
161
+ "semiconductor_medium" : semiconductor_medium ,
142
162
}
143
163
144
164
@@ -177,12 +197,19 @@ def structures(mediums):
177
197
name = "insulator_structure" ,
178
198
)
179
199
200
+ semiconductor_structure = td .Structure (
201
+ geometry = box ,
202
+ medium = mediums ["semiconductor_medium" ],
203
+ name = "semiconductor_structure" ,
204
+ )
205
+
180
206
return {
181
207
"fluid_structure" : fluid_structure ,
182
208
"solid_structure" : solid_structure ,
183
209
"solid_struct_no_heat" : solid_struct_no_heat ,
184
210
"solid_struct_no_elect" : solid_struct_no_elect ,
185
211
"insulator_structure" : insulator_structure ,
212
+ "semiconductor_structure" : semiconductor_structure ,
186
213
}
187
214
188
215
@@ -336,7 +363,12 @@ def voltage_capacitance_simulation(mediums, structures, boundary_conditions, mon
336
363
bc_insulating = td .InsulatingBC ()
337
364
pl7 = td .HeatChargeBoundarySpec (
338
365
condition = bc_insulating ,
339
- placement = td .StructureBoundary (structure = "solid_structure" ),
366
+ placement = td .StructureBoundary (structure = "semiconductor_structure" ),
367
+ )
368
+
369
+ # we need two voltage BCs for Charge simulations
370
+ pl8 = pl7 .updated_copy (
371
+ condition = td .VoltageBC (source = td .DCVoltageSource (voltage = 0 )),
340
372
)
341
373
342
374
# Let’s pick a couple of monitors. We'll definitely include the CapacitanceMonitor
@@ -349,10 +381,10 @@ def voltage_capacitance_simulation(mediums, structures, boundary_conditions, mon
349
381
# Build a new HeatChargeSimulation
350
382
voltage_cap_sim = td .HeatChargeSimulation (
351
383
medium = mediums ["insulator_medium" ],
352
- structures = [structures ["insulator_structure" ], structures ["solid_structure " ]],
384
+ structures = [structures ["insulator_structure" ], structures ["semiconductor_structure " ]],
353
385
center = (0 , 0 , 0 ),
354
386
size = (2 , 2 , 2 ),
355
- boundary_spec = [pl6 , pl7 ],
387
+ boundary_spec = [pl6 , pl7 , pl8 ],
356
388
grid_spec = grid_specs ["uniform" ],
357
389
sources = [],
358
390
monitors = chosen_monitors ,
@@ -1123,6 +1155,13 @@ def place_box(center_offset):
1123
1155
)
1124
1156
],
1125
1157
grid_spec = td .UniformUnstructuredGrid (dl = 0.1 ),
1158
+ monitors = [
1159
+ td .SteadyPotentialMonitor (
1160
+ center = [0 , 0 , 0 ],
1161
+ size = (td .inf , td .inf , td .inf ),
1162
+ name = "test_monitor" ,
1163
+ )
1164
+ ],
1126
1165
)
1127
1166
1128
1167
# Create all permutations of squares being shifted 1, -1, or zero in all three directions
@@ -1165,6 +1204,11 @@ def test_sim_structure_extent(box_size, log_level):
1165
1204
)
1166
1205
],
1167
1206
grid_spec = td .UniformUnstructuredGrid (dl = 0.1 ),
1207
+ monitors = [
1208
+ td .SteadyPotentialMonitor (
1209
+ center = (0 , 0 , 0 ), size = (td .inf , td .inf , td .inf ), name = "test_monitor"
1210
+ )
1211
+ ],
1168
1212
)
1169
1213
1170
1214
@@ -1705,3 +1749,75 @@ def test_unsteady_heat_analysis(heat_simulation):
1705
1749
unsteady_spec = td .UnsteadySpec (time_step = 0.1 , total_time_steps = 100000 ),
1706
1750
)
1707
1751
_ = unsteady_sim .updated_copy (analysis_spec = mew_spex )
1752
+
1753
+
1754
+ def test_heat_conduction_simulations ():
1755
+ """Test that heat-conduction simulations have necessary components."""
1756
+
1757
+ # let's create some mediums
1758
+ solid_medium = td .MultiPhysicsMedium (
1759
+ heat = td .SolidSpec (conductivity = 1 ),
1760
+ charge = td .ChargeConductorMedium (conductivity = 1 ),
1761
+ name = "solid_medium" ,
1762
+ )
1763
+ air = td .MultiPhysicsMedium (heat = td .FluidSpec (), charge = td .ChargeInsulatorMedium (), name = "air" )
1764
+
1765
+ struct1 = td .Structure (
1766
+ geometry = td .Box (center = (0 , 0 , 0 ), size = (1 , 1 , 1 )),
1767
+ medium = solid_medium ,
1768
+ name = "struct1" ,
1769
+ )
1770
+
1771
+ # thermal BC
1772
+ thermal_bc = td .HeatChargeBoundarySpec (
1773
+ condition = td .TemperatureBC (temperature = 300 ),
1774
+ placement = td .StructureBoundary (structure = "struct1" ),
1775
+ )
1776
+
1777
+ # electric BCs
1778
+ electric_bc = td .HeatChargeBoundarySpec (
1779
+ condition = td .VoltageBC (source = td .DCVoltageSource (voltage = [1 ])),
1780
+ placement = td .StructureBoundary (structure = "struct1" ),
1781
+ )
1782
+
1783
+ # thermal monitors
1784
+ temp_monitor = td .TemperatureMonitor (
1785
+ center = (0 , 0 , 0 ), size = (1 , 1 , 1 ), name = "temp_monitor" , unstructured = True
1786
+ )
1787
+ # electric monitors
1788
+ voltage_monitor = td .SteadyPotentialMonitor (
1789
+ center = (0 , 0 , 0 ), size = (1 , 1 , 1 ), name = "voltage_monitor" , unstructured = True
1790
+ )
1791
+
1792
+ sim = td .HeatChargeSimulation (
1793
+ medium = air ,
1794
+ structures = [struct1 ],
1795
+ center = (0 , 0 , 0 ),
1796
+ size = (3 , 3 , 3 ),
1797
+ boundary_spec = [thermal_bc , electric_bc ],
1798
+ grid_spec = td .UniformUnstructuredGrid (dl = 0.1 ),
1799
+ sources = [],
1800
+ monitors = [temp_monitor , voltage_monitor ],
1801
+ )
1802
+
1803
+ with pytest .raises (pd .ValidationError ):
1804
+ # no thermal monitors
1805
+ _ = sim .updated_copy (monitors = [voltage_monitor ])
1806
+
1807
+ with pytest .raises (pd .ValidationError ):
1808
+ # voltage array in electric BC
1809
+ _ = sim .updated_copy (
1810
+ boundary_spec = [
1811
+ thermal_bc ,
1812
+ electric_bc .updated_copy (
1813
+ condition = td .VoltageBC (source = td .DCVoltageSource (voltage = [1 , 2 ]))
1814
+ ),
1815
+ ]
1816
+ )
1817
+
1818
+ # this doesn't raise error
1819
+ coupling_sim = sim .updated_copy (sources = [td .HeatFromElectricSource ()])
1820
+
1821
+ with pytest .raises (pd .ValidationError ):
1822
+ # This should error since the conduction simulation doesn't have a monitor
1823
+ _ = sim .updated_copy (monitors = [temp_monitor ])
0 commit comments