コード例 #1
0
 def test_realistic_only_fracture_zone(self):
     # See changelist: reset changes for only fracture zone setup of 2020/06/25.
     # _sz = 2, bounding_box=None -> ~53k 3d, ~6k 2d, 80 1d cells
     _sz = 3.5
     params = BiotParameters(
         # Base parameters
         length_scale=0.05,
         scalar_scale=1e6,
         head="60k-5frac/medium-sized-intact-grid/t_end-10min",
         time_step=pp.MINUTE,
         end_time=10 * pp.MINUTE,
         rock=GrimselGranodiorite(),
         # Geometry parameters
         mesh_args={
             "mesh_size_frac": 0.9 * _sz,
             "mesh_size_min": 0.2 * _sz,
             "mesh_size_bound": 3 * _sz,
         },
         bounding_box={
             "xmin": -1 - 50,
             "ymin": 80 - 50,
             "zmin": -4 - 50,
             "xmax": 86 + 50,
             "ymax": 151 + 50,
             "zmax": 41 + 50,
         },
         shearzone_names=["S1_1", "S1_2", "S1_3", "S3_1", "S3_2"],
         # Mechanical parameters
         stress=stress_tensor(),
         newton_options={
             "max_iterations": 30,
             "nl_convergence_tol": 1e-10,
             "nl_divergence_tol": 1e5,
         },
         # Flow parameters
         source_scalar_borehole_shearzone={
             "shearzone": "S1_2",
             "borehole": "INJ1",
         },
         well_cells=nd_and_shearzone_injection_cell,
         injection_rate=(1 / 6) /
         3,  # = 10 l/min  - Divide by 3 due to 3 injection cells.
         frac_permeability=[2.3e-15, 4.5e-17, 2.3e-17, 6.4e-14, 1e-16],
         intact_permeability=2e-20,
     )
     setup = NeverFailtBiotCM(params)
     newton_params = params.newton_options
     pp.run_time_dependent_model(setup, newton_params)
コード例 #2
0
    def test_realistic_setup(self):
        """ For a 50 000 cell setup, test Contact mechanics Biot model on 5 shear zones.
        Parameters are close to the ISC setup. Model is run for 10 minutes,
        with time steps of 1 minute. Injection to a shear zone.
        """
        # _sz=6 => ~50k cells,
        # _sz=5.5 => ~66k cells
        _sz = 6
        params = BiotParameters(
            # Base parameters
            length_scale=12.8,
            scalar_scale=1e10,
            head="2frac/20l_min/inj-frac-center/dilation",
            time_step=pp.MINUTE,
            end_time=7 * pp.MINUTE,
            rock=GrimselGranodiorite(),
            # Geometry parameters
            shearzone_names=["S1_2", "S3_1"],
            mesh_args={
                "mesh_size_frac": _sz,  # 0.3 * _sz
                "mesh_size_min": 0.2 * _sz,
                "mesh_size_bound": 3 * _sz,  # 3.2 * _sz
            },
            # Mechanical parameters
            stress=stress_tensor(),
            dilation_angle=(np.pi / 180) * 5,  # 5 degrees dilation angle.
            newton_options={
                "max_iterations": 40,
                "nl_convergence_tol": 1e-10,
                "nl_divergence_tol": 1e5,
            },
            # Flow parameters
            source_scalar_borehole_shearzone={
                "shearzone": "S1_2",
                "borehole": "INJ1",
            },
            well_cells=center_of_shearzone_injection_cell,
            injection_rate=(10 / 60) * 2,  # (10/60)*2 = 20l per 60s = 20 l/min
            frac_transmissivity=[1e-9, 3.7e-7],
        )

        setup = NeverFailtBiotCM(params)
        newton_params = params.newton_options
        pp.run_time_dependent_model(setup, newton_params)
コード例 #3
0
def biot_params() -> BiotParameters:
    """ Initialize BiotParameters"""
    here = Path(__file__).parent / "simulations"
    _sz = 6
    params = BiotParameters(
        folder_name=here,
        stress=stress_tensor(),
        injection_rate=1 / 6,
        frac_permeability=1e-9,
        intact_permeability=1e-12,
        well_cells=shearzone_injection_cell,
        rock=GrimselGranodiorite(),
        mesh_args={
            "mesh_size_frac": _sz,
            "mesh_size_min": 0.2 * _sz,
            "mesh_size_bound": 3 * _sz,
        },
    )
    return params
コード例 #4
0
def test_nd_sides_shearzone_injection_cell():
    """ Test that the 2 Nd-cells are tagged correctly"""
    # --- Paste biot_params_small
    here = Path(__file__).parent / "simulations"

    values = {
        "folder_name": here,
        "stress": stress_tensor(),
        "injection_rate": 1 / 6,
        "frac_permeability": 3,  # -> frac_aperture = 6.0
        "intact_permeability": 1e-12,
        "well_cells": shearzone_injection_cell,
        "rock": GrimselGranodiorite(),
        "mesh_args": {
            "mesh_size_frac": 10,
            "mesh_size_min": 10,
            "mesh_size_bound": 30,
        },
        "length_scale": 7,
        "scalar_scale": 11,
    }
    # ---
    biot_params_small = values

    frac_name = "S1_2"
    biot_params_small["shearzone_names"] = [frac_name]
    params = BiotParameters(**biot_params_small)
    setup = ISCBiotContactMechanics(params)
    setup.create_grid()
    gb = setup.gb

    # Tag the cells
    nd_sides_shearzone_injection_cell(params, gb)

    for g, d in gb:
        tags = d["well"]
        if g.dim == setup.Nd:
            assert np.sum(np.abs(tags)) == np.sum(tags) == 2
        else:
            assert np.sum(tags) == np.sum(np.abs(tags)) == 0
コード例 #5
0
def biot_params_small() -> Dict:
    """ Initialize Biot parameters with 'easy' values on small grid"""
    here = Path(__file__).parent / "simulations"
    _sz = 6

    values = {
        "folder_name": here,
        "stress": stress_tensor(),
        "injection_rate": 1 / 6,
        "frac_permeability": 3,  # -> frac_aperture = 6.0
        "intact_permeability": 1e-12,
        "well_cells": shearzone_injection_cell,
        "rock": GrimselGranodiorite(),
        "mesh_args": {
            "mesh_size_frac": 10,
            "mesh_size_min": 10,
            "mesh_size_bound": 30,
        },
        "length_scale": 7,
        "scalar_scale": 11,
    }
    return values
コード例 #6
0
    newton_params = NewtonParameters(
        convergence_tol=5e-5,
        max_iterations=300,
    )
    base = Path.home() / "mastersproject-data/hs1"
    head = f"final/case_{case or '0'}"
    biot_params = BiotParameters(
        # BaseParameters
        length_scale=length_scale,
        scalar_scale=scalar_scale,
        base=base,
        head=head,
        time_step=time_params.initial_time_step,
        end_time=time_params.end_time,
        rock=GrimselGranodiorite(
            PERMEABILITY=k, ),  # low k: 5e-21 -- high k: 2 * 5e-21
        gravity=False,
        # GeometryParameters
        shearzone_names=[
            "S1_1",
            "S1_2",
            "S1_3",
            "S3_1",
        ],  # "S3_2"],  # ["S1_2", "S3_1"],
        fraczone_bounding_box=box,
        # MechanicsParameters
        dilation_angle=np.radians(3),
        newton_options=newton_params.dict(),
        # FlowParameters
        source_scalar_borehole_shearzone={
            "shearzone": "S1_3",
コード例 #7
0
def simple_validation():
    """ Validation on easy setup"""
    path = Path(__file__).parent / "results"
    # Grid
    mesh_size = 20
    gb, box, mesh_args = two_intersecting_blocking_fractures(
        str(path), mesh_size)

    # Injection phases and time configuration
    start_time = -1e2 * pp.YEAR
    phase_limits = [start_time, 0, 12 * pp.HOUR]
    rates = [0, 0]
    injection_protocol = InjectionRateProtocol.create_protocol(
        phase_limits, rates)

    phase_time_steps = [-start_time, 2.0 * pp.MINUTE]
    time_params = TimeStepProtocol.create_protocol(phase_limits,
                                                   phase_time_steps)

    # Newton
    newton_params = NewtonParameters(
        convergence_tol=1e-6,
        max_iterations=50,
    )

    rock = GrimselGranodiorite()
    rock.FRICTION_COEFFICIENT = 0.2
    stress = np.diag(-np.array([6, 13.1, 6]) * pp.MEGA * pp.PASCAL)
    # Model parameters
    biot_params = BiotParameters(
        # BaseParameters
        length_scale=15,
        scalar_scale=1e9,
        folder_name=path,
        time=time_params.start_time,
        time_step=time_params.initial_time_step,
        end_time=time_params.end_time,
        gravity=False,
        rock=rock,
        # GeometryParameters
        shearzone_names=["f1", "f2"],
        box=box,
        mesh_args=mesh_args,
        # MechanicsParameters
        stress=stress,
        dilation_angle=np.radians(5.0),
        newton_options=newton_params.dict(),
        # FlowParameters
        well_cells=nd_injection_cell_center,
        injection_protocol=injection_protocol,
        frac_transmissivity=5.17e-3,  # Gives a0=2e-3, which are Ivar's values.
        # BiotParameters
        alpha=0.8,
    )
    setup = ISCBiotContactMechanics(biot_params)
    setup.gb = gb

    time_machine = TimeMachinePhasesConstantDt(setup, newton_params,
                                               time_params)

    time_machine.run_simulation()
    return time_machine