diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/simple.py | 25 | 
1 files changed, 20 insertions, 5 deletions
| diff --git a/src/simple.py b/src/simple.py index 789c81a..91ed1a4 100644 --- a/src/simple.py +++ b/src/simple.py @@ -41,6 +41,10 @@ class SIMPLE:              self.u_star[i][0] = 1              self.v_star[i][0] = 0 +    def apply_outflow_boundary(self): +        for i in range(0, self.shape[0]): +            self.u_star[i][-1] = self.u_star[i][-2]; +      def assert_positive(self, value):          '''Assert that the value is nearly positive'''          assert value > -0.1, f'WARNING: Value must be positive: {value}' @@ -50,8 +54,8 @@ class SIMPLE:          '''Iterator over all grid points, excluding the obstacle'''          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) +                # if i > self.bfs_node_size[0] or j > self.bfs_node_size[1]: +                yield (i, j)      def solve_momentum_equations(self):          # Momentum along X direction @@ -104,8 +108,9 @@ class SIMPLE:      def apply_sides_boundary(self):          for j in range(self.shape[1]): -            self.v_star[1][j] = 0 +            self.v_star[0][j] = 0              self.v_star[-2][j] = 0 +            # WORKSNICE: self.v_star[-3][j] = 0      def apply_bfs_boundary(self):          '''Apply Backwards Facing Step boundary conditions''' @@ -145,15 +150,25 @@ 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() +        # self.apply_bfs_boundary()          self.correct_pressure()          self.correct_velocities() +        # Sides (magick wtf?) +        for j in range(self.shape[1]): +            self.v[1][j] = 0 +            self.v[-2][j] = 0 + +        for i in range(self.shape[0]): +            self.v[i][0] = 0 +            self.v[i][1] = 0 + +      def avg_error(self):          return np.absolute(self.b).sum() | 
