From 9e73d055bbd7359dd705dfd69e22d60e0a2b05ec Mon Sep 17 00:00:00 2001 From: Richard Plevin Date: Tue, 5 Nov 2024 12:29:13 -0800 Subject: [PATCH 1/6] Checkpoint commit while renaming streams --- docs/source/guidelines.rst | 2 +- opgee/etc/opgee.xml | 32 +++--- opgee/process.py | 6 +- opgee/processes/CO2_membrane.py | 7 +- opgee/processes/VRU_compressor.py | 4 +- opgee/processes/crude_oil_dewatering.py | 9 +- opgee/processes/crude_oil_stabilization.py | 4 +- opgee/processes/downhole_pump.py | 12 +-- opgee/processes/gas_gathering.py | 6 +- opgee/processes/gas_partition.py | 16 ++- opgee/processes/gas_reinjection_compressor.py | 4 +- opgee/processes/pre_membrane_chiller.py | 4 +- opgee/processes/pre_membrane_compressor.py | 8 +- opgee/processes/reservoir_well_interface.py | 12 +-- opgee/processes/separation.py | 8 +- opgee/processes/sour_gas_compressor.py | 4 +- opgee/processes/sour_gas_injection.py | 4 +- opgee/processes/steam_generation.py | 9 +- opgee/processes/venting.py | 4 +- opgee/processes/water_injection.py | 4 +- opgee/processes/water_treatment.py | 13 ++- tests/files/test_gui.xml | 4 +- tests/files/test_model.xml | 100 ++++++++++-------- tests/files/test_process_groups.xml | 30 +++--- tests/files/test_process_loop_model.xml | 8 +- tests/test_intermediate_boundary.py | 14 +-- tests/test_process_loop.py | 8 +- tests/test_processes.py | 40 +++---- 28 files changed, 190 insertions(+), 186 deletions(-) diff --git a/docs/source/guidelines.rst b/docs/source/guidelines.rst index 26362c7e..ed802a4b 100644 --- a/docs/source/guidelines.rst +++ b/docs/source/guidelines.rst @@ -75,7 +75,7 @@ principles: 2. **Keep stream contents as generic as possible.** |br| Avoid names that encode the endpoints of the stream, using instead as generic a name for the contents as possible. Use content names that describe the main contents of the - stream, like "crude oil" or "dehydrated gas". **Do not** include the name of the source or + stream, like "oil" or "dehydrated gas". **Do not** include the name of the source or destination processes in the contents. 3. **Store data that needs to be shared with other processes in the Field instance.** |br| diff --git a/opgee/etc/opgee.xml b/opgee/etc/opgee.xml index 613b24ee..816d3e47 100644 --- a/opgee/etc/opgee.xml +++ b/opgee/etc/opgee.xml @@ -383,21 +383,21 @@ - crude oil + oil - crude oil + oil - crude oil + oil - crude oil + oil @@ -438,7 +438,7 @@ - gas for gas gathering + gas @@ -513,20 +513,20 @@ - water for surface disposal + water water for subsurface disposal - produced water for steam generation + produced water - makeup water for steam generation + makeup water - water for water injection + water @@ -550,11 +550,11 @@ - gas for gas gathering + gas - gas for gas gathering + gas @@ -578,11 +578,11 @@ - gas for compressor + gas - gas for CO2 membrane + gas @@ -634,7 +634,7 @@ - gas for sour gas injection + gas @@ -666,7 +666,7 @@ - gas for gas reinjection compressor + gas @@ -682,7 +682,7 @@ - gas + exported gas diff --git a/opgee/process.py b/opgee/process.py index 8966ebb0..b8ba14d8 100644 --- a/opgee/process.py +++ b/opgee/process.py @@ -537,7 +537,7 @@ def _find_streams_by_type(self, direction, stream_type, combine=False, as_list=F Stream, list, dict]: """ Find the input or output streams (indicated by `direction`) that contain the indicated - `stream_type`, e.g., 'crude oil', 'raw water' and so on. + `stream_type`, e.g., 'oil', 'water' and so on. :param direction: (str) 'input' or 'output' :param stream_type: (str) the generic type of stream a process can handle. @@ -593,7 +593,7 @@ def find_output_streams(self, stream_type, combine=False, as_list=False, raiseEr def find_input_stream(self, stream_type, raiseError=True) -> Union[Stream, None]: """ Find exactly one input stream connected to a downstream Process that produces the indicated - `stream_type`, e.g., 'crude oil', 'raw water' and so on. + `stream_type`, e.g., 'oil', 'water' and so on. :param stream_type: (str) the generic type of stream a process can handle. :param raiseError: (bool) whether to raise an error if no handlers of `stream_type` are found. @@ -611,7 +611,7 @@ def find_input_stream(self, stream_type, raiseError=True) -> Union[Stream, None] def find_output_stream(self, stream_type, raiseError=True) -> Union[Stream, None]: """ Find exactly one output stream connected to a downstream Process that consumes the indicated - `stream_type`, e.g., 'crude oil', 'raw water' and so on. + `stream_type`, e.g., 'oil', 'water' and so on. :param stream_type: (str) the generic type of stream a process can handle. :param raiseError: (bool) whether to raise an error if no handlers of `stream_type` are found. diff --git a/opgee/processes/CO2_membrane.py b/opgee/processes/CO2_membrane.py index 006d0fde..86995bef 100644 --- a/opgee/processes/CO2_membrane.py +++ b/opgee/processes/CO2_membrane.py @@ -21,7 +21,7 @@ class CO2Membrane(Process): This process represents the separation of CO2 from natural gas using a membrane. input streams: - - gas for CO2 membrane + - gas output streams: - gas for AGR @@ -32,9 +32,10 @@ def __init__(self, name, **kwargs): super().__init__(name, **kwargs) self._required_inputs = [ - "gas for CO2 membrane", # TODO: avoid process names in contents. + "gas", ] + # TODO: avoid process names in contents. self._required_outputs = [ "gas for AGR", "gas for CO2 compressor", @@ -60,7 +61,7 @@ def run(self, analysis): self.print_running_msg() field = self.field - input = self.find_input_stream("gas for CO2 membrane") + input = self.find_input_stream("gas") if input.is_uninitialized(): return diff --git a/opgee/processes/VRU_compressor.py b/opgee/processes/VRU_compressor.py index 7bb8b0f0..3ee566e2 100644 --- a/opgee/processes/VRU_compressor.py +++ b/opgee/processes/VRU_compressor.py @@ -34,7 +34,7 @@ def __init__(self, name, **kwargs): ] self._required_outputs = [ - "gas for gas gathering" + "gas" ] self.discharge_press = None @@ -59,7 +59,7 @@ def run(self, analysis): loss_rate = self.venting_fugitive_rate() gas_fugitives = self.set_gas_fugitives(input, loss_rate) - gas_to_gathering = self.find_output_stream("gas for gas gathering") + gas_to_gathering = self.find_output_stream("gas") overall_compression_ratio = self.discharge_press / input.tp.P energy_consumption, output_temp, output_press = \ diff --git a/opgee/processes/crude_oil_dewatering.py b/opgee/processes/crude_oil_dewatering.py index e47f1bf2..a0675749 100644 --- a/opgee/processes/crude_oil_dewatering.py +++ b/opgee/processes/crude_oil_dewatering.py @@ -19,7 +19,8 @@ class CrudeOilDewatering(Process): """ - A subclass of the Process class that represents a crude oil dewatering process in an oil and gas production system. + A subclass of the Process class that represents a crude oil dewatering process + in an oil and gas production system. Attributes: field (Field): The field associated with the dewatering process. @@ -38,7 +39,7 @@ def __init__(self, name, **kwargs): self.oil_path = self.field.oil_path # TODO: avoid process names in contents. Can all the subsequent processes just - # look for "crude oil"? Then we'd have a single output stream. + # look for "oil"? Then we'd have a single output stream. self.oil_path_dict = {"Stabilization": "oil for stabilization", "Storage": "oil for storage", "Upgrading": "oil for upgrading", @@ -46,7 +47,7 @@ def __init__(self, name, **kwargs): "Dilution and Upgrading": "oil for dilution"} self._required_inputs = [ - "crude oil", + "oil", ] self._required_outputs = [ @@ -75,7 +76,7 @@ def run(self, analysis): self.print_running_msg() # mass rate - input = self.find_input_stream("crude oil") + input = self.find_input_stream("oil") if input.is_uninitialized(): return diff --git a/opgee/processes/crude_oil_stabilization.py b/opgee/processes/crude_oil_stabilization.py index bc494671..df40e1ef 100644 --- a/opgee/processes/crude_oil_stabilization.py +++ b/opgee/processes/crude_oil_stabilization.py @@ -42,7 +42,7 @@ def __init__(self, name, **kwargs): ] self._required_outputs = [ - "gas for gas gathering", + "gas", "oil for storage", ] @@ -101,7 +101,7 @@ def run(self, analysis): gas_removed_molar_rate = gas_removed_by_stabilizer * self.mol_per_scf * oil.gas_comp # Pandas Series gas_removed_mass_rate = oil.component_MW[gas_removed_molar_rate.index] * gas_removed_molar_rate - output_stab_gas = self.find_output_stream("gas for gas gathering") + output_stab_gas = self.find_output_stream("gas") gas_tp_after_separation = field.get_process_data("gas_tp_after_separation") if gas_tp_after_separation is None: gas_tp_after_separation = input.tp diff --git a/opgee/processes/downhole_pump.py b/opgee/processes/downhole_pump.py index 4b0ad932..2794fa2f 100644 --- a/opgee/processes/downhole_pump.py +++ b/opgee/processes/downhole_pump.py @@ -66,12 +66,12 @@ def __init__(self, name, **kwargs): super().__init__(name, **kwargs) self._required_inputs = [ - "crude oil", + "oil", # "lifting gas", # optional input stream ] self._required_outputs = [ - "crude oil", + "oil", ] self.gravitational_acceleration = self.field.model.const("gravitational-acceleration") @@ -113,7 +113,7 @@ def run(self, analysis): field = self.field # mass rate - input = self.find_input_stream("crude oil") + input = self.find_input_stream("oil") if input.is_uninitialized(): return @@ -124,7 +124,7 @@ def run(self, analysis): loss_rate = field.component_fugitive_table[self.name] gas_fugitives = self.set_gas_fugitives(input, loss_rate) - output = self.find_output_stream("crude oil") + output = self.find_output_stream("oil") output.copy_flow_rates_from(input, tp=self.wellhead_tp) output.subtract_rates_from(gas_fugitives) @@ -223,7 +223,7 @@ def run(self, analysis): def impute(self): field = self.field - output = self.find_output_stream("crude oil") + output = self.find_output_stream("oil") loss_rate = field.component_fugitive_table[self.name] loss_rate = (1 / (1 - loss_rate)).to("frac") @@ -238,7 +238,7 @@ def impute(self): completion_workover_fugitive_stream.set_rates_from_series(completion_workover_fugitive_series, phase=PHASE_GAS) field.save_process_data(completion_workover_fugitive_stream=completion_workover_fugitive_stream) - input = self.find_input_stream("crude oil") + input = self.find_input_stream("oil") input.copy_flow_rates_from(output) input.multiply_flow_rates(loss_rate) input.add_flow_rates_from(completion_workover_fugitive_stream) diff --git a/opgee/processes/gas_gathering.py b/opgee/processes/gas_gathering.py index 11ed8d52..d743f332 100644 --- a/opgee/processes/gas_gathering.py +++ b/opgee/processes/gas_gathering.py @@ -22,7 +22,7 @@ def __init__(self, name, **kwargs): # TODO: avoid process names in contents. self._required_inputs = [ - "gas for gas gathering" + "gas" ] self._required_outputs = [ @@ -49,11 +49,11 @@ def run(self, analysis): self.print_running_msg() field = self.field - if not self.all_streams_ready("gas for gas gathering"): + if not self.all_streams_ready("gas"): return # mass_rate - input = self.find_input_streams("gas for gas gathering", combine=True) + input = self.find_input_streams("gas", combine=True) if input.is_uninitialized(): return diff --git a/opgee/processes/gas_partition.py b/opgee/processes/gas_partition.py index 5572a67d..5f18eae7 100644 --- a/opgee/processes/gas_partition.py +++ b/opgee/processes/gas_partition.py @@ -38,11 +38,11 @@ def __init__(self, name, **kwargs): self._required_outputs = [ "gas", - # also two possible output streams below + # also two possible output streams below: "lifting gas" and "exported gas" ] if field.natural_gas_reinjection: - self._required_outputs.append("gas for gas reinjection compressor") + self._required_outputs.append("gas") if field.gas_lifting: self._required_outputs.append("lifting gas") @@ -185,9 +185,7 @@ def run(self, analysis): exported_gas_stream.subtract_rates_from(reinjected_HC_stream) exported_gas_stream.subtract_rates_from(fuel_stream) - gas_to_reinjection = self.find_output_stream( - "gas for gas reinjection compressor" - ) + gas_to_reinjection = self.find_output_stream("gas") combined_gas_stream = reinjected_HC_stream if field.get_process_data("gas_flooding_stream") is not None: gas_flooding_stream = field.get_process_data("gas_flooding_stream") @@ -202,7 +200,7 @@ def run(self, analysis): ) ) - exported_gas = self.find_output_stream("gas") + exported_gas = self.find_output_stream("exported gas") if field.get_process_data("is_input_from_well") is None: exported_gas.copy_flow_rates_from(exported_gas_stream) @@ -225,7 +223,7 @@ def gas_flooding_setup(self, import_product, reinjected_gas_stream, exported_gas gas etc.). If the reinjected gas stream has a non-zero total flow rate, the flow rates are copied - to the gas for gas reinjection compressor. + to the gas for the reinjection compressor. :param import_product: (ImportProduct) import product object :param reinjected_gas_stream: (Stream) gas stream being reinjected into the reservoir @@ -338,8 +336,6 @@ def gas_flooding_setup(self, import_product, reinjected_gas_stream, exported_gas self.name, NATURAL_GAS, imported_NG_energy_rate ) - gas_to_reinjection = self.find_output_stream( - "gas for gas reinjection compressor" - ) + gas_to_reinjection = self.find_output_stream("gas") if reinjected_gas_stream.total_flow_rate().m != 0: gas_to_reinjection.copy_flow_rates_from(reinjected_gas_stream) diff --git a/opgee/processes/gas_reinjection_compressor.py b/opgee/processes/gas_reinjection_compressor.py index b5d16c87..d066aff2 100644 --- a/opgee/processes/gas_reinjection_compressor.py +++ b/opgee/processes/gas_reinjection_compressor.py @@ -23,7 +23,7 @@ def __init__(self, name, **kwargs): # TODO: avoid process names in contents. self._required_inputs = [ - "gas for gas reinjection compressor" + "gas" ] self._required_outputs = [ @@ -59,7 +59,7 @@ def run(self, analysis): field = self.field # TODO: unclear how this can work if the input stream doesn't exist - input = self.find_input_stream("gas for gas reinjection compressor", raiseError=False) + input = self.find_input_stream("gas", raiseError=False) if input is None or input.is_uninitialized(): return diff --git a/opgee/processes/pre_membrane_chiller.py b/opgee/processes/pre_membrane_chiller.py index 03c6c64e..21ba86a6 100644 --- a/opgee/processes/pre_membrane_chiller.py +++ b/opgee/processes/pre_membrane_chiller.py @@ -25,7 +25,7 @@ def __init__(self, name, **kwargs): ] self._required_outputs = [ - "gas for compressor", + "gas", ] self.compressor_load = ureg.Quantity(3.44, "kW") @@ -49,7 +49,7 @@ def run(self, analysis): loss_rate = self.venting_fugitive_rate() gas_fugitives = self.set_gas_fugitives(input, loss_rate) - gas_to_compressor = self.find_output_stream("gas for compressor") + gas_to_compressor = self.find_output_stream("gas") gas_to_compressor.copy_flow_rates_from(input) gas_to_compressor.subtract_rates_from(gas_fugitives) gas_to_compressor.tp.set(T=self.outlet_temp, P=input.tp.P) diff --git a/opgee/processes/pre_membrane_compressor.py b/opgee/processes/pre_membrane_compressor.py index e9679cb0..1325ad25 100644 --- a/opgee/processes/pre_membrane_compressor.py +++ b/opgee/processes/pre_membrane_compressor.py @@ -22,11 +22,11 @@ def __init__(self, name, **kwargs): # TODO: avoid process names in contents. self._required_inputs = [ - "gas for compressor", + "gas", ] self._required_outputs = [ - "gas for CO2 membrane", + "gas", ] self.discharge_press = None @@ -42,7 +42,7 @@ def cache_attributes(self): def run(self, analysis): self.print_running_msg() - input = self.find_input_stream("gas for compressor") + input = self.find_input_stream("gas") if input.is_uninitialized(): return @@ -50,7 +50,7 @@ def run(self, analysis): loss_rate = min(ureg.Quantity(0.95, "frac"), loss_rate) gas_fugitives = self.set_gas_fugitives(input, loss_rate) - gas_to_CO2_membrane = self.find_output_stream("gas for CO2 membrane") + gas_to_CO2_membrane = self.find_output_stream("gas") gas_to_CO2_membrane.copy_flow_rates_from(input) gas_to_CO2_membrane.subtract_rates_from(gas_fugitives) self.set_iteration_value(gas_to_CO2_membrane.total_flow_rate()) diff --git a/opgee/processes/reservoir_well_interface.py b/opgee/processes/reservoir_well_interface.py index 6c133b7d..4a6734ae 100644 --- a/opgee/processes/reservoir_well_interface.py +++ b/opgee/processes/reservoir_well_interface.py @@ -22,11 +22,11 @@ def __init__(self, name, **kwargs): super().__init__(name, **kwargs) self._required_inputs = [ - "crude oil", + "oil", ] self._required_outputs = [ - "crude oil", + "oil", ] self.frac_CO2_breakthrough = None @@ -55,13 +55,13 @@ def run(self, analysis): field = self.field # mass rate - input = self.find_input_stream("crude oil") + input = self.find_input_stream("oil") if input.is_uninitialized(): return input.set_tp(self.res_tp) - output = self.find_output_stream("crude oil") + output = self.find_output_stream("oil") output.copy_flow_rates_from(input) CO2_flooding_rate = field.get_process_data("CO2_flooding_rate_init") @@ -77,9 +77,9 @@ def run(self, analysis): output.tp.set(T=self.res_tp.T, P=bottomhole_flowing_press) def impute(self): - output = self.find_output_stream("crude oil") + output = self.find_output_stream("oil") - input = self.find_input_stream("crude oil") + input = self.find_input_stream("oil") input.copy_flow_rates_from(output) def get_bottomhole_press(self, input_stream): diff --git a/opgee/processes/separation.py b/opgee/processes/separation.py index 44c7d4eb..2355e24d 100644 --- a/opgee/processes/separation.py +++ b/opgee/processes/separation.py @@ -24,7 +24,7 @@ def __init__(self, name, **kwargs): # TODO: avoid process names in contents. self._required_inputs = [ - "crude oil", + "oil", ] self._required_outputs = [ @@ -93,7 +93,7 @@ def run(self, analysis): water_oil_ratio = field.attr("WOR") # mass rate - input = self.find_input_stream("crude oil") + input = self.find_input_stream("oil") loss_rate = field.component_fugitive_table[self.name] gas_fugitives = self.set_gas_fugitives(input, loss_rate) @@ -139,7 +139,7 @@ def impute(self): loss_rate = (1 / (1 - loss_rate)).to("frac") output.multiply_flow_rates(loss_rate) - input = self.find_input_stream("crude oil") + input = self.find_input_stream("oil") input.copy_flow_rates_from(output, tp=field.wellhead_tp) oil_LHV_rate = oil.energy_flow_rate(input) gas_LHV_rate = field.gas.energy_flow_rate(input) @@ -176,7 +176,7 @@ def get_output_streams(self, field): gas_after.set_rates_from_series(gas_mass_rate, PHASE_GAS) gas_after.tp.set(T=self.outlet_tp.T, P=self.pressure_after_boosting) - oil_after = self.find_output_stream("crude oil") + oil_after = self.find_output_stream("oil") oil_mass_rate = (self.oil_volume_rate * density).to("tonne/day") water_in_oil_mass_rate = self.water_in_oil_mass_rate(oil_mass_rate) oil_after.set_liquid_flow_rate("oil", oil_mass_rate) diff --git a/opgee/processes/sour_gas_compressor.py b/opgee/processes/sour_gas_compressor.py index a1a50089..40257b92 100644 --- a/opgee/processes/sour_gas_compressor.py +++ b/opgee/processes/sour_gas_compressor.py @@ -26,7 +26,7 @@ def __init__(self, name, **kwargs): ] self._required_outputs = [ - "gas for sour gas injection", + "gas", ] self.eta_compressor = None @@ -52,7 +52,7 @@ def run(self, analysis): loss_rate = self.get_compressor_and_well_loss_rate(input) gas_fugitives = self.set_gas_fugitives(input, loss_rate) - gas_to_injection = self.find_output_stream("gas for sour gas injection") + gas_to_injection = self.find_output_stream("gas") gas_to_injection.copy_flow_rates_from(input) gas_to_injection.subtract_rates_from(gas_fugitives) diff --git a/opgee/processes/sour_gas_injection.py b/opgee/processes/sour_gas_injection.py index e730f163..976b1770 100644 --- a/opgee/processes/sour_gas_injection.py +++ b/opgee/processes/sour_gas_injection.py @@ -19,7 +19,7 @@ def __init__(self, name, **kwargs): # TODO: avoid process names in contents. self._required_inputs = [ - "gas for sour gas injection", + "gas", ] self._required_outputs = [ @@ -31,7 +31,7 @@ def run(self, analysis): field = self.field # mass rate - input = self.find_input_stream("gas for sour gas injection") + input = self.find_input_stream("gas") if input.is_uninitialized(): return diff --git a/opgee/processes/steam_generation.py b/opgee/processes/steam_generation.py index f709ad4a..ac44a036 100644 --- a/opgee/processes/steam_generation.py +++ b/opgee/processes/steam_generation.py @@ -33,9 +33,8 @@ def __init__(self, *args, **kwargs): field = self.field if field.steam_flooding == 1 and field.SOR != 0: self._required_inputs = [ - # TODO: avoid process names in contents. - "produced water for steam generation", - "makeup water for steam generation" + "produced water", + "makeup water" ] self._required_outputs = [ @@ -122,8 +121,8 @@ def run(self, analysis): # mass rate - input_prod_water = self.find_input_stream("produced water for steam generation") - input_makeup_water = self.find_input_stream("makeup water for steam generation") + input_prod_water = self.find_input_stream("produced water") + input_makeup_water = self.find_input_stream("makeup water") if input_prod_water.is_uninitialized() and input_makeup_water.is_uninitialized(): return diff --git a/opgee/processes/venting.py b/opgee/processes/venting.py index 63ab9aff..b42b9727 100644 --- a/opgee/processes/venting.py +++ b/opgee/processes/venting.py @@ -26,7 +26,7 @@ def __init__(self, name, **kwargs): ] self._required_outputs = [ - "gas for gas gathering", + "gas", ] self.imported_fuel_gas_comp = field.imported_gas_comp["Imported Fuel"] @@ -95,7 +95,7 @@ def run(self, analysis): gas_fugitives = self.set_gas_fugitives(input, fugitive_frac.to("frac").m) - gas_to_gathering = self.find_output_stream("gas for gas gathering") + gas_to_gathering = self.find_output_stream("gas") gas_tp_after_separation = field.get_process_data("gas_tp_after_separation") gas_to_gathering.copy_flow_rates_from(input, tp=gas_tp_after_separation) gas_to_gathering.subtract_rates_from(gas_to_vent) diff --git a/opgee/processes/water_injection.py b/opgee/processes/water_injection.py index ea225eb1..2c2ea0dc 100644 --- a/opgee/processes/water_injection.py +++ b/opgee/processes/water_injection.py @@ -39,7 +39,7 @@ def __init__(self, name, **kwargs): # TODO: avoid process names in contents. self._required_inputs = [ - "water for water injection", + "water", ] self._required_outputs = [] @@ -89,7 +89,7 @@ def run(self, analysis): if self.num_water_inj_wells.m == 0: raise OpgeeException(f"Got zero number of injector in the {self.name} process") - input = self.find_input_stream("water for water injection") + input = self.find_input_stream("water") if input.is_uninitialized(): return diff --git a/opgee/processes/water_treatment.py b/opgee/processes/water_treatment.py index 05d7787f..0c49b9f5 100644 --- a/opgee/processes/water_treatment.py +++ b/opgee/processes/water_treatment.py @@ -34,18 +34,17 @@ def __init__(self, name, **kwargs): "water", ] - # TODO: avoid process names in contents. self._required_outputs = [] field = self.field if field.steam_flooding: self._required_outputs.extend([ - "makeup water for steam generation", - "produced water for steam generation", + "makeup water", + "produced water", ]) if field.water_flooding or field.water_reinjection: - self._required_outputs.append("water for water injection") + self._required_outputs.append("water") self.water_treatment_table = self.model.water_treatment @@ -139,14 +138,14 @@ def run(self, analysis): min(injected_steam_mass_demand, input_water_mass_rate - prod_water_mass) if self.steam_flooding: - makeup_water_to_steam = self.find_output_stream("makeup water for steam generation") - prod_water_to_steam = self.find_output_stream("produced water for steam generation") + makeup_water_to_steam = self.find_output_stream("makeup water") + prod_water_to_steam = self.find_output_stream("produced water") prod_water_to_steam.set_liquid_flow_rate("H2O", prod_steam_mass.to("tonne/day"), tp=input.tp) if makeup_steam_mass.m != 0: makeup_water_to_steam.set_liquid_flow_rate("H2O", makeup_steam_mass.to("tonne/day"), tp=self.makeup_water_tp) if self.water_flooding or self.water_reinjection: - water_to_reinjection = self.find_output_stream("water for water injection") + water_to_reinjection = self.find_output_stream("water") water_to_reinjection_rate = prod_water_mass + makeup_water_mass water_to_reinjection.set_liquid_flow_rate("H2O", water_to_reinjection_rate, tp=input.tp) diff --git a/tests/files/test_gui.xml b/tests/files/test_gui.xml index 7536ee18..02cb2dc9 100644 --- a/tests/files/test_gui.xml +++ b/tests/files/test_gui.xml @@ -77,7 +77,7 @@ - water for surface disposal + water @@ -160,7 +160,7 @@ - water for surface disposal + water diff --git a/tests/files/test_model.xml b/tests/files/test_model.xml index 0d11885a..a02a1313 100644 --- a/tests/files/test_model.xml +++ b/tests/files/test_model.xml @@ -59,14 +59,14 @@ - crude oil + oil 90.0 150.0 100 - crude oil + oil @@ -79,14 +79,14 @@ - crude oil + oil 90.0 150.0 100 - crude oil + oil @@ -144,7 +144,7 @@ - gas for gas gathering + gas @@ -176,11 +176,11 @@ - gas for gas reinjection compressor + gas - gas + exported gas @@ -213,11 +213,11 @@ - gas for gas reinjection compressor + gas - gas + exported gas @@ -250,11 +250,11 @@ - gas for gas reinjection compressor + gas - gas + exported gas @@ -285,11 +285,11 @@ - gas for gas reinjection compressor + gas - gas + exported gas @@ -319,11 +319,11 @@ - gas for gas reinjection compressor + gas - gas + exported gas @@ -355,12 +355,16 @@ 500 + + gas + + lifting gas - gas + exported gas @@ -391,12 +395,16 @@ 500 + + gas + + lifting gas - gas + exported gas @@ -544,7 +552,7 @@ - gas for gas gathering + gas @@ -681,7 +689,7 @@ - gas for compressor + gas @@ -696,7 +704,7 @@ - gas for compressor + gas 1238.9609 8387.5011 22182.3128 @@ -708,7 +716,7 @@ - gas for CO2 membrane + gas @@ -722,7 +730,7 @@ - gas for CO2 membrane + gas 1238.95945 8387.49116 22182.28649 @@ -828,7 +836,7 @@ - gas for sour gas injection + gas @@ -842,7 +850,7 @@ - gas for sour gas injection + gas 4.80935 642.57354 85.98923 @@ -870,7 +878,7 @@ - gas for gas reinjection compressor + gas 2538.13283 23.02784 44497.80735 @@ -932,7 +940,7 @@ - crude oil + oil 244.25402 44.28207 4361.75720 @@ -982,7 +990,7 @@ - crude oil + oil 219.34013 1861.01603 9421.01484 @@ -994,7 +1002,7 @@ - crude oil + oil @@ -1008,7 +1016,7 @@ - crude oil + oil 4.89152 2.79728 87.35015 @@ -1020,7 +1028,7 @@ - crude oil + oil @@ -1041,7 +1049,7 @@ - crude oil + oil 244.389711 44.306667 4364.180279 @@ -1056,7 +1064,7 @@ - crude oil + oil @@ -1083,7 +1091,7 @@ - crude oil + oil 114.9419538 20.8378531 2052.7627982 @@ -1108,7 +1116,7 @@ - crude oil + oil @@ -1126,7 +1134,7 @@ - crude oil + oil 68951.16732 9653.16342 90.0 @@ -1174,7 +1182,7 @@ - gas for gas gathering + gas @@ -1333,14 +1341,14 @@ - produced water for steam generation + produced water 31929.035171733634 140.0 200.0 - makeup water for steam generation + makeup water 0.0 60.0 14.7 @@ -1366,14 +1374,14 @@ - produced water for steam generation + produced water 31929.035171733634 140.0 200.0 - makeup water for steam generation + makeup water 0.0 60.0 14.7 @@ -1398,14 +1406,14 @@ - produced water for steam generation + produced water 31929.035171733634 140.0 200.0 - makeup water for steam generation + makeup water 0.0 60.0 14.7 @@ -1446,12 +1454,12 @@ 100.0 - - makeup water for steam generation + + makeup water - - produced water for steam generation + + produced water diff --git a/tests/files/test_process_groups.xml b/tests/files/test_process_groups.xml index e68654af..9885074d 100644 --- a/tests/files/test_process_groups.xml +++ b/tests/files/test_process_groups.xml @@ -280,7 +280,7 @@ - gas for gas gathering + gas @@ -313,7 +313,7 @@ - gas for gas gathering + gas @@ -372,24 +372,24 @@ - water for surface disposal + water water for subsurface disposal - produced water for steam generation + produced water - makeup water for steam generation + makeup water - produced water for water injection + water - makeup water for water injection + water @@ -408,15 +408,15 @@ - gas for gas gathering + gas - gas for gas gathering + gas - gas for gas gathering + gas @@ -440,11 +440,11 @@ - gas for compressor + gas - gas for CO2 membrane + gas @@ -496,7 +496,7 @@ - gas for sour gas injection + gas @@ -528,7 +528,7 @@ - gas for gas reinjection compressor + gas @@ -544,7 +544,7 @@ - gas + exported gas diff --git a/tests/files/test_process_loop_model.xml b/tests/files/test_process_loop_model.xml index f834fe4d..1ff6abd0 100644 --- a/tests/files/test_process_loop_model.xml +++ b/tests/files/test_process_loop_model.xml @@ -21,12 +21,12 @@ 100 80 200 - crude oil + oil - crude oil + oil @@ -54,12 +54,12 @@ 100 80 200 - crude oil + oil - crude oil + oil diff --git a/tests/test_intermediate_boundary.py b/tests/test_intermediate_boundary.py index c1e902cd..8e863075 100644 --- a/tests/test_intermediate_boundary.py +++ b/tests/test_intermediate_boundary.py @@ -21,7 +21,7 @@ 100 - crude oil + oil @@ -30,7 +30,7 @@ - crude oil + oil @@ -38,14 +38,14 @@ - crude oil + oil natural gas - crude oil + oil natural gas @@ -63,10 +63,10 @@ def run(self, analysis): class Boundary_proc_2(Process): def run(self, analysis): - in_stream = self.find_input_stream("crude oil") + in_stream = self.find_input_stream("oil") if in_stream.is_uninitialized(): return - out_stream = self.find_output_stream("crude oil") + out_stream = self.find_output_stream("oil") out_stream.copy_flow_rates_from(in_stream) @@ -81,7 +81,7 @@ def run(self, analysis): class Boundary_proc_4(Process): def run(self, analysis): - for content in ("crude oil", "natural gas"): + for content in ("oil", "natural gas"): in_stream = self.find_input_stream(content) if in_stream.is_uninitialized(): return diff --git a/tests/test_process_loop.py b/tests/test_process_loop.py index 07add73d..cddbaf91 100644 --- a/tests/test_process_loop.py +++ b/tests/test_process_loop.py @@ -9,19 +9,19 @@ def run(self, analysis): # find appropriate streams by checking connected processes' capabilities oil_flow_rate = ureg.Quantity(100.0, Stream.units()) - out_stream = self.find_output_stream('crude oil') + out_stream = self.find_output_stream('oil') out_stream.set_liquid_flow_rate('oil', oil_flow_rate) class LoopProc2(Process): def run(self, analysis): - crude_oil = self.find_input_stream('crude oil') + crude_oil = self.find_input_stream('oil') recycled_water = self.find_input_stream("water") if crude_oil.is_uninitialized() and recycled_water.is_uninitialized(): return - output = self.find_output_stream("crude oil") + output = self.find_output_stream("oil") output.copy_flow_rates_from(crude_oil) output.set_liquid_flow_rate("H2O", recycled_water.liquid_flow_rate("H2O")) self.set_iteration_value(output.total_flow_rate()) @@ -29,7 +29,7 @@ def run(self, analysis): class LoopProc3(Process): def run(self, analysis): - input = self.find_input_stream("crude oil") + input = self.find_input_stream("oil") if input.is_uninitialized(): return water = input.liquid_flow_rate("H2O") diff --git a/tests/test_processes.py b/tests/test_processes.py index e05ccd93..deda4bfa 100644 --- a/tests/test_processes.py +++ b/tests/test_processes.py @@ -77,21 +77,21 @@ def procB(test_model): def test_find_input_streams_dict(procB): - obj = procB.find_input_streams("crude oil") + obj = procB.find_input_streams("oil") assert isinstance(obj, dict) and len(obj) == 1 def test_find_input_streams_list(procB): - obj = procB.find_input_streams("crude oil", as_list=True) + obj = procB.find_input_streams("oil", as_list=True) assert isinstance(obj, list) and len(obj) == 1 def test_find_input_stream(procB): - procB.find_input_stream("crude oil") + procB.find_input_stream("oil") def test_find_output_stream(process): - process.find_output_stream("crude oil") + process.find_output_stream("oil") def test_find_input_stream_error(procB): @@ -358,11 +358,11 @@ def test_N2Flooding(test_model): field.run(analysis) proc = field.find_process('GasPartition') # ensure total energy flow rates - total = proc.find_output_stream("gas for gas reinjection compressor").gas_flow_rates().sum() + total = proc.find_output_stream("gas").gas_flow_rates().sum() expected = ureg.Quantity(25086.65151856, "tonne/day") assert approx_equal(total, expected, rel=10e-4) - total = proc.find_output_stream("gas").gas_flow_rates().sum() + total = proc.find_output_stream("exported gas").gas_flow_rates().sum() expected = ureg.Quantity(758.78647, "tonne/day") assert approx_equal(total, expected) @@ -373,11 +373,11 @@ def test_CO2Flooding_CO2_reinjection(test_model_with_change): field.run(analysis) proc = field.find_process('GasPartition') # ensure total energy flow rates - total = proc.find_output_stream("gas for gas reinjection compressor").gas_flow_rates().sum() + total = proc.find_output_stream("gas").gas_flow_rates().sum() expected = ureg.Quantity(9976.19977172, "tonne/day") assert approx_equal(total, expected, rel=10e-3) - total = proc.find_output_stream("gas").gas_flow_rates().sum() + total = proc.find_output_stream("exported gas").gas_flow_rates().sum() expected = ureg.Quantity(24885.555110000005, "tonne/day") assert approx_equal(total, expected) @@ -388,11 +388,11 @@ def test_CO2Flooding_non_zero(test_model_with_change): field.run(analysis) proc = field.find_process('GasPartition') # ensure total energy flow rates - total = proc.find_output_stream("gas for gas reinjection compressor").gas_flow_rates().sum() + total = proc.find_output_stream("gas").gas_flow_rates().sum() expected = ureg.Quantity(9976.199771722018, "tonne/day") assert approx_equal(total, expected, rel=10e-3) - total = proc.find_output_stream("gas").gas_flow_rates().sum() + total = proc.find_output_stream("exported gas").gas_flow_rates().sum() expected = ureg.Quantity(24885.555110000005, "tonne/day") assert approx_equal(total, expected) @@ -403,11 +403,11 @@ def test_NGFlooding_onsite(test_model): field.run(analysis) proc = field.find_process('GasPartition') # ensure total energy flow rates - total = proc.find_output_stream("gas for gas reinjection compressor").gas_flow_rates().sum() + total = proc.find_output_stream("gas").gas_flow_rates().sum() expected = ureg.Quantity(3825.799, "tonne/day") assert approx_equal(total, expected, rel=10e-3) - total = proc.find_output_stream("gas").gas_flow_rates().sum() + total = proc.find_output_stream("exported gas").gas_flow_rates().sum() expected = ureg.Quantity(22185.893, "tonne/day") assert approx_equal(total, expected, rel=10e-3) @@ -419,12 +419,12 @@ def test_CO2Flooding_sour_gas_reinjection(test_model_with_change): proc = field.find_process('GasPartition') # ensure total energy flow rates - s = proc.find_output_stream("gas for gas reinjection compressor") + s = proc.find_output_stream("gas") total = s.gas_flow_rates().sum() expected = ureg.Quantity(9976.19977, "tonne/day") assert approx_equal(total, expected, rel=10e-3) - total = proc.find_output_stream("gas").gas_flow_rates().sum() + total = proc.find_output_stream("exported gas").gas_flow_rates().sum() expected = ureg.Quantity(24885.5551, "tonne/day") assert approx_equal(total, expected, rel=10e-4) @@ -435,11 +435,11 @@ def test_NGFlooding_offset(test_model): field.run(analysis) proc = field.find_process('GasPartition') # ensure total energy flow rates - total = proc.find_output_stream("gas for gas reinjection compressor").gas_flow_rates().sum() + total = proc.find_output_stream("gas").gas_flow_rates().sum() expected = ureg.Quantity(428933.382, "tonne/day") assert approx_equal(total, expected, rel=10e-3) - total = proc.find_output_stream("gas").gas_flow_rates().sum() + total = proc.find_output_stream("exported gas").gas_flow_rates().sum() expected = 0.0 assert total == expected @@ -454,7 +454,7 @@ def test_GasLifting_low_GLIR(test_model): expected = ureg.Quantity(176.061318, "tonne/day") assert approx_equal(total, expected, rel=10e-3) - total = proc.find_output_stream("gas").gas_flow_rates().sum() + total = proc.find_output_stream("exported gas").gas_flow_rates().sum() expected = ureg.Quantity(1486.42622, "tonne/day") assert approx_equal(total, expected, rel=10e-3) @@ -469,7 +469,7 @@ def test_GasLifting_high_GLIR(test_model): expected = ureg.Quantity(1662.48754, "tonne/day") assert approx_equal(total, expected) - total = proc.find_output_stream("gas").gas_flow_rates().sum() + total = proc.find_output_stream("exported gas").gas_flow_rates().sum() expected = 0.0 assert total == expected @@ -481,7 +481,7 @@ def test_ReservoirWellInterface(test_model): field.run(analysis) proc = field.find_process('ReservoirWellInterface') # ensure output stream pressure - pressure = proc.find_output_stream("crude oil").tp.P + pressure = proc.find_output_stream("oil").tp.P expected = ureg.Quantity(1324.23673, "mmbtu/day") assert approx_equal(pressure, expected, rel=10e-3) @@ -493,7 +493,7 @@ def test_ReservoirWellInterface_CO2_flood(test_model): field.run(analysis) proc = field.find_process('ReservoirWellInterface') # ensure output stream pressure - pressure = proc.find_output_stream("crude oil").tp.P + pressure = proc.find_output_stream("oil").tp.P expected = ureg.Quantity(1520.21852, "mmbtu/day") assert approx_equal(pressure, expected, rel=10e-4) From 626af9bbd6e5d3712bf1620de0c59402ba388bec Mon Sep 17 00:00:00 2001 From: Richard Plevin Date: Tue, 5 Nov 2024 12:44:48 -0800 Subject: [PATCH 2/6] Checkpoint while renaming stream contents --- opgee/etc/opgee.xml | 8 ++++---- opgee/processes/CO2_injection_well.py | 8 ++++---- opgee/processes/CO2_reinjection_compressor.py | 6 +++--- opgee/processes/gas_reinjection_compressor.py | 5 ++--- opgee/processes/gas_reinjection_well.py | 8 ++++---- opgee/processes/steam_generation.py | 4 ++-- tests/files/test_model.xml | 12 ++++++------ tests/files/test_process_groups.xml | 11 +++++++---- 8 files changed, 32 insertions(+), 30 deletions(-) diff --git a/opgee/etc/opgee.xml b/opgee/etc/opgee.xml index 816d3e47..24e2fd79 100644 --- a/opgee/etc/opgee.xml +++ b/opgee/etc/opgee.xml @@ -530,7 +530,7 @@ - recycled water + water @@ -622,7 +622,7 @@ - gas for CO2 injection well + gas @@ -670,11 +670,11 @@ - gas for gas reinjection well + gas - gas for reservoir + gas diff --git a/opgee/processes/CO2_injection_well.py b/opgee/processes/CO2_injection_well.py index 5a95d3d8..48ee30f1 100644 --- a/opgee/processes/CO2_injection_well.py +++ b/opgee/processes/CO2_injection_well.py @@ -18,17 +18,17 @@ class CO2InjectionWell(Process): This process models a injection well used for injecting CO2 into the reservoir. input streams: - - gas for CO2 injection well: gas stream with CO2 for injection + - gas: gas stream with CO2 for injection output streams: - - gas for reservoir: gas stream with CO2 injected into reservoir + - gas for gas partition: gas stream with CO2 injected into reservoir """ def __init__(self, name, **kwargs): super().__init__(name, **kwargs) # TODO: avoid process names in contents. self._required_inputs = [ - "gas for CO2 injection well", + "gas", ] self._required_outputs = [ @@ -40,7 +40,7 @@ def run(self, analysis): field = self.field # Get input stream and check if it's initialized - input = self.find_input_stream("gas for CO2 injection well") + input = self.find_input_stream("gas") if input.is_uninitialized(): return diff --git a/opgee/processes/CO2_reinjection_compressor.py b/opgee/processes/CO2_reinjection_compressor.py index 568b024f..050f18e3 100644 --- a/opgee/processes/CO2_reinjection_compressor.py +++ b/opgee/processes/CO2_reinjection_compressor.py @@ -24,7 +24,7 @@ class CO2ReinjectionCompressor(Process): - gas for CO2 compressor: The inlet stream of CO2 gas to the compressor. Outputs: - - gas for CO2 injection well: The outlet stream of CO2 gas that is reinjected into the reservoir. + - gas: The outlet stream of CO2 gas that is reinjected into the reservoir. Attributes: - res_press: The reservoir pressure in psia. @@ -41,7 +41,7 @@ def __init__(self, name, **kwargs): ] self._required_outputs = [ - "gas for CO2 injection well", + "gas", ] self.res_press = None @@ -86,7 +86,7 @@ def run(self, analysis): total_energy_consumption += energy_consumption # Set output stream and iteration value - gas_to_well = self.find_output_stream("gas for CO2 injection well") + gas_to_well = self.find_output_stream("gas") gas_to_well.copy_flow_rates_from(input) gas_to_well.subtract_rates_from(gas_fugitives) gas_to_well.tp.set(T=out_temp, P=discharge_press) diff --git a/opgee/processes/gas_reinjection_compressor.py b/opgee/processes/gas_reinjection_compressor.py index d066aff2..bb3dec04 100644 --- a/opgee/processes/gas_reinjection_compressor.py +++ b/opgee/processes/gas_reinjection_compressor.py @@ -21,13 +21,12 @@ class GasReinjectionCompressor(Process): def __init__(self, name, **kwargs): super().__init__(name, **kwargs) - # TODO: avoid process names in contents. self._required_inputs = [ "gas" ] self._required_outputs = [ - "gas for gas reinjection well" + "gas" ] self.air_separation_energy_intensity = None @@ -67,7 +66,7 @@ def run(self, analysis): loss_rate = self.get_compressor_and_well_loss_rate(input) gas_fugitives = self.set_gas_fugitives(input, loss_rate) - gas_to_well = self.find_output_stream("gas for gas reinjection well") + gas_to_well = self.find_output_stream("gas") gas_to_well.copy_flow_rates_from(input) gas_to_well.subtract_rates_from(gas_fugitives) diff --git a/opgee/processes/gas_reinjection_well.py b/opgee/processes/gas_reinjection_well.py index 36f0926c..2fc4322f 100644 --- a/opgee/processes/gas_reinjection_well.py +++ b/opgee/processes/gas_reinjection_well.py @@ -19,11 +19,11 @@ def __init__(self, name, **kwargs): # TODO: avoid process names in contents. self._required_inputs = [ - "gas for gas reinjection well" + "gas" ] self._required_outputs = [ - "gas for reservoir", + "gas", ] self.gas_flooding = None @@ -44,7 +44,7 @@ def run(self, analysis): self.print_running_msg() # mass rate - input = self.find_input_stream("gas for gas reinjection well") + input = self.find_input_stream("gas") if input.is_uninitialized(): return @@ -52,7 +52,7 @@ def run(self, analysis): loss_rate = self.get_compressor_and_well_loss_rate(input) gas_fugitives = self.set_gas_fugitives(input, loss_rate) - gas_to_reservoir = self.find_output_stream("gas for reservoir") + gas_to_reservoir = self.find_output_stream("gas") gas_to_reservoir.copy_flow_rates_from(input) gas_to_reservoir.subtract_rates_from(gas_fugitives) diff --git a/opgee/processes/steam_generation.py b/opgee/processes/steam_generation.py index ac44a036..2c8b140c 100644 --- a/opgee/processes/steam_generation.py +++ b/opgee/processes/steam_generation.py @@ -38,7 +38,7 @@ def __init__(self, *args, **kwargs): ] self._required_outputs = [ - "recycled water", + "water", ] else: self._required_inputs = [] @@ -145,7 +145,7 @@ def run(self, analysis): recycled_blowdown_water = blowdown_water_mass_rate * self.fraction_blowdown_recycled - recycled_water_stream = self.find_output_stream("recycled water") + recycled_water_stream = self.find_output_stream("water") recycled_water_stream.set_liquid_flow_rate("H2O", recycled_blowdown_water.to("tonne/day"), tp=self.waste_water_reinjection_tp) diff --git a/tests/files/test_model.xml b/tests/files/test_model.xml index a02a1313..4b0aeeb3 100644 --- a/tests/files/test_model.xml +++ b/tests/files/test_model.xml @@ -781,7 +781,7 @@ - gas for CO2 injection well + gas @@ -795,7 +795,7 @@ - gas for CO2 injection well + gas 530.281476 7577.609834 372.658027 @@ -890,7 +890,7 @@ - gas for gas reinjection well + gas @@ -1355,7 +1355,7 @@ - recycled water + water @@ -1388,7 +1388,7 @@ - recycled water + water @@ -1420,7 +1420,7 @@ - recycled water + water diff --git a/tests/files/test_process_groups.xml b/tests/files/test_process_groups.xml index 9885074d..a5d225c3 100644 --- a/tests/files/test_process_groups.xml +++ b/tests/files/test_process_groups.xml @@ -484,11 +484,11 @@ - gas for CO2 injection well + gas - gas for reservoir + gas @@ -499,9 +499,12 @@ gas + + gas for gas partition @@ -532,11 +535,11 @@ - gas for gas reinjection well + gas - gas for reservoir + gas From cee2cf1eae6cc437bf4128422658188a9919026c Mon Sep 17 00:00:00 2001 From: Richard Plevin Date: Tue, 5 Nov 2024 13:04:00 -0800 Subject: [PATCH 3/6] Checkpoint while renaming stream contents --- opgee/etc/opgee.xml | 10 +++++----- opgee/processes/LNG_liquefaction.py | 5 ++--- opgee/processes/LNG_transport.py | 5 ++--- opgee/processes/post_storage_compressor.py | 6 +++--- opgee/processes/storage_compressor.py | 4 ++-- opgee/processes/storage_separator.py | 9 ++++----- opgee/processes/storage_well.py | 9 ++++----- opgee/processes/transmission_compressor.py | 4 ++-- tests/files/test_boundary.xml | 10 +++++----- tests/files/test_boundary_procs.xml | 2 +- tests/files/test_process_groups.xml | 10 +++++----- 11 files changed, 35 insertions(+), 39 deletions(-) diff --git a/opgee/etc/opgee.xml b/opgee/etc/opgee.xml index 24e2fd79..f579ef61 100644 --- a/opgee/etc/opgee.xml +++ b/opgee/etc/opgee.xml @@ -678,7 +678,7 @@ - gas for transmission + gas @@ -714,15 +714,15 @@ - gas for well + gas - gas for separator + gas - gas for storage + gas @@ -730,7 +730,7 @@ - gas for transport + gas diff --git a/opgee/processes/LNG_liquefaction.py b/opgee/processes/LNG_liquefaction.py index bc5c19c6..b8e194c2 100644 --- a/opgee/processes/LNG_liquefaction.py +++ b/opgee/processes/LNG_liquefaction.py @@ -23,9 +23,8 @@ def __init__(self, name, **kwargs): "LNG", ] - # TODO: avoid process names in contents. self._required_outputs = [ - "gas for transport", + "gas", # "gas fugitives" # TODO: future feature ] @@ -52,7 +51,7 @@ def run(self, analysis): # TODO: delete unused code here and below # total_load = (self.compression_refrigeration_load + self.ancillary_loads) * self.NG_to_liq_rate - gas_to_transport = self.find_output_stream("gas for transport") + gas_to_transport = self.find_output_stream("gas") gas_to_transport.copy_flow_rates_from(input) gas_to_transport.tp.set(T=self.field.LNG_temp) diff --git a/opgee/processes/LNG_transport.py b/opgee/processes/LNG_transport.py index ff2100ee..a44f188c 100644 --- a/opgee/processes/LNG_transport.py +++ b/opgee/processes/LNG_transport.py @@ -22,9 +22,8 @@ class LNGTransport(Process): def __init__(self, name, **kwargs): super().__init__(name, **kwargs) - # TODO: avoid process names in contents. self._required_inputs = [ - "gas for transport", + "gas", ] self._required_outputs = [ @@ -39,7 +38,7 @@ def run(self, analysis): self.print_running_msg() field = self.field - input = self.find_input_stream("gas for transport") + input = self.find_input_stream("gas") if input.is_uninitialized(): return diff --git a/opgee/processes/post_storage_compressor.py b/opgee/processes/post_storage_compressor.py index b87062b5..e7b9d3c4 100644 --- a/opgee/processes/post_storage_compressor.py +++ b/opgee/processes/post_storage_compressor.py @@ -21,11 +21,11 @@ class PostStorageCompressor(Process): def __init__(self, name, **kwargs): super().__init__(name, **kwargs) - # TODO: avoid process names in contents. self._required_inputs = [ - "gas for storage", + "gas", ] + # TODO: avoid process names in contents. self._required_outputs = [ "gas for distribution", ] @@ -45,7 +45,7 @@ def cache_attributes(self): def run(self, analysis): self.print_running_msg() - input = self.find_input_stream("gas for storage") + input = self.find_input_stream("gas") if input.is_uninitialized(): return diff --git a/opgee/processes/storage_compressor.py b/opgee/processes/storage_compressor.py index 3f629b19..8df4b4c7 100644 --- a/opgee/processes/storage_compressor.py +++ b/opgee/processes/storage_compressor.py @@ -29,7 +29,7 @@ def __init__(self, name, **kwargs): ] self._required_outputs = [ - "gas for well", + "gas", ] self.discharge_press = None @@ -71,7 +71,7 @@ def run(self, analysis): # import/export self.set_import_from_energy(energy_use) - gas_to_well = self.find_output_stream("gas for well") + gas_to_well = self.find_output_stream("gas") gas_to_well.copy_flow_rates_from(input, phase=PHASE_GAS) gas_to_well.tp.set(T=output_temp, P=self.discharge_press) gas_to_well.subtract_rates_from(gas_fugitives) diff --git a/opgee/processes/storage_separator.py b/opgee/processes/storage_separator.py index f0aca0f2..316c463b 100644 --- a/opgee/processes/storage_separator.py +++ b/opgee/processes/storage_separator.py @@ -21,13 +21,12 @@ class StorageSeparator(Process): def __init__(self, name, **kwargs): super().__init__(name, **kwargs) - # TODO: avoid process names in contents. self._required_inputs = [ - "gas for separator", + "gas", ] self._required_outputs = [ - "gas for storage", + "gas", ] self.water_production_frac = None @@ -41,7 +40,7 @@ def cache_attributes(self): def run(self, analysis): self.print_running_msg() - input = self.find_input_stream("gas for separator") + input = self.find_input_stream("gas") if input.is_uninitialized(): return @@ -50,7 +49,7 @@ def run(self, analysis): prod_water = Stream("produced water stream", self.outlet_tp) prod_water.set_liquid_flow_rate("H2O", (input.total_gas_rate() * self.water_production_frac).m) - gas_to_compressor = self.find_output_stream("gas for storage") + gas_to_compressor = self.find_output_stream("gas") gas_to_compressor.copy_gas_rates_from(input, tp=self.outlet_tp) #TODO: Future versions of OPGEE may treat this process in more detail. diff --git a/opgee/processes/storage_well.py b/opgee/processes/storage_well.py index a4081577..033b156e 100644 --- a/opgee/processes/storage_well.py +++ b/opgee/processes/storage_well.py @@ -21,13 +21,12 @@ class StorageWell(Process): def __init__(self, name, **kwargs): super().__init__(name, **kwargs) - # TODO: avoid process names in contents. self._required_inputs = [ - "gas for well", + "gas", ] self._required_outputs = [ - "gas for separator", + "gas", ] self.cache_attributes() @@ -38,14 +37,14 @@ def cache_attributes(self): def run(self, analysis): self.print_running_msg() - input = self.find_input_stream("gas for well") + input = self.find_input_stream("gas") if input.is_uninitialized(): return gas_fugitives = self.set_gas_fugitives(input, self.loss_rate) - gas_to_separator = self.find_output_stream("gas for separator") + gas_to_separator = self.find_output_stream("gas") gas_to_separator.copy_gas_rates_from(input) gas_to_separator.subtract_rates_from(gas_fugitives) diff --git a/opgee/processes/transmission_compressor.py b/opgee/processes/transmission_compressor.py index 035244ab..a013b655 100644 --- a/opgee/processes/transmission_compressor.py +++ b/opgee/processes/transmission_compressor.py @@ -26,7 +26,7 @@ def __init__(self, *args, **kwargs): # TODO: avoid process names in contents. self._required_inputs = [ - "gas for transmission", + "gas", ] self._required_outputs = [ @@ -63,7 +63,7 @@ def cache_attributes(self): def run(self, analysis): self.print_running_msg() - input = self.find_input_stream("gas for transmission") + input = self.find_input_stream("gas") if input.is_uninitialized(): return diff --git a/tests/files/test_boundary.xml b/tests/files/test_boundary.xml index f98d7e42..f1b66678 100644 --- a/tests/files/test_boundary.xml +++ b/tests/files/test_boundary.xml @@ -35,7 +35,7 @@ 1.4 90.0 500.0 - gas for transmission + gas @@ -51,17 +51,17 @@ - gas for well + gas - gas for separator + gas - gas for storage + gas @@ -70,7 +70,7 @@ - gas for transport + gas diff --git a/tests/files/test_boundary_procs.xml b/tests/files/test_boundary_procs.xml index 5d3abd74..639fa961 100644 --- a/tests/files/test_boundary_procs.xml +++ b/tests/files/test_boundary_procs.xml @@ -27,7 +27,7 @@ - gas for transmission + gas diff --git a/tests/files/test_process_groups.xml b/tests/files/test_process_groups.xml index a5d225c3..6d08c08d 100644 --- a/tests/files/test_process_groups.xml +++ b/tests/files/test_process_groups.xml @@ -543,7 +543,7 @@ - gas for transmission + gas @@ -575,15 +575,15 @@ - gas for well + gas - gas for separator + gas - gas for storage + gas @@ -591,7 +591,7 @@ - gas for transport + gas From 2cf79c8c6ab5ab9d1ba8a6ee8078e373ee68f12a Mon Sep 17 00:00:00 2001 From: Richard Plevin Date: Wed, 13 Nov 2024 12:23:24 -0800 Subject: [PATCH 4/6] Updated .readthedocs.yml to use opgee.yml --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index b70d2d8a..212ed486 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -19,5 +19,5 @@ build: python: "mambaforge-4.10" conda: - environment: py3-opgee-travis.yml + environment: opgee.yml From b532c4fd3c0ebb3b1e765e3c2e1634153f1c0af8 Mon Sep 17 00:00:00 2001 From: Richard Plevin Date: Wed, 13 Nov 2024 12:31:30 -0800 Subject: [PATCH 5/6] Debugging readthedocs --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 212ed486..5ba93eec 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -19,5 +19,5 @@ build: python: "mambaforge-4.10" conda: - environment: opgee.yml + environment: py3-opgee.yml From f425cca4dc30f5282d83fcee8948fdac2f9f904c Mon Sep 17 00:00:00 2001 From: Richard Plevin Date: Wed, 13 Nov 2024 12:52:12 -0800 Subject: [PATCH 6/6] - Updated sphinx doc conf.py - Fixed format error in function doc string --- docs/source/conf.py | 4 ++-- opgee/analysis.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 4dae5b9e..8b788e16 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ # -- Project information ----------------------------------------------------- project = 'OPGEE' -copyright = '2022-2023, The Board of Trustees of the Leland Stanford Junior University' +copyright = '2022-2024, The Board of Trustees of the Leland Stanford Junior University' author = 'Adam Brandt, Richard Plevin, Wennan Long' # The short X.Y version. @@ -79,4 +79,4 @@ # -- Options for intersphinx extension --------------------------------------- # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'https://docs.python.org/3/': None} +intersphinx_mapping = {'python' : ('https://docs.python.org/3/', None)} diff --git a/opgee/analysis.py b/opgee/analysis.py index 0740821a..71e611fd 100644 --- a/opgee/analysis.py +++ b/opgee/analysis.py @@ -221,7 +221,7 @@ def from_xml(cls, elt, parent=None, field_names=None): :param elt: (etree.Element) representing a element :param parent: (opgee.Model) the Model containing the new Analysis - :param field_names: (list[str] or None) field names to restrict to, + :param field_names: (list[str] or None) field names to restrict to, otherwise all fields declared in the Analysis are used. :return: (Analysis) instance populated from XML """