Ejemplo n.º 1
0
 def __init__(self,
              params=None,
              modelPressureTransient=False,
              modelTemperatureDepletion=True,
              **kwargs):
     self.params = params
     if self.params == None:
         self.params = SimulationParameters(**kwargs)
     self.modelPressureTransient = modelPressureTransient
     self.modelTemperatureDepletion = modelTemperatureDepletion
     super().__init__()
Ejemplo n.º 2
0
    def testFluidSystemWaterSolverMdot40(self):
        params = SimulationParameters(working_fluid = 'water', orc_fluid = 'R245fa', capacity_factor = 0.9)
        params.m_dot_IP = 40

        output = FullSystemORC.getDefaultWaterSystem(params).solve()

        self.assertTrue(*testAssert(output.fluid_system_solver.pump.well.state.P_Pa, 7.9610e6, 'test_subsurface_solver2_pressure'))
        self.assertTrue(*testAssert(output.fluid_system_solver.pump.well.state.T_C, 100.3125, 'test_subsurface_solver2_temp'))
        self.assertTrue(*testAssert(output.energy_results.W_net, 1.4286e+05, 'test_subsurface_solver2_w_net'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_brownfield, 2.3287e7, 'test_solver2_C_brownfield_N'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_greenfield, 3.6399062e7, 'test_solver2_C_greenfield_N'))
        self.assertTrue(*testAssert(output.capital_cost_model.LCOE_brownfield.LCOE, 7.8465e-4, 'test_solver2_LCOE_brownfield'))
Ejemplo n.º 3
0
    def testFluidSystemWaterSolverMdot1(self):
        params = SimulationParameters(working_fluid = 'water', orc_fluid = 'R245fa', capacity_factor = 0.9)
        params.m_dot_IP = 1

        output = FullSystemORC.getDefaultWaterSystem(params).solve()

        self.assertTrue(*testAssert(output.fluid_system_solver.pump.well.state.P_Pa, 7.84791e5, 'test_subsurface_solver1_pressure'))
        self.assertTrue(*testAssert(output.fluid_system_solver.pump.well.state.T_C, 81.2595, 'test_subsurface_solver1_temp'))
        self.assertTrue(*testAssert(output.energy_results.W_net, 5.2775e3, 'test_subsurface_solver1_w_net'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_brownfield, 9.1965e6, 'test_solver1_C_brownfield_N'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_greenfield, 2.2308e7, 'test_solver1_C_greenfield_N'))
        self.assertTrue(*testAssert(output.capital_cost_model.LCOE_brownfield.LCOE, 0.0083879, 'test_solver1_LCOE_brownfield'))
Ejemplo n.º 4
0
 def __init__(self, params=None, **kwargs):
     self.params = params
     if self.params == None:
         self.params = SimulationParameters(**kwargs)
     self.data = getTboilOptimum()
     self.orc_fluid = self.params.orc_fluid
     self.T_boil_max = maxSubcritORCBoilTemp(self.orc_fluid)
Ejemplo n.º 5
0
    def testProductionWell(self):
        ###
        #  Testing SemiAnalyticalWell for vertical production well settings
        ###
        # Water
        params = SimulationParameters(working_fluid = 'water',
                                        time_years = 10.,
                                        m_dot_IP=136.)

        # initial state
        initial_state = FluidState.getStateFromPT(25.e6, 97., params.working_fluid)
        
        well = SemiAnalyticalWell(params, T_e_initial=102.5, dz_total=2500.)
        wellresult = well.solve(initial_state)

        self.assertMessages(well.params.working_fluid,
                        (wellresult.state.P_Pa, 1.2372e6),
                        (wellresult.state.T_C, 95.0133),
                        (wellresult.state.h_Jkg, 3.9902e5))

        # CO2
        well.params.working_fluid = 'CO2'
        # initial state
        wellresult = well.solve(initial_state)

        self.assertMessages(well.params.working_fluid,
                        (wellresult.state.P_Pa, 1.1674e7),
                        (wellresult.state.T_C, 55.9783),
                        (wellresult.state.h_Jkg, 3.7225e5))
Ejemplo n.º 6
0
 def cO2MonitoringIdeal(params=None, **kwargs):
     if params == None:
         params = SimulationParameters(**kwargs)
     return cPermitting(params.cost_year) + dCPermittingCO2(
         params.N_5spot, params.cost_year) + dCMonitoringCO2Ideal(
             params.N_5spot, params.cost_year, params.depth,
             params.monitoring_well_radius)
Ejemplo n.º 7
0
    def getDefaultCPGSystem(params = None, **kwargs):
        if params == None:
            params = SimulationParameters(**kwargs)

        fluid_system = FluidSystemCO2(params = params)
        injWell_m_dot_multiplier = params.wellFieldType.getInjWellMdotMultiplier()
        fluid_system.injection_well = SemiAnalyticalWell(params = params,
                                            dz_total = -params.depth,
                                            T_e_initial = params.T_ambient_C,
                                            m_dot_multiplier = injWell_m_dot_multiplier)
        fluid_system.reservoir = PorousReservoir(params = params)
        prodWell_m_dot_multiplier = params.wellFieldType.getProdWellMdotMultiplier()
        fluid_system.production_well = SemiAnalyticalWell(params = params,
                                            dz_total = params.depth,
                                            T_e_initial = params.T_ambient_C + params.dT_dz * params.depth,
                                            m_dot_multiplier = prodWell_m_dot_multiplier)

        capital_cost_system = CapitalCostSystem()
        capital_cost_system.CapitalCost_SurfacePlant = CapitalCostSurfacePlantCPG(params = params)
        capital_cost_system.CapitalCost_SurfacePipe = CapitalCostSurfacePipes.cost(params = params)
        capital_cost_system.CapitalCost_Production_Well = CapitalCostWell.cO2Baseline(params = params)
        capital_cost_system.CapitalCost_Injection_Well = CapitalCostWell.cO2Baseline(params = params)
        capital_cost_system.CapitalCost_Wellfield = CapitalCostWellField.cO2MonitoringBaseline(params = params)
        capital_cost_system.CapitalCost_Exploration = CapitalCostExploration.cO2Baseline(params = params)
        capital_cost_system.CapitalCost_Stimulation = CapitalCostWellStimulation.cost()
        capital_cost_system.lcoe_model = LCOESimple(params = params)

        return FullSystemCPG(params, fluid_system, capital_cost_system)
 def __init__(self, params=None, **kwargs):
     self.params = params
     if self.params == None:
         self.params = SimulationParameters(**kwargs)
     self.ppi_T_G = readCostTable('PPI_T-G')
     self.ppi_pump = readCostTable('PPI_Pump')
     self.ppi_HX = readCostTable('PPI_HX')
Ejemplo n.º 9
0
 def waterBaseline(params=None, **kwargs):
     if params == None:
         params = SimulationParameters(**kwargs)
     A = cModeling(params.cost_year)
     B = dCCharacterizationWellsBaseline(params.cost_year, params.depth,
                                         params.well_radius,
                                         params.success_rate)
     return A + B
Ejemplo n.º 10
0
 def cO2Ideal(params=None, **kwargs):
     if params == None:
         params = SimulationParameters(**kwargs)
     A = cModeling(params.cost_year)
     B = dCCharacterizationWellsIdeal(params.cost_year, params.depth,
                                      params.well_radius,
                                      params.success_rate)
     C = dCModelingCO2(params.N_5spot, params.cost_year)
     return A + B + C
Ejemplo n.º 11
0
    def testFluidSystemCO2Mdot10(self):
        params = SimulationParameters(working_fluid='co2', capacity_factor=0.9)
        params.m_dot_IP = 10
        output = FullSystemCPG.getDefaultCPGSystem(params).solve()

        self.assertTrue(*testAssert(output.fluid_system_solver.pp.dP_surface,
                                    5.9421e6, 'test_dP_surface'))
        self.assertTrue(
            *testAssert(output.fluid_system_solver.production_well.state.T_C,
                        59.2802, 'test_T_prod_surface_C'))
        self.assertTrue(
            *testAssert(output.energy_results.W_net, 9.7662e4, 'test_W_net'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_brownfield,
                                    1.3271e7, 'test_C_brownfield_N'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_greenfield,
                                    3.5901e7, 'test_C_greenfield_N'))
        self.assertTrue(
            *testAssert(output.capital_cost_model.LCOE_brownfield.LCOE,
                        6.5410e-4, 'test_LCOE_brownfield'))
Ejemplo n.º 12
0
    def testFluidSystemCO2Mdot200(self):
        params = SimulationParameters(working_fluid='co2', capacity_factor=0.9)
        params.m_dot_IP = 200
        output = FullSystemCPG.getDefaultCPGSystem(params).solve()

        self.assertTrue(*testAssert(output.fluid_system_solver.pp.dP_surface,
                                    3.468765e+06, 'test_dP_surface'))
        self.assertTrue(
            *testAssert(output.fluid_system_solver.production_well.state.T_C,
                        47.6070, 'test_T_prod_surface_C'))
        self.assertTrue(
            *testAssert(output.energy_results.W_net, -1.3875e6, 'test_W_net'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_brownfield,
                                    5.0443e7, 'test_C_brownfield_N'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_greenfield,
                                    7.3073e7, 'test_C_greenfield_N'))
        self.assertTrue(
            np.isnan(output.capital_cost_model.LCOE_brownfield.LCOE),
            'test_LCOE_brownfield')
Ejemplo n.º 13
0
    def testFluidSystemCO2Mdot80(self):
        params = SimulationParameters(working_fluid='co2', capacity_factor=0.9)
        params.m_dot_IP = 80
        output = FullSystemCPG.getDefaultCPGSystem(params).solve()

        self.assertTrue(*testAssert(output.fluid_system_solver.pp.dP_surface,
                                    5.6501e6, 'test_dP_surface'))
        self.assertTrue(
            *testAssert(output.fluid_system_solver.production_well.state.T_C,
                        59.0540, 'test_T_prod_surface_C'))
        self.assertTrue(
            *testAssert(output.energy_results.W_net, 4.9940e+05, 'test_W_net'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_brownfield,
                                    2.7650e7, 'test_C_brownfield_N'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_greenfield,
                                    5.0280e7, 'test_C_greenfield_N'))
        self.assertTrue(
            *testAssert(output.capital_cost_model.LCOE_brownfield.LCOE,
                        2.6650e-4, 'test_LCOE_brownfield'))
Ejemplo n.º 14
0
    def testFluidSystemWaterSolverOptMdot(self):

        params = SimulationParameters(working_fluid = 'water', orc_fluid = 'R245fa', capacity_factor = 0.9)

        full_system = FullSystemORC.getDefaultWaterSystem(params)
        full_system_solver = FullSystemSolver(full_system)

        output = full_system_solver.solve()

        self.assertTrue(*testAssert(output.optMdot, 21.9823, 'test_optMdot_solver_optMdot', 1e-3))
        self.assertTrue(*testAssert(output.energy_results.W_net, 1.5212e5, 'test_optMdot_solver_w_net', 1e-3))
        self.assertTrue(*testAssert(output.capital_cost_model.LCOE_brownfield.LCOE, 5.4633e-4, 'test_optMdot_solver_brownfield', 1e-3))
    def cost(params=None, **kwargs):
        if params == None:
            params = SimulationParameters(**kwargs)

        X_PCs = 1.15
        X_ICs = 1.12

        if params.wellFieldType == WellFieldType.Doublet:
            L_surfacePipe = 707
            D_surfacePipe = 0.41
        elif params.wellFieldType == WellFieldType._5Spot:
            L_surfacePipe = 3000
            D_surfacePipe = 0.41
        elif params.wellFieldType == WellFieldType._5Spot_SharedNeighbor:
            L_surfacePipe = 707
            D_surfacePipe = 0.41
        elif params.wellFieldType == WellFieldType._5Spot_Many:
            L_surfacePipe_manyN = {
                1: 3000,
                2: 12000,
                3: 25000,
                4: 45000,
                5: 69000,
                6: 107000,
                7: 153000,
                8: 223000,
                9: 309000,
                10: 406000
            }
            D_surfacePipe_manyN = {
                1: 0.34,
                2: 0.54,
                3: 0.65,
                4: 0.79,
                5: 0.89,
                6: 0.98,
                7: 1.02,
                8: 1.05,
                9: 1.09,
                10: 1.13
            }
            L_surfacePipe = L_surfacePipe_manyN[params.N_5spot]
            D_surfacePipe = D_surfacePipe_manyN[params.N_5spot]
        else:
            L_surfacePipe = 707
            D_surfacePipe = 0.41

        c_surfacePipe = 2205. * D_surfacePipe**2 + 134.
        return X_PCs * X_ICs * readCostTable(
            'PPI_Pipe',
            cost_year=params.cost_year) * c_surfacePipe * L_surfacePipe
Ejemplo n.º 16
0
    def testFluidSystemCO2Mdot100(self):
        params = SimulationParameters(working_fluid='co2', capacity_factor=0.9)
        params.m_dot_IP = 100
        params.depth = 2400.
        params.permeability = 1e-8 / 100.
        output = FullSystemCPG.getDefaultCPGSystem(params).solve()

        self.assertTrue(*testAssert(output.fluid_system_solver.pp.dP_surface,
                                    5.0019e6, 'test_dP_surface'))
        self.assertTrue(
            *testAssert(output.fluid_system_solver.production_well.state.T_C,
                        55.3144, 'test_T_prod_surface_C'))
        self.assertTrue(*testAssert(output.fluid_system_solver.pp.dP_pump,
                                    -1.0756e6, 'test_dP_pump'))
        self.assertTrue(
            *testAssert(output.energy_results.W_net, 8.2656e5, 'test_W_net'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_brownfield,
                                    2.6182e7, 'test_C_brownfield_N'))
        self.assertTrue(*testAssert(output.capital_cost_model.C_greenfield,
                                    4.8021e7, 'test_C_greenfield_N'))
        self.assertTrue(
            *testAssert(output.capital_cost_model.LCOE_brownfield.LCOE,
                        1.5247e-4, 'test_LCOE_brownfield'))
Ejemplo n.º 17
0
    def testFluidSystemCO2SolverOptMdot(self):
        params = SimulationParameters(working_fluid='co2', capacity_factor=0.9)

        full_system = FullSystemCPG.getDefaultCPGSystem(params)
        full_system_solver = FullSystemSolver(full_system)

        output = full_system_solver.solve()

        self.assertTrue(*testAssert(output.optMdot, 54.8493,
                                    'test_optMdot_solver_optMdot', 1e-3))
        self.assertTrue(*testAssert(output.energy_results.W_net, 4.5411e5,
                                    'test_optMdot_solver_w_net', 1e-3))
        self.assertTrue(*testAssert(
            output.capital_cost_model.LCOE_brownfield.LCOE, 2.3915e-4,
            'test_optMdot_solver_LCOE_brownfield', 1e-3))
Ejemplo n.º 18
0
 def __init__(self, params = None, T_e_initial = 15., dz_total = 0., dr_total = 0., m_dot_multiplier = 1, **kwargs):
     self.params = params
     if self.params == None:
         self.params = SimulationParameters(**kwargs)
     # dimensions
     # dz_total is the change in elevation, negative if going into the earth
     self.dz_total = dz_total
     # dr_total is the deviation from vertical, always positive
     self.dr_total = dr_total
     # T_e_initial is the beginning rock temp
     # default is set to be 15 C
     self.T_e_initial = T_e_initial
     # m_dot_multiplier is the multiplier applied to the mass flowrate within the wells
     # default is 1
     self.m_dot_multiplier = m_dot_multiplier
Ejemplo n.º 19
0
    def getDefaultWaterSystem(params=None, **kwargs):
        if params == None:
            params = SimulationParameters(**kwargs)

        fluid_system = FluidSystemWater(params=params)
        injWell_m_dot_multiplier = params.wellFieldType.getInjWellMdotMultiplier(
        )
        fluid_system.injection_well = SemiAnalyticalWell(
            params=params,
            dz_total=-params.depth,
            T_e_initial=params.T_ambient_C,
            m_dot_multiplier=injWell_m_dot_multiplier)
        fluid_system.reservoir = PorousReservoir(params=params)
        prodWell_m_dot_multiplier = params.wellFieldType.getProdWellMdotMultiplier(
        )
        fluid_system.production_well1 = SemiAnalyticalWell(
            params=params,
            dz_total=params.depth - params.pump_depth,
            T_e_initial=params.T_ambient_C + params.dT_dz * params.depth,
            m_dot_multiplier=prodWell_m_dot_multiplier)
        prod_well2 = SemiAnalyticalWell(
            params=params,
            dz_total=params.pump_depth,
            T_e_initial=params.T_ambient_C + params.dT_dz * params.pump_depth,
            m_dot_multiplier=prodWell_m_dot_multiplier)
        fluid_system.pump = DownHolePump(well=prod_well2, params=params)
        fluid_system.pp = ORCCycleTboil(params=params)

        capital_cost_system = CapitalCostSystem()
        capital_cost_system.CapitalCost_SurfacePlant = CapitalCostSurfacePlantORC(
            params=params)
        capital_cost_system.CapitalCost_SurfacePipe = CapitalCostSurfacePipes.cost(
            params=params)
        capital_cost_system.CapitalCost_Production_Well = CapitalCostWell.waterBaseline(
            params=params)
        capital_cost_system.CapitalCost_Injection_Well = CapitalCostWell.waterBaseline(
            params=params)
        capital_cost_system.CapitalCost_Wellfield = CapitalCostWellField.water(
            params=params)
        capital_cost_system.CapitalCost_Exploration = CapitalCostExploration.waterBaseline(
            params=params)
        capital_cost_system.CapitalCost_Stimulation = CapitalCostWellStimulation.cost(
        )
        capital_cost_system.lcoe_model = LCOESimple(params=params)

        solver = FluidSystemWaterSolver(fluid_system)

        return FullSystemORC(params, solver, capital_cost_system)
Ejemplo n.º 20
0
    def testORCCycleSupercritPboil(self):

        params = SimulationParameters(orc_fluid = 'R245fa')

        cycle = ORCCycleSupercritPboil(params = params)

        initialState = FluidState.getStateFromPT(1.e6, 190., 'water')
        results = cycle.solve(initialState = initialState,
                                P_boil_Pa = 5e6)

        self.assertTrue(*testAssert(results.dT_range_CT, 6.8948, 'test1_dT_range_CT'))
        self.assertTrue(*testAssert(results.w_pump, -1.9676e+03, 'test1_w_pump'))
        self.assertTrue(*testAssert(results.q_boiler, 1.2030e+05, 'test1_q_boiler'))
        self.assertTrue(*testAssert(results.w_turbine, 2.4353e+04, 'test1_w_turbine'))
        self.assertTrue(*testAssert(results.q_recuperator, 9.8023e+03, 'test1_q_recuperator'))
        self.assertTrue(*testAssert(results.q_desuperheater, -3.0484e+03, 'test1_q_desuperheater'))
        self.assertTrue(*testAssert(results.q_condenser, -9.4878e+04, 'test1_q_condenser'))
        self.assertTrue(*testAssert(results.w_cooler, -51.2720, 'test1_w_cooler'))
        self.assertTrue(*testAssert(results.w_condenser, -2.5484e+03, 'test1_w_condenser'))
        self.assertTrue(*testAssert(results.w_net, 1.9786e+04, 'test1_w_net'))
        self.assertTrue(*testAssert(results.state.T_C, 73.7974, 'test1_end_T_C'))
        self.assertTrue(*testAssert(results.dT_LMTD_boiler, 9.6698, 'test1_dT_LMTD_boiler'))
        self.assertTrue(*testAssert(results.dT_LMTD_recuperator, 7.4340, 'test1_dT_LMTD_recuperator'))
Ejemplo n.º 21
0
    def testInjectionWellCO2SmallWellR(self):
        ###
        #  Testing SemiAnalyticalWell for horizontal injection well settings
        ###
        # load global physical properties
        gpp = SimulationParameters(working_fluid = 'co2')
        gpp.time_years = 10.
        gpp.dT_dz = 0.06
        gpp.well_radius = 0.02
        gpp.m_dot_IP = 0.1

        vertical_well = SemiAnalyticalWell(params = gpp,
                                            dz_total = -3500.,
                                            T_e_initial = 15.)

        # initial state
        initial_state = FluidState.getStateFromPT(1.e6, 25., gpp.working_fluid)
        vertical_well_results = vertical_well.solve(initial_state)

        self.assertMessages(gpp.working_fluid,
                        (vertical_well_results.state.P_Pa, 1.1431e6),
                        (vertical_well_results.state.T_C, 222.2246),
                        (vertical_well_results.state.h_Jkg, 6.8717e5))
Ejemplo n.º 22
0
    def testInjectionWellWater(self):
        ###
        #  Testing SemiAnalyticalWell for vertical and horizontal injection well settings
        ###
        # load parameters
        gpp = SimulationParameters(working_fluid = 'water')
        gpp.time_years = 10.
        gpp.dT_dz = 0.06
        gpp.well_radius = 0.279
        gpp.m_dot_IP = 5.

        vertical_well = SemiAnalyticalWell(params = gpp,
                                        dz_total = -3500.,
                                        T_e_initial = 15.)

        # initial state
        initial_state = FluidState.getStateFromPT(1.e6, 25., gpp.working_fluid)
        vertical_well_results = vertical_well.solve(initial_state)

        self.assertMessages(gpp.working_fluid,
                        (vertical_well_results.state.P_Pa, 3.533e7),
                        (vertical_well_results.state.T_C, 67.03),
                        (vertical_well_results.state.h_Jkg, 3.0963e5))

        horizontal_well = SemiAnalyticalWell(params = gpp,
                                        dr_total = 3000.,
                                        T_e_initial = vertical_well.T_e_initial + gpp.dT_dz * abs(vertical_well.dz_total))

        # initial state
        initial_state = FluidState.getStateFromPT(vertical_well_results.state.P_Pa, vertical_well_results.state.T_C, gpp.working_fluid)
        horizontal_well_results = horizontal_well.solve(initial_state)

        self.assertMessages(gpp.working_fluid,
                        (horizontal_well_results.state.P_Pa, 3.533e7),
                        (horizontal_well_results.state.T_C, 121.99),
                        (horizontal_well_results.state.h_Jkg, 5.3712e5))
Ejemplo n.º 23
0
    def testInjectionWellCO2(self):
        ###
        #  Testing SemiAnalyticalWell for horizontal injection well settings
        ###
        # load global physical properties
        gpp = SimulationParameters(working_fluid = 'co2')
        gpp.time_years = 10.
        gpp.dT_dz = 0.06
        gpp.well_radius = 0.279
        gpp.m_dot_IP = 5.

        vertical_well = SemiAnalyticalWell(params = gpp,
                                            dz_total = -3500.,
                                            T_e_initial = 15.)

        # initial state
        initial_state = FluidState.getStateFromPT(1.e6, 25., gpp.working_fluid)
        vertical_well_results = vertical_well.solve(initial_state)

        self.assertMessages(gpp.working_fluid,
                        (vertical_well_results.state.P_Pa, 1.7245e6),
                        (vertical_well_results.state.T_C, 156.08),
                        (vertical_well_results.state.h_Jkg, 6.1802e5))

        horizontal_well = SemiAnalyticalWell(params = gpp,
                                            dr_total = 3000.,
                                            T_e_initial = vertical_well.T_e_initial + gpp.dT_dz * abs(vertical_well.dz_total))

        # initial state
        initial_state = FluidState.getStateFromPT(vertical_well_results.state.P_Pa, vertical_well_results.state.T_C, gpp.working_fluid)
        horizontal_well_results = horizontal_well.solve(initial_state)

        self.assertMessages(gpp.working_fluid,
                        (horizontal_well_results.state.P_Pa, 1.7235e6),
                        (horizontal_well_results.state.T_C, 212.746),
                        (horizontal_well_results.state.h_Jkg, 6.755e5))
Ejemplo n.º 24
0
 def __init__(self, well, params=None, **kwargs):
     self.well = well
     self.params = params
     if self.params == None:
         self.params = SimulationParameters(**kwargs)
     self.computeSurfacePipeFrictionFactor()
Ejemplo n.º 25
0
 def cO2Baseline(params=None, **kwargs):
     if params == None:
         params = SimulationParameters(**kwargs)
     return wellCO2(params.depth, params.well_radius,
                    baseLine(params.depth), params.success_rate,
                    params.cost_year)
Ejemplo n.º 26
0
class DownHolePump(object):
    """DownHolePump."""
    def __init__(self, well, params=None, **kwargs):
        self.well = well
        self.params = params
        if self.params == None:
            self.params = SimulationParameters(**kwargs)
        self.computeSurfacePipeFrictionFactor()

    def computeSurfacePipeFrictionFactor(self):
        self.ff_m_dot = self.params.m_dot_IP
        initial_P = 1e6 + self.params.P_system_min()
        initial_T = 60.
        initial_h = FluidState.getStateFromPT(initial_P, initial_T,
                                              self.params.working_fluid).h_Jkg
        self.friction_factor = frictionFactor(self.params.well_radius, initial_P, initial_h, \
                            self.params.m_dot_IP, self.params.working_fluid, self.params.epsilon)

    def solve(self, initial_state, P_inj_surface):

        if self.ff_m_dot != self.params.m_dot_IP:
            self.computeSurfacePipeFrictionFactor()

        # initilize object with well output
        results = DownHolePumpOutput()

        # Pumping and second well
        d_dP_pump = 1e5
        dP_pump = 0
        dP_surface = np.nan
        dP_loops = 1
        dP_Solver = Solver()

        while np.isnan(dP_surface) or abs(dP_surface) > 100:
            try:
                if dP_pump > self.params.max_pump_dP:
                    dP_pump = self.params.max_pump_dP

                P_prod_pump_out = initial_state.P_Pa + dP_pump
                T_prod_pump_out = initial_state.T_C
                temp_at_pump_depth = self.well.T_e_initial + self.params.dT_dz * self.params.pump_depth

                state_in = FluidState.getStateFromPT(P_prod_pump_out,
                                                     T_prod_pump_out,
                                                     self.params.working_fluid)
                results.well = self.well.solve(state_in)

                # calculate surface pipe friction loss
                if self.params.has_surface_gathering_system:
                    dP_surface_pipes = self.friction_factor * self.params.well_spacing / \
                    (2 * self.params.well_radius)**5 * 8 * self.params.m_dot_IP**2 / results.well.state.rho_kgm3 / np.pi**2
                else:
                    dP_surface_pipes = 0.

                dP_surface = (results.well.state.P_Pa - P_inj_surface -
                              dP_surface_pipes)
                if dP_pump == self.params.max_pump_dP:
                    break

                # No pumping is needed in this system
                if dP_pump == 0 and dP_surface >= 0:
                    break

                dP_pump = dP_Solver.addDataAndEstimate(dP_pump, dP_surface)
                if np.isnan(dP_pump):
                    dP_pump = -1 * dP_surface

                # Pump can't be less than zero
                if dP_pump < 0:
                    dP_pump = 0

                # Warn against excessive loops
                if dP_loops > 10:
                    print('Warning::DownHolePump:dP_loops is large: %s' %
                          dP_loops)
                dP_loops += 1

            except ValueError as error:
                # Only catch problems of flashing fluid
                if str(error).find(
                        'GenGeo::SemiAnalyticalWell:BelowSaturationPressure'
                ) > -1:
                    dP_pump = dP_pump + d_dP_pump
                else:
                    raise error
        # if pump pressure greater than allowable, throw error
        if dP_pump >= self.params.max_pump_dP:
            raise Exception(
                'GenGeo::DownHolePump:ExceedsMaxProductionPumpPressure - '
                'Exceeds Max Pump Pressure of %.3f MPa!' %
                (self.params.max_pump_dP / 1e6))

        results.w_pump = 0
        results.dP_surface_pipes = dP_surface_pipes
        if dP_pump > 0:
            results.w_pump = (initial_state.h_Jkg -
                              state_in.h_Jkg) / self.params.eta_pump

        return results
Ejemplo n.º 27
0
# Further changes are done by:
#

############################
import unittest

from src.oRCCycleTboil import ORCCycleTboil
from src.coolingCondensingTower import CoolingCondensingTower
from models.coolingCondensingTowerMode import CoolingCondensingTowerMode

from utils.fluidState import FluidState
from models.simulationParameters import SimulationParameters

from tests.testAssertion import testAssert

params = SimulationParameters(orc_fluid='R245fa')
cycle = ORCCycleTboil(params=params)


class ORCCycleTboilTest(unittest.TestCase):
    def testParasiticPowerFraction(self):
        parasiticPowerFraction = CoolingCondensingTower.parasiticPowerFraction(
            15., 7., 25., CoolingCondensingTowerMode.Wet)
        self.assertTrue(*testAssert(parasiticPowerFraction('cooling'),
                                    0.016025303571428565, 'Wet - cooling'))
        self.assertTrue(*testAssert(parasiticPowerFraction('condensing'),
                                    0.02685987257142855, 'Wet - condensing'))
        self.assertRaises(Exception, parasiticPowerFraction, 'heating')
        parasiticPowerFraction = CoolingCondensingTower.parasiticPowerFraction(
            15., 7., 25., CoolingCondensingTowerMode.Dry)
        self.assertTrue(*testAssert(parasiticPowerFraction('cooling'),
Ejemplo n.º 28
0
 def waterIdeal(params=None, **kwargs):
     if params == None:
         params = SimulationParameters(**kwargs)
     return well(params.depth, params.well_radius, ideal(params.depth),
                 params.success_rate, params.cost_year)
Ejemplo n.º 29
0
from models.simulationParameters import SimulationParameters

logTrans = np.arange(2., 8., 1.)
permeabilities = 1e-15 * 10.**logTrans
depths = np.arange(1000, 8000, 1000)

# create output folder
output_folder = 'results'
if not os.path.exists(output_folder):
    os.mkdir(output_folder)

output_file = open(os.path.join(output_folder, 'data_CO2.csv'), 'w')

# initialize parameters
params = SimulationParameters(working_fluid='co2', capacity_factor=0.9)

# generate the full system
full_system = FullSystemCPG.getDefaultCPGSystem(params)
full_system_solver = FullSystemSolver(full_system)

# iterate over all depths and permeabilities and solve the system
for depth in depths:
    for permeability in permeabilities:
        print('Depth: ', depth)
        print('Permeability: ', permeability)
        params.depth = depth
        params.permeability = permeability / 100.

        try:
            output = full_system_solver.solve()
Ejemplo n.º 30
0
 def water(params=None, **kwargs):
     if params == None:
         params = SimulationParameters(**kwargs)
     return cPermitting(params.cost_year)