diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-05-19 03:48:00 +0400 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-05-19 03:48:00 +0400 |
commit | bd5b9c012a3a91ef9260ca89596b1e13d0c5bb4f (patch) | |
tree | a8465415c3de49bfaeb47d7cb828448a665844eb /src/simple.py | |
parent | d460983ac34b6de32ade0790c371494de75c19f7 (diff) | |
download | CFD-SIMPLE-bd5b9c012a3a91ef9260ca89596b1e13d0c5bb4f.tar.gz |
feat: iterate until error is small enough
Diffstat (limited to 'src/simple.py')
-rw-r--r-- | src/simple.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/simple.py b/src/simple.py index d524659..9a3aa31 100644 --- a/src/simple.py +++ b/src/simple.py @@ -115,8 +115,8 @@ class SIMPLE: self.v_star[0][j] = 0 self.u_star[0][j] = 0 - self.u_star[self.shape[0] - 1][j] = 0 self.v_star[self.shape[0] - 1][j] = 0 + self.u_star[self.shape[0] - 1][j] = 0 def apply_bfs_boundary(self): '''Apply Backwards Facing Step boundary conditions''' @@ -157,25 +157,22 @@ class SIMPLE: self.u[i][j] = self.u_star[i][j] + self.d_e[i][j] * (self.p_prime[i][j + 1] - self.p_prime[i][j]) self.v[i][j] = self.v_star[i][j] + self.d_n[i][j] * (self.p_prime[i][j] - self.p_prime[i + 1][j]) - def apply_outflow_boundary(self): - for i in range(self.shape[0]): - self.u[i][self.shape[1] - 1] = self.u[i][self.shape[1] - 2] - self.v[i][self.shape[1] - 1] = self.v[i][self.shape[1] - 2] - def iterate(self): + self.apply_sides_boundary() self.apply_inflow_boundary() + self.apply_bfs_boundary() self.solve_momentum_equations() self.apply_sides_boundary() + self.apply_inflow_boundary() self.apply_bfs_boundary() self.correct_pressure() self.correct_velocities() - # self.apply_outflow_boundary() - - self.apply_bfs_boundary() # Is it needed? + def avg_error(self): + return np.absolute(self.b).sum() def plot(self, normalize=False, density=1): if self.patch: |