Skip to content

Commit

Permalink
Merge pull request #62 from bergolho/master
Browse files Browse the repository at this point in the history
New examples for MonoAlg3D introductory course
  • Loading branch information
rsachetto authored Jan 22, 2024
2 parents 4146c0d + ee53fb1 commit e5f7e97
Show file tree
Hide file tree
Showing 24 changed files with 1,651 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ src/*/custom_functions.c
src/*/custom_functions_BACKUP.c
src/*/custom_functions.h

bsbash/find_functions_with_mpi.sh

.cache/
.ccls-cache/

Expand Down
90 changes: 90 additions & 0 deletions example_configs/introduction_to_monoalg3d/EX01_plain_wave.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Version: 12/01/2024
# ===============================================================================================
# Author: Lucas Berg (@bergolho)
# Last update: 12/01/2024
# Description: Plain wave simulation using a slab (5,5cm x 5,5cm) using a
# space discretization of 200um.
# Stimulus:
# - Two pulses with a Basic Cycle Length (BCL) equal to 1000ms
# Cellular model:
# - Ten & Tusscher 3
# ECG:
# - Two electrodes positioned on each side of the slab.
#
# ______ x = electrodes
# | |
# x | | x
# |______|
# -----------------------------------------------------------------------------------------------
# Execute:> ./bin/MonoAlg3D -c example_configs/intro_to_monoalg3d/EX01_plain_wave.ini
# Visualize:> ./bin/MonoAlg3D_visualizer ./outputs/EX01_IntroMonoAlg_plain_mesh_healthy_200um
# - The simulation can be open on Paraview as well!
# ===============================================================================================

[main]
num_threads=6
dt_pde=0.02 ; miliseconds
simulation_time=2000.0 ; miliseconds
abort_on_no_activity=false
use_adaptivity=false

[update_monodomain]
main_function=update_monodomain_default

[save_result]
print_rate=200
output_dir=./outputs/EX01_IntroMonoAlg_plain_mesh_healthy_200um
add_timestamp=false
binary=true
main_function=save_as_ensight
remove_older_simulation=true

[assembly_matrix]
init_function=set_initial_conditions_fvm
sigma_x=0.00005336 ; mS/um { ~44 cm/s }
sigma_y=0.00005336 ; mS/um { ~44 cm/s }
sigma_z=0.00005336 ; mS/um { ~44 cm/s }
main_function=homogeneous_sigma_assembly_matrix

[linear_system_solver]
tolerance=1e-16
use_preconditioner=no
max_iterations=200
use_gpu=true
init_function=init_conjugate_gradient
end_function=end_conjugate_gradient
main_function=conjugate_gradient

[domain]
name=Plain Mesh
num_layers=1
start_dx=200.0 ; micrometers
start_dy=200.0 ; micrometers
start_dz=200.0 ; micrometers
side_length=55000.0 ; micrometers
main_function=initialize_grid_with_square_mesh

[ode_solver]
dt=0.02 ; miliseconds
use_gpu=yes
gpu_id=0
library_file=shared_libs/libten_tusscher_3_endo.so

[stim_plain]
start = 0.0
duration = 2.0 ; miliseconds
period = 1000.0 ; miliseconds
current = -38.0
x_limit = 500.0 ; micrometers
main_function=stim_if_x_less_than

[calc_ecg]
main_function=pseudo_bidomain
init_function=init_pseudo_bidomain
end_function=end_pseudo_bidomain
calc_rate=10
lead1=-5000,27500,50 ; micrometers
lead2=60000,27500,50 ; micrometers
sigma_b=20
use_gpu=true
filename=./outputs/EX01_IntroMonoAlg_plain_mesh_healthy_200um/ecg.txt
103 changes: 103 additions & 0 deletions example_configs/introduction_to_monoalg3d/EX02_S1S2_protocol.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Version: 12/01/2024
# ===============================================================================================
# Author: Lucas Berg (@bergolho)
# Last update: 12/01/2024
# Description: Simulation using a slab (5,5cm x 5,5cm) considering the S1S2 protocol with a
# space discretization of 200um.
# Stimulus:
# - First stimulus (S1=0ms) in the left border of the slab.
# - Second stimulus (S2=360ms) in the square [0,27500]x[0,27500] of the slab.
# Cellular model:
# - Ten & Tusscher 3
# ECG:
# - Two electrodes positioned on each side of the slab.
#
# ______ x = electrodes
# | |
# x | | x
# |______|
# -----------------------------------------------------------------------------------------------
# Execute:> ./bin/MonoAlg3D -c example_configs/intro_to_monoalg3d/EX02_S1S2_protocol.ini
# Visualize:> ./bin/MonoAlg3D_visualizer ./outputs/EX02_IntroMonoAlg_plain_mesh_S1S2_protocol_200um
# - The simulation can be open on Paraview as well!
# ===============================================================================================

[main]
num_threads=6
dt_pde=0.02
simulation_time=2000.0
abort_on_no_activity=true
use_adaptivity=false

[update_monodomain]
main_function=update_monodomain_default

[save_result]
print_rate=200
output_dir=./outputs/EX02_IntroMonoAlg_plain_mesh_S1S2_protocol_200um
add_timestamp=false
binary=true
main_function=save_as_ensight
remove_older_simulation=true

[assembly_matrix]
init_function=set_initial_conditions_fvm
sigma_x=0.00005336
sigma_y=0.00005336
sigma_z=0.00005336
main_function=homogeneous_sigma_assembly_matrix

[linear_system_solver]
tolerance=1e-16
use_preconditioner=no
max_iterations=200
use_gpu=true
init_function=init_conjugate_gradient
end_function=end_conjugate_gradient
main_function=conjugate_gradient

[domain]
name=Plain Mesh S1S2 Protocol
num_layers=1
start_dx=200.0
start_dy=200.0
start_dz=200.0
side_length=55000
main_function=initialize_grid_with_square_mesh

[ode_solver]
dt=0.02
use_gpu=yes
gpu_id=0
library_file=shared_libs/libten_tusscher_3_endo.so

; First stimulus S1
[stim_plain_s1]
start = 0.0
duration = 2.0
current = -38.0
x_limit = 500.0
main_function=stim_if_x_less_than

; Second stimulus S2
[stim_plain_s2]
start = 360.0
duration = 2.0
current = -38.0
min_x = 0.0
min_y = 0.0
max_x = 27550.0
max_y = 27550.0
main_function=stim_x_y_limits

[calc_ecg]
main_function=pseudo_bidomain
init_function=init_pseudo_bidomain
end_function=end_pseudo_bidomain
calc_rate=10
lead1=-5000,27500,50
lead2=60000,27500,50
sigma_b=20
use_gpu=true
filename=./outputs/EX02_IntroMonoAlg_plain_mesh_S1S2_protocol_200um/ecg.txt

123 changes: 123 additions & 0 deletions example_configs/introduction_to_monoalg3d/EX03_ischemia_modeling.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Version: 12/01/2024
# ===============================================================================================
# Author: Lucas Berg (@bergolho)
# Last update: 12/01/2024
# Description: Simulation using a slab (5,5cm x 5,5cm) considering ischemia remodeling around a
# circle centered at (2.75, 2.75) with a radius equal to 1.5cm and a border zone
# size of 0.75cm. Space discretization equal to 200um.
# Stimulus:
# - First stimulus (S1=0ms) on the left border of the slab.
# - Second stimulus (S2=375ms) on the left border of the slab.
# Cellular model:
# - Ten & Tusscher 3
# Ischemia:
# - Change the action potential behaviour of the TT3 model inside the ischemic zone using the
# parameters:
# - Hyperkelemia = [Ko]
# - Hypoxia = [Ikatp_mod]
# - Acidosis = [INa_mod, ICaL_mod]
# ECG:
# - Two electrodes positioned on each side of the slab.
#
# ______ x = electrodes
# | |
# x | | x
# |______|
# -----------------------------------------------------------------------------------------------
# Execute:> ./bin/MonoAlg3D -c example_configs/intro_to_monoalg3d/EX03_IntroMonoAlg_plain_mesh_ischemia_modeling_200um
# Visualize:> ./bin/MonoAlg3D_visualizer ./outputs/EX03_IntroMonoAlg_plain_mesh_ischemia_modeling_200um
# - The simulation can be open on Paraview as well!
# ===============================================================================================

[main]
num_threads=6
dt_pde=0.02
simulation_time=2000.0
abort_on_no_activity=true
use_adaptivity=false

[update_monodomain]
main_function=update_monodomain_default

[save_result]
print_rate=100
output_dir=./outputs/EX03_IntroMonoAlg_plain_mesh_ischemia_modeling_200um
add_timestamp=false
binary=true
main_function=save_as_ensight
remove_older_simulation=true

[assembly_matrix]
init_function=set_initial_conditions_fvm
sigma_x=0.00005336
sigma_y=0.00005336
sigma_z=0.00005336
main_function=homogeneous_sigma_assembly_matrix

[linear_system_solver]
tolerance=1e-16
use_preconditioner=no
max_iterations=200
use_gpu=true
init_function=init_conjugate_gradient
end_function=end_conjugate_gradient
main_function=conjugate_gradient

[domain]
name=Plain Mesh with fibrosis and circle
start_dx=200.0
start_dy=200.0
start_dz=200.0
num_layers=1
side_length=55000
seed=1508201274
phi=0.0
plain_center=27550.0
sphere_radius=15000.0
border_zone_radius=22500.0
border_zone_size=7500.0
main_function=initialize_grid_with_plain_and_sphere_fibrotic_mesh

[ode_solver]
dt=0.02
use_gpu=yes
gpu_id=0
library_file=shared_libs/libten_tusscher_3_endo.so

[stim_plain_s1]
start = 0.0
duration = 2.0
current = -38.0
x_limit = 2500.0
main_function=stim_if_x_less_than

[stim_plain_s2]
start = 375.0
duration = 2.0
current = -38.0
x_limit = 2500.0
main_function=stim_if_x_less_than

; Ischemia parameters
; Only the cells inside the ischemic region will change!
[extra_data]
Ko=9.0 ; Hyperkelemia
GNa_multiplicator=0.75 ; Ischemia
GCaL_multiplicator=0.75 ; Ischemia
Ikatp_multiplicator=0.01 ; Hypoxia
plain_center=27550.0
sphere_radius=15000.0
border_zone_radius=22500.0
border_zone_size=7500.0
main_function=set_extra_data_for_fibrosis_sphere

[calc_ecg]
main_function=pseudo_bidomain
init_function=init_pseudo_bidomain
end_function=end_pseudo_bidomain
calc_rate=10
lead1=-5000,27500,50
lead2=60000,27500,50
sigma_b=20
use_gpu=true
filename=./outputs/EX03_IntroMonoAlg_plain_mesh_ischemia_modeling_200um/ecg.txt
Loading

0 comments on commit e5f7e97

Please sign in to comment.