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 muscle tutorial #471

Draft
wants to merge 42 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
822cb19
Create tutorial structure
carme-hp Feb 26, 2024
cc8b43c
Add sample structure for an opendihu participant
carme-hp Feb 26, 2024
feef2d0
Move src code to opendihu-solver folder
carme-hp Feb 27, 2024
cfbe718
Complete opendihu participants
carme-hp Feb 27, 2024
3eb5bb0
Update README
carme-hp Feb 27, 2024
b559c85
Get muscle participant to run
carme-hp Feb 29, 2024
1b4f1fe
Add check for OPENDIHU_HOME
carme-hp Mar 4, 2024
0cb1947
Rename meshName to preciceMeshName
carme-hp Mar 4, 2024
bcbc6fd
Fix rename
carme-hp Mar 4, 2024
ff5ed78
Fix paths, variables and add scripts
carme-hp Mar 4, 2024
a80cfaa
Add remove precice-run to clean.sh
carme-hp Mar 5, 2024
b383782
Fix bc errors
carme-hp Mar 5, 2024
0bdcb05
Setup exchange directory and remove comments
carme-hp Mar 5, 2024
c6091ae
Add information about OpenDiHu
carme-hp Mar 10, 2024
1d31091
Add .gitignore
carme-hp Mar 10, 2024
f555039
Merge branch 'develop' into add-muscle-tutorial
MakisH Mar 11, 2024
6bfa0a9
Fix Markdown linting issues in muscle tutorial README
MakisH Mar 11, 2024
5459862
Fix Markdown linting issues in muscle tutorial README
MakisH Mar 11, 2024
c3b4db8
Remove unrelated results image - fix check.sh
MakisH Mar 11, 2024
b24c63d
Mark shell scripts as executable
MakisH Mar 11, 2024
50333ef
Fix shellcheck errors
MakisH Mar 11, 2024
0a5858a
Format with autopep8
MakisH Mar 11, 2024
e3bd5e2
Bump GItHub Action autopep8 from v1 to v2
MakisH Mar 11, 2024
83f7597
Format more files with autopep8
MakisH Mar 11, 2024
dcd7a3f
Double --aggressive autopep8
MakisH Mar 11, 2024
f9325f3
Double --aggressive autopep8
MakisH Mar 11, 2024
bbfa73e
Minor fixes in muscle tutorial README
MakisH Mar 11, 2024
9660161
Add a clean_opendihu function, adjust cleaning scripts
MakisH Mar 11, 2024
13ccd83
Rename opendihu-solver to solver-opendihu
MakisH Mar 11, 2024
d9141f5
solver-opendihu scripts: set -e -u
MakisH Mar 11, 2024
9ec1cdb
Fix clean_opendihu call to clean_precice_logs
MakisH Mar 11, 2024
b3602f0
Further fixes in solver-opendihu/clean.sh
MakisH Mar 11, 2024
e908415
Apply set -e -u to more shell scripts
MakisH Mar 11, 2024
b7e9272
Format precice-config.xml
MakisH Mar 11, 2024
2e6dc39
Update muscle-tendon-complex/README.md
carme-hp Mar 11, 2024
09d53d6
Update muscle-tendon-complex/solver-opendihu/src/tendon-solver.cpp
carme-hp Mar 11, 2024
37233da
Update muscle-tendon-complex/solver-opendihu/src/muscle-solver.cpp
carme-hp Mar 11, 2024
76b5a0f
Explain activation and add citation
carme-hp Mar 11, 2024
db6820e
Use pre-commit
carme-hp Mar 11, 2024
535342f
Use pre-commit
carme-hp Mar 11, 2024
75c09ff
Merge branch 'add-muscle-tutorial' of github.com:carme-hp/tutorials i…
carme-hp Mar 11, 2024
755c3e4
Add automatically generated folder to gitignore
carme-hp Mar 11, 2024
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
5 changes: 3 additions & 2 deletions muscle-tendon-complex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@ The solver solves the so called "monodomain equation" independently for each fib

- Download input files for OpenDiHu

OpenDiHu requires input files hosted in [Zenodo](https://zenodo.org/records/4705982) which include CellML files (containing model equations) and mesh files. Downloading these files is necessary to simulate muscles and/or tendons with OpenDiHu. You can [directly download the necessary files](https://zenodo.org/record/4705982/files/input.tgz?download=1). Extract the files and place them in the `opendihu/examples/electrophysiology/` directory.
OpenDiHu requires input files hosted in [Zenodo](https://zenodo.org/records/4705982) which include CellML files (containing model equations) and mesh files. Downloading these files is necessary to simulate muscles and/or tendons with OpenDiHu. You can [directly download the necessary files](https://zenodo.org/record/4705982/files/input.tgz?download=1).

- Setup `$OPENDIHU_HOME` to your `.bashrc` file
- Setup `$OPENDIHU_HOME` and `$OPENDIHU_INPUT_DIR` in your `.bashrc` file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a general terminology thing: When I see "input files", I understand configuration files for a specific simulation. How do these differ that the files included in this repository?

If they are specific to this tutorial, they could also be downloaded directly into this directory (and specified in the .gitignore).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What in opendihu we call input file are not what I understand as configuration files. They are files that specify meshes, i.e., geometry, and cellml models, i.e., equations. In the configuration files (the ones included in the tutorial, we give the parameters and user settings to use this files.


```bash
export OPENDIHU_HOME=/path/to/opendihu
export OPENDIHU_INPUT_DIR=/path/to/input
```

- Compile muscle and tendon solvers
Expand Down
13 changes: 7 additions & 6 deletions muscle-tendon-complex/muscle-opendihu/variables/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# not used [cm], this will later be used to specify a variance of positions of the innervation point at the fibers
innervation_zone_width = 0.
rho = 10

# solvers
# -------
diffusion_solver_type = "cg" # solver and preconditioner for the diffusion part of the Monodomain equation
Expand Down Expand Up @@ -45,14 +46,14 @@
# -----------

import os
opendihu_home = os.environ.get('OPENDIHU_HOME')
fiber_file = opendihu_home + "/examples/electrophysiology/input/left_biceps_brachii_9x9fibers.bin"
input_dir = os.environ.get('OPENDIHU_INPUT_DIR')
fiber_file = input_dir + "/left_biceps_brachii_9x9fibers.bin"
fat_mesh_file = fiber_file + "_fat.bin"
# use setSpecificStatesCallEnableBegin and setSpecificStatesCallFrequency
firing_times_file = opendihu_home + "/examples/electrophysiology/input/MU_firing_times_always.txt"
fiber_distribution_file = opendihu_home + "/examples/electrophysiology/input/MU_fibre_distribution_10MUs.txt"
cellml_file = opendihu_home + "/examples/electrophysiology/input/2020_06_03_hodgkin-huxley_shorten_ocallaghan_davidson_soboleva_2007.cellml"
firing_times_file = opendihu_home + "/examples/electrophysiology/input/MU_firing_times_real.txt"
firing_times_file = input_dir + "/MU_firing_times_always.txt"
fiber_distribution_file = input_dir + "/MU_fibre_distribution_10MUs.txt"
cellml_file = input_dir + "/2020_06_03_hodgkin-huxley_shorten_ocallaghan_davidson_soboleva_2007.cellml"
firing_times_file = input_dir + "/MU_firing_times_real.txt"
precice_config_file = "../precice-config.xml"
# If the fiber geometry data should be loaded completely in the python
# script. If True, this reads the binary file and assigns the node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
# -----------

import os
opendihu_home = os.environ.get('OPENDIHU_HOME')
fiber_file = opendihu_home + "/examples/electrophysiology/input/left_biceps_brachii_tendon1.bin"
cellml_file = opendihu_home + "/examples/electrophysiology/input/2020_06_03_hodgkin-huxley_shorten_ocallaghan_davidson_soboleva_2007.cellml"
input_dir = os.environ.get('OPENDIHU_INPUT_DIR')
fiber_file = input_dir + "/left_biceps_brachii_tendon1.bin"
cellml_file = input_dir + "/2020_06_03_hodgkin-huxley_shorten_ocallaghan_davidson_soboleva_2007.cellml"
precice_config_file = "../precice-config.xml"
# If the fiber geometry data should be loaded completely in the python
# script. If True, this reads the binary file and assigns the node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
# -----------

import os
opendihu_home = os.environ.get('OPENDIHU_HOME')
fiber_file = opendihu_home + "/examples/electrophysiology/input/left_biceps_brachii_tendon2a.bin"
cellml_file = opendihu_home + "/examples/electrophysiology/input/2020_06_03_hodgkin-huxley_shorten_ocallaghan_davidson_soboleva_2007.cellml"
input_dir = os.environ.get('OPENDIHU_INPUT_DIR')
fiber_file = input_dir + "/left_biceps_brachii_tendon2a.bin"
cellml_file = input_dir + "/2020_06_03_hodgkin-huxley_shorten_ocallaghan_davidson_soboleva_2007.cellml"
precice_config_file = "../precice-config.xml"
# If the fiber geometry data should be loaded completely in the python
# script. If True, this reads the binary file and assigns the node
Expand Down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side-effect of having configuration files in Python script format (see opendihu/opendihu#44): How can I know if all variable names exist / are defined / are not misspelled / are needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, at the moment there's no way to check that.

Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
# -----------

import os
opendihu_home = os.environ.get('OPENDIHU_HOME')
fiber_file = opendihu_home + "/examples/electrophysiology/input/left_biceps_brachii_tendon2b.bin"
cellml_file = opendihu_home + "/examples/electrophysiology/input/2020_06_03_hodgkin-huxley_shorten_ocallaghan_davidson_soboleva_2007.cellml"
input_dir = os.environ.get('OPENDIHU_INPUT_DIR')
fiber_file = input_dir + "/left_biceps_brachii_tendon2b.bin"
cellml_file = input_dir + "/2020_06_03_hodgkin-huxley_shorten_ocallaghan_davidson_soboleva_2007.cellml"
precice_config_file = "../precice-config.xml"
# If the fiber geometry data should be loaded completely in the python
# script. If True, this reads the binary file and assigns the node
Expand Down