Repository: JuliaPhysics/SolidStateDetectors.jl
Pull request #475: Add support for simulation for dead layer-Step1: position dependent mobility function
Author: login: zpdg
Created: 2025-04-14T12:37:14Z | Merged: 2025-04-14T15:19:53Z

Changes:
1. pass the `current_pos` parameter in the `_get_driftvectors!` function:
```
function _get_driftvectors!(step_vectors::Vector{CartesianVector{T}}, done::Vector{Bool}, Δt::T, cdm::AbstractChargeDriftModel{T}, current_pos::Vector{CartesianPoint{T}}, ::Type{Hole})::Nothing where {T <: SSDFloat}
    for n in eachindex(step_vectors)
        if !done[n]
            step_vectors[n] = getVh(SVector{3,T}(step_vectors[n]), cdm, current_pos[n]) * Δt
        end
    end
    nothing
end
```

2. add the `current_pos` in the three built-in drifting models
3. add a true coaxial detector yaml for this pr test and future dead layer simulation test

Test for this pr: 
1. Construct a z-linear mobility model
2. Put charge at r = 5 mm, z = 10-90% of max z. The pulse should have slower rising edge while z is bigger.
<img width="497" alt="image" src="https://github.com/user-attachments/assets/9947b4a7-60bd-4257-a3b3-201be21b4a79" />

Code for the test:
```julia
using Plots
using Pkg

Pkg.develop(path="./SolidStateDetectors.jl")
using SolidStateDetectors
using Revise

using Unitful

T = Float32
sim = Simulation{T}(SSD_examples[:TrueCoaxial])
det_rin=1/1000 # m
det_r=10/1000 # m
det_z=10/1000 # m

refinement_limits = [0.2,0.06,0.02]
calculate_electric_potential!(sim, refinement_limits = refinement_limits, verbose = false, depletion_handling = true)
calculate_electric_field!(sim, n_points_in_φ = 2)
for contact_id in [1,2]
    contact=sim.detector.contacts[contact_id]
    calculate_weighting_potential!(sim, contact.id, refinement_limits = refinement_limits,
    n_points_in_φ = 2, verbose = false,depletion_handling = true)
end


using SolidStateDetectors: SSDFloat, AbstractChargeDriftModel
struct CustomChargeDriftModel{T <: SSDFloat} <: AbstractChargeDriftModel{T} 
    det_z::T # in m
    calculate_mobility::Function
end
using StaticArrays
function SolidStateDetectors.getVe(fv::SVector{3, T}, cdm::CustomChargeDriftModel, current_pos::CartesianPoint{T})::SVector{3, T} where {T <: SSDFloat}
    mu0=cdm.calculate_mobility(current_pos[3])
    return -fv*mu0
end
function SolidStateDetectors.getVh(fv::SVector{3, T}, cdm::CustomChargeDriftModel, current_pos::CartesianPoint{T})::SVector{3, T} where {T <: SSDFloat}
    mu0=cdm.calculate_mobility(current_pos[3])
    return fv*mu0
end
function calculate_mobility(z)
    # the mobility is linear in z
    z/det_z*4.2 # in m2/V/s
end
charge_drift_model = CustomChargeDriftModel{T}(det_z,calculate_mobility) # calculate_mobility in m2/V/s
sim.detector = SolidStateDetector(sim.detector, charge_drift_model)


# test
plot()
for z_percent in 10:20:90
    z=det_z*z_percent/100
    r=det_r/2
    pointN=500
    energy_depos = [1] * u"keV"
    starting_positions = [CylindricalPoint{T}(r, deg2rad(0), z)]
    evt1 = Event(starting_positions, energy_depos);

    simulate!(evt1, sim, Δt = 1u"ns",max_nsteps=pointN)
    plot!(evt1.waveforms[1]
    , lw = 1.5, xlabel = "Time", ylabel = "Charge"
    ,label="z = $(z_percent)%"
    ,unitformat = :slash, legend = true, tickfontsize = 12, guidefontsize = 14,xlim=[0,pointN])
end
display(plot!())

```


Diff:
diff --git a/examples/example_config_files/public_TrueCoaxial.yaml b/examples/example_config_files/public_TrueCoaxial.yaml
new file mode 100644
index 000000000..2550881cf
--- /dev/null
+++ b/examples/example_config_files/public_TrueCoaxial.yaml
@@ -0,0 +1,67 @@
+name: TrueCoaxial
+units:
+  length: mm
+  angle: deg
+  potential: V
+  temperature: K
+grid:
+  coordinates: cylindrical
+  axes:
+    r:
+      to: 10.01
+      boundaries: inf
+    phi:
+      from: 0
+      to: 0
+      boundaries:
+        left: periodic
+        right: periodic
+    z:
+      from: -0.01
+      to: 10.01
+      boundaries:
+        left: inf
+        right: inf
+medium: vacuum
+detectors:
+- semiconductor:
+    material: HPGe
+    temperature: 77
+    impurity_density:
+      name: constant
+      value: 1e8cm^-3
+    charge_drift_model:
+      include: ADLChargeDriftModel/drift_velocity_config.yaml
+    geometry:
+      cone:
+        r:
+          from: 1.0
+          to: 10.0
+        h: 10 
+        origin:
+          z: 5
+  contacts:
+    - name: "P+"
+      id: 1
+      material: HPGe
+      potential: -500
+      geometry:
+        tube:
+          r:
+            from: 0.5
+            to: 1
+          h: 10
+          origin:
+            z: 5
+    - name: "N+"
+      id: 2
+      material: HPGe
+      potential: 0
+      geometry:
+        tube:
+          r:
+            from: 10.0
+            to: 10.5
+          h: 10.
+          origin:
+            z: 5
\ No newline at end of file
diff --git a/src/ChargeDrift/ChargeDrift.jl b/src/ChargeDrift/ChargeDrift.jl
index e8daf9ac4..12c2d34fc 100644
--- a/src/ChargeDrift/ChargeDrift.jl
+++ b/src/ChargeDrift/ChargeDrift.jl
@@ -147,19 +147,19 @@ function _modulate_driftvectors!(step_vectors::Vector{CartesianVector{T}}, curre
 end
 _modulate_driftvectors!(step_vectors::Vector{CartesianVector{T}}, current_pos::Vector{CartesianPoint{T}}, ::Missing) where {T <: SSDFloat} = nothing
 
-function _get_driftvectors!(step_vectors::Vector{CartesianVector{T}}, done::Vector{Bool}, Δt::T, cdm::AbstractChargeDriftModel{T}, ::Type{Electron})::Nothing where {T <: SSDFloat}
+function _get_driftvectors!(step_vectors::Vector{CartesianVector{T}}, done::Vector{Bool}, Δt::T, cdm::AbstractChargeDriftModel{T}, current_pos::Vector{CartesianPoint{T}}, ::Type{Electron})::Nothing where {T <: SSDFloat}
     for n in eachindex(step_vectors)
         if !done[n]
-            step_vectors[n] = getVe(SVector{3,T}(step_vectors[n]), cdm) * Δt
+            step_vectors[n] = getVe(SVector{3,T}(step_vectors[n]), cdm, current_pos[n]) * Δt
         end
     end
     nothing
 end
 
-function _get_driftvectors!(step_vectors::Vector{CartesianVector{T}}, done::Vector{Bool}, Δt::T, cdm::AbstractChargeDriftModel{T}, ::Type{Hole})::Nothing where {T <: SSDFloat}
+function _get_driftvectors!(step_vectors::Vector{CartesianVector{T}}, done::Vector{Bool}, Δt::T, cdm::AbstractChargeDriftModel{T}, current_pos::Vector{CartesianPoint{T}}, ::Type{Hole})::Nothing where {T <: SSDFloat}
     for n in eachindex(step_vectors)
         if !done[n]
-            step_vectors[n] = getVh(SVector{3,T}(step_vectors[n]), cdm) * Δt
+            step_vectors[n] = getVh(SVector{3,T}(step_vectors[n]), cdm, current_pos[n]) * Δt
         end
     end
     nothing
@@ -299,7 +299,7 @@ function _drift_charge!(
         _set_to_zero_vector!(step_vectors)
         _add_fieldvector_drift!(step_vectors, current_pos, done, electric_field, det, S)
         self_repulsion && _add_fieldvector_selfrepulsion!(step_vectors, current_pos, done, charges, ϵ_r)
-        _get_driftvectors!(step_vectors, done, Δt, det.semiconductor.charge_drift_model, CC)
+        _get_driftvectors!(step_vectors, done, Δt, det.semiconductor.charge_drift_model, current_pos, CC)
         diffusion && _add_fieldvector_diffusion!(step_vectors, done, diffusion_length)
         _modulate_driftvectors!(step_vectors, current_pos, det.virtual_drift_volumes)
         _check_and_update_position!(step_vectors, current_pos, done, normal, drift_path, timestamps, istep, det, grid, point_types, startpos, Δt, verbose)
diff --git a/src/ChargeDriftModels/ADLChargeDriftModel/ADLChargeDriftModel.jl b/src/ChargeDriftModels/ADLChargeDriftModel/ADLChargeDriftModel.jl
index 58b329705..29f824c6c 100644
--- a/src/ChargeDriftModels/ADLChargeDriftModel/ADLChargeDriftModel.jl
+++ b/src/ChargeDriftModels/ADLChargeDriftModel/ADLChargeDriftModel.jl
@@ -319,7 +319,7 @@ end
     AE, RE
 end
 
-
+getVe(fv::SVector{3, T}, cdm::ADLChargeDriftModel{T}, ::CartesianPoint{T}, Emag_threshold::T = T(1e-5)) where {T} = getVe(fv, cdm, Emag_threshold)
 @fastmath function getVe(fv::SVector{3, T}, cdm::ADLChargeDriftModel{T,M,N}, Emag_threshold::T = T(1e-5))::SVector{3, T} where {T <: SSDFloat, M, N}
     @inbounds begin
         Emag::T = norm(fv)
@@ -373,6 +373,7 @@ end
     p1 * x + p2 * x^2 + p3 * x^3 + p4 * x^4
 end
 
+getVh(fv::SVector{3,T}, cdm::ADLChargeDriftModel{T}, ::CartesianPoint{T}, Emag_threshold::T = T(1e-5)) where {T <: SSDFloat} = getVh(fv, cdm, Emag_threshold)
 @fastmath function getVh(fv::SVector{3,T}, cdm::ADLChargeDriftModel{T, M}, Emag_threshold::T = T(1e-5))::SVector{3,T} where {T <: SSDFloat, M}
     @inbounds begin
         Emag::T = norm(fv)
diff --git a/src/ChargeDriftModels/ElectricFieldChargeDriftModel/ElectricFieldChargeDriftModel.jl b/src/ChargeDriftModels/ElectricFieldChargeDriftModel/ElectricFieldChargeDriftModel.jl
index d7bae28a2..d117655cc 100644
--- a/src/ChargeDriftModels/ElectricFieldChargeDriftModel/ElectricFieldChargeDriftModel.jl
+++ b/src/ChargeDriftModels/ElectricFieldChargeDriftModel/ElectricFieldChargeDriftModel.jl
@@ -10,5 +10,5 @@ struct ElectricFieldChargeDriftModel{T <: SSDFloat} <: AbstractChargeDriftModel{
 end
 
 ElectricFieldChargeDriftModel(T::Type{<:SSDFloat}) = ElectricFieldChargeDriftModel{T}()
-getVe(fv::SVector{3, T}, cdm::ElectricFieldChargeDriftModel) where {T <: SSDFloat} = -fv
-getVh(fv::SVector{3, T}, cdm::ElectricFieldChargeDriftModel) where {T <: SSDFloat} = fv
\ No newline at end of file
+getVe(fv::SVector{3, T}, cdm::ElectricFieldChargeDriftModel, current_pos::CartesianPoint{T} = zero(CartesianPoint{T})) where {T <: SSDFloat} = -fv
+getVh(fv::SVector{3, T}, cdm::ElectricFieldChargeDriftModel, current_pos::CartesianPoint{T} = zero(CartesianPoint{T})) where {T <: SSDFloat} = fv
\ No newline at end of file
diff --git a/src/ChargeDriftModels/IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl b/src/ChargeDriftModels/IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl
index b6dd89f31..1dbeea454 100644
--- a/src/ChargeDriftModels/IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl
+++ b/src/ChargeDriftModels/IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl
@@ -39,13 +39,13 @@ function IsotropicChargeDriftModel{T}(config::AbstractDict) where {T <: SSDFloat
     IsotropicChargeDriftModel{T}(config["mobilities"]["e"], config["mobilities"]["h"])
 end
 
-@fastmath function getVe(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}) where {T <: SSDFloat}
+@fastmath function getVe(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}, current_pos::CartesianPoint{T} = zero(CartesianPoint{T})) where {T <: SSDFloat}
     @inbounds begin 
         -cdm.μ_e*fv
     end
 end
 
-@fastmath function getVh(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}) where {T <: SSDFloat}
+@fastmath function getVh(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}, current_pos::CartesianPoint{T} = zero(CartesianPoint{T})) where {T <: SSDFloat}
     @inbounds begin 
         cdm.μ_h*fv
     end
diff --git a/src/examples.jl b/src/examples.jl
index 4aed9f851..ffb6932ad 100644
--- a/src/examples.jl
+++ b/src/examples.jl
@@ -25,6 +25,7 @@ sim = Simulation(path_to_config_file)
 """
 const SSD_examples = Dict{Symbol,String}([
     :TwoSpheresCapacitor                     => joinpath(get_path_to_example_config_files(), "two_spheres_capacitor.yaml"),
+    :TrueCoaxial                             => joinpath(get_path_to_example_config_files(), "public_TrueCoaxial.yaml"),
     :InvertedCoax                            => joinpath(get_path_to_example_config_files(), "public_ivc_config.yaml"),
     :InvertedCoaxInCryostat                  => joinpath(get_path_to_example_config_files(), "ivc_splitted_config/public_ivc_cryostat_config.yaml"),
     :InvertedCoaxTrapping                    => joinpath(get_path_to_example_config_files(), "public_ivc_trapping_config.yaml"),


Reviews:
user: login: fhagemann
state: CHANGES_REQUESTED
author_association: COLLABORATOR
submitted_at: 2025-04-14T12:56:31Z
user: login: zpdg
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T13:15:35Z
user: login: fhagemann
state: CHANGES_REQUESTED
author_association: COLLABORATOR
submitted_at: 2025-04-14T14:40:38Z

Review comments:
diff_hunk: @@ -0,0 +1,75 @@
+name: TrueCoaxial
+units:
+  length: mm
+  angle: deg
+  potential: V
+  temperature: K
+grid:
+  coordinates: cylindrical
+  axes:
+    r:
+      to: 10.01
+      boundaries: inf
+    phi:
+      from: 0
+      to: 120
+      boundaries:
+        left: periodic
+        right: periodic
path: examples/example_config_files/public_TrueCoaxial.yaml
user: login: fhagemann
body: Is there any reason not making this 2D ?
```suggestion
    phi:
      from: 0
      to: 0
      boundaries:
        left: periodic
        right: periodic
```
created_at: 2025-04-14T12:49:39Z
author_association: COLLABORATOR
diff_hunk: @@ -320,7 +320,7 @@ end
 end
 
 
-@fastmath function getVe(fv::SVector{3, T}, cdm::ADLChargeDriftModel{T,M,N}, Emag_threshold::T = T(1e-5))::SVector{3, T} where {T <: SSDFloat, M, N}
+@fastmath function getVe(fv::SVector{3, T}, cdm::ADLChargeDriftModel{T,M,N}, current_pos::CartesianPoint{T}, Emag_threshold::T = T(1e-5))::SVector{3, T} where {T <: SSDFloat, M, N}
path: src/ChargeDriftModels/ADLChargeDriftModel/ADLChargeDriftModel.jl
user: login: fhagemann
body: To not have this breaking, I would suggest not modifying this function, but adding a new one which could be something like
```julia
getVe(fv::SVector{3, T}, cdm::ADLChargeDriftModel{T}, ::CartesianPoint{T}, Emag_threshold::T = T(1e-5)) where {T <: SSDFloat} = getVe(fv, cdm, Emag_threshold)
```
and keep the old method as is.
created_at: 2025-04-14T12:52:07Z
author_association: COLLABORATOR
diff_hunk: @@ -373,7 +373,7 @@ end
     p1 * x + p2 * x^2 + p3 * x^3 + p4 * x^4
 end
 
-@fastmath function getVh(fv::SVector{3,T}, cdm::ADLChargeDriftModel{T, M}, Emag_threshold::T = T(1e-5))::SVector{3,T} where {T <: SSDFloat, M}
+@fastmath function getVh(fv::SVector{3,T}, cdm::ADLChargeDriftModel{T, M}, current_pos::CartesianPoint{T}, Emag_threshold::T = T(1e-5))::SVector{3,T} where {T <: SSDFloat, M}
path: src/ChargeDriftModels/ADLChargeDriftModel/ADLChargeDriftModel.jl
user: login: fhagemann
body: same thing here
created_at: 2025-04-14T12:52:18Z
author_association: COLLABORATOR
diff_hunk: @@ -10,5 +10,5 @@ struct ElectricFieldChargeDriftModel{T <: SSDFloat} <: AbstractChargeDriftModel{
 end
 
 ElectricFieldChargeDriftModel(T::Type{<:SSDFloat}) = ElectricFieldChargeDriftModel{T}()
-getVe(fv::SVector{3, T}, cdm::ElectricFieldChargeDriftModel) where {T <: SSDFloat} = -fv
-getVh(fv::SVector{3, T}, cdm::ElectricFieldChargeDriftModel) where {T <: SSDFloat} = fv
\ No newline at end of file
+getVe(fv::SVector{3, T}, cdm::ElectricFieldChargeDriftModel, current_pos::CartesianPoint{T}) where {T <: SSDFloat} = -fv
+getVh(fv::SVector{3, T}, cdm::ElectricFieldChargeDriftModel, current_pos::CartesianPoint{T}) where {T <: SSDFloat} = fv
path: src/ChargeDriftModels/ElectricFieldChargeDriftModel/ElectricFieldChargeDriftModel.jl
user: login: fhagemann
body: Here, you could just add a default value
```suggestion
getVe(fv::SVector{3, T}, cdm::ElectricFieldChargeDriftModel, current_pos::CartesianPoint{T} = zero(CartesianPoint{T})) where {T <: SSDFloat} = -fv
getVh(fv::SVector{3, T}, cdm::ElectricFieldChargeDriftModel, current_pos::CartesianPoint{T} = zero(CartesianPoint{T})) where {T <: SSDFloat} = fv
```
then, this is also non-breaking
created_at: 2025-04-14T12:52:58Z
author_association: COLLABORATOR
diff_hunk: @@ -39,13 +39,13 @@ function IsotropicChargeDriftModel{T}(config::AbstractDict) where {T <: SSDFloat
     IsotropicChargeDriftModel{T}(config["mobilities"]["e"], config["mobilities"]["h"])
 end
 
-@fastmath function getVe(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}) where {T <: SSDFloat}
+@fastmath function getVe(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}, current_pos::CartesianPoint{T}) where {T <: SSDFloat}
path: src/ChargeDriftModels/IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl
user: login: fhagemann
body: Also, add default here:
```suggestion
@fastmath function getVe(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}, current_pos::CartesianPoint{T} = zero(CartesianPoint{T})) where {T <: SSDFloat}
```
created_at: 2025-04-14T12:53:51Z
author_association: COLLABORATOR
diff_hunk: @@ -39,13 +39,13 @@ function IsotropicChargeDriftModel{T}(config::AbstractDict) where {T <: SSDFloat
     IsotropicChargeDriftModel{T}(config["mobilities"]["e"], config["mobilities"]["h"])
 end
 
-@fastmath function getVe(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}) where {T <: SSDFloat}
+@fastmath function getVe(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}, current_pos::CartesianPoint{T}) where {T <: SSDFloat}
     @inbounds begin 
         -cdm.μ_e*fv
     end
 end
 
-@fastmath function getVh(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}) where {T <: SSDFloat}
+@fastmath function getVh(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}, current_pos::CartesianPoint{T}) where {T <: SSDFloat}
path: src/ChargeDriftModels/IsotropicChargeDriftModel/IsotropicChargeDriftModel.jl
user: login: fhagemann
body: and here:
```suggestion
@fastmath function getVh(fv::SVector{3, T}, cdm::IsotropicChargeDriftModel{T}, current_pos::CartesianPoint{T} = zero(CartesianPoint{T})) where {T <: SSDFloat}
```
created_at: 2025-04-14T12:54:17Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,75 @@
+name: TrueCoaxial
+units:
+  length: mm
+  angle: deg
+  potential: V
+  temperature: K
+grid:
+  coordinates: cylindrical
+  axes:
+    r:
+      to: 10.01
+      boundaries: inf
+    phi:
+      from: 0
+      to: 120
+      boundaries:
+        left: periodic
+        right: periodic
+    z:
+      from: -0.01
+      to: 10.01
+      boundaries:
+        left: inf
+        right: inf
+medium: vacuum
+detectors:
+- semiconductor:
+    material: HPGe
+    temperature: 77
+    impurity_density:
+      name: "constant"
path: examples/example_config_files/public_TrueCoaxial.yaml
user: login: fhagemann
body: No need to put `"` in YAML:
```suggestion
      name: constant
```
created_at: 2025-04-14T12:54:53Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,75 @@
+name: TrueCoaxial
+units:
+  length: mm
+  angle: deg
+  potential: V
+  temperature: K
+grid:
+  coordinates: cylindrical
+  axes:
+    r:
+      to: 10.01
+      boundaries: inf
+    phi:
+      from: 0
+      to: 120
+      boundaries:
+        left: periodic
+        right: periodic
+    z:
+      from: -0.01
+      to: 10.01
+      boundaries:
+        left: inf
+        right: inf
+medium: vacuum
+detectors:
+- semiconductor:
+    material: HPGe
+    temperature: 77
+    impurity_density:
+      name: "constant"
+      value: 1e8cm^-3
+    charge_drift_model:
+      include: ADLChargeDriftModel/drift_velocity_config.yaml
+    geometry:
+      cone:
+        r:
+          bottom:
+            from: 1.0
+            to: 10.0
+          top:
+            from: 1.0
+            to: 10.0    
path: examples/example_config_files/public_TrueCoaxial.yaml
user: login: fhagemann
body: If `top` and `bottom` is the same, you can just write:
```suggestion
        r:
          from: 1.0
          to: 10.0
```
created_at: 2025-04-14T12:55:26Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,75 @@
+name: TrueCoaxial
+units:
+  length: mm
+  angle: deg
+  potential: V
+  temperature: K
+grid:
+  coordinates: cylindrical
+  axes:
+    r:
+      to: 10.01
+      boundaries: inf
+    phi:
+      from: 0
+      to: 120
+      boundaries:
+        left: periodic
+        right: periodic
+    z:
+      from: -0.01
+      to: 10.01
+      boundaries:
+        left: inf
+        right: inf
+medium: vacuum
+detectors:
+- semiconductor:
+    material: HPGe
+    temperature: 77
+    impurity_density:
+      name: "constant"
+      value: 1e8cm^-3
+    charge_drift_model:
+      include: ADLChargeDriftModel/drift_velocity_config.yaml
+    geometry:
+      cone:
+        r:
+          bottom:
+            from: 1.0
+            to: 10.0
+          top:
+            from: 1.0
+            to: 10.0    
+        h: 10 
+        origin:
+          z: 5
+  contacts:
+    - name: "P+"
+      id: 1
+      material: HPGe
+      potential: -500
+      geometry:
+        tube:
+          r:
+            from: 0.5
+            to: 1
+          h: 10
+          origin:
+            z: 5
+    - name: "N+"
+      id: 2
+      material: HPGe
+      potential: 0
+      geometry:
+        tube:
+          r:
+            bottom:
+              from: 10.0
+              to: 10.5
+            top:
+              from: 10.
+              to: 10.5
+          h: 10.
path: examples/example_config_files/public_TrueCoaxial.yaml
user: login: fhagemann
body: same thing here:
```suggestion
          r:
            from: 10.0
            to: 10.5
          h: 10.0
```
created_at: 2025-04-14T12:56:00Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,75 @@
+name: TrueCoaxial
+units:
+  length: mm
+  angle: deg
+  potential: V
+  temperature: K
+grid:
+  coordinates: cylindrical
+  axes:
+    r:
+      to: 10.01
+      boundaries: inf
+    phi:
+      from: 0
+      to: 120
+      boundaries:
+        left: periodic
+        right: periodic
path: examples/example_config_files/public_TrueCoaxial.yaml
user: login: zpdg
body: Ah, this is better. I just didn't know we can set the range with 0-0.
created_at: 2025-04-14T13:15:35Z
author_association: CONTRIBUTOR
diff_hunk: @@ -319,8 +319,7 @@ end
     AE, RE
 end
 
-
-@fastmath function getVe(fv::SVector{3, T}, cdm::ADLChargeDriftModel{T,M,N}, Emag_threshold::T = T(1e-5))::SVector{3, T} where {T <: SSDFloat, M, N}
+@fastmath function getVe(fv::SVector{3, T}, cdm::ADLChargeDriftModel{T,M,N}, current_pos::CartesianPoint{T} = zero(CartesianPoint{T}), Emag_threshold::T = T(1e-5))::SVector{3, T} where {T <: SSDFloat, M, N}
path: src/ChargeDriftModels/ADLChargeDriftModel/ADLChargeDriftModel.jl
user: login: fhagemann
body: Here, I would still split `getVe` into two methods (the old one remaining ontouched, and adding a new one with `current_pos`:
```suggestion
getVe(fv::SVector{3, T}, cdm::ADLChargeDriftModel{T}, ::CartesianPoint{T}, Emag_threshold::T = T(1e-5)) where {T} = getVe(fv, cdm, Emag_threshold)

@fastmath function getVe(fv::SVector{3, T}, cdm::ADLChargeDriftModel{T,M,N}, Emag_threshold::T = T(1e-5))::SVector{3, T} where {T <: SSDFloat, M, N}
```
created_at: 2025-04-14T14:38:50Z
author_association: COLLABORATOR
diff_hunk: @@ -373,7 +372,7 @@ end
     p1 * x + p2 * x^2 + p3 * x^3 + p4 * x^4
 end
 
-@fastmath function getVh(fv::SVector{3,T}, cdm::ADLChargeDriftModel{T, M}, Emag_threshold::T = T(1e-5))::SVector{3,T} where {T <: SSDFloat, M}
+@fastmath function getVh(fv::SVector{3,T}, cdm::ADLChargeDriftModel{T, M}, current_pos::CartesianPoint{T} = zero(CartesianPoint{T}), Emag_threshold::T = T(1e-5))::SVector{3,T} where {T <: SSDFloat, M}
path: src/ChargeDriftModels/ADLChargeDriftModel/ADLChargeDriftModel.jl
user: login: fhagemann
body: same thing here:
```suggestion
getVh(fv::SVector{3,T}, cdm::ADLChargeDriftModel{T}, ::CartesianPoint{T}, Emag_threshold::T = T(1e-5)) where {T <: SSDFloat} = getVh(fv, cdm, Emag_threshold)

@fastmath function getVh(fv::SVector{3,T}, cdm::ADLChargeDriftModel{T, M}, Emag_threshold::T = T(1e-5))::SVector{3,T} where {T <: SSDFloat, M}
```
created_at: 2025-04-14T14:39:58Z
author_association: COLLABORATOR

PR comments:
user: login: fhagemann
created_at: 2025-04-14T12:57:03Z
body: This looks good in general. I would suggest to modify the changes such that they are non-breaking. See comments above
author_association: COLLABORATOR
user: login: fhagemann
created_at: 2025-04-14T12:58:32Z
body: Tests are failing because some functions were modified. This should be fixed when adding defaults or still allowing for the old function call.
author_association: COLLABORATOR
user: login: zpdg
created_at: 2025-04-14T13:43:46Z
body: > Tests are failing because some functions were modified. This should be fixed when adding defaults or still allowing for the old function call.

Sorry, new to this. The new commit will solve these breakings.
author_association: CONTRIBUTOR
user: login: fhagemann
created_at: 2025-04-14T14:35:32Z
body: I'm redirecting this PR to the branch `transition` instead of `main`, so that we can gather all code changes there for now.
author_association: COLLABORATOR
user: login: fhagemann
created_at: 2025-04-14T14:41:16Z
body: The old `getVe` and `getVh` for `ADLChargeDriftModel` should remain untouched, but you can add new methods to fallback to them (see code suggestions above)
author_association: COLLABORATOR
user: login: zpdg
created_at: 2025-04-14T14:50:48Z
body: > The old `getVe` and `getVh` for `ADLChargeDriftModel` should remain untouched, but you can add new methods to fallback to them (see code suggestions above)

Sure, it's done. But, what' the difference? 
author_association: CONTRIBUTOR
user: login: fhagemann
created_at: 2025-04-14T14:55:52Z
body: > > The old `getVe` and `getVh` for `ADLChargeDriftModel` should remain untouched, but you can add new methods to fallback to them (see code suggestions above)
> 
> Sure, it's done. But, what' the difference?

In this case, the third argument already has a default value.
So, if someone where to call
```julia
getVe(fv, cdm, 1e-5)
```
that would have worked with the old code, but not with the new one (because the third argument would now be forced to be a `CartesianVector{T}` (instead of just `T`). This way, `julia` can choose the correct method based on the type of the third argument.
author_association: COLLABORATOR
user: login: zpdg
created_at: 2025-04-14T14:59:19Z
body: @fhagemann 
I see. Should I make new PRs for more steps, or use this PR and change the branch name and the PR title to "DeadlayerSimulation" instead of one step name
author_association: CONTRIBUTOR
user: login: fhagemann
created_at: 2025-04-14T15:01:09Z
body: I would propose to merge this PR as is, and to create a new one on top, also onto the `JuliaPhysics#transition` branch.
author_association: COLLABORATOR
user: login: zpdg
created_at: 2025-04-14T15:04:04Z
body: > I would propose to merge this PR as is, and to create a new one on top, also onto the `JuliaPhysics#transition` branch.

Okay, I agree. This way seems more clear. I will create more PRs then. 
author_association: CONTRIBUTOR