예제 #1
0
    def test_no_family_given(self):
        # Assign fracture family automatically
        tol = 1e-2
        p = np.array([[0, 0], [2, 0], [1, 0], [1, 3]]).T
        e = np.array([[0, 1], [2, 3]]).T

        fractures = extrusion.fractures_from_outcrop(p, e, tol=tol)
        self.assertTrue(np.all(fractures[1].p[1] >= -tol))
예제 #2
0
def create(conforming, tol=1e-4):

    csv_folder = "./"
    csv_file = "example_4_outcrop.csv"
    pts, edges = importer.lines_from_csv(csv_folder + csv_file)

    # A tolerance of 1 seems to be sufficient to recover the T-intersections, but
    # I might have missed some, though, so take a look at the network and modify
    # if necessary.
    snap_pts = cg.snap_points_to_segments(pts, edges, tol=1)

    extrusion_kwargs = {}
    extrusion_kwargs["tol"] = tol
    extrusion_kwargs["exposure_angle"] = np.pi / 4.0 * np.ones(edges.shape[1])
    # Added an option not to include the points on the exposed surface. This
    # reduces cell refinement somewhat, but setting it True should also be okay
    extrusion_kwargs["outcrop_consistent"] = True

    fractures = extrusion.fractures_from_outcrop(snap_pts, edges,
                                                 **extrusion_kwargs)
    network = FractureNetwork(fractures, tol=tol)
    # network.to_vtk(folder_export+"network.vtu")
    bounding_box = {
        "xmin": -800,
        "xmax": 600,
        "ymin": 100,
        "ymax": 1500,
        "zmin": -100,
        "zmax": 1000,
    }
    network.impose_external_boundary(bounding_box,
                                     truncate_fractures=True,
                                     keep_box=False)

    mesh_kwargs = {}
    h = 30
    mesh_kwargs["mesh_size"] = {
        "mode": "weighted",  # 'distance'
        "value": h,
        "bound_value": h,
        "tol": tol,
    }

    if conforming:
        # Change h_ideal and h_min at will here, but I ran into trouble with h_min < 1.
        gb = meshing.dfn(network, conforming=True, h_ideal=100, h_min=5)
    else:
        # Switch conforming=True to get conforming meshes
        gb = meshing.dfn(network,
                         conforming=False,
                         **mesh_kwargs,
                         keep_geo=True)

    gb.remove_nodes(lambda g: g.dim == 0)
    gb.compute_geometry()
    gb.assign_node_ordering()

    return gb
예제 #3
0
    def test_cut_off(self):
        # Two fractures, the second abutting. Check that the second fracture is
        # cut correctly.
        tol = 1e-4
        p = np.array([[0, 0], [2, 0], [1, 0], [1, 10]]).T
        e = np.array([[0, 1], [2, 3]]).T

        fractures = extrusion.fractures_from_outcrop(p, e, tol=tol)
        self.assertTrue(np.all(fractures[1].p[1] > -tol))
예제 #4
0
    def test_not_aligned_outcrop(self):
        # The fractures are not aligned with the mesh
        p = np.array([[0, 0], [2, 2], [1, 1], [1, 3]]).T
        e = np.array([[0, 1], [2, 3]]).T

        tol = 1e-4

        fractures = extrusion.fractures_from_outcrop(p, e, tol=tol)
        #
        self.assertTrue(np.all(fractures[1].p[1] >= fractures[1].p[0] - tol))
예제 #5
0
    def test_rotation(self):
        # Test a case with a fracture terminated in both ends (H-configuration)
        # This turned out to be problematic for certain cases.
        # The test is simply that it runs - should have something more
        # insightful here
        pt = np.array([[
            0.4587156, 0.76605504, 0.60586278, 0.74934585, 0.46570401,
            0.55721055
        ],
                       [
                           0.28593274, 0.35321103, 0.31814406, 0.028759,
                           0.44178218, 0.30749384
                       ]])
        edges = np.array([[0, 1], [2, 3], [4, 5]]).T

        np.random.seed(7)
        family = np.zeros(3, dtype=np.int)
        extrusion.fractures_from_outcrop(pt,
                                         edges,
                                         family=family,
                                         family_std_incline=[0.3])