Skip to content

Commit c27caa6

Browse files
committed
output fr change
1 parent 893f6fe commit c27caa6

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
lines changed

tests/test_components/test_heat_charge.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -1566,34 +1566,28 @@ def test_unsteady_parameters():
15661566

15671567
_ = td.UnsteadyHeatAnalysis(
15681568
initial_temperature=300,
1569-
unsteady_spec=td.UnsteadySpec(time_step=0.1, total_time_steps=1, output_fr=2),
1569+
unsteady_spec=td.UnsteadySpec(time_step=0.1, total_time_steps=1),
15701570
)
15711571

15721572
# test non-positive initial temperature raises error
15731573
with pytest.raises(pd.ValidationError):
15741574
_ = td.UnsteadyHeatAnalysis(
15751575
initial_temperature=0,
1576-
unsteady_spec=td.UnsteadySpec(time_step=0.1, total_time_steps=1, output_fr=2),
1576+
unsteady_spec=td.UnsteadySpec(time_step=0.1, total_time_steps=1),
15771577
)
15781578

15791579
# test negative time step raises error
15801580
with pytest.raises(pd.ValidationError):
15811581
_ = td.UnsteadyHeatAnalysis(
15821582
initial_temperature=10,
1583-
unsteady_spec=td.UnsteadySpec(time_step=-0.1, total_time_steps=1, output_fr=2),
1583+
unsteady_spec=td.UnsteadySpec(time_step=-0.1, total_time_steps=1),
15841584
)
15851585

15861586
# test negative total time steps raises error
15871587
with pytest.raises(pd.ValidationError):
15881588
_ = td.UnsteadyHeatAnalysis(
15891589
initial_temperature=10,
1590-
unsteady_spec=td.UnsteadySpec(time_step=0.1, total_time_steps=-1, output_fr=2),
1591-
)
1592-
# test negative output frequency raises error
1593-
with pytest.raises(pd.ValidationError):
1594-
_ = td.UnsteadyHeatAnalysis(
1595-
initial_temperature=10,
1596-
unsteady_spec=td.UnsteadySpec(time_step=0.1, total_time_steps=1, output_fr=-2),
1590+
unsteady_spec=td.UnsteadySpec(time_step=0.1, total_time_steps=-1),
15971591
)
15981592

15991593

@@ -1602,11 +1596,15 @@ def test_unsteady_heat_analysis(heat_simulation):
16021596

16031597
unsteady_analysis_spec = td.UnsteadyHeatAnalysis(
16041598
initial_temperature=300,
1605-
unsteady_spec=td.UnsteadySpec(time_step=0.1, total_time_steps=1, output_fr=2),
1599+
unsteady_spec=td.UnsteadySpec(time_step=0.1, total_time_steps=1),
16061600
)
16071601

16081602
temp_mnt = td.TemperatureMonitor(
1609-
center=(0, 0, 0), size=(td.inf, td.inf, td.inf), name="temperature", unstructured=True
1603+
center=(0, 0, 0),
1604+
size=(td.inf, td.inf, td.inf),
1605+
name="temperature",
1606+
unstructured=True,
1607+
interval=2,
16101608
)
16111609

16121610
# this should work since the monitor is unstructured
@@ -1617,3 +1615,7 @@ def test_unsteady_heat_analysis(heat_simulation):
16171615
with pytest.raises(pd.ValidationError):
16181616
temp_mnt = temp_mnt.updated_copy(unstructured=False)
16191617
_ = unsteady_sim.updated_copy(monitors=[temp_mnt])
1618+
1619+
with pytest.raises(pd.ValidationError):
1620+
temp_mnt = temp_mnt.updated_copy(unstructured=True, interval=0)
1621+
_ = unsteady_sim.updated_copy(monitors=[temp_mnt])

tidy3d/components/tcad/analysis/heat_simulation_type.py

-7
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ class UnsteadySpec(Tidy3dBaseModel):
3232
description="Specifies the total number of time steps run during the simulation.",
3333
)
3434

35-
output_fr: pd.PositiveInt = pd.Field(
36-
1,
37-
title="Output frequency",
38-
description="Determines how often output files will be written. I.e., an output "
39-
"file will be written every 'output_fr' time steps.",
40-
)
41-
4235

4336
class UnsteadyHeatAnalysis(Tidy3dBaseModel):
4437
"""
+11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
"""Objects that define how data is recorded from simulation."""
22

3+
import pydantic.v1 as pd
4+
35
from tidy3d.components.tcad.monitors.abstract import HeatChargeMonitor
46

57

68
class TemperatureMonitor(HeatChargeMonitor):
79
"""Temperature monitor."""
10+
11+
interval: pd.PositiveInt = pd.Field(
12+
1,
13+
title="Interval",
14+
description="Sampling rate of the monitor: number of time steps between each measurement. "
15+
"Set ``interval`` to 1 for the highest possible resolution in time. "
16+
"Higher integer values down-sample the data by measuring every ``interval`` time steps. "
17+
"This can be useful for reducing data storage as needed by the application.",
18+
)

tidy3d/components/tcad/simulation/heat_charge.py

-1
Original file line numberDiff line numberDiff line change
@@ -1660,7 +1660,6 @@ def _get_simulation_types(self) -> list[TCADAnalysisTypes]:
16601660
return [TCADAnalysisTypes.CHARGE]
16611661

16621662
# check if unsteady heat
1663-
# NOTE: this won't work
16641663
if isinstance(self.analysis_spec, UnsteadyHeatAnalysis):
16651664
return [TCADAnalysisTypes.HEAT]
16661665

0 commit comments

Comments
 (0)