def default_well() -> case_description.WellDescription:
    """
    Minimum valid WellDescription
    """
    return case_description.WellDescription(
        name="Well 1",
        profile=case_description.ProfileDescription(
            length_and_elevation=case_description.LengthAndElevationDescription(
                length=Array([0.0] + [1000] * 2, "m"),
                elevation=Array([0.0] + [1.2] * 2, "m"),
            )
        ),
        stagnant_fluid="Lift Gas",
        top_node="Node 1",
        bottom_node="Node 2",
        annulus=case_description.AnnulusDescription(
            has_annulus_flow=False, top_node="Node 1"
        ),
        formation=case_description.FormationDescription(
            reference_y_coordinate=Scalar(0, "m")
        ),
        environment=case_description.EnvironmentDescription(
            thermal_model=constants.PipeThermalModelType.SteadyState
        ),
    )
    def test_pipe_pvt_model(self, default_case, default_well):
        """
        If a Elements on case uses an invalid PvtModel, the pvt_model must reset to None when calling ResetInvalidReferences()
        """
        case = attr.evolve(
            default_case,
            nodes=[
                case_description.NodeDescription(
                    name="Node 1",
                    node_type=NodeCellType.Pressure,
                    pvt_model="InvalidPVT",
                )
            ],
            wells=[
                attr.evolve(
                    default_well,
                    pvt_model="InvalidPVT",
                    annulus=case_description.AnnulusDescription(
                        has_annulus_flow=False,
                        pvt_model="InvalidPVT",
                        top_node="Node 1",
                    ),
                )
            ],
            pipes=[
                case_description.PipeDescription(
                    name="Pipe 1",
                    pvt_model="InvalidPVT",
                    source="in",
                    target="out",
                    profile=_empty_profile(),
                    segments=build_simple_segment(),
                    equipment=case_description.EquipmentDescription(
                        mass_sources={
                            "Mass Equip. 1": case_description.MassSourceEquipmentDescription(
                                position=Scalar(0, "m")
                            )
                        }
                    ),
                )
            ],
        )

        case.reset_invalid_references()
        assert case.pipes[0].pvt_model is None
        assert case.nodes[0].pvt_model is None
        assert case.wells[0].pvt_model is None
        assert case.wells[0].annulus.pvt_model is None
 def test_annulus_description_pvt_model(self, default_case, default_well):
     """
     If a AnnulusDescription uses an invalid PvtModel, an InvalidReferenceError must be raised.
     """
     case = attr.evolve(
         default_case,
         wells=[
             attr.evolve(
                 default_well,
                 annulus=case_description.AnnulusDescription(
                     has_annulus_flow=False,
                     pvt_model="Acme",
                     top_node="Node 1"),
             )
         ],
     )
     expected_error = (
         "PVT model 'Acme' selected on 'Annulus from Well 1' is not declared on 'pvt_models', "
         "available pvt_models are: PVT1, PVT2, PVT3")
     with pytest.raises(
             InvalidReferenceError,
             match=re.escape(expected_error),
     ):
         case.ensure_valid_references()
)
TUBING_DESCRIPTION = case_description.TubingDescription(
    name="Tubing 1",
    length=Scalar(42, "m"),
    outer_diameter=Scalar(0.35, "m"),
    inner_diameter=Scalar(0.3, "m"),
    inner_roughness=Scalar(0.0, "m"),
    material="Carbon Steel",
)
WALL_LAYER_DESCRIPTION = case_description.WallLayerDescription(
    thickness=Scalar(25.4, "mm"), material_name="Carbon Steel", has_annulus_flow=True
)
ANNULUS_DESCRIPTION = case_description.AnnulusDescription(
    has_annulus_flow=True,
    pvt_model="gavea",
    top_node="mass_source_node",
    initial_conditions=INITIAL_CONDITIONS_DESCRIPTION,
    gas_lift_valve_equipment={"My gas-lift valve": GAS_LIST_VALVE_DESCRIPTION},
)
CASE_OUTPUT_DEFINITION = case_description.CaseOutputDescription(
    trends=[TREND_OUTPUT_DESCRIPTION],
    trend_frequency=Scalar(0.1, "s"),
    profiles=[PROFILE_OUTPUT_DESCRIPTION],
    profile_frequency=Scalar(0.1, "s"),
)


CASING_DESCRIPTION = case_description.CasingDescription(
    casing_sections=[CASING_SECTION_DESCRIPTION],
    tubings=[TUBING_DESCRIPTION],
    packers=[PACKER_DESCRIPTION],
Beispiel #5
0
        "VALVE CONSTANT OPENING": VALVE_DESCRIPTION_CONSTANT_OPENING,
    },
    reservoir_inflows={"RESERVOIR": RESERVOIR_INFLOW_DESCRIPTION},
    heat_sources={"HEAT": HEAT_SOURCE_DESCRIPTION},
    compressors={"COMPRESSOR": COMPRESSOR_DESCRIPTION},
    pigs={"PIG": PIG_DESCRIPTION},
    leaks={"LEAK": LEAK_EQUIPMENT_DESCRIPTION},
)
ANNULUS_EQUIPMENT_DESCRIPTION = case_description.AnnulusEquipmentDescription(
    leaks={"ANNULUS LEAK": LEAK_EQUIPMENT_DESCRIPTION},
    gas_lift_valves={"GAS LIFT VALVE": GAS_LIST_VALVE_DESCRIPTION},
)
ANNULUS_DESCRIPTION = case_description.AnnulusDescription(
    has_annulus_flow=True,
    pvt_model="gavea",
    top_node="mass_source_node",
    initial_conditions=INITIAL_CONDITIONS_DESCRIPTION,
    equipment=ANNULUS_EQUIPMENT_DESCRIPTION,
)
ENVIRONMENT_PROPERTY_DESCRIPTION = case_description.EnvironmentPropertyDescription(
    position=Scalar(1, "m"),
    temperature=Scalar(1, "degC"),
    type=constants.PipeEnvironmentHeatTransferCoefficientModelType.WallsAndEnvironment,
    heat_transfer_coefficient=Scalar(1.0e50, "W/m2.K"),
    overall_heat_transfer_coefficient=Scalar(2, "W/m2.K"),
    fluid_velocity=Scalar(1, "m/s"),
)
ENVIRONMENT_DESCRIPTION = case_description.EnvironmentDescription(
    thermal_model=constants.PipeThermalModelType.SteadyState,
    reference_y_coordinate=Scalar(5.0, "m"),
    position_input_mode=constants.PipeThermalPositionInput.Tvd,