-
Notifications
You must be signed in to change notification settings - Fork 1
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
Geselowitz ECG + Poisson reconstruction #85
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume further progress is blocked until we have subdomains or intergrid transfer operators merged?
|
||
ecg_reconst_cache = Thunderbolt.Potse2006ECGPoissonReconstructionCache(problem, κ, κ) | ||
|
||
u = zeros(Thunderbolt.solution_size(problem.A)) | ||
|
||
κ = ConstantCoefficient(SymmetricTensor{2,3,Float64}((1.0, 0, 0, 1.0, 0, 1.0))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ecg_reconst_cache = Thunderbolt.Potse2006ECGPoissonReconstructionCache(problem, κ, κ) | |
u = zeros(Thunderbolt.solution_size(problem.A)) | |
κ = ConstantCoefficient(SymmetricTensor{2,3,Float64}((1.0, 0, 0, 1.0, 0, 1.0))) | |
ecg_reconst_cache = Thunderbolt.Potse2006ECGPoissonReconstructionCache(problem, κ, κ) | |
u = zeros(Thunderbolt.solution_size(problem.A)) | |
κ = ConstantCoefficient(SymmetricTensor{2,3,Float64}((1.0, 0, 0, 1.0, 0, 1.0))) |
author="Ogiermann, Dennis | ||
and Balzani, Daniel | ||
and Perotti, Luigi E.", | ||
editor="Ennis, Daniel B. | ||
and Perotti, Luigi E. | ||
and Wang, Vicky Y.", | ||
title="The Effect of Modeling Assumptions on the ECG in Monodomain and Bidomain Simulations", | ||
booktitle="Functional Imaging and Modeling of the Heart", | ||
year="2021", | ||
publisher="Springer International Publishing", | ||
address="Cham", | ||
pages="503--514", | ||
isbn="978-3-030-78710-3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting
(0.0, 50.0), | ||
steady_state_initializer, | ||
iocb_ | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) | |
) | |
@@ -54,6 +54,7 @@ struct ConstantCoefficient{T} | |||
val::T | |||
end | |||
|
|||
Base.:(-)(cc::ConstantCoefficient) = ConstantCoefficient(-cc.val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? I am not sure if we should do this, because this might be error prone for users (and internals).
@@ -137,6 +138,8 @@ end | |||
@inline _eval_sdt_coefficient(M::SVector{MS}, λ::SVector{λS}) where {MS, λS} = error("Incompatible dimensions! dim(M)=$MS dim(λ)=$λS") | |||
@inline _eval_sdt_coefficient(M::SVector{rdim,<:Vec{sdim}}, λ::SVector{rdim}) where {rdim,sdim} = sum(i->λ[i] * M[i] ⊗ M[i], 1:rdim; init=zero(Tensor{2,sdim})) | |||
|
|||
Base.:(-)(cc::SpectralTensorCoefficient) = SpectralTensorCoefficient(-cc.eigenvalues, cc.eigenvectors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
|
||
The important simplifications taken are: | ||
1. Surrounding volume is an infinite, homogeneous sphere with isotropic conductivity | ||
2. The extracellular space and surrounding volume share the same isotropic, homogeneous conductivity tensor | ||
""" | ||
struct Plonsey1964ECGGaussCache{BUF, CV, G} | ||
struct Plonsey1964ECGGaussCache{BUF, CV, DH <: DofHandler, κT} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct Plonsey1964ECGGaussCache{BUF, CV, DH <: DofHandler, κT} | |
struct Plonsey1964ECGGaussCache{BUF, CV, DH <: AbstractDofHandler, κT} |
Maybe?
f = zeros(ndofs(dh_Z)) | ||
v = zeros(size(Z,1)) | ||
|
||
integrator = BilinearDiffusionIntegrator(-κ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can alternatively change the sign of the right hand side.
function _compute_lead_field(f, ∇Z, Z, op, p, electrodes::AbstractArray{Vec{3, T}}) where T | ||
_add_electrode(f, op.dh, electrodes[1], true) | ||
_add_electrode(f, op.dh, electrodes[2], false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add the electrodes every time?
Also, since we need 2 electrodes at a time why not simply a static array?
function _compute_lead_field(f, ∇Z, Z, op, p, electrodes::AbstractArray{Vec{3, T}}) where T | ||
_add_electrode(f, op.dh, electrodes[1], true) | ||
_add_electrode(f, op.dh, electrodes[2], false) | ||
(temp, _) = Krylov.cg(op.A,f, M=p, ldiv = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check for convergence failure here. Also, you can solve inplcae with Krylov.jl https://jso.dev/Krylov.jl/dev/solvers/spd/#Krylov.cg! .
as proposed in [PotDubRicVinGul:2006:cmb](@cite) and mentioned in [OgiBalPer:2021:ema](@cite). Where κ is the bulk conductivity tensor, and κᵢ is the intracellular conductivity tensor. The cache includes the assembled | ||
stiffness matrix with applied homogeneous Dirichlet boundary condition at the first vertex of the mesh. As the problem is solved for each timestep with only the right hand side changing. | ||
|
||
TODO: Implement [BisPla:2011:bes](@cite) to improve the precision. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there some specific blocker for this?
For #71 and #72