Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/api/charge/mediums.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Generation Recombination
tidy3d.AugerRecombination
tidy3d.RadiativeRecombination
tidy3d.ShockleyReedHallRecombination
tidy3d.FossumCarrierLifetime
tidy3d.DistributedGeneration


Doping
Expand Down
34 changes: 34 additions & 0 deletions schemas/EMESimulation.json
Original file line number Diff line number Diff line change
Expand Up @@ -3670,6 +3670,37 @@
],
"type": "object"
},
"DistributedGeneration": {
"additionalProperties": false,
"properties": {
"attrs": {
"default": {},
"type": "object"
},
"rate": {
"properties": {
"_dims": {
"type": "Tuple[str, ...]"
}
},
"required": [
"_dims"
],
"type": "xr.DataArray"
},
"type": {
"default": "DistributedGeneration",
"enum": [
"DistributedGeneration"
],
"type": "string"
}
},
"required": [
"rate"
],
"type": "object"
},
"Drude": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -9211,6 +9242,9 @@
{
"$ref": "#/definitions/AugerRecombination"
},
{
"$ref": "#/definitions/DistributedGeneration"
},
{
"$ref": "#/definitions/RadiativeRecombination"
},
Expand Down
34 changes: 34 additions & 0 deletions schemas/HeatChargeSimulation.json
Original file line number Diff line number Diff line change
Expand Up @@ -3082,6 +3082,37 @@
],
"type": "object"
},
"DistributedGeneration": {
"additionalProperties": false,
"properties": {
"attrs": {
"default": {},
"type": "object"
},
"rate": {
"properties": {
"_dims": {
"type": "Tuple[str, ...]"
}
},
"required": [
"_dims"
],
"type": "xr.DataArray"
},
"type": {
"default": "DistributedGeneration",
"enum": [
"DistributedGeneration"
],
"type": "string"
}
},
"required": [
"rate"
],
"type": "object"
},
"Drude": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -6389,6 +6420,9 @@
{
"$ref": "#/definitions/AugerRecombination"
},
{
"$ref": "#/definitions/DistributedGeneration"
},
{
"$ref": "#/definitions/RadiativeRecombination"
},
Expand Down
34 changes: 34 additions & 0 deletions schemas/HeatSimulation.json
Original file line number Diff line number Diff line change
Expand Up @@ -3082,6 +3082,37 @@
],
"type": "object"
},
"DistributedGeneration": {
"additionalProperties": false,
"properties": {
"attrs": {
"default": {},
"type": "object"
},
"rate": {
"properties": {
"_dims": {
"type": "Tuple[str, ...]"
}
},
"required": [
"_dims"
],
"type": "xr.DataArray"
},
"type": {
"default": "DistributedGeneration",
"enum": [
"DistributedGeneration"
],
"type": "string"
}
},
"required": [
"rate"
],
"type": "object"
},
"Drude": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -6389,6 +6420,9 @@
{
"$ref": "#/definitions/AugerRecombination"
},
{
"$ref": "#/definitions/DistributedGeneration"
},
{
"$ref": "#/definitions/RadiativeRecombination"
},
Expand Down
34 changes: 34 additions & 0 deletions schemas/ModeSimulation.json
Original file line number Diff line number Diff line change
Expand Up @@ -3763,6 +3763,37 @@
],
"type": "object"
},
"DistributedGeneration": {
"additionalProperties": false,
"properties": {
"attrs": {
"default": {},
"type": "object"
},
"rate": {
"properties": {
"_dims": {
"type": "Tuple[str, ...]"
}
},
"required": [
"_dims"
],
"type": "xr.DataArray"
},
"type": {
"default": "DistributedGeneration",
"enum": [
"DistributedGeneration"
],
"type": "string"
}
},
"required": [
"rate"
],
"type": "object"
},
"Drude": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -8877,6 +8908,9 @@
{
"$ref": "#/definitions/AugerRecombination"
},
{
"$ref": "#/definitions/DistributedGeneration"
},
{
"$ref": "#/definitions/RadiativeRecombination"
},
Expand Down
34 changes: 34 additions & 0 deletions schemas/Simulation.json
Original file line number Diff line number Diff line change
Expand Up @@ -4982,6 +4982,37 @@
],
"type": "object"
},
"DistributedGeneration": {
"additionalProperties": false,
"properties": {
"attrs": {
"default": {},
"type": "object"
},
"rate": {
"properties": {
"_dims": {
"type": "Tuple[str, ...]"
}
},
"required": [
"_dims"
],
"type": "xr.DataArray"
},
"type": {
"default": "DistributedGeneration",
"enum": [
"DistributedGeneration"
],
"type": "string"
}
},
"required": [
"rate"
],
"type": "object"
},
"Drude": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -12721,6 +12752,9 @@
{
"$ref": "#/definitions/AugerRecombination"
},
{
"$ref": "#/definitions/DistributedGeneration"
},
{
"$ref": "#/definitions/RadiativeRecombination"
},
Expand Down
34 changes: 34 additions & 0 deletions schemas/TerminalComponentModeler.json
Original file line number Diff line number Diff line change
Expand Up @@ -5290,6 +5290,37 @@
],
"type": "object"
},
"DistributedGeneration": {
"additionalProperties": false,
"properties": {
"attrs": {
"default": {},
"type": "object"
},
"rate": {
"properties": {
"_dims": {
"type": "Tuple[str, ...]"
}
},
"required": [
"_dims"
],
"type": "xr.DataArray"
},
"type": {
"default": "DistributedGeneration",
"enum": [
"DistributedGeneration"
],
"type": "string"
}
},
"required": [
"rate"
],
"type": "object"
},
"Drude": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -13204,6 +13235,9 @@
{
"$ref": "#/definitions/AugerRecombination"
},
{
"$ref": "#/definitions/DistributedGeneration"
},
{
"$ref": "#/definitions/RadiativeRecombination"
},
Expand Down
51 changes: 51 additions & 0 deletions tests/test_components/test_heat_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2215,3 +2215,54 @@ def test_heat_conduction_simulations():
medium=struct1.medium.updated_copy(charge=td.ChargeInsulatorMedium)
)
_ = sim.updated_copy(structures=[struct_error])


def test_generation_recombination():
"""Test that generation and recombination models are properly defined."""

# Create a spatial data array for generation rate
x = [1, 2]
y = [2, 3, 4]
z = [3, 4, 5, 6]
coords = {"x": x, "y": y, "z": z}
fd = td.SpatialDataArray(np.random.random((2, 3, 4)), coords=coords)

# make sure we can create a DistributedGeneration
_ = td.DistributedGeneration(rate=fd)

# check that unit conversion works
g_um3 = fd.sel(x=1, y=2, z=3).item()
new_g = td.DistributedGeneration.from_rate_um3(fd)
assert new_g.rate.sel(x=1, y=2, z=3).item() == g_um3 * 1e12

# make sure an error is raised if input array is 1D
with pytest.raises(ValueError):
rate1D = td.SpatialDataArray(
np.random.random((5, 1, 1)), coords={"x": [1, 2, 3, 4, 5], "y": [1], "z": [1]}
)
_ = td.DistributedGeneration(rate=rate1D)

# make sure we can build Fossum
tau_fossum = td.FossumCarrierLifetime(
tau_300=3.3e-6, alpha_T=-0.5, N0=7.1e15, A=1, B=0, C=1, alpha=1
)

# make sure we can build AugerRecombination
_ = td.AugerRecombination(
c_n=2.8e-31,
c_p=9.9e-32,
)

# make sure we can build RadiativeRecombination
_ = td.RadiativeRecombination(r_const=1.6e-14)

# make sure we can build ShockleyReedHallRecombination
_ = td.ShockleyReedHallRecombination(
tau_n=3.3e-6,
tau_p=4e-6,
)

_ = td.ShockleyReedHallRecombination(
tau_n=tau_fossum,
tau_p=tau_fossum,
)
2 changes: 2 additions & 0 deletions tidy3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
ConstantMobilityModel,
ConvectionBC,
CurrentBC,
DistributedGeneration,
HeatFluxBC,
HeatFromElectricSource,
HeatSource,
Expand Down Expand Up @@ -501,6 +502,7 @@ def set_logging_level(level: str) -> None:
"DirectivityData",
"DirectivityMonitor",
"DistanceUnstructuredGrid",
"DistributedGeneration",
"Drude",
"EMECoefficientData",
"EMECoefficientDataArray",
Expand Down
Loading
Loading