Ejemplo n.º 1
0
def make_grid_bucket():
    """
    Define the geometry and produce the meshes
    """
    mesh_kwargs = {'tol': 1e-7}
    mesh_size = 0.05
    mesh_kwargs = {'mesh_size_frac': mesh_size,
                       'mesh_size_min': mesh_size / 20}
    domain = {'xmin': 0, 'xmax': 1, 'ymin': 0, 'ymax': 1}

    file_name = 'network_scotti.csv'
    write_network(file_name)
    gb = importer.dfm_2d_from_csv(file_name, mesh_kwargs, domain)
    return gb, domain
Ejemplo n.º 2
0
def make_grid_bucket():
    """
    Define the geometry and produce the meshes
    """
    mesh_kwargs = {"tol": 1e-7}
    mesh_size = 0.05
    mesh_kwargs = {
        "mesh_size_frac": mesh_size,
        "mesh_size_min": mesh_size / 20
    }
    domain = {"xmin": 0, "xmax": 1, "ymin": 0, "ymax": 1}

    file_name = "network_scotti.csv"
    write_network(file_name)
    gb = importer.dfm_2d_from_csv(file_name, mesh_kwargs, domain)
    return gb, domain
Ejemplo n.º 3
0
def make_grid_bucket():
    """
    Define the geometry and produce the meshes
    """
    mesh_kwargs = {'tol': 1e-7}
    mesh_size = 0.05
    mesh_kwargs['mesh_size'] = {
        'mode': 'constant',
        'value': mesh_size,
        'bound_value': mesh_size
    }

    domain = {'xmin': 0, 'xmax': 1, 'ymin': 0, 'ymax': 1}

    file_name = 'network_scotti.csv'
    write_network(file_name)
    gb = importer.dfm_2d_from_csv(file_name, mesh_kwargs, domain)
    return gb, domain
Ejemplo n.º 4
0
def main(kf, description, is_coarse=False, if_export=False):
    mesh_kwargs = {}
    mesh_kwargs['mesh_size'] = {
        'mode': 'constant',
        'value': 0.045,
        'bound_value': 0.045
    }

    domain = {'xmin': 0, 'xmax': 1, 'ymin': 0, 'ymax': 1}

    file_name = 'network_geiger.csv'
    write_network(file_name)
    gb = importer.dfm_2d_from_csv(file_name, mesh_kwargs, domain)
    gb.compute_geometry()
    if is_coarse:
        co.coarsen(gb, 'by_volume')
    gb.assign_node_ordering()

    internal_flag = FaceTag.FRACTURE
    [g.remove_face_tag_if_tag(FaceTag.BOUNDARY, internal_flag) for g, _ in gb]

    # Assign parameters
    add_data(gb, domain, kf)

    # Choose and define the solvers and coupler
    solver_flow = vem_dual.DualVEMMixedDim('flow')
    A_flow, b_flow = solver_flow.matrix_rhs(gb)

    solver_source = vem_source.IntegralMixedDim('flow')
    A_source, b_source = solver_source.matrix_rhs(gb)

    up = sps.linalg.spsolve(A_flow + A_source, b_flow + b_source)
    solver_flow.split(gb, "up", up)

    gb.add_node_props(["discharge", 'pressure', "P0u"])
    solver_flow.extract_u(gb, "up", "discharge")
    solver_flow.extract_p(gb, "up", 'pressure')
    solver_flow.project_u(gb, "discharge", "P0u")

    if if_export:
        save = Exporter(gb, "vem", folder="vem_" + description)
        save.write_vtk(['pressure', "P0u"])
Ejemplo n.º 5
0
def main(kf, description, multi_point, if_export=False):

    # Define the geometry and produce the meshes
    mesh_kwargs = {}
    mesh_size = 0.045
    mesh_kwargs['mesh_size'] = {
        'mode': 'constant',
        'value': mesh_size,
        'bound_value': mesh_size
    }
    domain = {'xmin': 0, 'xmax': 1, 'ymin': 0, 'ymax': 1}

    file_name = 'network_geiger.csv'
    write_network(file_name)
    gb = importer.dfm_2d_from_csv(file_name, mesh_kwargs, domain)
    gb.compute_geometry()
    gb.assign_node_ordering()

    # Assign parameters
    add_data(gb, domain, kf, mesh_size)

    # Choose discretization and define the solver
    if multi_point:
        solver = mpfa.MpfaMixedDim('flow')
    else:
        solver = tpfa.TpfaMixedDim('flow')

    # Discretize
    A, b = solver.matrix_rhs(gb)

    # Solve the linear system
    p = sps.linalg.spsolve(A, b)

    # Store the solution
    gb.add_node_props(['pressure'])
    solver.split(gb, 'pressure', p)

    if if_export:
        save = Exporter(gb, "fv", folder="fv_" + description)
        save.write_vtk(['pressure'])
        d['discharge'] = discharge

#------------------------------------------------------------------------------#


do_save = False
folder = os.path.dirname(os.path.realpath(__file__)) + "/"
export_folder = folder + 'advection_diffusion_coupling'
tol = 1e-3

mesh_kwargs = {}
mesh_kwargs['mesh_size'] = {'mode': 'constant',
                            'value': 0.045, 'bound_value': 0.045}

domain = {'xmin': -0.2, 'xmax': 1.2, 'ymin': -0.2, 'ymax': 1.2}
gb = importer.dfm_2d_from_csv(folder + 'network.csv', mesh_kwargs, domain)
gb.compute_geometry()
gb.assign_node_ordering()

gb.add_node_props(['face_tags'])
for g, d in gb:
    d['face_tags'] = g.face_tags.copy()

internal_flag = FaceTag.FRACTURE
[g.remove_face_tag_if_tag(FaceTag.BOUNDARY, internal_flag) for g, _ in gb]

# Assign parameters
add_data_darcy(gb, domain, tol)

# Choose and define the solvers and coupler
darcy = vem_dual.DualVEMMixedDim('flow')