def test_one_to_boundar_3d(self): """ One fracture in 3d going all the way to the boundary """ f_1 = np.array([[1, 5, 5, 1], [1, 1, 1, 1], [1, 1, 3, 3]]) f_set = [pp.Fracture(f_1)] domain = {"xmin": 0, "ymin": 0, "zmin": 0, "xmax": 5, "ymax": 5, "zmax": 5} mesh_size_min = .1 mesh_size_frac = .1 mesh_size_bound = 2 on_boundary = np.array( [False, False, False, False, True, True, True, True, True, True, True, True] ) network = pp.FractureNetwork(f_set) network.impose_external_boundary(domain) network.find_intersections() network.split_intersections() network.insert_auxiliary_points( mesh_size_frac=mesh_size_frac, mesh_size_min=mesh_size_min, mesh_size_bound=mesh_size_bound, ) mesh_size = network._determine_mesh_size(boundary_point_tags=on_boundary) # 0.1 corresponds to fracture corners, 2.0 to domain corners far # away from the fracture and the other values to domain corners # affected by the mesh_size_known = np.array( [0.1, 0.1, 0.1, 0.1, 2., 1.73205081, 2., 2., 2., 1.41421356, 2., 2.] ) self.assertTrue(np.all(np.isclose(mesh_size, mesh_size_known)))
def import_grid(file_geo, tol): frac = pp.Fracture( np.array([[0, 10, 10, 0], [0, 0, 10, 10], [8, 2, 2, 8]]) * 10) network = pp.FractureNetwork([frac], tol=tol) domain = { "xmin": 0, "xmax": 100, "ymin": 0, "ymax": 100, "zmin": 0, "zmax": 100 } network.impose_external_boundary(domain) network.find_intersections() network.split_intersections() network.to_gmsh("dummy.geo") gb = pp.importer.dfm_from_gmsh(file_geo, 3, network) gb.compute_geometry() return gb, domain
def create_grid(): file_name = 'fractures.csv' data = np.genfromtxt(file_name, delimiter=',') data = np.atleast_2d(data) centers = data[:, 0:3] maj_ax = data[:, 3] min_ax = data[:, 4] maj_ax_ang = data[:, 5] strike_ang = data[:, 6] dip_ang = data[:, 7] if data.shape[1] == 9: num_points = data[:, 8] else: num_points = 16 * np.ones(data.shape[0]) frac_list = [] for i in range(maj_ax.shape[0]): frac_list.append( pp.EllipticFracture(centers[i, :], maj_ax[i], min_ax[i], maj_ax_ang[i], strike_ang[i], dip_ang[i], num_points[i])) frac_network = pp.FractureNetwork(frac_list) box = { 'xmin': -5000, 'ymin': -5000, 'zmin': -5000, 'xmax': 10000, 'ymax': 10000, 'zmax': 10000 } gb = pp.meshing.simplex_grid(frac_network, box, mesh_size_bound=10000, mesh_size_frac=500, mesh_size_min=200) return gb
def create_grid(fn): domain = { "xmin": 0, "xmax": 1, "ymin": 0, "ymax": 2.25, "zmin": 0, "zmax": 1 } _, ext = os.path.splitext(fn) if ext == ".geo": f1 = pp.Fracture( np.array([ [0.05, 0.25, 0.05], [0.95, 0.25, 0.05], [0.95, 2, 0.05], [0.05, 2, 0.05], ]).T) f2 = pp.Fracture( np.array([ [0.5, 0.05, 0.95], [0.5, 0.05, 0.05], [0.5, 0.3, 0.05], [0.5, 0.3, 0.95], ]).T) f3 = pp.Fracture( np.array([[0.05, 1, 0.5], [0.95, 1, 0.5], [0.95, 2, 0.85], [0.05, 2, 0.85]]).T) f4 = pp.Fracture( np.array([[0.05, 1, 0.49], [0.95, 1, 0.49], [0.95, 2, 0.14], [0.05, 2, 0.14]]).T) f5 = pp.Fracture( np.array([ [0.23, 1.9, 0.195], [0.23, 1.9, 0.795], [0.17, 2.7, 0.795], [0.17, 2.7, 0.195], ]).T) f6 = pp.Fracture( np.array([ [0.17, 1.9, 0.195], [0.17, 1.9, 0.795], [0.23, 2.7, 0.795], [0.23, 2.7, 0.195], ]).T) f7 = pp.Fracture( np.array([ [0.77, 1.9, 0.195], [0.77, 1.9, 0.795], [0.77, 2.7, 0.795], [0.77, 2.7, 0.195], ]).T) f8 = pp.Fracture( np.array([ [0.83, 1.9, 0.195], [0.83, 1.9, 0.795], [0.83, 2.7, 0.795], [0.83, 2.7, 0.195], ]).T) network = pp.FractureNetwork([f1, f2, f3, f4, f5, f6, f7, f8]) network.impose_external_boundary(domain) network.find_intersections() network.split_intersections() network.to_gmsh("tmp.geo") tm = time.time() gb = pp.importer.dfm_from_gmsh(fn, 3, network) print("Elapsed time " + str(time.time() - tm)) elif ext == ".grid": gb = pickle.load(open(fn, "rb")) else: raise ValueError("Not supported data format") return gb, domain