예제 #1
0
 def test_bottom_bc(self):
     solver = LaplaceSolver(nx=3,ny=3)
     solver.set_boundary_condtion('bottom', lambda x,y: 14)
     solver.swig_solve(quiet=True)
     x = solver.get_solution()
     solver.reset()
     solver.solve(quiet=True)
     y = solver.get_solution()
     np.testing.assert_allclose(x, y, atol=0.01)
예제 #2
0
    def test_right_bc_rb(self):

        solver = LaplaceSolver(nx=4,ny=4)
        solver.set_boundary_condtion('right', lambda x,y: 5)
        solver.swig_solve_red_black(quiet=True)
        x = solver.get_solution()
        solver.reset()
        solver.solve(quiet=True)
        y = solver.get_solution()
        np.testing.assert_allclose(x, y, atol=0.01)
예제 #3
0
    def test_top_bc(self):

        solver = LaplaceSolver(nx=4, ny=3)
        solver.set_boundary_condtion('top', lambda x, y: 10)
        solver.cffi_solve_api(quiet=True)
        x = solver.get_solution()
        solver.reset()
        solver.solve(quiet=True)
        y = solver.get_solution()
        np.testing.assert_allclose(x, y, atol=0.01)
예제 #4
0
def test_bottom_bc():
    solver = LaplaceSolver(nx=3, ny=3)
    solver.set_boundary_condtion('bottom', lambda x, y: 14)
    solver.swig_solve(quiet=True)
    np.testing.assert_allclose(solver.get_solution(),
                               np.array([[14., 14., 14.], [0., 3.5, 0.],
                                         [0., 0., 0.]]),
                               atol=0.01)
예제 #5
0
def test_right_bc():

    solver = LaplaceSolver(nx=4, ny=3)
    solver.set_boundary_condtion('right', lambda x, y: 5)
    solver.swig_solve(quiet=True)
    np.testing.assert_allclose(solver.get_solution(),
                               np.array([[0., 0., 5.], [0., 0., 0.30252101],
                                         [0.87394958, 0., 5.], [0., 0., 5.]]),
                               atol=0.01)
예제 #6
0
def test_top_bc():

    solver = LaplaceSolver(nx=4, ny=3)
    solver.set_boundary_condtion('top', lambda x, y: 10)
    solver.swig_solve(quiet=True)
    np.testing.assert_allclose(solver.get_solution(),
                               np.array([[0., 0., 0.], [0., 0., 2.35294118],
                                         [2.35294118, 0., 0.], [10., 10.,
                                                                10.]]),
                               atol=0.01)
예제 #7
0
def test_left_bc():

    solver = LaplaceSolver(nx=4, ny=4)
    solver.set_boundary_condtion('left', lambda x, y: 7)
    solver.swig_solve(quiet=True)
    np.testing.assert_allclose(solver.get_solution(),
                               np.array([[7., 0., 0., 0.],
                                         [7., 2.625, 0.875, 0.],
                                         [7., 2.625, 0.875, 0.],
                                         [7., 0., 0., 0.]]),
                               atol=0.01)
예제 #8
0
    def test_top_bc(self):

        solver = LaplaceSolver(nx=4, ny=3)
        solver.set_boundary_condtion('top', lambda x, y: 10)
        solver.numba_solve(quiet=True)
        np.testing.assert_allclose(
            solver.get_solution(),
            np.array([[0., 0., 0., 0.], [0., 4.09090909, 4.09090909, 0.],
                      [10., 10., 10., 10.]],
                     dtype=np.double),
            atol=0.01)
예제 #9
0
    def test_right_bc(self):

        solver = LaplaceSolver(nx=4, ny=3)
        solver.set_boundary_condtion('right', lambda x, y: 5)
        solver.numba_solve(quiet=True)
        np.testing.assert_allclose(
            solver.get_solution(),
            np.array([[0., 0., 0., 5.], [0., 0.12121212, 0.78787879, 5.],
                      [0., 0., 0., 5.]],
                     dtype=np.double),
            atol=0.01)