From cf9def525afe8ae899040c7e95667c21998f68e5 Mon Sep 17 00:00:00 2001 From: Padniuk Date: Mon, 11 Nov 2024 15:02:32 +0100 Subject: [PATCH] Add IsotropicChargeDriftModel --- .../IsotropicChargeDriftModel/mobilities.yaml | 4 ++ src/ChargeDriftModels/ChargeDriftModels.jl | 3 +- .../IsotropicChargeDriftModel.jl | 52 +++++++++++++++++++ src/SolidStateDetectors.jl | 2 +- 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 examples/example_config_files/IsotropicChargeDriftModel/mobilities.yaml create mode 100644 src/ChargeDriftModels/IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl diff --git a/examples/example_config_files/IsotropicChargeDriftModel/mobilities.yaml b/examples/example_config_files/IsotropicChargeDriftModel/mobilities.yaml new file mode 100644 index 000000000..22d411429 --- /dev/null +++ b/examples/example_config_files/IsotropicChargeDriftModel/mobilities.yaml @@ -0,0 +1,4 @@ +model: IsotropicChargeDriftModel +mobilities: + e: 1000cm^2/(V*s) + h: 1000cm^2/(V*s) \ No newline at end of file diff --git a/src/ChargeDriftModels/ChargeDriftModels.jl b/src/ChargeDriftModels/ChargeDriftModels.jl index ca1ef911a..99af6da45 100644 --- a/src/ChargeDriftModels/ChargeDriftModels.jl +++ b/src/ChargeDriftModels/ChargeDriftModels.jl @@ -2,4 +2,5 @@ abstract type AbstractChargeDriftModel{T <: SSDFloat} end abstract type AbstractTemperatureModel{T <: SSDFloat} end include("ElectricFieldChargeDriftModel/ElectricFieldChargeDriftModel.jl") -include("ADLChargeDriftModel/ADLChargeDriftModel.jl") \ No newline at end of file +include("ADLChargeDriftModel/ADLChargeDriftModel.jl") +include("IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl") diff --git a/src/ChargeDriftModels/IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl b/src/ChargeDriftModels/IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl new file mode 100644 index 000000000..b6dd89f31 --- /dev/null +++ b/src/ChargeDriftModels/IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl @@ -0,0 +1,52 @@ +""" + struct IsotropicChargeDriftModel{T <: SSDFloat} <: AbstractChargeDriftModel{T} + +Charge drift model in which the electrons and holes drift along the electric field with a constant mobility in m²/Vs + +## Fields +- `μ_e::Union{RealQuantity, AbstractString}`: Mobility of the electrons in m²/Vs. +- `μ_h::Union{RealQuantity, AbstractString}`: Mobility of the holes in m²/Vs. + +""" +struct IsotropicChargeDriftModel{T <: SSDFloat} <: AbstractChargeDriftModel{T} + μ_e::T + μ_h::T + IsotropicChargeDriftModel{T}( + μ_e::Union{RealQuantity, AbstractString}, + μ_h::Union{RealQuantity, AbstractString} + ) where {T <: SSDFloat} = new{T}(_parse_value.(T, (μ_e, μ_h), internal_mobility_unit)...) +end + +IsotropicChargeDriftModel(args...; T::Type = Float32, kwargs...) = IsotropicChargeDriftModel{T}(args...; kwargs...) + +const default_icd_config_file = joinpath(get_path_to_example_config_files(), "IsotropicChargeDriftModel/mobilities.yaml") + +function IsotropicChargeDriftModel{T}(config_filename::AbstractString = default_icd_config_file) where {T <: SSDFloat} + IsotropicChargeDriftModel(parse_config_file(config_filename)) +end + +function IsotropicChargeDriftModel{T}(config::AbstractDict) where {T <: SSDFloat} + if !haskey(config, "mobilities") + throw(ConfigFileError("IsotropicChargeDriftModel config file needs entry 'mobilities'.")) + end + + for axis in ("e", "h") + if !haskey(config["mobilities"], axis) + throw(ConfigFileError("IsotropicChargeDriftModel config file needs entry 'mobilities/$axis'.")) + end + end + + IsotropicChargeDriftModel{T}(config["mobilities"]["e"], config["mobilities"]["h"]) +end + +@fastmath function getVe(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}) where {T <: SSDFloat} + @inbounds begin + -cdm.μ_e*fv + end +end + +@fastmath function getVh(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}) where {T <: SSDFloat} + @inbounds begin + cdm.μ_h*fv + end +end \ No newline at end of file diff --git a/src/SolidStateDetectors.jl b/src/SolidStateDetectors.jl index 39c75ca2e..d190223f4 100644 --- a/src/SolidStateDetectors.jl +++ b/src/SolidStateDetectors.jl @@ -67,7 +67,7 @@ export Grid, GridPoint export ElectricPotential, PointTypes, EffectiveChargeDensity, DielectricDistribution, WeightingPotential, ElectricField export apply_initial_state! export calculate_electric_potential!, calculate_weighting_potential!, calculate_electric_field!, calculate_drift_fields! -export ElectricFieldChargeDriftModel, ADLChargeDriftModel +export ElectricFieldChargeDriftModel, ADLChargeDriftModel, IsotropicChargeDriftModel export NoChargeTrappingModel, BoggsChargeTrappingModel export get_active_volume, is_depleted, estimate_depletion_voltage export calculate_stored_energy, calculate_mutual_capacitance, calculate_capacitance_matrix