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

Output SUTRA pump efficiency as percentage (issue 95) #275

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 0 additions & 3 deletions src/geophires_x/Economics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1810,9 +1810,6 @@ def read_parameters(self, model: Model) -> None:
key = ParameterToModify.Name.strip()
if key in model.InputParameters:
ParameterReadIn = model.InputParameters[key]
# Before we change the parameter, let's assume that the unit preferences will match
# - if they don't, the later code will fix this.
ParameterToModify.CurrentUnits = ParameterToModify.PreferredUnits
# this should handle all the non-special cases
ReadParameter(ParameterReadIn, ParameterToModify, model)

Expand Down
2 changes: 1 addition & 1 deletion src/geophires_x/Outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1653,7 +1653,7 @@ def PrintOutputs(self, model: Model):
f.write(f' Number of Injection Wells: {model.wellbores.ninj.value:10.0f}' + NL)
f.write(f' Well depth (or total length, if not vertical): {model.reserv.depth.value:10.1f} ' + model.reserv.depth.CurrentUnits.value + NL)
f.write(f' Water loss rate: {model.reserv.waterloss.value*100:10.1f} ' + model.reserv.waterloss.CurrentUnits.value + NL)
f.write(f' Pump efficiency: {model.surfaceplant.pump_efficiency.value * 100:10.1f} ' + model.surfaceplant.pump_efficiency.CurrentUnits.value + NL)
f.write(f' Pump efficiency: {model.surfaceplant.pump_efficiency.value:10.1f} ' + model.surfaceplant.pump_efficiency.CurrentUnits.value + NL)
f.write(f' Injection temperature: {model.wellbores.Tinj.value:10.1f} ' + model.wellbores.Tinj.CurrentUnits.value + NL)
if model.wellbores.rameyoptionprod.value:
f.write(' Production Wellbore heat transmission calculated with Ramey\'s model\n')
Expand Down
5 changes: 3 additions & 2 deletions src/geophires_x/Parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,9 @@ def ReadParameter(ParameterReadIn: ParameterEntry, ParamToModify, model):
if len(new_str) > 0:
ParameterReadIn.sValue = new_str
else:
# The value came in without any units, so it must be using the default PreferredUnits
ParamToModify.CurrentUnits = ParamToModify.PreferredUnits
# TODO: determine proper action in this case (previously assumed value
# must be using default PreferredUnits, but this led to problems)
model.logger.info('value came in without any units')

def default_parameter_value_message(new_val: Any, param_to_modify_name: str, default_value: Any) -> str:
return (
Expand Down
25 changes: 14 additions & 11 deletions src/geophires_x/SUTRAOutputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import geophires_x
import numpy as np
import geophires_x.Model as Model
from .Parameter import LookupUnits
from .Parameter import ConvertUnitsBack, ConvertOutputUnits, LookupUnits
from .OptionList import EconomicModel

NL="\n"
Expand Down Expand Up @@ -89,22 +89,25 @@ def PrintOutputs(self, model: Model):
# to the units that the user entered the data in
# We do this because the value may be displayed in the output, and we want the user to recognize their value,
# not some converted value
# for obj in [model.reserv, model.wellbores, model.surfaceplant, model.economics]:
# for key in obj.ParameterDict:
# param = obj.ParameterDict[key]
# if not param.UnitsMatch: ConvertUnitsBack(param, model)
for obj in [model.reserv, model.wellbores, model.surfaceplant, model.economics]:
for key in obj.ParameterDict:
param = obj.ParameterDict[key]
if not param.UnitsMatch: ConvertUnitsBack(param, model)

# now we need to loop through all thw output parameters to update their units to
# whatever units the user has specified.
# i.e., they may have specified that all LENGTH results must be in feet, so we need to convert those
# from whatever LENGTH unit they are to feet.
# same for all the other classes of units (TEMPERATURE, DENSITY, etc).

#for obj in [model.reserv, model.wellbores, model.surfaceplant, model.economics]:
# for key in obj.OutputParameterDict:
# if key in self.ParameterDict:
# if self.ParameterDict[key] != obj.OutputParameterDict[key].CurrentUnits:
# ConvertOutputUnits(obj.OutputParameterDict[key], self.ParameterDict[key], model)
for obj in [model.reserv, model.wellbores, model.surfaceplant, model.economics]:
for key in obj.OutputParameterDict:
output_param:OutputParameter = obj.OutputParameterDict[key]
if key in self.ParameterDict:
if self.ParameterDict[key] != output_param.CurrentUnits:
ConvertOutputUnits(output_param, self.ParameterDict[key], model)
elif not output_param.UnitsMatch:
obj.OutputParameterDict[key] = output_param.with_preferred_units()

# write results to output file and screen

Expand Down Expand Up @@ -142,7 +145,7 @@ def PrintOutputs(self, model: Model):
f.write(f" Fixed Charge Rate (FCR): {model.economics.FCR.value*100.0:10.2f} " + model.economics.FCR.CurrentUnits.value + NL)
elif model.economics.econmodel.value == EconomicModel.STANDARDIZED_LEVELIZED_COST:
f.write(" Economic Model = " + model.economics.econmodel.value.value + NL)
f.write(f" Interest Rate: {model.economics.discountrate.value*100.0:10.2f} " + model.economics.discountrate.PreferredUnits.value + NL)
f.write(f" Interest Rate: {model.economics.discountrate.value:10.2f} " + model.economics.discountrate.PreferredUnits.value + NL)
elif model.economics.econmodel.value == EconomicModel.BICYCLE:
f.write(" Economic Model = " + model.economics.econmodel.value.value + NL)
f.write(f" Accrued financing during construction: {model.economics.inflrateconstruction.value*100:10.2f} " + model.economics.inflrateconstruction.PreferredUnits.value + NL)
Expand Down
6 changes: 1 addition & 5 deletions src/geophires_x/SurfacePlant.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def __init__(self, model: Model):
Min=0.1,
Max=1.0,
UnitType=Units.PERCENT,
PreferredUnits=PercentUnit.TENTH,
PreferredUnits=PercentUnit.PERCENT,
CurrentUnits=PercentUnit.TENTH,
Required=True,
ErrMessage="assume default circulation pump efficiency (0.75)",
Expand Down Expand Up @@ -551,9 +551,6 @@ def read_parameters(self, model:Model) -> None:
key = ParameterToModify.Name.strip()
if key in model.InputParameters:
ParameterReadIn = model.InputParameters[key]
# Before we change the parameter, let's assume that the unit preferences will match -
# if they don't, the later code will fix this.
ParameterToModify.CurrentUnits = ParameterToModify.PreferredUnits
# this should handle all the non-special cases
ReadParameter(ParameterReadIn, ParameterToModify, model)

Expand All @@ -563,7 +560,6 @@ def read_parameters(self, model:Model) -> None:
ParameterToModify.value = end_use_option
if end_use_option == EndUseOptions.HEAT:
self.plant_type.value = PlantType.INDUSTRIAL

elif ParameterToModify.Name == 'Power Plant Type':
ParameterToModify.value = PlantType.from_input_string(ParameterReadIn.sValue)
if self.enduse_option.value == EndUseOptions.ELECTRICITY:
Expand Down
3 changes: 0 additions & 3 deletions src/geophires_x/WellBores.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,9 +1235,6 @@ def read_parameters(self, model: Model) -> None:
key = ParameterToModify.Name.strip()
if key in model.InputParameters:
ParameterReadIn = model.InputParameters[key]
# Before we change the parameter, let's assume that the unit preferences will match
# - if they don't, the later code will fix this.
ParameterToModify.CurrentUnits = ParameterToModify.PreferredUnits
ReadParameter(ParameterReadIn, ParameterToModify, model) # this should handle all non-special cases

# handle special cases
Expand Down
2 changes: 1 addition & 1 deletion tests/examples/Fervo_Norbeck_Latimer_2023.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Horizontal Well Drilling Cost Correlation, 10, per the drill cost paper - works
Production Flow Rate per Well, 41.02, =650 gpm per the paper - per the paper the maximum flow rate was 63 L/s but the range was 550-750 gpm
Production Well Diameter, 7, per the paper
Injection Well Diameter, 7, per the paper
Well Separation, 365 feet, per the paper
Well Separation, 365 ft, per the paper
Injection Temperature, 38 degC, per the paper 75 to 125 degF
Injection Wellbore Temperature Gain, 3
Reservoir Impedance, 0.33, per paper, matching pumping power report 500-1000 kW
Expand Down
Loading