Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IsotropicChargeDriftModel and add more materials #431

Merged
merged 5 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
model: IsotropicChargeDriftModel
mobilities:
e: 1000cm^2/(V*s)
h: 1000cm^2/(V*s)
2 changes: 2 additions & 0 deletions ext/Geant4/io_gdml.jl
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ end
elseif material == "Polyethylene Naphthalate" return "G4_PEN"
elseif material == "Polytetrafluorethylen" return "G4_PTFE"
elseif material == "Cadmium zinc telluride" return "G4_CdZnTe"
elseif material == "CsPbBr3" return "G4_CsPbBr3"
elseif material == "Lead" return "G4_Pb"
end
throw("Material characteristics for \"$(material)\" not defined yet")
end
22 changes: 22 additions & 0 deletions ext/Geant4/materials.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,26 @@
<fraction n="0.0278" ref="G4_Zn" />
<fraction n="0.5422" ref="G4_Te" />
</material>

<element name="G4_Cs" Z="55">
<atom value="132.9054" />
</element>
<element name="G4_Pb" Z="82">
<atom value="207.2" />
</element>
<element name="G4_Br" Z="35">
<atom value="79.904" />
</element>

<material name="G4_CsPbBr3" formula="CsPbBr3">
<D value="4.73" unit="g/cm3" />
<fraction n="0.2292" ref="G4_Cs" />
<fraction n="0.3574" ref="G4_Pb" />
<fraction n="0.4134" ref="G4_Br" />
</material>

<material name="G4_Pb" Z="82">
<D value="11.34" />
<atom value="207.2" />
</material>
</materials>
3 changes: 2 additions & 1 deletion src/ChargeDriftModels/ChargeDriftModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ abstract type AbstractChargeDriftModel{T <: SSDFloat} end
abstract type AbstractTemperatureModel{T <: SSDFloat} end

include("ElectricFieldChargeDriftModel/ElectricFieldChargeDriftModel.jl")
include("ADLChargeDriftModel/ADLChargeDriftModel.jl")
include("ADLChargeDriftModel/ADLChargeDriftModel.jl")
include("IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl")
Original file line number Diff line number Diff line change
@@ -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
18 changes: 17 additions & 1 deletion src/MaterialProperties/MaterialProperties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,21 @@ material_properties[:CdZnTe] = (
ϵ_r = 10.9,
ρ = 5.78u"g*cm^-3"
)

abstract type CsPbBr3 <: AbstractDriftMaterial end
Symbol(::Type{CsPbBr3}) = :CsPbBr3
material_properties[:CsPbBr3] = (
name = "CsPbBr3",
E_ionisation = 6.9u"eV",
ϵ_r = 16.46,
ρ = 4.73u"g*cm^-3"
)

material_properties[:Pb] = (
name = "Lead",
ϵ_r = 1e6, # high value for lead as for conductor. Usage of lead is shielding.
ρ = 11.35u"g*cm^-3"
)
# Add new materials above this line
# and just put different spellings into the dict `materials` below

Expand All @@ -101,7 +116,8 @@ materials = Dict{String, Symbol}(
"Al" => :Al,
"LAr" => :LAr,
"CZT" => :CdZnTe,
"Si" => :Si
"Si" => :Si,
"Lead" => :Pb
)


Expand Down
2 changes: 1 addition & 1 deletion src/SolidStateDetectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down