Exemplo n.º 1
0
def plot(pb):

    color_f = pb["wells"]["color"]

    pb["domain"] = pp.cg.bounding_box(pb["dfn"]["pts"])
    pp.plot_fractures(
        pb["domain"],
        pb["dfn"]["pts"],
        pb["dfn"]["edges"],
        plot=False,
        fig_id=1,
        colortag=color_f,
    )

    pp.plot_wells(
        pb["domain"],
        pb["wells"]["position"],
        plot=False,
        fig_id=1,
        colortag=pb["wells"]["fracture"],
    )

    plt.figure(1)
    plt.xlabel("x [m]")
    plt.ylabel("y [m]")
    plt.show()
Exemplo n.º 2
0
def main():
    # example in 2d
    file_name = "network.csv"
    write_network(file_name)

    # load the network and split it, we assume 2d
    domain = {"xmin": 0, "xmax": 1, "ymin": 0, "ymax": 1}
    global_network = pp.fracture_importer.network_2d_from_csv(file_name,
                                                              domain=domain)
    global_network = global_network.split_intersections()

    # select a subsample of the fractures
    macro_network, micro_network = split_network(global_network,
                                                 Criterion.every)
    # NOTE: the explicit network is empty so far

    # create the macroscopic grid
    mesh_size = 2
    mesh_kwargs = {
        "mesh_size_frac": mesh_size,
        "mesh_size_min": mesh_size / 20
    }
    gb = macro_network.mesh(mesh_kwargs)

    # plot the suff
    pp.plot_fractures(micro_network.pts, micro_network.edges,
                      micro_network.domain)
    pp.plot_grid(gb, info="c", alpha=0)

    # construct the solver
    tpfa_dfm = Tpfa_DFM()

    # Set data for the upscaling problem
    g = gb.grids_of_dimension(gb.dim_max())[0]
    d = gb.node_props(g)

    # store the
    # EK: We probably need to initialize some of the nested dictionaries
    d[pp.PARAMETERS][tpfa_dfm.keyword][
        tpfa_dfm.network_keyword] = micro_network

    # set parameters and discretization variables
    # EK: This must be done in this run-script - it is not the responsibility of the
    # discretization. We may want to construct a model for this.
    # tpfa_dfm.set_parameters(gb)
    # tpfa_dfm.set_variables_discretizations(gb)

    # discretize with the assembler
    assembler = pp.Assembler(gb)
    assembler.discretize()

    A, b = assembler.assemble_matrix_rhs()

    # Solve and distribute
    x = spsolve(A, b)
    assembler.distribute_variable(x)
Exemplo n.º 3
0
    def plot(self, **kwargs):
        """ Plot the fracture set.

        The function passes this fracture set to PorePy plot_fractures

        Parameters:
            **kwargs: Keyword arguments to be passed on to matplotlib.

        """
        pp.plot_fractures(self.domain, self.pts, self.edges, **kwargs)
Exemplo n.º 4
0
import numpy as np
import porepy as pp

from examples.papers.flow_upscaling.import_grid import raw_from_csv
from examples.papers.flow_upscaling.frac_gen import fit, generate

if __name__ == "__main__":
    file_geo = "algeroyna_1to100.csv"

    pts, edges, frac = raw_from_csv(file_geo, {"mesh_size_frac": 10},
                                    {"snap": 1e-3})

    domain = {
        "xmin": pts[0].min(),
        "xmax": pts[0].max(),
        "ymin": pts[1].min(),
        "ymax": pts[1].max(),
    }

    pp.plot_fractures(domain, pts, edges)

    # we assume only 1 family, need to change the next line instead
    family = np.ones(frac.size)

    dist_l, dist_a = fit(pts, edges, frac, family)
    pts_n, edges_n = generate(pts, edges, frac, dist_l, dist_a)

    pp.plot_fractures(domain, pts_n, edges_n)