Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Econo cash flow #15

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/geophires_monte_carlo/MC_GeoPHIRES3.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ def work_package(pass_list: list):
HipRaInputParameters(from_file_path=Path(tmp_input_file))
)
shutil.copyfile(result.output_file_path, tmp_output_file)
elif args.Code_File.endswith('HIP_RA_x.py'):
# FIXME verify client manipulation of sys.argv is threadsafe
hip_ra_x_client: HipRaXClient = HipRaXClient()
result: HipRaResult = hip_ra_x_client.get_hip_ra_result(
HipRaInputParameters(from_file_path=Path(tmp_input_file))
)
shutil.copyfile(result.output_file_path, tmp_output_file)
else:
log.warning(
f'Code file from args ({args.Code_File}) is not a known program, '
Expand Down Expand Up @@ -194,7 +201,10 @@ def get_output(output):
result_s += '\n'

with open(output_file, 'a') as f:
f.write('\n') # This creates extra lines in the output file, but is needed to make concurrency work (?!?!?!).
f.write(result_s)
f.write('\n') # This creates extra lines in the output file, but is needed to make concurrency work (?!?!?!).
# the extra lines in the file are cleaned up later.


def main(command_line_args=None):
Expand Down Expand Up @@ -311,7 +321,7 @@ def main(command_line_args=None):

args = []
for _ in range(iterations):
args.append(pass_list) # we need to make Iterations number of copies of this list fr the map
args.append(pass_list) # we need to make Iterations number of copies of this list for the map
args = tuple(args) # convert to a tuple

# Now run the executor with the map - that will run it Iterations number of times
Expand All @@ -335,6 +345,7 @@ def main(command_line_args=None):
if len(line) > 3:
# FIXME TODO doesn't work for HIP RA results
line, sep, tail = line.partition(', (') # strip off the Input Variable Values
line = line.replace('(', '').replace(')', '') # strip off the ()
results.append([float(y) for y in line.split(',')])
else:
logger.warning(f'-9999.0 or space found in line {result_count!s}')
Expand Down Expand Up @@ -401,6 +412,8 @@ def main(command_line_args=None):

annotations = ''

# TODO remove extraneous blank lines from output file

with open(Path(output_file).with_suffix('.json'), 'w') as json_output_file:
json_output_file.write(json.dumps(outputs_result))
logger.info(f'Wrote JSON results to {json_output_file.name}')
Expand Down
2 changes: 2 additions & 0 deletions src/geophires_x/AGSOutputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def PrintOutputs(self, model: Model):
if not model.economics.econmodel.value == EconomicModel.CLGS:
super().PrintOutputs(model)
else:
if len(sys.argv) > 2:
self.output_file = sys.argv[2]
with open(self.output_file, 'w', encoding='UTF-8') as f:
f.write(' *****************\n')
f.write(' ***CASE REPORT***\n')
Expand Down
2 changes: 1 addition & 1 deletion src/geophires_x/AGSWellBores.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ def Calculate(self, model: Model) -> None:
DowngoingPumpingPower, ppp2, dppw, ppwh = ProdPressureDropAndPumpingPowerUsingIndexes(
model, self.productionwellpumping.value,
self.usebuiltinppwellheadcorrelation,
model.reserv.Trock.value, model.reserv.depth.value,
model.reserv.Trock.value, model.reserv.InputDepth.value,
self.ppwellhead.value, self.PI.value,
self.prodwellflowrate.value, f3, vprod,
self.injwelldiam.value, self.nprod.value, model.surfaceplant.pump_efficiency.value,
Expand Down
67 changes: 67 additions & 0 deletions src/geophires_x/Border_EGS_150C_Electricity_Input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Reservoir Model,1, ---Multiple, Fractures, reservoir, model
Reservoir Depth,3.7, ---[km]
Number of Segments,3, ---[-]
Gradient 1,42.69972, ---[deg.C/km]
Gradient 2,51.66667, ---[deg.C/km]
Thickness 1,0.793, ---[km]
Gradient 3,46.9697, ---[deg.C/km]
Thickness 2,1.646, ---[km]
Maximum Temperature,400, ---[deg.C]
Number of Production Wells,2, ---[-]
Number of Injection Wells,2, ---[-]
Production Well Diameter,7, ---[inch]
Injection Well Diameter,7, ---[inch]
Ramey Production Wellbore Model,1, ---
Production Wellbore Temperature Drop,.5, ---[deg.C]
Injection Wellbore Temperature Gain,0, ---[deg.C]
Production Flow Rate per Well,90, ---[kg/s]
Fracture Shape,3, ---[-]
Fracture Height,900, ---[m]
Reservoir Volume Option,3, ---[-]
Reservoir Volume,1000000000000, ---[m^3]
Number of Fractures,20, ---[-]
Water Loss Fraction,.02, ---[-]
Productivity Index,5, ---[kg/s/bar]
Injectivity Index,5, ---[kg/s/bar]
Injection Temperature,40, ---[deg.C]
Maximum Drawdown,0.3, ---[-] no redrilling considered
Reservoir Heat Capacity,975, ---[J/kg/K]
Reservoir Density,2600, ---[kg/m^3]
Reservoir Thermal Conductivity,3, ---[W/m/K]

***SURFACE TECHNICAL PARAMETERS***
**********************************
End-Use Option,1, ---[-] Electricity
Economic Model,1, ---[-] Fixed Charge Rate Model
Power Plant Type,2, ---[-] Supercritcal ORC
Circulation Pump Efficiency,.8, ---[-] between .1 and 1
Utilization Factor,.9, ---[-] between .1 and 1
Surface Temperature,20, ---[deg.C]
Ambient Temperature,20, ---[deg.C]

***FINANCIAL PARAMETERS***
**************************
Plant Lifetime,30, ---[years]
Fixed Charge Rate,.05, ---[-] between 0 and 1

Inflation Rate During Construction,0, ---[-]

Starting Electricity Sale Price, 0.10

Ending Electricity Sale Price, 0.15

Electricity Escalation Start Year, 5

Electricity Escalation Rate Per Year, 0.01

***Simulation Parameters***
***************************

Print Output to Console,1, ---[-] Should be 0 (don't print results) or 1 (print results)
Time steps per year,6, ---[1/year]

***Output unit conversions you wish to make***
***************************
Units:Bottom-hole temperature, degF, ---[This is what I want the units to be for this output parameter
Units:Exploration cost,MEUR, ---[This is what I want the units to be for this output parameter
Units:O&M Make-up Water costs, MEUR/yr
6 changes: 3 additions & 3 deletions src/geophires_x/CylindricalReservoir.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
from pint.facets.plain import PlainQuantity

from geophires_x.GeoPHIRESUtils import density_water_kg_per_m3, lithostatic_pressure_MPa, quantity
from geophires_x.GeoPHIRESUtils import density_water_kg_per_m3, static_pressure_MPa, quantity

from geophires_x.GeoPHIRESUtils import heat_capacity_water_J_per_kg_per_K
import geophires_x.Model as Model
Expand Down Expand Up @@ -266,5 +266,5 @@ def lithostatic_pressure(self) -> PlainQuantity:

Standard reservoir implementation uses depth but CylindricalReservoir sets depth to total drilled length
"""
return quantity(lithostatic_pressure_MPa(self.rhorock.quantity().to('kg/m**3').magnitude,
self.InputDepth.quantity().to('m').magnitude), 'MPa')
return quantity(static_pressure_MPa(self.rhorock.quantity().to('kg/m**3').magnitude,
self.InputDepth.quantity().to('m').magnitude), 'MPa')
Loading
Loading