Ejemplo n.º 1
0
    seed = int(readParameters("seed.txt")["SEED"])
    parameters = readParameters("snake_oil_params.txt")

    op1_divergence_scale = float(parameters["OP1_DIVERGENCE_SCALE"])
    op2_divergence_scale = float(parameters["OP2_DIVERGENCE_SCALE"])
    op1_persistence = float(parameters["OP1_PERSISTENCE"])
    op2_persistence = float(parameters["OP2_PERSISTENCE"])
    op1_offset = float(parameters["OP1_OFFSET"])
    op2_offset = float(parameters["OP2_OFFSET"])
    bpr_138_persistence = float(parameters["BPR_138_PERSISTENCE"])
    bpr_555_persistence = float(parameters["BPR_555_PERSISTENCE"])

    op1_octaves = roundedInt(parameters["OP1_OCTAVES"])
    op2_octaves = roundedInt(parameters["OP2_OCTAVES"])

    simulator = OilSimulator()
    simulator.addWell(
        "OP1",
        seed * 997,
        persistence=op1_persistence,
        octaves=op1_octaves,
        divergence_scale=op1_divergence_scale,
        offset=op1_offset,
    )
    simulator.addWell(
        "OP2",
        seed * 13,
        persistence=op2_persistence,
        octaves=op2_octaves,
        divergence_scale=op2_divergence_scale,
        offset=op2_offset,
Ejemplo n.º 2
0
    def test_oil_simulator(self):
        sim = OilSimulator()
        sim.addWell("OP1", seed=1)
        sim.addBlock("6,6,6", seed=2)

        for report_step in range(10):
            sim.step(scale=1.0 / 10.0)

            values = [
                sim.fopr(),
                sim.fopt(),
                sim.fgpr(),
                sim.fgpt(),
                sim.fwpr(),
                sim.fwpt(),
                sim.fwct(),
                sim.fgor(),
                sim.opr("OP1"),
                sim.gpr("OP1"),
                sim.wpr("OP1"),
                sim.gor("OP1"),
                sim.wct("OP1"),
                sim.bpr("6,6,6"),
            ]

            self.assertAlmostEqual(values[0], values[8])  # fopr = opr:op1
            self.assertAlmostEqual(values[2], values[9])  # fgpr = gpr:op1
            self.assertAlmostEqual(values[4], values[10])  # fwpr = wpr:op1

            self.assertAlmostEqual(sim.foip(), sim.ooip - sim.fopt())
            self.assertAlmostEqual(sim.fgip(), sim.goip - sim.fgpt())
            self.assertAlmostEqual(sim.fwip(), sim.woip - sim.fwpt())

            self.assertAlmostEqualList(values, EXPECTED_VALUES[report_step])
Ejemplo n.º 3
0
    seed = int(readParameters("seed.txt")["SEED"])
    parameters = readParameters("snake_oil_params.txt")

    op1_divergence_scale = float(parameters['OP1_DIVERGENCE_SCALE'])
    op2_divergence_scale = float(parameters['OP2_DIVERGENCE_SCALE'])
    op1_persistence = float(parameters['OP1_PERSISTENCE'])
    op2_persistence = float(parameters['OP2_PERSISTENCE'])
    op1_offset = float(parameters['OP1_OFFSET'])
    op2_offset = float(parameters['OP2_OFFSET'])
    bpr_138_persistence = float(parameters['BPR_138_PERSISTENCE'])
    bpr_555_persistence = float(parameters['BPR_555_PERSISTENCE'])

    op1_octaves = roundedInt(parameters['OP1_OCTAVES'])
    op2_octaves = roundedInt(parameters['OP2_OCTAVES'])

    simulator = OilSimulator()
    simulator.addWell('OP1',
                      seed * 997,
                      persistence=op1_persistence,
                      octaves=op1_octaves,
                      divergence_scale=op1_divergence_scale,
                      offset=op1_offset)
    simulator.addWell('OP2',
                      seed * 13,
                      persistence=op2_persistence,
                      octaves=op2_octaves,
                      divergence_scale=op2_divergence_scale,
                      offset=op2_offset)
    simulator.addBlock('5,5,5', seed * 37, persistence=bpr_555_persistence)
    simulator.addBlock('1,3,8', seed * 31, persistence=bpr_138_persistence)
Ejemplo n.º 4
0
    seed = int(readParameters("seed.txt")["SEED"])
    parameters = readParameters("snake_oil_params.txt")

    op1_divergence_scale = float(parameters["OP1_DIVERGENCE_SCALE"])
    op2_divergence_scale = float(parameters["OP2_DIVERGENCE_SCALE"])
    op1_persistence = float(parameters["OP1_PERSISTENCE"])
    op2_persistence = float(parameters["OP2_PERSISTENCE"])
    op1_offset = float(parameters["OP1_OFFSET"])
    op2_offset = float(parameters["OP2_OFFSET"])
    bpr_138_persistence = float(parameters["BPR_138_PERSISTENCE"])
    bpr_555_persistence = float(parameters["BPR_555_PERSISTENCE"])

    op1_octaves = roundedInt(parameters["OP1_OCTAVES"])
    op2_octaves = roundedInt(parameters["OP2_OCTAVES"])

    simulator = OilSimulator()
    simulator.addWell("OP1", seed * 997, persistence=op1_persistence, octaves=op1_octaves, divergence_scale=op1_divergence_scale, offset=op1_offset)
    simulator.addWell("OP2", seed * 13, persistence=op2_persistence, octaves=op2_octaves, divergence_scale=op2_divergence_scale, offset=op2_offset)
    simulator.addBlock("5,5,5", seed * 37, persistence=bpr_555_persistence)
    simulator.addBlock("1,3,8", seed * 31, persistence=bpr_138_persistence)

    history_simulator = OilSimulator()
    history_simulator.addWell("OP1", 222118781)
    history_simulator.addWell("OP2", 118116362)

    report_step_count = 200
    ecl_sum, time_map = runSimulator(simulator, history_simulator, report_step_count)

    ecl_sum.fwrite()

    with open("time_map.txt", "w") as f:
Ejemplo n.º 5
0
def run_simulator(
    simulator: OilSimulator, history_simulator: OilSimulator, time_step_count: int
) -> EclSum:
    """@rtype: EclSum"""
    ecl_sum = EclSum.writer("SNAKE_OIL_FIELD", datetime(2010, 1, 1), 10, 10, 10)

    ecl_vectors = [
        "OPT",
        "OPR",
        "GPT",
        "GPR",
        "WPT",
        "WPR",
        "GOR",
        "WCT",
    ]

    # Field vectors ("F"-prefix):
    for ecl_vector in ecl_vectors:
        ecl_sum.addVariable("F" + ecl_vector)
        ecl_sum.addVariable("F" + ecl_vector + "H")
        # "H" suffix is for history vectors.

    # Well vectors ("W"-prefix)
    wells = ["OP1", "OP2"]
    for ecl_vector in ecl_vectors:
        for wellname in wells:
            ecl_sum.addVariable("W" + ecl_vector, wgname=wellname)
            ecl_sum.addVariable("W" + ecl_vector + "H", wgname=wellname)

    # Block pressure:
    ecl_sum.addVariable("BPR", num=global_index(5, 5, 5))
    ecl_sum.addVariable("BPR", num=global_index(1, 3, 8))

    mini_step_count = 10
    total_step_count = time_step_count * mini_step_count

    for report_step in range(time_step_count):
        for mini_step in range(mini_step_count):
            t_step = ecl_sum.addTStep(
                report_step + 1, sim_days=report_step * mini_step_count + mini_step
            )
            simulator.step(scale=1.0 / total_step_count)
            history_simulator.step(scale=1.0 / total_step_count)

            t_step["FOPR"] = simulator.fopr()
            t_step["FOPT"] = simulator.fopt()
            t_step["FGPR"] = simulator.fgpr()
            t_step["FGPT"] = simulator.fgpt()
            t_step["FWPR"] = simulator.fwpr()
            t_step["FWPT"] = simulator.fwpt()
            t_step["FGOR"] = simulator.fgor()
            t_step["FWCT"] = simulator.fwct()

            t_step["WOPR:OP1"] = simulator.opr("OP1")
            t_step["WOPR:OP2"] = simulator.opr("OP2")

            t_step["WGPR:OP1"] = simulator.gpr("OP1")
            t_step["WGPR:OP2"] = simulator.gpr("OP2")

            t_step["WWPR:OP1"] = simulator.wpr("OP1")
            t_step["WWPR:OP2"] = simulator.wpr("OP2")

            t_step["WGOR:OP1"] = simulator.gor("OP1")
            t_step["WGOR:OP2"] = simulator.gor("OP2")

            t_step["WWCT:OP1"] = simulator.wct("OP1")
            t_step["WWCT:OP2"] = simulator.wct("OP2")

            t_step["BPR:5,5,5"] = simulator.bpr("5,5,5")
            t_step["BPR:1,3,8"] = simulator.bpr("1,3,8")

            t_step["FOPRH"] = history_simulator.fopr()
            t_step["FOPTH"] = history_simulator.fopt()
            t_step["FGPRH"] = history_simulator.fgpr()
            t_step["FGPTH"] = history_simulator.fgpt()
            t_step["FWPRH"] = history_simulator.fwpr()
            t_step["FWPTH"] = history_simulator.fwpt()
            t_step["FGORH"] = history_simulator.fgor()
            t_step["FWCTH"] = history_simulator.fwct()

            t_step["WOPRH:OP1"] = history_simulator.opr("OP1")
            t_step["WOPRH:OP2"] = history_simulator.opr("OP2")

            t_step["WGPRH:OP1"] = history_simulator.gpr("OP1")
            t_step["WGPRH:OP2"] = history_simulator.gpr("OP2")

            t_step["WWPRH:OP1"] = history_simulator.wpr("OP1")
            t_step["WWPRH:OP2"] = history_simulator.wpr("OP2")

            t_step["WGORH:OP1"] = history_simulator.gor("OP1")
            t_step["WGORH:OP2"] = history_simulator.gor("OP2")

            t_step["WWCTH:OP1"] = history_simulator.wct("OP1")
            t_step["WWCTH:OP2"] = history_simulator.wct("OP2")

    return ecl_sum
Ejemplo n.º 6
0
def main(
    seedfile: str = "seed.txt", parameters_file: str = "snake_oil_params.txt"
) -> None:
    """Parse input and run the snake oil simulator, producing mocked Eclipse
    binary output file (SMSPEC + UNSMRY)"""
    seed = int(read_parameters(seedfile)["SEED"])
    parameters = read_parameters(parameters_file)

    op1_divergence_scale = parameters["OP1_DIVERGENCE_SCALE"]
    op2_divergence_scale = parameters["OP2_DIVERGENCE_SCALE"]
    op1_persistence = parameters["OP1_PERSISTENCE"]
    op2_persistence = parameters["OP2_PERSISTENCE"]
    op1_offset = parameters["OP1_OFFSET"]
    op2_offset = parameters["OP2_OFFSET"]
    bpr_138_persistence = parameters["BPR_138_PERSISTENCE"]
    bpr_555_persistence = parameters["BPR_555_PERSISTENCE"]

    op1_octaves = int(round(parameters["OP1_OCTAVES"]))
    op2_octaves = int(round(parameters["OP2_OCTAVES"]))

    simulator = OilSimulator()
    simulator.addWell(
        "OP1",
        seed * 997,
        persistence=op1_persistence,
        octaves=op1_octaves,
        divergence_scale=op1_divergence_scale,
        offset=op1_offset,
    )
    simulator.addWell(
        "OP2",
        seed * 13,
        persistence=op2_persistence,
        octaves=op2_octaves,
        divergence_scale=op2_divergence_scale,
        offset=op2_offset,
    )
    simulator.addBlock("5,5,5", seed * 37, persistence=bpr_555_persistence)
    simulator.addBlock("1,3,8", seed * 31, persistence=bpr_138_persistence)

    history_simulator = OilSimulator()
    history_simulator.addWell("OP1", 222118781)
    history_simulator.addWell("OP2", 118116362)

    report_step_count = 200
    ecl_sum = run_simulator(simulator, history_simulator, report_step_count)
    ecl_sum.fwrite()
Ejemplo n.º 7
0
    def test_oil_simulator(self):
        sim = OilSimulator()
        sim.addWell("OP1", seed=1)
        sim.addBlock("6,6,6", seed=2)

        expected_values = [
            [
                0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0,
                0.0, 1.0
            ],
            [
                0.3359771423145687, 0.3359771423145687, 0.25672494192349865,
                0.25672494192349865, 0.010039005455891323,
                0.010039005455891323, 0.029013112597713192, 0.7641143089523995,
                0.3359771423145687, 0.25672494192349865, 0.010039005455891323,
                0.7641143089523995, 0.029013112597713192, 0.8462347957619747
            ],
            [
                0.7252470407619624, 1.0612241830765312, 0.5175173529594699,
                0.7742422948829686, 0.017973831236885583, 0.028012836692776905,
                0.02418370085402209, 0.7135738912023045, 0.7252470407619624,
                0.5175173529594699, 0.017973831236885583, 0.7135738912023045,
                0.02418370085402209, 0.6888364145396828
            ],
            [
                0.7723163496234255, 1.8335405326999568, 0.5742386073607806,
                1.3484809022437492, 0.11041673583737899, 0.1384295725301559,
                0.12508507685507134, 0.7435277106858791, 0.7723163496234255,
                0.5742386073607806, 0.11041673583737899, 0.7435277106858791,
                0.12508507685507134, 0.6403046565762696
            ],
            [
                0.6038799675664164, 2.437420500266373, 0.6888868738548185,
                2.037367776098568, 0.267892132439122, 0.4063217049692779,
                0.3072960610203287, 1.140767885762087, 0.6038799675664164,
                0.6888868738548185, 0.267892132439122, 1.140767885762087,
                0.3072960610203287, 0.5205364945011657
            ],
            [
                0.23016535126253962, 2.6675858515289126, 0.721655666522216,
                2.7590234426207836, 0.35552466124555465, 0.7618463662148325,
                0.6070184801736589, 3.135379250454838, 0.23016535126253962,
                0.721655666522216, 0.35552466124555465, 3.135379250454838,
                0.6070184801736589, 0.4800677649914682
            ],
            [
                0.026293782934652718, 2.693879634463565, 0.7131990780527108,
                3.4722225206734945, 0.6392372725163122, 1.4010836387311447,
                0.8647254356377257, 7.131990780527107, 0.026293782934652718,
                0.7131990780527108, 0.6392372725163122, 7.131990780527107,
                0.8647254356377257, 0.3872974839053025
            ],
            [
                0.0, 2.693879634463565, 0.8676997908824122, 4.339922311555907,
                0.8580356376693129, 2.2591192764004577, 0.8956197493411856,
                8.676997908824122, 0.0, 0.8676997908824122, 0.8580356376693129,
                8.676997908824122, 0.8956197493411856, 0.22557165737149715
            ],
            [
                0.10560669451549878, 2.799486328979064, 0.869082212788759,
                5.209004524344666, 0.8903674796589355, 3.1494867560593933,
                0.8939664328113363, 8.229423492288294, 0.10560669451549878,
                0.869082212788759, 0.8903674796589355, 8.229423492288294,
                0.8939664328113363, 0.1340241573819292
            ],
            [
                0.08615885630000791, 2.885645185279072, 0.44074890315982446,
                5.64975342750449, 0.9425699260811738, 4.0920566821405675,
                0.9040831722665535, 4.407489031598244, 0.08615885630000791,
                0.44074890315982446, 0.9425699260811738, 4.407489031598244,
                0.9040831722665535, 0.13404047971467026
            ]
        ]

        for report_step in range(10):
            sim.step(scale=1.0 / 10.0)

            values = [
                sim.fopr(),
                sim.fopt(),
                sim.fgpr(),
                sim.fgpt(),
                sim.fwpr(),
                sim.fwpt(),
                sim.fwct(),
                sim.fgor(),
                sim.opr("OP1"),
                sim.gpr("OP1"),
                sim.wpr("OP1"),
                sim.gor("OP1"),
                sim.wct("OP1"),
                sim.bpr("6,6,6")
            ]

            self.assertAlmostEqual(values[0], values[8])  # fopr = opr:op1
            self.assertAlmostEqual(values[2], values[9])  # fgpr = gpr:op1
            self.assertAlmostEqual(values[4], values[10])  # fwpr = wpr:op1

            self.assertAlmostEqual(sim.foip(), sim.ooip - sim.fopt())
            self.assertAlmostEqual(sim.fgip(), sim.goip - sim.fgpt())
            self.assertAlmostEqual(sim.fwip(), sim.woip - sim.fwpt())

            self.assertAlmostEqualList(values, expected_values[report_step])