Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
style = "blue"
7 changes: 7 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ jobs:
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
if: matrix.version == '1.10' && matrix.os == 'ubuntu-latest'
- uses: codecov/codecov-action@v5
if: matrix.version == '1.10' && matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
docs:
name: Documentation
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
JuliaHealth Community Standards
=========================

The JuliaHealth community abides by the broader Julia Community Code of Conduct (CoC). You can find that CoC listed here: https://julialang.org/community/standards/

If you have a conflict or concern that requires resolution, please contact the [Julia Community Stewards](https://julialang.org/community/stewards/).
41 changes: 41 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributing Guidelines

Thanks for taking the time to contribute to BloodFlowTrixi.jl! ❤️

We appreciate your interest in improving this project. Before you start contributing, please take a moment to review the following guidelines.


## Reporting Issues

First off, we assume that you have read the available [Documentation](https://juliahealth.org/BloodFlowTrixi.jl/dev/).

Before you report an issue, it is best to search for existing [Issues](https://github.com/JuliaHealth/BloodFlowTrixi.jl/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue.

If you then still feel the need to report an issue, we recommend the following:

- Open an [Issue on GitHub](https://github.com/JuliaHealth/BloodFlowTrixi.jl/issues/new).
- Provide as much context as you can about what you're running into.
- Provide project and platform versions, depending on what seems relevant.

We will then take care of the issue as soon as possible.


## How to Contribute

- **Implement Code Changes**: Introduce your modifications, ensuring adherence to the [Julia Blue Style Guidelines](https://github.com/invenia/BlueStyle). For new features, include informative comments, docstrings, and consider enriching the documentation with relevant examples.

- **Format Code**: This project uses JuliaFormatter with Blue style. Run formatting from the repository root using these steps:
- `julia --project=dev`
- `using JuliaFormatter`
- `format(".")`

- **Validate Changes with Tests**: Execute existing tests to verify the compatibility of your alterations with the current functionality. If applicable, incorporate additional tests to validate your new contributions.

- **Undergo Code Review**: Subject your code to review by maintainers, who will provide feedback and may request further adjustments before merging.


## License

By contributing to BloodFlowTrixi.jl, you agree that your contributions will be licensed under the [MIT License](LICENSE).

Thank you for contributing to BloodFlowTrixi.jl! 🌟
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BloodFlowTrixi"
uuid = "7b46d5ad-635f-4b66-9393-904f183e39b5"
version = "0.1.7"
authors = ["yolhan83 <yolhan@laposte.net>"]
version = "0.1.7"

[deps]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliahealth.org/BloodFlowTrixi.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliahealth.org/BloodFlowTrixi.jl/dev/)
[![Build Status](https://github.com/yolhan83/BloodFlowTrixi.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/yolhan83/BloodFlowTrixi.jl/actions/workflows/CI.yml?query=branch%3Amaster)
[![Coverage](https://codecov.io/gh/JuliaHealth/BloodFlowTrixi.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaHealth/BloodFlowTrixi.jl)
[![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

**BloodFlowTrixi.jl** is a Julia package that implements one-dimensional (1D) and two-dimensional (2D) blood flow models for arterial circulation. These models are derived from the Navier-Stokes equations and were developed as part of my PhD research in applied mathematics, focusing on cardiovascular pathologies such as aneurysms and stenoses.
Expand Down Expand Up @@ -57,6 +58,10 @@ pkg> add Trixi
pkg> add BloodFlowTrixi
```

## Usage Examples

For detailed usage examples and tutorials on how to use BloodFlowTrixi.jl, please visit the [Tutorial Documentation](https://juliahealth.org/BloodFlowTrixi.jl/stable/tuto/).

# Simulations
![Alt Text](./docs/src/graph.gif)
![Alt Text](./docs/src/graph2d.gif)
Expand All @@ -80,6 +85,14 @@ pkg> add BloodFlowTrixi

This package is licensed under the MIT license.

## Contributing

We welcome contributions from the community! If you find a bug, have a feature request, or want to improve the package, please:

1. Check the [Contributing Guidelines](CONTRIBUTING.md)
2. See the [Code of Conduct](CODE_OF_CONDUCT.md)
3. Open a [new issue](https://github.com/JuliaHealth/BloodFlowTrixi.jl/issues) or [pull request](https://github.com/JuliaHealth/BloodFlowTrixi.jl/pulls)

## Acknowledgments

This package was developed as part of my PhD research in applied mathematics in the IMATH laboratory and founded by the University of Toulon in France, focusing on mathematical modeling and numerical simulation of blood flow in arteries.
Expand Down
1 change: 1 addition & 0 deletions dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Manifest.toml
5 changes: 5 additions & 0 deletions dev/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[deps]
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"

[compat]
JuliaFormatter = "2.3.0"
11 changes: 2 additions & 9 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,7 @@ makedocs(;
edit_link="master",
assets=String[],
),
pages=[
"Home" => "index.md",
"Tutorial" => "tuto.md",
"Mathematics" => "math.md"
],
pages=["Home" => "index.md", "Tutorial" => "tuto.md", "Mathematics" => "math.md"],
)

deploydocs(;
repo="github.com/JuliaHealth/BloodFlowTrixi.jl",
devbranch="master",
)
deploydocs(; repo="github.com/JuliaHealth/BloodFlowTrixi.jl", devbranch="master")
42 changes: 17 additions & 25 deletions exemples/Model1D/exemple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,34 @@ using Trixi
using BloodFlowTrixi
using OrdinaryDiffEq

eq = BloodFlowEquations1D(; h = 0.1)
eq = BloodFlowEquations1D(; h=0.1)

mesh = TreeMesh(0.0, 40.0,
initial_refinement_level = 4,
n_cells_max = 10^4,
periodicity = false)
mesh = TreeMesh(0.0, 40.0; initial_refinement_level=4, n_cells_max=10^4, periodicity=false)

bc = (;
x_neg = boundary_condition_pressure_in,
x_pos = Trixi.BoundaryConditionDoNothing()
)
bc = (; x_neg=boundary_condition_pressure_in, x_pos=Trixi.BoundaryConditionDoNothing())

solver = DGSEM(polydeg = 2,
surface_flux = (flux_lax_friedrichs,flux_nonconservative),
volume_integral = VolumeIntegralFluxDifferencing((flux_lax_friedrichs,flux_nonconservative))
)
solver = DGSEM(;
polydeg=2,
surface_flux=(flux_lax_friedrichs, flux_nonconservative),
volume_integral=VolumeIntegralFluxDifferencing((
flux_lax_friedrichs, flux_nonconservative
)),
)

semi = SemidiscretizationHyperbolic(
mesh,
eq,
initial_condition_simple,
source_terms = source_term_simple,
solver,
boundary_conditions = bc
solver;
source_terms=source_term_simple,
boundary_conditions=bc,
)

tspan = (0.0, 0.3)
ode = semidiscretize(semi, tspan)

dt_adapt = StepsizeCallback(;cfl=0.5)
analyse = AliveCallback(
alive_interval = 10,
analysis_interval = 100
)
cb = CallbackSet(
dt_adapt,analyse
)
dt_adapt = StepsizeCallback(; cfl=0.5)
analyse = AliveCallback(; alive_interval=10, analysis_interval=100)
cb = CallbackSet(dt_adapt, analyse)

sol = solve(ode, SSPRK33(),dt = dt_adapt(ode),callback= cb)
sol = solve(ode, SSPRK33(); dt=dt_adapt(ode), callback=cb)
48 changes: 20 additions & 28 deletions exemples/Model1DOrd2/exemple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,40 @@ using Trixi
using BloodFlowTrixi
using OrdinaryDiffEq

eq = BloodFlowEquations1D(; h = 0.1)
eq = BloodFlowEquations1D(; h=0.1)
eq_ord2 = BloodFlowEquations1DOrd2(eq)

mesh = TreeMesh(0.0, 40.0,
initial_refinement_level = 4,
n_cells_max = 10^4,
periodicity = false)
mesh = TreeMesh(0.0, 40.0; initial_refinement_level=4, n_cells_max=10^4, periodicity=false)

bc_hypo = (;
x_neg = boundary_condition_pressure_in,
x_pos = Trixi.BoundaryConditionDoNothing()
)
bc_hypo = (; x_neg=boundary_condition_pressure_in, x_pos=Trixi.BoundaryConditionDoNothing())

bc_parab = (;
x_neg = BoundaryConditionNeumann((x,t,eq) -> SVector(0.0,0,0,0,0)),
x_pos = BoundaryConditionNeumann((x,t,eq) -> SVector(0.0,0,0,0,0))
x_neg=BoundaryConditionNeumann((x, t, eq) -> SVector(0.0, 0, 0, 0, 0)),
x_pos=BoundaryConditionNeumann((x, t, eq) -> SVector(0.0, 0, 0, 0, 0)),
)

solver = DGSEM(polydeg = 2,
surface_flux = (flux_lax_friedrichs,flux_nonconservative),
volume_integral = VolumeIntegralFluxDifferencing((flux_lax_friedrichs,flux_nonconservative))
)
solver = DGSEM(;
polydeg=2,
surface_flux=(flux_lax_friedrichs, flux_nonconservative),
volume_integral=VolumeIntegralFluxDifferencing((
flux_lax_friedrichs, flux_nonconservative
)),
)

semi = SemidiscretizationHyperbolicParabolic(
mesh,
(eq,eq_ord2),
initial_condition_simple,
source_terms = source_term_simple_ord2,
(eq, eq_ord2),
initial_condition_simple;
source_terms=source_term_simple_ord2,
solver,
boundary_conditions = (bc_hypo,bc_parab)
boundary_conditions=(bc_hypo, bc_parab),
)

tspan = (0.0, 0.3)
ode = semidiscretize(semi, tspan)

dt_adapt = StepsizeCallback(;cfl=0.5)
analyse = AliveCallback(
alive_interval = 10,
analysis_interval = 100
)
cb = CallbackSet(
dt_adapt,analyse
)
dt_adapt = StepsizeCallback(; cfl=0.5)
analyse = AliveCallback(; alive_interval=10, analysis_interval=100)
cb = CallbackSet(dt_adapt, analyse)

sol = solve(ode, SSPRK33(),dt = dt_adapt(ode),callback= cb)
sol = solve(ode, SSPRK33(); dt=dt_adapt(ode), callback=cb)
59 changes: 28 additions & 31 deletions exemples/Model2D/diexemple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,53 @@ using StaticArrays, LinearAlgebra
using QuadGK
using LinearAlgebra

eq = BloodFlowEquations2D(; h = 0.1)
xyz_data = [SA[cos(0.2*si),sin(0.2*si),si] for si in range(0,40,100)]
eq = BloodFlowEquations2D(; h=0.1)
xyz_data = [SA[cos(0.2*si), sin(0.2*si), si] for si in range(0, 40, 100)]

curve = interpolate_curve(xyz_data)
L = curve.t[end-1]
L = curve.t[end - 1]
println("curve length : $L")
BloodFlowTrixi.curvature(s) = norm(DataInterpolations.derivative(curve,s,2))
BloodFlowTrixi.curvature(s) = norm(DataInterpolations.derivative(curve, s, 2))

mesh = P4estMesh(
(1,2),
polydeg = 1,
periodicity = (true,false),
coordinates_min = (0.0,0.0),
coordinates_max = (2*pi,L),
initial_refinement_level = 4
(1, 2);
polydeg=1,
periodicity=(true, false),
coordinates_min=(0.0, 0.0),
coordinates_max=(2*pi, L),
initial_refinement_level=4,
)

bc = (;
y_neg = boundary_condition_pressure_in,
y_pos = Trixi.BoundaryConditionDoNothing()
)
bc = (; y_neg=boundary_condition_pressure_in, y_pos=Trixi.BoundaryConditionDoNothing())

solver = DGSEM(polydeg = 1,
surface_flux = (flux_lax_friedrichs,flux_nonconservative),
volume_integral = VolumeIntegralFluxDifferencing((flux_lax_friedrichs,flux_nonconservative))
)
solver = DGSEM(;
polydeg=1,
surface_flux=(flux_lax_friedrichs, flux_nonconservative),
volume_integral=VolumeIntegralFluxDifferencing((
flux_lax_friedrichs, flux_nonconservative
)),
)

semi = SemidiscretizationHyperbolic(
mesh,
eq,
initial_condition_simple,
source_terms = source_term_simple,
solver,
boundary_conditions = bc
solver;
source_terms=source_term_simple,
boundary_conditions=bc,
)

tspan = (0.0, 0.3)
ode = semidiscretize(semi, tspan)

dt_adapt = StepsizeCallback(;cfl=0.5)
analyse = AliveCallback(
alive_interval = 10,
analysis_interval = 100
)
cb = CallbackSet(
dt_adapt,analyse
)
dt_adapt = StepsizeCallback(; cfl=0.5)
analyse = AliveCallback(; alive_interval=10, analysis_interval=100)
cb = CallbackSet(dt_adapt, analyse)

sol = solve(ode, SSPRK33(),dt = dt_adapt(ode),callback= cb,saveat = 0.03,save_everystep = false)
sol = solve(
ode, SSPRK33(); dt=dt_adapt(ode), callback=cb, saveat=0.03, save_everystep=false
)

# artery center-line

res = get3DData(eq,xyz_data,semi,sol,1)
res = get3DData(eq, xyz_data, semi, sol, 1)
Loading