Example #1
0
    def test_porous_random_seeding(self):
        '''Test the reproducibility of the meshing algorithm.'''

        L = np.array([2.0, 2.0])
        R = 0.1
        dx = 0.1
        rs = np.array([
            [-0.5, 0.5],
            [0.0, 0.0],
            [0.1, 0.4],
            [0.88, 0.88],
            [0.88, 0.0],
        ])

        np.random.seed(2)
        mesh_1 = mesh.porous_mesh_factory(rs, R, dx, L)

        np.random.seed(3)
        mesh_2 = mesh.porous_mesh_factory(rs, R, dx, L)

        self.assertTrue(np.allclose(mesh_1.cellCenters.value,
                                    mesh_2.cellCenters.value))
Example #2
0
 def get_mesh(self, L, dx):
     return mesh.porous_mesh_factory(self.rs, self.R, dx, L)