Skip to content

Commit

Permalink
convergence_tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
alemelis committed Nov 20, 2023
1 parent 53bfb52 commit 5a10661
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/src/man/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ It contains the values for the numerical scheme parameters:

- `cycles` is the maximum number of cardiac cycles to be simulated. This is used to stop openBF execution in case of non-converging simulations. An openBF simulation usually takes less than 20 cardiac cycles to converge.

- `convergence tolerance` is the maximum percentage error allowed between two consecutive cardiac cycle to claim convergence. During openBF development and validation, this was set to $5$%.
- `convergence tolerance` is the maximum error in $mmHg$ allowed between two consecutive cardiac cycle to claim convergence.

- `jump` is the number of time-points to be saved in the result files.

Expand Down Expand Up @@ -98,7 +98,7 @@ project name: <project name> # String
solver:
Ccfl: <Courant's number> # 0.0 < Ccfl ≤ 1.0; Float
cycles: <Max number of cardiac cycles> # Int
convergence tolerance: <Max %error between two cycles> # Float
convergence_tolerance: <Max %error between two cycles> # Pressure, Float
jump: <Number of timepoints in result files; default 100> # Int
blood:
Expand Down
3 changes: 2 additions & 1 deletion src/simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function run_simulation(

passed_cycles = 0
counter = 1
conv_error = floatmax()
@time while true
step!(network, dt, current_time)

Expand Down Expand Up @@ -97,7 +98,7 @@ function run_simulation(
counter = 1
end
current_time += dt
if current_time >= total_time || passed_cycles == config["solver"]["cycles"]
if current_time >= total_time || passed_cycles == config["solver"]["cycles"] || conv_error < config["solver"]["convergence_tolerance"]
verbose && finish!(prog)
break
end
Expand Down
2 changes: 1 addition & 1 deletion test/network/network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ solver:
Ccfl: 0.9
cycles: 2
jump: 100
convergence tolerance: 1.0
convergence_tolerance: 1.0
network:
- label: v0
sn: 1
Expand Down

0 comments on commit 5a10661

Please sign in to comment.