示例#1
0
def main(folder, solver, solver_name, dt):

    gb, domain = problem_data.create_grid(from_file=False, generate_network=True)

    data = {"domain": domain, "t_max": 5000}
    data["time_step"] = dt

    problem_data.add_data(gb, data, solver_name)

    solver(gb, folder)

    outflow_upper, outflow_lower = outlet_fluxes(gb)
    mean = mean_inlet_pressure(gb, solver_name)

    # to store the results for the current problem
    results = np.empty(8, dtype=np.object)

    # save basic informations
    results[0] = "UiB-" + solver_name.upper()
    results[1] = np.sum([g.num_cells for g in gb.grids_of_dimension(3)])
    results[2] = np.sum([g.num_cells for g in gb.grids_of_dimension(2)])
    results[3] = np.sum([g.num_cells for g in gb.grids_of_dimension(1)])
    results[4] = np.sum([g.num_cells for g in gb.grids_of_dimension(0)])
    results[5] = outflow_upper
    results[6] = outflow_lower
    results[7] = mean

    file_name = folder + "/info.txt"
    with open(file_name, "w") as f:
        f.write(", ".join(map(str, results)))

    T, outflow, A, b, block_dof, full_dof = solvers.transport(
        gb, data, solver_name, folder, callback=report_concentrations, save_every=1
    )
示例#2
0
def main(test_case, file_geo, folder, solver, solver_name, N=None):

    tol = 1e-8
    if N is not None:
        gb, domain = problem_data.make_grid_cart(N)
    else:
        gb, domain = problem_data.import_grid(file_geo, tol)

    # select the permeability depending on the selected test case
    if test_case == 0:
        kf = 1e4
        porosity_f = 0.9
    else:
        kf = 1e-4
        porosity_f = 0.01
    data = {
        "domain": domain,
        "tol": tol,
        "aperture": 1e-4,
        "km_low": 1e-1,
        "km": 1,
        "kf": kf,
        "porosity_m": 1e-1,
        "porosity_f": porosity_f,
        "dt": 0.25 / 100,
        "t_max": 0.25,
    }

    problem_data.add_data(gb, data, solver_name)
    solver(gb, folder)

    # to store the results for the current problem
    results = np.empty(5, dtype=np.object)

    # save basic informations
    results[0] = "UiB-" + solver_name.upper()
    results[1] = np.sum([g.num_cells for g in gb.grids_of_dimension(3)])
    results[2] = np.sum([g.num_cells for g in gb.grids_of_dimension(2)])
    results[3] = np.sum([g.num_cells for g in gb.grids_of_dimension(1)])
    results[4] = np.sum([g.num_cells for g in gb.grids_of_dimension(0)])

    file_name = folder + "/info.txt"
    with open(file_name, "w") as f:
        f.write(", ".join(map(str, results)))

    solvers.transport(gb, data, solver_name, folder,
                      problem_data.AdvectiveDataAssigner)
示例#3
0
def main(grid_file, folder, solver, solver_name, dt):

    gb, domain = problem_data.create_grid(grid_file)

    data = {"domain": domain, "t_max": 1}
    data["dt"] = dt

    problem_data.add_data(gb, data, solver_name)

    solver(gb, folder)

    outflow_upper, outflow_lower = outlet_fluxes(gb)
    mean = mean_inlet_pressure(gb, solver_name)

    # to store the results for the current problem
    results = np.empty(8, dtype=np.object)

    # save basic informations
    results[0] = "UiB-" + solver_name.upper()
    results[1] = np.sum([g.num_cells for g in gb.grids_of_dimension(3)])
    results[2] = np.sum([g.num_cells for g in gb.grids_of_dimension(2)])
    results[3] = np.sum([g.num_cells for g in gb.grids_of_dimension(1)])
    results[4] = np.sum([g.num_cells for g in gb.grids_of_dimension(0)])
    results[5] = outflow_upper
    results[6] = outflow_lower
    results[7] = mean

    file_name = folder + "/info.txt"
    with open(file_name, "w") as f:
        f.write(", ".join(map(str, results)))

    solvers.transport(
        gb,
        data,
        solver_name,
        folder,
        problem_data.AdvectiveDataAssigner,
        callback=report_concentrations,
    )
示例#4
0
def main(file_geo, folder, solver, solver_name):

    tol = 1e-8
    gb, domain = problem_data.import_grid(file_geo, tol)

    # select the permeability depending on the selected test case
    data = {
        "domain": domain,
        "tol": tol,
        "aperture": 1e-2,
        "km_low": 1e-6,
        "km_high": 1e-5,
        "kf": 1e-1,
        "porosity_low": 0.2,
        "porosity_high": 0.25,
        "porosity_f": 0.4,
        "time_step": 1e7,
        "t_max": 1e9,
    }

    problem_data.add_data(gb, data, solver_name)
    solver(gb, folder)

    # to store the results for the current problem
    results = np.empty(5, dtype=np.object)

    # save basic informations
    results[0] = "UiB-" + solver_name.upper()
    results[1] = np.sum([g.num_cells for g in gb.grids_of_dimension(3)])
    results[2] = np.sum([g.num_cells for g in gb.grids_of_dimension(2)])
    results[3] = np.sum([g.num_cells for g in gb.grids_of_dimension(1)])
    results[4] = np.sum([g.num_cells for g in gb.grids_of_dimension(0)])

    file_name = folder + "/info.txt"
    with open(file_name, "w") as f:
        f.write(", ".join(map(str, results)))

    T, outflow, A, b, block_dof, full_dof = solvers.transport(gb,
                                                              data,
                                                              solver_name,
                                                              folder,
                                                              save_every=1)

    np.savetxt(folder + "/outflow.csv", outflow)