Skip to content

Commit

Permalink
Change Gradients and Gradient1 units from degC/m to degC/km
Browse files Browse the repository at this point in the history
  • Loading branch information
natakokota committed Jun 8, 2024
1 parent becec79 commit 7a90808
Show file tree
Hide file tree
Showing 20 changed files with 2,555 additions and 2,557 deletions.
16 changes: 8 additions & 8 deletions src/geophires_x/Reservoir.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(self, model: Model):
Min=0.0,
Max=500.0,
UnitType=Units.TEMP_GRADIENT,
PreferredUnits=TemperatureGradientUnit.DEGREESCPERM,
PreferredUnits=TemperatureGradientUnit.DEGREESCPERKM,
CurrentUnits=TemperatureGradientUnit.DEGREESCPERM,
Required=True,
ErrMessage="assume default geothermal gradients 1 (50, 0, 0, 0 deg.C/km)",
Expand All @@ -113,7 +113,7 @@ def __init__(self, model: Model):
Min=0.0,
Max=500.0,
UnitType=Units.TEMP_GRADIENT,
PreferredUnits=TemperatureGradientUnit.DEGREESCPERM,
PreferredUnits=TemperatureGradientUnit.DEGREESCPERKM,
CurrentUnits=TemperatureGradientUnit.DEGREESCPERM,
Required=True,
ErrMessage="assume default geothermal gradient 1 (50 deg.C/km)",
Expand Down Expand Up @@ -624,15 +624,15 @@ def read_parameters(self, model: Model) -> None:
parts = ParameterReadIn.Name.split(' ')
position = int(parts[1]) - 1
model.reserv.gradient.value[position] = ParameterToModify.value
if model.reserv.gradient.value[position] > 1.0:
model.reserv.gradient.CurrentUnits = ParameterToModify.CurrentUnits
if model.reserv.gradient.value[position] > 1.0 and ParameterToModify.CurrentUnits == TemperatureGradientUnit.DEGREESCPERM:
# TODO refactor to avoid heuristic-based unit conversions
model.reserv.gradient.value[position] = model.reserv.gradient.value[
position] / 1000.0 # convert C/m
model.reserv.gradient.CurrentUnits = TemperatureGradientUnit.DEGREESCPERM

if model.reserv.gradient.value[position] < 1e-6:
# convert 0 C/m gradients to very small number, avoids divide by zero errors later
model.reserv.gradient.value[position] = 1e-6
# model.reserv.gradient.CurrentUnits = TemperatureGradientUnit.DEGREESCPERM
elif model.reserv.gradient.value[position] <= 1.0 and ParameterToModify.CurrentUnits == TemperatureGradientUnit.DEGREESCPERKM:
model.reserv.gradient.value[position] = model.reserv.gradient.value[
position] * 1000.0 # convert C/km

elif ParameterToModify.Name.startswith('Thickness'):
parts = ParameterReadIn.Name.split(' ')
Expand Down
4 changes: 2 additions & 2 deletions src/geophires_x_schema_generator/geophires-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@
"Gradients": {
"description": "Geothermal gradients",
"type": "number",
"units": "degC/m",
"units": "degC/km",
"category": "Reservoir"
},
"Gradient 1": {
"description": "Geothermal gradient 1 in rock segment 1",
"type": "number",
"units": "degC/m",
"units": "degC/km",
"category": "Reservoir"
},
"Gradient 2": {
Expand Down
162 changes: 81 additions & 81 deletions tests/examples/Fervo_Norbeck_Latimer_2023.out

Large diffs are not rendered by default.

282 changes: 141 additions & 141 deletions tests/examples/example1.out

Large diffs are not rendered by default.

270 changes: 135 additions & 135 deletions tests/examples/example10_HP.out

Large diffs are not rendered by default.

278 changes: 139 additions & 139 deletions tests/examples/example11_AC.out

Large diffs are not rendered by default.

282 changes: 141 additions & 141 deletions tests/examples/example12_DH.out

Large diffs are not rendered by default.

280 changes: 140 additions & 140 deletions tests/examples/example13.out

Large diffs are not rendered by default.

360 changes: 180 additions & 180 deletions tests/examples/example1_addons.out

Large diffs are not rendered by default.

241 changes: 120 additions & 121 deletions tests/examples/example2.out

Large diffs are not rendered by default.

318 changes: 159 additions & 159 deletions tests/examples/example3.out

Large diffs are not rendered by default.

276 changes: 138 additions & 138 deletions tests/examples/example4.out

Large diffs are not rendered by default.

271 changes: 135 additions & 136 deletions tests/examples/example5.out

Large diffs are not rendered by default.

273 changes: 136 additions & 137 deletions tests/examples/example8.out

Large diffs are not rendered by default.

281 changes: 140 additions & 141 deletions tests/examples/example9.out

Large diffs are not rendered by default.

271 changes: 136 additions & 135 deletions tests/examples/example_SHR-1.out

Large diffs are not rendered by default.

277 changes: 139 additions & 138 deletions tests/examples/example_SHR-2.out

Large diffs are not rendered by default.

290 changes: 145 additions & 145 deletions tests/examples/example_multiple_gradients.out

Large diffs are not rendered by default.

340 changes: 170 additions & 170 deletions tests/examples/example_overpressure.out

Large diffs are not rendered by default.

340 changes: 170 additions & 170 deletions tests/examples/example_overpressure2.out

Large diffs are not rendered by default.

0 comments on commit 7a90808

Please sign in to comment.