예제 #1
0
def main(coarse):
    tol = 1e-6

    problem_kwargs = {}
    problem_kwargs['file_name'] = 'solution'
    if coarse:
        problem_kwargs['folder_name'] = 'vem_coarse'
    else:
        problem_kwargs['folder_name'] = 'vem'

    h = 0.08
    grid_kwargs = {}
    grid_kwargs['mesh_size'] = {
        'mode': 'constant',
        'value': h,
        'bound_value': h,
        'tol': tol
    }

    file_dfm = 'dfm.csv'
    gb, domain = importer.dfm_3d_from_csv(file_dfm, tol, **grid_kwargs)
    gb.compute_geometry()
    if coarse:
        coarsening.coarsen(gb, 'by_volume')

    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]

    problem = elliptic.DualEllipticModel(gb, **problem_kwargs)

    # Assign parameters
    add_data(gb, domain, tol)

    problem.solve()
    problem.split()

    problem.pressure('pressure')
    problem.discharge('discharge')
    problem.project_discharge('P0u')
    problem.save(['pressure', 'P0u', 'frac_num'])

    for g, d in gb:
        g.face_tags = d['face_tags']

    problem_kwargs['file_name'] = 'transport'

    for g, d in gb:
        d['problem'] = AdvectiveModelData(g, d, domain, tol)

    advective = AdvectiveModel(gb, **problem_kwargs)
    advective.solve()
    advective.save()
예제 #2
0
def main(coarse):
    tol = 1e-6

    problem_kwargs = {}
    problem_kwargs["file_name"] = "solution"
    if coarse:
        problem_kwargs["folder_name"] = "vem_coarse"
    else:
        problem_kwargs["folder_name"] = "vem"

    h = 0.08
    grid_kwargs = {}
    grid_kwargs["mesh_size"] = {
        "mode": "constant",
        "value": h,
        "bound_value": h,
        "tol": tol,
    }

    file_dfm = "dfm.csv"
    gb, domain = importer.dfm_3d_from_csv(file_dfm, tol, **grid_kwargs)
    gb.compute_geometry()
    if coarse:
        coarsening.coarsen(gb, "by_volume")

    problem = elliptic.DualEllipticModel(gb, **problem_kwargs)

    # Assign parameters
    add_data(gb, domain, tol)

    problem.solve()
    problem.split()

    problem.pressure("pressure")
    problem.discharge("discharge")
    problem.project_discharge("P0u")
    problem.save(["pressure", "P0u", "frac_num"])

    problem_kwargs["file_name"] = "transport"

    for g, d in gb:
        d["problem"] = AdvectiveModelData(g, d, domain, tol)

    advective = AdvectiveModel(gb, **problem_kwargs)
    advective.solve()
    advective.save()
예제 #3
0
def main():
    tol = 1e-6

    problem_kwargs = {}
    problem_kwargs['file_name'] = 'solution'
    problem_kwargs['folder_name'] = 'tpfa'

    h = 0.08
    grid_kwargs = {}
    grid_kwargs['mesh_size'] = {
        'mode': 'constant',
        'value': h,
        'bound_value': h,
        'tol': tol
    }

    file_dfm = 'dfm.csv'
    gb, domain = importer.dfm_3d_from_csv(file_dfm, tol, **grid_kwargs)
    gb.compute_geometry()

    problem = elliptic.EllipticModel(gb, **problem_kwargs)

    # Assign parameters
    add_data(gb, domain, tol)

    problem.solve()
    problem.split()

    problem.pressure('pressure')
    problem.discharge('discharge')
    problem.save(['pressure', 'frac_num'])

    problem_kwargs['file_name'] = 'transport'

    for g, d in gb:
        d['problem'] = AdvectiveModelData(g, d, domain, tol)

    advective = AdvectiveModel(gb, **problem_kwargs)
    advective.solve()
    advective.save()
예제 #4
0
from porepy.grids.simplex import StructuredTriangleGrid
from porepy.grids.grid import FaceTag
from porepy.numerics import elliptic

test_case = 1
assert test_case == 1 or test_case == 2

# geometrical tolerance
tol = 1e-8
VEM = True

# first line in the file is the domain boundary, the others the fractures
file_dfm = "geiger_3d.csv"

# import the dfm and generate the grids
gb, domain = importer.dfm_3d_from_csv(file_dfm, tol, h_ideal=0.2, h_min=0.2)
gb.compute_geometry()

for _, d in gb.edges_props():
    mg = d["mortar_grid"]
    # print(mg.high_to_mortar.shape[0])

dom_min = 0
dom_max = 1

if True:
    frac_list, network, domain = importer.network_3d_from_csv("geiger_3d.csv")
    # Conforming=False would have been cool here, but that does not split the 1d grids
    gb_new = meshing.dfn(frac_list, conforming=True, h_ideal=0.07, h_min=0.05)

    gmap = {}