Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarlow12 committed Nov 13, 2024
2 parents 6788ac2 + f425cca commit 322267c
Show file tree
Hide file tree
Showing 43 changed files with 261 additions and 259 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ build:
python: "mambaforge-4.10"

conda:
environment: py3-opgee-travis.yml
environment: py3-opgee.yml

4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)}
2 changes: 1 addition & 1 deletion docs/source/guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
2 changes: 1 addition & 1 deletion opgee/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def from_xml(cls, elt, parent=None, field_names=None):
:param elt: (etree.Element) representing a <Analysis> 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
"""
Expand Down
50 changes: 25 additions & 25 deletions opgee/etc/opgee.xml
Original file line number Diff line number Diff line change
Expand Up @@ -383,21 +383,21 @@
</Stream>

<Stream src="Reservoir" dst="ReservoirWellInterface">
<Contains>crude oil</Contains>
<Contains>oil</Contains>
</Stream>

<Stream src="ReservoirWellInterface" dst="DownholePump">
<Contains>crude oil</Contains>
<Contains>oil</Contains>
</Stream>

<Stream src="DownholePump" dst="Separation">
<Contains>crude oil</Contains>
<Contains>oil</Contains>
</Stream>


<!-- After separation-->
<Stream src="Separation" dst="CrudeOilDewatering">
<Contains>crude oil</Contains>
<Contains>oil</Contains>
</Stream>

<Stream src="Separation" dst="WaterTreatment">
Expand Down Expand Up @@ -438,7 +438,7 @@
</Stream>

<Stream src="CrudeOilStabilization" dst="GasGathering">
<Contains>gas for gas gathering</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="HeavyOilDilution" dst="CrudeOilStorage">
Expand Down Expand Up @@ -513,24 +513,24 @@

<!-- water processing path-->
<Stream src="WaterTreatment" dst="ProductionBoundary">
<Contains>water for surface disposal</Contains>
<Contains>water</Contains>
<Contains>water for subsurface disposal</Contains>
</Stream>

<Stream src="WaterTreatment" dst="SteamGeneration" name="produced water treatment">
<Contains>produced water for steam generation</Contains>
<Contains>produced water</Contains>
</Stream>

<Stream src="WaterTreatment" dst="SteamGeneration" name="makeup water treatment">
<Contains>makeup water for steam generation</Contains>
<Contains>makeup water</Contains>
</Stream>

<Stream src="WaterTreatment" dst="WaterInjection">
<Contains>water for water injection</Contains>
<Contains>water</Contains>
</Stream>

<Stream src="SteamGeneration" dst="WaterTreatment">
<Contains>recycled water</Contains>
<Contains>water</Contains>
</Stream>


Expand All @@ -550,11 +550,11 @@
</Stream>

<Stream src="Venting" dst="GasGathering">
<Contains>gas for gas gathering</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="VRUCompressor" dst="GasGathering">
<Contains>gas for gas gathering</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="GasGathering" dst="GasDehydration">
Expand All @@ -578,11 +578,11 @@
</Stream>

<Stream src="PreMembraneChiller" dst="PreMembraneCompressor">
<Contains>gas for compressor</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="PreMembraneCompressor" dst="CO2Membrane">
<Contains>gas for CO2 membrane</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="CO2Membrane" dst="AcidGasRemoval">
Expand Down Expand Up @@ -622,7 +622,7 @@
</Stream>

<Stream src="CO2ReinjectionCompressor" dst="CO2InjectionWell">
<Contains>gas for CO2 injection well</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="CO2InjectionWell" dst="GasPartition">
Expand All @@ -634,7 +634,7 @@
</Stream>

<Stream src="SourGasCompressor" dst="SourGasInjection">
<Contains>gas for sour gas injection</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="SourGasInjection" dst="GasPartition">
Expand Down Expand Up @@ -666,23 +666,23 @@
</Stream>

<Stream src="GasPartition" dst="GasReinjectionCompressor">
<Contains>gas for gas reinjection compressor</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="GasReinjectionCompressor" dst="GasReinjectionWell">
<Contains>gas for gas reinjection well</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="GasReinjectionWell" dst="Reservoir" impute="false">
<Contains>gas for reservoir</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="ProductionBoundary" dst="TransmissionCompressor">
<Contains>gas for transmission</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="GasPartition" dst="ProductionBoundary">
<Contains>gas</Contains>
<Contains>exported gas</Contains>
</Stream>

<Stream src="NGL" dst="ProductionBoundary">
Expand Down Expand Up @@ -714,23 +714,23 @@
</Stream>

<Stream src="StorageCompressor" dst="StorageWell">
<Contains>gas for well</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="StorageWell" dst="StorageSeparator">
<Contains>gas for separator</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="StorageSeparator" dst="PostStorageCompressor">
<Contains>gas for storage</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="PostStorageCompressor" dst="GasDistribution">
<Contains>gas for distribution</Contains>
</Stream>

<Stream src="LNGLiquefaction" dst="LNGTransport">
<Contains>gas for transport</Contains>
<Contains>gas</Contains>
</Stream>

<Stream src="LNGTransport" dst="LNGRegasification">
Expand Down
6 changes: 3 additions & 3 deletions opgee/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions opgee/processes/CO2_injection_well.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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

Expand Down
7 changes: 4 additions & 3 deletions opgee/processes/CO2_membrane.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions opgee/processes/CO2_reinjection_compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -41,7 +41,7 @@ def __init__(self, name, **kwargs):
]

self._required_outputs = [
"gas for CO2 injection well",
"gas",
]

self.res_press = None
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions opgee/processes/LNG_liquefaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]

Expand All @@ -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)

Expand Down
5 changes: 2 additions & 3 deletions opgee/processes/LNG_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions opgee/processes/VRU_compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, name, **kwargs):
]

self._required_outputs = [
"gas for gas gathering"
"gas"
]

self.discharge_press = None
Expand All @@ -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 = \
Expand Down
Loading

0 comments on commit 322267c

Please sign in to comment.