summaryrefslogtreecommitdiff
path: root/src/main.py
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-05-19 03:48:00 +0400
committereug-vs <eugene@eug-vs.xyz>2022-05-19 03:48:00 +0400
commitbd5b9c012a3a91ef9260ca89596b1e13d0c5bb4f (patch)
treea8465415c3de49bfaeb47d7cb828448a665844eb /src/main.py
parentd460983ac34b6de32ade0790c371494de75c19f7 (diff)
downloadCFD-SIMPLE-bd5b9c012a3a91ef9260ca89596b1e13d0c5bb4f.tar.gz
feat: iterate until error is small enough
Diffstat (limited to 'src/main.py')
-rw-r--r--src/main.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.py b/src/main.py
index 01f0c19..551595e 100644
--- a/src/main.py
+++ b/src/main.py
@@ -1,11 +1,16 @@
from simple import SIMPLE
problem = SIMPLE((1, 2), (0.7, 0.5), 0.02, 120)
-
problem.prep()
-for i in range(3000):
- print(f'Iteration {i}')
+error = 1
+iteration = 0
+while error > 10 ** -7:
+ iteration += 1
problem.iterate()
- if i % 5 == 0 or i == 1:
+ error = problem.avg_error()
+ print(f'Iteration {iteration}')
+ print(f'Avg error: {error}')
+
+ if iteration % 5 == 0 or iteration == 1:
problem.plot(True, 2)