コード例 #1
0
ファイル: plot_wbhp.py プロジェクト: qilicun/script
                    '--en',
                    help='Name of ecl data files',
                    default=None,
                    required=True)
parser.add_argument('-v',
                    '--vn',
                    nargs='+',
                    help='Name of vectors',
                    default=None,
                    required=True)
##Get FPR from output/pressure/*.txt
args = parser.parse_args()
##Get FPR from output/pressure/*.txt

#load ecl result
sum_ecl = ecl.EclSum(args.en)
sum_opm = ecl.EclSum(args.fn)
#set fixed time step
scale = 1e5
for v in args.vn:
    plt.figure()
    plt.title("WBHP:" + v)
    plt.plot(sum_opm.days, sum_opm.get_values("WBHP:" + v) / scale)
    plt.plot(sum_ecl.days, sum_ecl.get_values("WBHP:" + v), color='red')
    plt.xlabel("Time/Day")
    plt.ylabel("WBHP(bar)")
    plt.legend(["opm", "ecl"], loc='best')
    picpath = "/private/miliu/data/norne/" + args.en.lower() + "_WBHP" "_" + v
    plt.savefig(picpath + ".png")
#plt.show()
コード例 #2
0
ファイル: Optimization.py プロジェクト: mahg/OpenDect
def Swarmfunction(p, hist, ExpParams, Orientation, Padding_top, Padding_bottom,
                  Crop_pct, nblocks, nblocks_z, nCycle, clength, Swcr, n,
                  window):
    joblist = []
    pb_out = []
    currentjobs = True

    for i in range(0, n):

        index = 0
        for k, param in enumerate(window.StaticParams):

            if not window.ActiveParams[k]: window.DynamicParams[k] = param
            else:
                window.DynamicParams[k] = p[index, i]
                index += 1

        window.Writetoconsole("Running simulation for :" +
                              str(window.DynamicParams))
        Epsilon = 0.00001
        WriteDATAfile(window.height, ExpParams, Orientation, Padding_top,
                      Padding_bottom, Crop_pct, nblocks, nblocks_z,
                      window.DynamicParams[3], window.DynamicParams[4],
                      window.DynamicParams[5], Swcr, window.DynamicParams[6],
                      window.DynamicParams[7], window.DynamicParams[0],
                      window.DynamicParams[1], window.DynamicParams[2],
                      window.DynamicParams[11], window.DynamicParams[10],
                      window.DynamicParams[9], window.DynamicParams[8], nCycle,
                      clength, i)
        joblist += [RunEclipse_checkout("temp/CORE_TEST-" + str(i) + ".DATA")]

    while (currentjobs == True):
        currentjobs = Testforjobs(joblist)

    for i in range(0, n):
        summary = ecl.EclSum("temp/CORE_TEST-" + str(i) + ".DATA")

        FOPT = summary["FOPT"]
        FWPT = summary["FWPT"]
        BPR_IN = summary["BPR:" + str(int(float(nblocks) / 2) + 1) + "," +
                         str(int(float(nblocks) / 2) + 1) + "," +
                         str(nblocks_z)]
        BPR_OUT = summary["BPR:" + str(int(float(nblocks) / 2) + 1) + "," +
                          str(int(float(nblocks) / 2) + 1) + ",1"]
        BPR_IN_init = BPR_IN.first.value
        BPR_OUT_init = BPR_OUT.first.value
        DELTA = [[], [], []]
        TEST = []

        for node1, node2, node3, node4, node5 in zip(FOPT, FWPT, BPR_IN,
                                                     BPR_OUT, hist):
            hist_node = node5.split("\t")
            hist_oil = float(hist_node[0]) + Epsilon
            hist_wat = float(hist_node[1]) + Epsilon
            hist_diff = float(hist_node[2]) + Epsilon
            DELTA[0] += [((node1.value - hist_oil) / hist_oil)**2]
            DELTA[1] += [((node2.value - hist_wat) / hist_wat)**2]
            DELTA[2] += [(((abs(node3.value - node4.value) /
                            abs(BPR_IN_init / BPR_OUT_init)) - hist_diff) /
                          hist_diff)**2]
        pb_out += [np.sum(DELTA[0] + DELTA[1] + DELTA[2])
                   ]  #opt on oil only so far

    return pb_out
コード例 #3
0
ファイル: CoreSimulation.py プロジェクト: mahg/OpenDect
def PlotEclipseResults(CASE, ExpParams, Orientation, nblocks, nblocks_z):
    summary = ecl.EclSum(CASE)
    Method = ExpParams[8]

    if Method == "USS":
        FOPT = summary["FOPT"]
        FWPT = summary["FWPT"]

        if Orientation == "Vertical":
            BPR_IN = summary["BPR:" + str(int(float(nblocks) / 2) + 1) + "," +
                             str(int(float(nblocks) / 2) + 1) + "," +
                             str(nblocks_z)]
            BPR_OUT = summary["BPR:" + str(int(float(nblocks) / 2) + 1) + "," +
                              str(int(float(nblocks) / 2) + 1) + ",1"]
        else:
            BPR_IN = summary["BPR:1," + str(int(float(nblocks) / 2) + 1) +
                             "," + str(int(float(nblocks) / 2) + 1)]
            BPR_OUT = summary["BPR:" + str(nblocks_z) + "," +
                              str(int(float(nblocks) / 2) + 1) + "," +
                              str(int(float(nblocks) / 2) + 1)]

        BPR_IN_init = BPR_IN.first.value
        BPR_OUT_init = BPR_OUT.first.value
        FOPT_values = []
        FWPT_values = []
        DIFF = []

        for node1, node2, node3, node4 in zip(FOPT, FWPT, BPR_IN, BPR_OUT):
            FOPT_values += [node1.value]
            FWPT_values += [node2.value]
            DIFF += [
                abs(node3.value - node4.value) /
                abs(BPR_IN_init / BPR_OUT_init)
            ]

    else:
        FOPT = summary["FOPT"]
        FWPT = summary["FWPT"]
        FOIT = summary["FOIT"]
        FWIT = summary["FWIT"]

        if Orientation == "Vertical":
            BPR_IN = summary["BPR:" + str(int(float(nblocks) / 2) + 1) + "," +
                             str(int(float(nblocks) / 2) + 1) + "," +
                             str(nblocks_z)]
            BPR_OUT = summary["BPR:" + str(int(float(nblocks) / 2) + 1) + "," +
                              str(int(float(nblocks) / 2) + 1) + ",1"]
        else:
            BPR_IN = summary["BPR:1," + str(int(float(nblocks) / 2) + 1) +
                             "," + str(int(float(nblocks) / 2) + 1)]
            BPR_OUT = summary["BPR:" + str(nblocks_z) + "," +
                              str(int(float(nblocks) / 2) + 1) + "," +
                              str(int(float(nblocks) / 2) + 1)]

        BPR_IN_init = BPR_IN.first.value
        BPR_OUT_init = BPR_OUT.first.value
        FOPT_values = []
        FWPT_values = []
        DIFF = []

        for node1, node2, node3, node4, node5, node6 in zip(
                FOPT, FWPT, BPR_IN, BPR_OUT, FOIT, FWIT):
            FOPT_values += [node1.value - node5.value]
            FWPT_values += [node2.value - node6.value]
            DIFF += [
                abs(node3.value - node4.value) /
                abs(BPR_IN_init / BPR_OUT_init)
            ]

    return FOPT_values, FWPT_values, DIFF
コード例 #4
0
ファイル: plot_fpr.py プロジェクト: qilicun/script
        sum1 = 0
        sum2 = 0
        p = np.loadtxt(pfiles[i])
        sw = np.loadtxt(sfiles[i])
        print len(p), len(sw), len(pv)
        for cell in range(0, len(p)):
            sum1 += p[cell] * pv[cell] * (1 - sw[3 * cell])
            sum2 += pv[cell] * (1 - sw[3 * cell])
        tmp.append(sum1 / sum2)
    return np.array(tmp)


print "Starting plot field pressure\n"
opm_pav = get_opm_pav(args.fn, args.pn)
#load ecl result
ecl_pav = ecl.EclSum(args.en)
#set fixed time step
#timestep =[0,1.0, 1.0, 1.0, 1.5, 1.5, 4.0, 5.0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0, 10.0, 10.0, 2.0, 2.5, 3.9099999999999966, 5.7900000000000063, 5.7999999999999972, 12.5, 12.5, 12.5, 12.5, 25.0, 2.5, 3.1200000000000045, 4.8899999999999864, 7.2400000000000091, 7.25, 12.5, 12.5, 25.0, 2.5, 3.1200000000000045, 4.8899999999999864, 7.2400000000000091, 7.25, 12.5, 12.5]
dt = np.add.accumulate(timestep)
print len(dt)
plt.plot(dt, opm_pav / 1e5, label='OPM')
plt.plot(ecl_pav.days, ecl_pav.get_values("FPR"), label='ECL', color='red')
plt.grid(True)
plt.title("FPR In OPM and ECL")
plt.legend(loc='best')
plt.xlabel("Time/Day")
plt.ylabel("FPR(bar)")
picpath = "/private/miliu/data/norne/"
picname = args.en.lower() + "_fpr"
plt.savefig(picpath + picname + ".png")
print "End."
コード例 #5
0
                    required=True)
#parser.add_argument('-f', '--fn', nargs='+', help='Name of opm data files', default=None, required=True)
parser.add_argument('-e',
                    '--en',
                    help='Name of ecl data files',
                    default=None,
                    required=True)
parser.add_argument('-m',
                    '--mn',
                    nargs='+',
                    help='Global cell num',
                    default=None,
                    required=True)
args = parser.parse_args()

sum = ecl.EclSum(args.en)
#print sum

i, j, k = int(args.mn[0]), int(args.mn[1]), int(args.mn[2])


def get_active_index(i, j, k):
    grid = ecl.EclGrid(args.en + '.EGRID')
    active_index = grid.get_active_index(ijk=(i - 1, j - 1, k - 1))
    return active_index


def get_opm_pav(path, cell_num):
    file = glob.glob(path + '/pressure/*.txt')
    file.sort()
    tmp = []