示例#1
0
    def setup_subproblems(self, gb, mp, mix, suffix):

        kw = {'folder_name': main_folder + suffix}

        darcy_problem = DarcySolver(gb, mp, mix, suffix, kw)
        assign_data(gb, TransportData, 'transport_data')
        transport_problem = TransportSolver(gb, kw)
        return darcy_problem, transport_problem
示例#2
0
    def setup_subproblems(self, gb, mp, mix):
        appendix = ''
        if mp:
            appendix += '_mp'
        elif mix:
            appendix += '_mix'
        kw = {'folder_name': main_folder + appendix}

        darcy_problem = DarcySolver(gb, mp, mix, kw)
        assign_data(gb, TransportData, 'transport_data')
        transport_problem = TransportSolver(gb, kw)
        return darcy_problem, transport_problem
示例#3
0
        tr = np.asarray(tracer)
        tempvec = tr[:, ny**2 - 1]
        np.savetxt(folder + '/tracer' + appendix + '.csv',
                   tr[-1, :], delimiter=",")

        np.savetxt(folder + '/tvec' + appendix + '.csv',
                   tempvec, delimiter=",")


if __name__ == '__main__':
    ny = [4, 8, 16, 32]
    yfactor = [1, 2, 4, 6]
    deg = [10, 30, 60]
    main_folder = 'results/'
    for n in ny:
        gb = define_grid(n, n)
        assign_data(gb, FlowData, 'problem')
        edge_params(gb)
        assign_data(gb, TransportData, 'transport_data')
        for y in yfactor:
            for d in deg:
                appendix = '{}cells_{}degrees_{}factor'.format(n, d, y)
                kw = {'folder_name': main_folder + appendix}
                anisotropy(gb, d, y)
                darcy_problem = DarcySolver(gb)
                transport_problem = TransportSolver(gb)
                Full = BothProblems(darcy_problem, transport_problem)
                p, t = Full.solve()
#                Full.save()
                Full.save_text(t, n, main_folder, appendix)
示例#4
0
    ax.text2D(1, 0.54, z_label, transform=ax.transAxes, size=sz)
    ax.text2D(0.25, 0, '$K_h$', transform=ax.transAxes, size=sz)
    ax.text2D(.85, 0.08, '$K_v$', transform=ax.transAxes, size=sz)
    #    plt.title(t1 + ', ' + title, position=(.5, 1.06), size=sz)
    plt.savefig('figures/' + plot_type + title + '.png')


def split_mrst_to_gb(gb, u):
    Both.el.flux_disc().split(gb, 'pressure', u)


if __name__ == "__main__":
    # Set up grid
    nc = 4
    gb = define_grid(nc, nc)
    assign_data(gb, FlowData, 'problem')
    # Copy it for the elimination
    gb_el, _ = gb.duplicate_without_dimension(0)
    # Initialize model and solver class
    problem = EllipticModel(gb)
    problem_el = EllipticModel(gb_el)
    # Merge for convenience
    Both = BothProblems(problem, problem_el)
    # Define permeability ranges
    horizontal_permeabilities = [10**i for i in range(-3, 4)]
    vertical_permeabilities = horizontal_permeabilities.copy()

    global_errors_porepy = np.zeros(
        (len(horizontal_permeabilities), len(vertical_permeabilities)))
    global_errors_mrst = np.zeros(
        (len(horizontal_permeabilities), len(vertical_permeabilities)))