From d18a1fef9d965e1e9332c5eeacf781dcbdad7643 Mon Sep 17 00:00:00 2001 From: Matteo Salvador <44835004+MatteoSalvador@users.noreply.github.com> Date: Tue, 31 Oct 2023 10:31:45 -0700 Subject: [PATCH] Bueno-Orovio parameters (#130) * Expose tau_fi and tau_si from BO in the XML interface * Tests --- Code/Source/svFSI/CepModBo.h | 2 +- Code/Source/svFSI/Parameters.cpp | 3 +++ Code/Source/svFSI/Parameters.h | 3 +++ Code/Source/svFSI/distribute.cpp | 3 +++ Code/Source/svFSI/read_files.cpp | 4 ++++ .../result_BICG_CN_epicardium_BO_001.vtu | 3 +++ .../result_BICG_CN_myocardium_BO_001.vtu | 3 --- .../result_CG_RK4_endocardium_BO_001.vtu | 3 --- .../result_CG_RK4_myocardium_BO_001.vtu | 3 +++ ..._BO.xml => svFSI_BICG_CN_epicardium_BO.xml} | 18 +++--------------- ...m_BO.xml => svFSI_CG_RK4_myocardium_BO.xml} | 4 ++-- tests/test_integration.py | 4 ++-- 12 files changed, 27 insertions(+), 26 deletions(-) create mode 100644 tests/cases/niederer_benchmark_ECGs_quadrature/result_BICG_CN_epicardium_BO_001.vtu delete mode 100644 tests/cases/niederer_benchmark_ECGs_quadrature/result_BICG_CN_myocardium_BO_001.vtu delete mode 100644 tests/cases/niederer_benchmark_ECGs_quadrature/result_CG_RK4_endocardium_BO_001.vtu create mode 100644 tests/cases/niederer_benchmark_ECGs_quadrature/result_CG_RK4_myocardium_BO_001.vtu rename tests/cases/niederer_benchmark_ECGs_quadrature/{svFSI_BICG_CN_myocardium_BO.xml => svFSI_BICG_CN_epicardium_BO.xml} (89%) rename tests/cases/niederer_benchmark_ECGs_quadrature/{svFSI_CG_RK4_endocardium_BO.xml => svFSI_CG_RK4_myocardium_BO.xml} (97%) diff --git a/Code/Source/svFSI/CepModBo.h b/Code/Source/svFSI/CepModBo.h index 56ad6c5c..f8a577e9 100644 --- a/Code/Source/svFSI/CepModBo.h +++ b/Code/Source/svFSI/CepModBo.h @@ -36,7 +36,7 @@ #include "Vector.h" #include -using BoModelParam = std::array; +using BoModelParam = Vector; /// @brief This module defines data structures for Bueno-Orovio cellular /// activation model for cardiac electrophysiology. diff --git a/Code/Source/svFSI/Parameters.cpp b/Code/Source/svFSI/Parameters.cpp index 8e4a0933..29faf91d 100644 --- a/Code/Source/svFSI/Parameters.cpp +++ b/Code/Source/svFSI/Parameters.cpp @@ -1234,6 +1234,9 @@ DomainParameters::DomainParameters() set_parameter("G_Ks", 0.392, !required, G_Ks); set_parameter("G_to", 0.294, !required, G_to); + set_parameter("tau_fi", 0.110, !required, tau_fi); + set_parameter("tau_si", 1.88750, !required, tau_si); + set_parameter("ODE_solver", "euler", !required, ode_solver); set_parameter("Penalty_parameter", 0.0, !required, penalty_parameter); diff --git a/Code/Source/svFSI/Parameters.h b/Code/Source/svFSI/Parameters.h index a4233000..98ace5e1 100644 --- a/Code/Source/svFSI/Parameters.h +++ b/Code/Source/svFSI/Parameters.h @@ -1009,6 +1009,9 @@ class DomainParameters : public ParameterLists Parameter G_Ks; Parameter G_to; + Parameter tau_fi; + Parameter tau_si; + Parameter ode_solver; Parameter penalty_parameter; Parameter poisson_ratio; diff --git a/Code/Source/svFSI/distribute.cpp b/Code/Source/svFSI/distribute.cpp index 972b89d0..eca9cada 100644 --- a/Code/Source/svFSI/distribute.cpp +++ b/Code/Source/svFSI/distribute.cpp @@ -1043,6 +1043,9 @@ void dist_eq(ComMod& com_mod, const CmMod& cm_mod, const cmType& cm, const std:: cm.bcast(cm_mod, &cep_mod.ttp.G_Kr); cm.bcast(cm_mod, cep_mod.ttp.G_Ks); cm.bcast(cm_mod, cep_mod.ttp.G_to); + + cm.bcast(cm_mod, cep_mod.bo.tau_si); + cm.bcast(cm_mod, cep_mod.bo.tau_fi); } if ((dmn.phys == EquationType::phys_struct) || (dmn.phys == EquationType::phys_ustruct)) { diff --git a/Code/Source/svFSI/read_files.cpp b/Code/Source/svFSI/read_files.cpp index 1a821016..ba64b464 100644 --- a/Code/Source/svFSI/read_files.cpp +++ b/Code/Source/svFSI/read_files.cpp @@ -867,6 +867,10 @@ void read_cep_domain(Simulation* simulation, EquationParameters* eq_params, Doma if (domain_params->G_to.defined()) { cep_mod.ttp.G_to[lDmn.cep.imyo - 1] = domain_params->G_to.value(); } if (domain_params->G_CaL.defined()) { cep_mod.ttp.G_CaL = domain_params->G_CaL.value(); } + // Set Bo parameters. + // + if (domain_params->tau_si.defined()) { cep_mod.bo.tau_si[lDmn.cep.imyo - 1] = domain_params->tau_si.value(); } + if (domain_params->tau_fi.defined()) { cep_mod.bo.tau_fi[lDmn.cep.imyo - 1] = domain_params->tau_fi.value(); } // Set stimulus parameters. // diff --git a/tests/cases/niederer_benchmark_ECGs_quadrature/result_BICG_CN_epicardium_BO_001.vtu b/tests/cases/niederer_benchmark_ECGs_quadrature/result_BICG_CN_epicardium_BO_001.vtu new file mode 100644 index 00000000..03842bc3 --- /dev/null +++ b/tests/cases/niederer_benchmark_ECGs_quadrature/result_BICG_CN_epicardium_BO_001.vtu @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6af5a1ba655072991230391acabfddff4cb3a34b0a5c81241ee4a311aa550fe3 +size 8305950 diff --git a/tests/cases/niederer_benchmark_ECGs_quadrature/result_BICG_CN_myocardium_BO_001.vtu b/tests/cases/niederer_benchmark_ECGs_quadrature/result_BICG_CN_myocardium_BO_001.vtu deleted file mode 100644 index b332caa0..00000000 --- a/tests/cases/niederer_benchmark_ECGs_quadrature/result_BICG_CN_myocardium_BO_001.vtu +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:73e3586bb76e28f89c64120172c30cc8d0982d0a702e84661f6bb5749fd158c0 -size 8315415 diff --git a/tests/cases/niederer_benchmark_ECGs_quadrature/result_CG_RK4_endocardium_BO_001.vtu b/tests/cases/niederer_benchmark_ECGs_quadrature/result_CG_RK4_endocardium_BO_001.vtu deleted file mode 100644 index 03bb339e..00000000 --- a/tests/cases/niederer_benchmark_ECGs_quadrature/result_CG_RK4_endocardium_BO_001.vtu +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b6e00cbfbe76beaebc5527b7416aa965d3b400e962357e25677d3392353cbf2f -size 8289563 diff --git a/tests/cases/niederer_benchmark_ECGs_quadrature/result_CG_RK4_myocardium_BO_001.vtu b/tests/cases/niederer_benchmark_ECGs_quadrature/result_CG_RK4_myocardium_BO_001.vtu new file mode 100644 index 00000000..91f6d532 --- /dev/null +++ b/tests/cases/niederer_benchmark_ECGs_quadrature/result_CG_RK4_myocardium_BO_001.vtu @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd7cc1fa1369a3965e615577e1f9c584cd794013794cf0d1077217a19b2ac88f +size 8279618 diff --git a/tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_BICG_CN_myocardium_BO.xml b/tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_BICG_CN_epicardium_BO.xml similarity index 89% rename from tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_BICG_CN_myocardium_BO.xml rename to tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_BICG_CN_epicardium_BO.xml index 386bfcd0..dd22ab3c 100644 --- a/tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_BICG_CN_myocardium_BO.xml +++ b/tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_BICG_CN_epicardium_BO.xml @@ -73,16 +73,10 @@ BO - 14.838 - 3.98E-5 - 0.153 - 0.392 - 0.294 - 0.012571 0.082715 - myocardium + epicardium CN @@ -90,16 +84,10 @@ BO - 14.838 - 3.98E-5 - 0.153 - 0.392 - 0.294 - 0.012571 0.082715 - myocardium + epicardium -35.714 @@ -108,7 +96,7 @@ 10000.0 - CN + FE diff --git a/tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_CG_RK4_endocardium_BO.xml b/tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_CG_RK4_myocardium_BO.xml similarity index 97% rename from tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_CG_RK4_endocardium_BO.xml rename to tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_CG_RK4_myocardium_BO.xml index 020c07d4..bd01f38e 100644 --- a/tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_CG_RK4_endocardium_BO.xml +++ b/tests/cases/niederer_benchmark_ECGs_quadrature/svFSI_CG_RK4_myocardium_BO.xml @@ -76,7 +76,7 @@ 0.012571 0.082715 - endocardium + myocardium RK4 @@ -87,7 +87,7 @@ 0.012571 0.082715 - endocardium + myocardium -35.714 diff --git a/tests/test_integration.py b/tests/test_integration.py index a76b8baa..aee88dec 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -131,8 +131,8 @@ def test_purkinje(n_proc): name_ref = "result_" + str(t_max).zfill(3) + ".vtu" run_with_reference(folder, name_inp, name_ref, field, t_max, n_proc) -@pytest.mark.parametrize("confs_ecgs", [["BICG_CN_myocardium_BO" , -0.0781125, 0.0781125, 0.00885273], - ["CG_RK4_endocardium_BO" , -0.0780188, 0.0780188, 0.00884210], +@pytest.mark.parametrize("confs_ecgs", [["BICG_CN_epicardium_BO" , -0.0786707, 0.0786707, 0.00891599], + ["CG_RK4_myocardium_BO" , -0.0781115, 0.0781115, 0.00885261], ["GMRES_FE_epicardium_TTP", -0.0786707, 0.0786707, 0.00891599], ["GMRES_FE_pfib_AP" , 0.0786707, -0.0786707, -0.00891599]]) @pytest.mark.parametrize("n_proc", procs)