diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-05-23 16:37:14 +0400 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-05-23 16:37:14 +0400 |
commit | 794c72733725fbf20355c05c8e14931389069a7e (patch) | |
tree | ca2c86b26a8f4ea8b9692f43dafbce70affc9c47 | |
parent | 0534e85981b327b8c0effb9b0814ae041a4fb905 (diff) | |
download | CFD-SIMPLE-794c72733725fbf20355c05c8e14931389069a7e.tar.gz |
feat: minor changes that I'm unsure about
-rw-r--r-- | src/simple.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/simple.py b/src/simple.py index 0282dd1..789c81a 100644 --- a/src/simple.py +++ b/src/simple.py @@ -37,18 +37,18 @@ class SIMPLE: return np.zeros(shape=self.shape, dtype=float) def apply_inflow_boundary(self): - for i in range(self.shape[0]): + for i in range(1, self.shape[0] - 1): self.u_star[i][0] = 1 self.v_star[i][0] = 0 def assert_positive(self, value): '''Assert that the value is nearly positive''' - assert value > -0.01, f'WARNING: Value must be positive: {value}' + assert value > -0.1, f'WARNING: Value must be positive: {value}' return value def grid(self): '''Iterator over all grid points, excluding the obstacle''' - for i in range(self.shape[0] - 1): + for i in range(1, self.shape[0] - 1): for j in range(1, self.shape[1] - 1): if i > self.bfs_node_size[0] or j > self.bfs_node_size[1]: yield (i, j) @@ -104,13 +104,15 @@ class SIMPLE: def apply_sides_boundary(self): for j in range(self.shape[1]): - self.v_star[0][j] = 0 + self.v_star[1][j] = 0 self.v_star[-2][j] = 0 def apply_bfs_boundary(self): '''Apply Backwards Facing Step boundary conditions''' for i in range(self.bfs_node_size[0]): self.u_star[i][self.bfs_node_size[1]] = 0 + for j in range(self.bfs_node_size[1]): + self.v_star[self.bfs_node_size[0]][j] = 0 def correct_pressure(self): self.p_prime = self.allocate_field() @@ -143,10 +145,9 @@ class SIMPLE: 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 iterate(self): - self.apply_inflow_boundary() - self.solve_momentum_equations() + self.apply_inflow_boundary() self.apply_sides_boundary() self.apply_bfs_boundary() |