Skip to content

Commit cfa9279

Browse files
FractureShape values enum
1 parent 1c31b74 commit cfa9279

File tree

3 files changed

+50
-15
lines changed

3 files changed

+50
-15
lines changed

src/geophires_x/OptionList.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ def from_int(int_val):
129129

130130
@staticmethod
131131
def from_input_string(input_string:str):
132-
for res_vol in ReservoirVolume:
133-
if input_string == str(res_vol.int_value):
134-
return res_vol
132+
for member in __class__:
133+
if input_string == str(member.int_value):
134+
return member
135135

136136
raise ValueError(f'Unknown Reservoir Volume input value: {input_string}')
137137

@@ -172,12 +172,25 @@ def calculate_cost_MUSD(self, meters) -> float:
172172
return (self._c2 * meters ** 2 + self._c1 * meters + self._c0) * 1E-6
173173

174174

175-
class FractureShape(str, Enum):
176-
CIRCULAR_AREA = "Circular fracture with known area"
177-
CIRCULAR_DIAMETER = "Circular fracture with known diameter"
178-
SQUARE = "Square"
179-
RECTANGULAR = "Rectangular"
175+
class FractureShape(GeophiresInputEnum):
176+
CIRCULAR_AREA = 1, "Circular fracture with known area"
177+
CIRCULAR_DIAMETER = 2, "Circular fracture with known diameter"
178+
SQUARE = 3, "Square"
179+
RECTANGULAR = 4, "Rectangular"
180+
181+
@staticmethod
182+
def from_int(int_val):
183+
for member in __class__:
184+
if member.int_value == int_val:
185+
return member
186+
187+
@staticmethod
188+
def from_input_string(input_string:str):
189+
for member in __class__:
190+
if input_string == str(member.int_value):
191+
return member
180192

193+
raise ValueError(f'Unknown Fracture Shape input value: {input_string}')
181194

182195
class WorkingFluid(str, Enum):
183196
WATER = "water"

src/geophires_x/Reservoir.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ def __init__(self, model: Model):
241241

242242
self.fracshape = self.ParameterDict[self.fracshape.Name] = intParameter(
243243
"Fracture Shape",
244-
DefaultValue=FractureShape.CIRCULAR_AREA,
244+
DefaultValue=FractureShape.CIRCULAR_AREA.int_value,
245245
AllowableRange=[1, 2, 3, 4],
246+
ValuesEnum=FractureShape,
246247
UnitType=Units.NONE,
247248
ErrMessage="assume default fracture shape (1)",
248-
ToolTipText="Specifies the shape of the (identical) fractures in a fracture-based reservoir: \
249-
1: Circular fracture with known area, 2: Circular fracture with known diameter, \
250-
3: Square fracture, 4: Rectangular fracture"
249+
ToolTipText="Specifies the shape of the (identical) fractures in a fracture-based reservoir: " +
250+
'; '.join([f'{it.int_value}: {it.value}' for it in FractureShape])
251251
)
252252

253253
self.fracarea = self.ParameterDict[self.fracarea.Name] = floatParameter(

src/geophires_x_schema_generator/geophires-request.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,35 @@
252252
]
253253
},
254254
"Fracture Shape": {
255-
"description": "Specifies the shape of the (identical) fractures in a fracture-based reservoir: 1: Circular fracture with known area, 2: Circular fracture with known diameter, 3: Square fracture, 4: Rectangular fracture",
255+
"description": "Specifies the shape of the (identical) fractures in a fracture-based reservoir: 1: Circular fracture with known area; 2: Circular fracture with known diameter; 3: Square; 4: Rectangular",
256256
"type": "integer",
257257
"units": null,
258258
"category": "Reservoir",
259-
"default": "Circular fracture with known area",
259+
"default": 1,
260260
"minimum": 1,
261-
"maximum": 4
261+
"maximum": 4,
262+
"enum_values": [
263+
{
264+
"name": "CIRCULAR_AREA",
265+
"value": "Circular fracture with known area",
266+
"int_value": 1
267+
},
268+
{
269+
"name": "CIRCULAR_DIAMETER",
270+
"value": "Circular fracture with known diameter",
271+
"int_value": 2
272+
},
273+
{
274+
"name": "SQUARE",
275+
"value": "Square",
276+
"int_value": 3
277+
},
278+
{
279+
"name": "RECTANGULAR",
280+
"value": "Rectangular",
281+
"int_value": 4
282+
}
283+
]
262284
},
263285
"Fracture Area": {
264286
"description": "Effective heat transfer area per fracture",

0 commit comments

Comments
 (0)