Skip to content

Commit

Permalink
Merge pull request NREL#243 from softwareengineerprogrammer/main
Browse files Browse the repository at this point in the history
Gradients in degC/km; Unit conversion cleanup [3.4.36]
  • Loading branch information
softwareengineerprogrammer authored Jun 21, 2024
2 parents af2fdf7 + 63545f3 commit 012bec4
Show file tree
Hide file tree
Showing 40 changed files with 291 additions and 266 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.4.35
current_version = 3.4.36
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion .cookiecutterrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ default_context:
sphinx_doctest: "no"
sphinx_theme: "sphinx-py3doc-enhanced-theme"
test_matrix_separate_coverage: "no"
version: 3.4.35
version: 3.4.36
version_manager: "bump2version"
website: "https://github.com/NREL"
year_from: "2023"
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ Free software: `MIT license <LICENSE>`__
:alt: Supported implementations
:target: https://pypi.org/project/geophires-x

.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.4.35.svg
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.4.36.svg
:alt: Commits since latest release
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.4.35...main
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.4.36...main

.. |docs| image:: https://readthedocs.org/projects/GEOPHIRES-X/badge/?style=flat
:target: https://nrel.github.io/GEOPHIRES-X
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
year = '2023'
author = 'NREL'
copyright = f'{year}, {author}'
version = release = '3.4.35'
version = release = '3.4.36'

pygments_style = 'trac'
templates_path = ['./templates']
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def read(*names, **kwargs):

setup(
name='geophires-x',
version='3.4.35',
version='3.4.36',
license='MIT',
description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.',
long_description='{}\n{}'.format(
Expand Down
28 changes: 15 additions & 13 deletions src/geophires_x/Outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,8 @@ def PrintOutputs(self, model: 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)
if not param.UnitsMatch:
ConvertUnitsBack(param, model)

# now we need to loop through all the output parameters to update their units to
# whatever units the user has specified.
Expand Down Expand Up @@ -847,19 +848,20 @@ def PrintOutputs(self, model: Model):
model.reserv.depth.CurrentUnits.value))

if model.reserv.numseg.value == 1:
summary.append(OutputTableItem('Geothermal gradient', '{0:10.4f}'.format(model.reserv.gradient.value[0]),
summary.append(OutputTableItem('Geothermal gradient', '{0:10.4g}'.format(model.reserv.gradient.value[0]),
model.reserv.gradient.CurrentUnits.value))
else:
for i in range(1, model.reserv.numseg.value):
summary.append(OutputTableItem(f'Segment {str(i)} Geothermal gradient',
'{0:10.4f}'.format(model.reserv.gradient.value[i - 1]),
'{0:10.4g}'.format(model.reserv.gradient.value[i - 1]),
model.reserv.gradient.CurrentUnits.value))
summary.append(OutputTableItem(f'Segment {str(i)} Thickness',
'{0:10.0f}'.format(model.reserv.layerthickness.value[i - 1]),
model.reserv.layerthickness.CurrentUnits.value))
summary.append(OutputTableItem(f'Segment {str(i + 1)} Geothermal gradient',
'{0:10.4f}'.format(model.reserv.gradient.value[i]),
'{0:10.4g}'.format(model.reserv.gradient.value[i]),
model.reserv.gradient.CurrentUnits.value))

if model.economics.DoCarbonCalculations.value:
summary.append(OutputTableItem('Total Avoided Carbon Emissions', '{0:10.2f}'.format(
model.economics.CarbonThatWouldHaveBeenProducedTotal.value * 0.000453592), 'metric tonnes'))
Expand Down Expand Up @@ -946,18 +948,18 @@ def PrintOutputs(self, model: Model):
model.reserv.Tmax.CurrentUnits.value))
resource_characteristics.append(OutputTableItem('Number of segments', '{0:10.0f}'.format(model.reserv.numseg.value)))
if model.reserv.numseg.value == 1:
resource_characteristics.append(OutputTableItem('Geothermal gradient', '{0:10.4f}'.format(model.reserv.gradient.value[0]),
resource_characteristics.append(OutputTableItem('Geothermal gradient', '{0:10.4g}'.format(model.reserv.gradient.value[0]),
model.reserv.gradient.CurrentUnits.value))
else:
for i in range(1, model.reserv.numseg.value):
resource_characteristics.append(OutputTableItem(f'Segment {str(i)} Geothermal gradient',
'{0:10.4f}'.format(
'{0:10.4g}'.format(
model.reserv.gradient.value[i - 1]),
model.reserv.gradient.CurrentUnits.value))
resource_characteristics.append(OutputTableItem(f'Segment {str(i)} Thickness', '{0:10.0f}'.format(
model.reserv.layerthickness.value[i - 1]), model.reserv.layerthickness.CurrentUnits.value))
resource_characteristics.append(OutputTableItem(f'Segment {str(i + 1)} Geothermal gradient',
'{0:10.4f}'.format(model.reserv.gradient.value[i]),
'{0:10.4g}'.format(model.reserv.gradient.value[i]),
model.reserv.gradient.CurrentUnits.value))
if model.wellbores.IsAGS.value:
reservoir_parameters.append(OutputTableItem('The AGS models contain an intrinsic reservoir model that doesn\'t expose values that can be used in extensive reporting.'))
Expand Down Expand Up @@ -1596,12 +1598,12 @@ def PrintOutputs(self, model: Model):
f.write(f' Well depth (or total length, if not vertical): {model.reserv.depth.value:10.1f} ' +model.reserv.depth.CurrentUnits.value + NL)

if model.reserv.numseg.value == 1:
f.write(f' Geothermal gradient: {model.reserv.gradient.value[0]:10.4f} ' + model.reserv.gradient.CurrentUnits.value + NL)
f.write(f' Geothermal gradient: {model.reserv.gradient.value[0]:10.4g} ' + model.reserv.gradient.CurrentUnits.value + NL)
else:
for i in range(1, model.reserv.numseg.value):
f.write(f' Segment {str(i):s} Geothermal gradient: {model.reserv.gradient.value[i-1]:10.4f} ' + model.reserv.gradient.CurrentUnits.value +NL)
f.write(f' Segment {str(i):s} Geothermal gradient: {model.reserv.gradient.value[i-1]:10.4g} ' + model.reserv.gradient.CurrentUnits.value +NL)
f.write(f' Segment {str(i):s} Thickness: {model.reserv.layerthickness.value[i-1]:10.0f} ' + model.reserv.layerthickness.CurrentUnits.value + NL)
f.write(f' Segment {str(i+1):s} Geothermal gradient: {model.reserv.gradient.value[i]:10.4f} ' + model.reserv.gradient.CurrentUnits.value + NL)
f.write(f' Segment {str(i+1):s} Geothermal gradient: {model.reserv.gradient.value[i]:10.4g} ' + model.reserv.gradient.CurrentUnits.value + NL)
if model.economics.DoCarbonCalculations.value:
f.write(f' Total Avoided Carbon Emissions: {model.economics.CarbonThatWouldHaveBeenProducedTotal.value*0.000453592:10.2f} metric tonnes' + NL)

Expand Down Expand Up @@ -1670,12 +1672,12 @@ def PrintOutputs(self, model: Model):
f.write(f' Maximum reservoir temperature: {model.reserv.Tmax.value:10.1f} ' + model.reserv.Tmax.CurrentUnits.value + NL)
f.write(f' Number of segments: {model.reserv.numseg.value:10.0f} ' + NL)
if model.reserv.numseg.value == 1:
f.write(f' Geothermal gradient: {model.reserv.gradient.value[0]:10.4f} ' + model.reserv.gradient.CurrentUnits.value + NL)
f.write(f' Geothermal gradient: {model.reserv.gradient.value[0]:10.4g} ' + model.reserv.gradient.CurrentUnits.value + NL)
else:
for i in range(1, model.reserv.numseg.value):
f.write(f' Segment {str(i):s} Geothermal gradient: {model.reserv.gradient.value[i-1]:10.4f} ' + model.reserv.gradient.CurrentUnits.value +NL)
f.write(f' Segment {str(i):s} Geothermal gradient: {model.reserv.gradient.value[i-1]:10.4g} ' + model.reserv.gradient.CurrentUnits.value +NL)
f.write(f' Segment {str(i):s} Thickness: {model.reserv.layerthickness.value[i-1]:10.0f} ' + model.reserv.layerthickness.CurrentUnits.value + NL)
f.write(f' Segment {str(i+1):s} Geothermal gradient: {model.reserv.gradient.value[i]:10.4f} ' + model.reserv.gradient.CurrentUnits.value + NL)
f.write(f' Segment {str(i+1):s} Geothermal gradient: {model.reserv.gradient.value[i]:10.4g} ' + model.reserv.gradient.CurrentUnits.value + NL)

f.write(NL)
f.write(NL)
Expand Down
Loading

0 comments on commit 012bec4

Please sign in to comment.