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 new tutorial: opendihu-febio-muscle-contraction #345

Draft
wants to merge 21 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c25bacb
Added opendihu-febio-muscle-simulation example
silasnatterer Jul 16, 2023
47c7615
Change muscle tutorial folder name to something meaningful
IshaanDesai Jul 25, 2023
20b44d5
Remove non-coupled mechanics-only cases
carme-hp Jul 25, 2023
f7f5fe3
Remove non-coupled opendihu case
carme-hp Jul 25, 2023
ee76d4c
Remove more non-coupled opendihu cases
carme-hp Jul 25, 2023
27ea3ab
Create folders for opendihu solvers for muscle and fibres
carme-hp Jul 25, 2023
05ccc0e
Move precice-config.xml to main folder
carme-hp Jul 25, 2023
6aab2b6
Create muscle-febio folder
carme-hp Jul 25, 2023
442a44a
Use precice-config.xml in parent directory
carme-hp Jul 25, 2023
a38c99b
Add run.sh files for opendihu cases
carme-hp Jul 25, 2023
21c5017
Split variables.py into muscle and fibers part
carme-hp Jul 25, 2023
26391a9
Rename fibres-opendihu to fibers-opendihu
carme-hp Jul 25, 2023
bdfe085
Remove variables folder
carme-hp Jul 25, 2023
5dfc978
Add first draft of README.md
carme-hp Jul 25, 2023
f2eafdc
Remove duplicated fibers-opendihu case (febio_contraction)
carme-hp Jul 26, 2023
1d3839c
Clean-up repository
carme-hp Jul 26, 2023
0ff410d
Update .gitignore
carme-hp Jul 26, 2023
c3be5ce
Move all simulation output to output folder in parent directory
carme-hp Jul 26, 2023
4560d69
Fix running of run.sh
carme-hp Jul 26, 2023
b3c2369
Change FEBio execution command to use FEBio 4.1 executable
IshaanDesai Jul 26, 2023
5f5b4f6
Add generic exchange directory in the preCICE config file of the musc…
IshaanDesai Jul 27, 2023
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
153 changes: 153 additions & 0 deletions muscle-contraction-with-fibres/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

.sconsign.dblite
.sconf_temp
**/build_release/**
**/build_debug/**
**precice-Participant**
**precice-output**
**precice-run**
**.xplt
**.vtk
**.vtu
solver_structure.txt
mappings_between_meshes_log.txt
log_residual_norm.txt
**/output/**
muscle.xplt
**.swp
**precice-Generator**

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# Aditional files
fibers-opendihu/src/hodgkin_huxley-razumova_fast_monodomain.c
fibers-opendihu/src/hodgkin_huxley-razumova.c
**/.scons_node_count
**/logs/**
61 changes: 61 additions & 0 deletions muscle-contraction-with-fibres/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: Muscle contraction with fibers
permalink:
keywords: OpenDiHu, FEBio
summary: The muscle contraction with fibers is a solid mechanics problem. The muscle participant, is a FEM solver is used to compute the deformation of the muscle due to internal active forces. The fibers participant takes care of the computation of active forces by solving the monodomain equation in each fiber. This tutorial contains OpenDiHu and FEBio variants of the FEM solver and an OpenDiHu fibers solvers.
---

**Disclaimer:** This tutorial is built on the work of Silas Natterer et al. You can check out their work at their [repository](https://github.com/silasnatterer/bfp), including a student report.

## Setup

## Available solvers

The muscle and fibers participants are supported in:

- *OpenDiHu*: Check [OpenDiHu's documentation](https://opendihu.readthedocs.io/en/latest/) and follow the installation instructions.
- *FEBio*: TODO

Note: the fibers participant is only supported in OpenDiHu.

Before running the OpenDiHu participants you first have to build it. In order to follow the following instructions you must have added `OPENDIHU_HOME` to your system variables as well as the aliases for `mkorn` and `sr`.

```bash
cd muscle-opendihu
mkorn && sr
```

```bash
cd fibers-opendihu
mkorn && sr
```

## Running the Simulation

### OpenDiHu

Open two separate terminals and start each participant by calling the respective run script.

```bash
cd muscle-opendihu
./run.sh
```

and

```bash
cd fibers-opendihu
./run.sh
```

### FEBio

TODO

## Post-processing

TODO

## References

TODO
14 changes: 14 additions & 0 deletions muscle-contraction-with-fibres/fibers-opendihu/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This script declares to SCons how to compile the example.
# It has to be called from a SConstruct file.
# The 'env' object is passed from there and contains further specification like directory and debug/release flags.
#
# Note: If you're creating a new example and copied this file, adjust the desired name of the executable in the 'target' parameter of env.Program.


Import('env') # import Environment object from calling SConstruct

# if the option no_tests was given, quit the script
if not env['no_examples']:

# create the main executable
env.Program(target = 'fibers', source= "src/fibers.cpp")
18 changes: 18 additions & 0 deletions muscle-contraction-with-fibres/fibers-opendihu/SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SConstruct file for a single example.
#
# Usage: `scons BUILD_TYPE=debug` will build debug version, `scons` will build release version.

# Call the generic `SConstructGeneral` script that will configure everything. It is located at the top level directory of opendihu.
# That script will then call a `SConscript` file that defines which sources to use.

import os

# get the directory where opendihu is installed (the top level directory of opendihu)
opendihu_home = os.environ.get('OPENDIHU_HOME') or "../../.."

# set path where the "SConscript" file is located (set to current path)
path_where_to_call_sconscript = Dir('.').srcnode().abspath

# call general SConstruct that will configure everything and then call SConscript at the given path
SConscript(os.path.join(opendihu_home,'SConstructGeneral'),
exports={"path": path_where_to_call_sconscript})
4 changes: 4 additions & 0 deletions muscle-contraction-with-fibres/fibers-opendihu/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -e -u

./build_release/fibers settings_fibers.py
Loading
Loading