Skip to content

Commit bbe0d31

Browse files
committed
Fixing formatting and minor error
1 parent a058736 commit bbe0d31

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

tidy3d/components/tcad/boundary/heat.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class HeatFluxBC(HeatChargeBC):
4040
units=HEAT_FLUX,
4141
)
4242

43-
#TODO Should I adapt to Tidy3D units (e.g. micrometers), or keep the original ones?
43+
44+
# TODO Should I adapt to Tidy3D units (e.g. micrometers), or keep the original ones?
4445
THERMAL_CONDUCTIVITY_UNITS = "W/(m*K)"
4546
DYNAMIC_VISCOSITY_UNITS = "Pa*s"
4647
SPECIFIC_HEAT_UNITS = "J/(kg*K)"
@@ -49,6 +50,7 @@ class HeatFluxBC(HeatChargeBC):
4950
LENGTH_UNITS = "m"
5051
ACCELERATION_UNITS = "m/s**2"
5152

53+
5254
class NaturalConvectionVerticalSpec(HeatChargeBC):
5355
"""
5456
Specification for natural convection from a vertical plate.
@@ -58,6 +60,7 @@ class NaturalConvectionVerticalSpec(HeatChargeBC):
5860
values as 'base' and 'exponent' for a generalized heat flux equation
5961
q = base * (T_surf - T_fluid)^exponent.
6062
"""
63+
6164
# --- Input Parameters ---
6265
fluid_k: pd.NonNegativeFloat = pd.Field(
6366
title="Fluid Thermal Conductivity",
@@ -98,14 +101,9 @@ class NaturalConvectionVerticalSpec(HeatChargeBC):
98101
)
99102

100103
def _compute_parameters(self):
101-
102104
# Calculate the Rayleigh Number (Ra_L)
103105
rayleigh_numerator_notemp = (
104-
self.gravity
105-
* self.fluid_beta
106-
* self.fluid_rho ** 2
107-
* self.fluid_Cp
108-
* self.plate_L ** 3
106+
self.gravity * self.fluid_beta * self.fluid_rho**2 * self.fluid_Cp * self.plate_L**3
109107
)
110108
rayleigh_denominator = self.fluid_mu * self.fluid_k
111109
Ra_L = rayleigh_numerator_notemp / rayleigh_denominator
@@ -122,19 +120,22 @@ def _compute_parameters(self):
122120
if Ra_L <= 1e9:
123121
# Laminar Flow
124122
h_factor_linear = 0.68
125-
h_factor_non_linear = (0.670 * Ra_L ** (1 / 6)) / pr_denominator
123+
h_factor_non_linear = (0.670 * Ra_L ** (1 / 6)) / pr_denominator
126124
elif 1e9 < Ra_L <= 1e13:
127125
# Turbulent Flow
128126
h_factor_linear = 0.825
129127
h_factor_non_linear = (0.387 * Ra_L ** (1 / 6)) / pr_denominator
130128
else:
131-
raise ValueError(f"Ra_l={Ra_L} should be smaller than 1e13 for NaturalConvectionVerticalSpec")
129+
raise ValueError(
130+
f"Ra_L={Ra_L} should be smaller than 1e13 for NaturalConvectionVerticalSpec"
131+
)
132132

133133
h = (self.fluid_k / self.plate_L) * h_factor_linear
134134
h_nonlinear = (self.fluid_k / self.plate_L) * h_factor_non_linear
135-
exponent = 1 + 1/6
135+
exponent = 1 + 1 / 6
136136
return h, h_nonlinear, exponent
137137

138+
138139
class ConvectionBC(HeatChargeBC):
139140
"""Convective thermal boundary conditions.
140141
@@ -156,6 +157,7 @@ class ConvectionBC(HeatChargeBC):
156157
units=HEAT_TRANSFER_COEFF,
157158
)
158159

159-
#TODO Maybe I should find a better place for these lines.
160+
161+
# TODO Maybe I should find a better place for these lines.
160162
NaturalConvectionVerticalSpec.update_forward_refs()
161163
ConvectionBC.update_forward_refs()

tidy3d/components/tcad/types.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44

55
from tidy3d.components.tcad.bandgap import SlotboomBandGapNarrowing
66
from tidy3d.components.tcad.boundary.charge import CurrentBC, InsulatingBC, VoltageBC
7-
from tidy3d.components.tcad.boundary.heat import ConvectionBC, HeatFluxBC, TemperatureBC, NaturalConvectionVerticalSpec
7+
from tidy3d.components.tcad.boundary.heat import (
8+
ConvectionBC,
9+
HeatFluxBC,
10+
TemperatureBC,
11+
NaturalConvectionVerticalSpec,
12+
)
813
from tidy3d.components.tcad.generation_recombination import (
914
AugerRecombination,
1015
RadiativeRecombination,

0 commit comments

Comments
 (0)