@@ -75,74 +75,107 @@ def __init__(self, enable_geophires_logging_config=True, input_file=None):
75
75
if input_file is None and len (sys .argv ) > 1 :
76
76
input_file = sys .argv [1 ]
77
77
78
+ # Key step - read the entire provided input file
78
79
read_input_file (self .InputParameters , logger = self .logger , input_file_name = input_file )
79
80
81
+ # initiate the outputs object
82
+ output_file = 'HDR.out'
83
+ if len (sys .argv ) > 2 :
84
+ output_file = sys .argv [2 ]
85
+ self .outputs = Outputs (self , output_file = output_file )
86
+
87
+ # Initiate the elements of the Model object
88
+ # this is where you can change what class get initiated - the superclass, or one of the subclasses
89
+ self .logger .info ("Initiate the elements of the Model" )
90
+
91
+ # Assume that SDAC and add-ons are not used
80
92
self .sdacgtoutputs = None
81
93
self .sdacgteconomics = None
82
94
self .addoutputs = None
83
95
self .addeconomics = None
84
96
85
- # Initiate the elements of the Model
86
- # this is where you can change what class get initiated - the superclass, or one of the subclasses
87
- self .logger .info ("Initiate the elements of the Model" )
88
- # we need to decide which reservoir to instantiate based on the user input (InputParameters),
89
- # which we just read above for the first time
90
- # Default is Thermal drawdown percentage model (GETEM)
91
- self .reserv : TDPReservoir = TDPReservoir (self )
92
- if 'Reservoir Model' in self .InputParameters :
93
- if self .InputParameters ['Reservoir Model' ].sValue == '0' :
94
- self .reserv : CylindricalReservoir = CylindricalReservoir (self ) # Simple Cylindrical Reservoir
95
- elif self .InputParameters ['Reservoir Model' ].sValue == '1' :
96
- self .reserv : MPFReservoir = MPFReservoir (self ) # Multiple parallel fractures model (LANL)
97
- elif self .InputParameters ['Reservoir Model' ].sValue == '2' :
98
- self .reserv : LHSReservoir = LHSReservoir (self ) # Multiple parallel fractures model (LANL)
99
- elif self .InputParameters ['Reservoir Model' ].sValue == '3' :
100
- self .reserv : SFReservoir = SFReservoir (self ) # Drawdown parameter model (Tester)
101
- elif self .InputParameters ['Reservoir Model' ].sValue == '5' :
102
- self .reserv : UPPReservoir = UPPReservoir (self ) # Generic user-provided temperature profile
103
- elif self .InputParameters ['Reservoir Model' ].sValue == '6' :
104
- self .reserv : TOUGH2Reservoir = TOUGH2Reservoir (self ) # Tough2 is called
105
- elif self .InputParameters ['Reservoir Model' ].sValue == '7' :
106
- self .reserv : SUTRAReservoir = SUTRAReservoir (self ) # SUTRA output is created
107
- elif self .InputParameters ['Reservoir Model' ].sValue == '8' :
108
- self .logger .info ('Setup the SBT elements of the Model and instantiate new attributes as needed' )
109
- self .reserv : SBTReservoir = SBTReservoir (self )
110
-
111
97
# initialize the default objects
98
+ self .reserv : TDPReservoir = TDPReservoir (self )
112
99
self .wellbores : WellBores = WellBores (self )
113
- self .surfaceplant : SurfacePlant = SurfacePlant (self )
100
+ self .surfaceplant = SurfacePlantIndustrialHeat (self ) # default is Industrial Heat
114
101
self .economics : Economics = Economics (self )
115
102
116
- output_file = 'HDR.out'
117
- if len ( sys . argv ) > 2 :
118
- output_file = sys . argv [ 2 ]
119
-
120
- self . outputs = Outputs ( self , output_file = output_file )
103
+ # Now we need to handle the creation of all the special case objects based on the user settings
104
+ # We have to access the user setting from the overall master table because the read_parameters functions
105
+ # have not been called on the specific objects yet, so the instantiated objects only contain default values
106
+ # not user set values. The user set value can only come from the master dictionary "InputParameters"
107
+ # based on the user input, which we just read above for the first time
121
108
109
+ # First, we need to decide which reservoir to instantiate
110
+ # For reservoirs, the default is Thermal drawdown percentage model (GETEM); see above where it is initialized.
111
+ # The user can change this in the input file, so check the values and initiate the appropriate reservoir object
122
112
if 'Reservoir Model' in self .InputParameters :
123
- if self .InputParameters ['Reservoir Model' ].sValue == '7' :
124
- # if we use SUTRA output for simulating reservoir thermal energy storage, we use a special wellbore object that can handle SUTRA data
113
+ if self .InputParameters ['Reservoir Model' ].sValue in ['0' , 'Simple cylindrical' ]:
114
+ self .reserv : CylindricalReservoir = CylindricalReservoir (self )
115
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['1' , 'Multiple Parallel Fractures' ]:
116
+ self .reserv : MPFReservoir = MPFReservoir (self )
117
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['2' , '1-D Linear Heat Sweep' ]:
118
+ self .reserv : LHSReservoir = LHSReservoir (self )
119
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['3' , 'Single Fracture m/A Thermal Drawdown' ]:
120
+ self .reserv : SFReservoir = SFReservoir (self )
121
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['5' , 'User-Provided Temperature Profile' ]:
122
+ self .reserv : UPPReservoir = UPPReservoir (self )
123
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['6' , 'TOUGH2 Simulator' ]:
124
+ self .reserv : TOUGH2Reservoir = TOUGH2Reservoir (self )
125
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['7' , 'SUTRA' ]:
126
+ # if we use SUTRA output for simulating reservoir thermal energy storage,
127
+ # we use a special wellbore object that handles SUTRA data, and special Economics and Outputs objects
128
+ self .logger .info ('Setup the SUTRA elements of the Model and instantiate new attributes as needed' )
129
+ self .reserv : SUTRAReservoir = SUTRAReservoir (self )
125
130
self .wellbores : WellBores = SUTRAWellBores (self )
126
131
self .surfaceplant : SurfacePlantSUTRA = SurfacePlantSUTRA (self )
127
132
self .economics : SUTRAEconomics = SUTRAEconomics (self )
128
133
self .outputs : SUTRAOutputs = SUTRAOutputs (self , output_file = output_file )
129
- if self .InputParameters ['Reservoir Model' ].sValue == '8' :
130
- self .wellbores : SBTWellbores = SBTWellbores (self )
134
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['8' , 'SBT' ]:
135
+ self .logger .info ('Setup the SBT elements of the Model and instantiate new attributes as needed' )
136
+ self .reserv : SBTReservoir = SBTReservoir (self )
137
+ self .wellbores : SBTWellBores = SBTWellbores (self )
131
138
self .economics : SBTEconomics = SBTEconomics (self )
132
139
140
+ # Now handle the special cases for all AGS cases (CLGS, SBT, or CLGS)
133
141
if 'Is AGS' in self .InputParameters :
134
142
if self .InputParameters ['Is AGS' ].sValue in ['True' , 'true' , 'TRUE' , 'T' , '1' ]:
135
- self .logger .info ("Setup the AGS elements of the Model and instantiate new attributes as needed" )
136
- # If we are doing AGS, we need to replace the various objects we with versions of the objects
137
- # that have AGS functionality.
138
- # that means importing them, initializing them, then reading their parameters
139
- # use the simple cylindrical reservoir for all AGS systems.
140
- self .reserv : CylindricalReservoir = CylindricalReservoir (self )
141
- self .wellbores : WellBores = AGSWellBores (self )
142
- self .surfaceplant : SurfacePlantAGS = SurfacePlantAGS (self )
143
- self .economics : AGSEconomics = AGSEconomics (self )
144
- self .outputs : AGSOutputs = AGSOutputs (self , output_file = output_file )
143
+ self .logger .info ('Setup the AGS elements of the Model and instantiate new attributes as needed' )
145
144
self .wellbores .IsAGS .value = True
145
+ if not isinstance (self .reserv , SBTReservoir ):
146
+ if self .InputParameters ['Economic Model' ].sValue not in ['4' , 'Simple (CLGS)' ]:
147
+ # must be doing wangju approach, # so go back to using default objects
148
+ self .surfaceplant = SurfacePlant (self )
149
+ self .economics = Economics (self )
150
+ # Must be doing CLGS, so we need to instantiate the right objects
151
+ self .reserv : CylindricalReservoir = CylindricalReservoir (self )
152
+ self .wellbores : WellBores = AGSWellBores (self )
153
+ self .surfaceplant : SurfacePlantAGS = SurfacePlantAGS (self )
154
+ self .economics : AGSEconomics = AGSEconomics (self )
155
+ self .outputs : AGSOutputs = AGSOutputs (self , output_file = output_file )
156
+
157
+ # initialize the right Power Plant Type
158
+ if 'Power Plant Type' in self .InputParameters :
159
+ # electricity
160
+ if self .InputParameters ['Power Plant Type' ].sValue in ['1' , 'Subcritical ORC' ]:
161
+ self .surfaceplant = SurfacePlantSubcriticalOrc (self )
162
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['2' , 'Supercritical ORC' ]:
163
+ self .surfaceplant = SurfacePlantSupercriticalOrc (self )
164
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['3' , 'Single-Flash' ]:
165
+ self .surfaceplant = SurfacePlantSingleFlash (self )
166
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['4' , 'Double-Flash' ]:
167
+ self .surfaceplant = SurfacePlantDoubleFlash (self )
168
+ # Heat applications
169
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['5' , 'Absorption Chiller' ]:
170
+ self .surfaceplant = SurfacePlantAbsorptionChiller (self )
171
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['6' , 'Heat Pump' ]:
172
+ self .surfaceplant = SurfacePlantHeatPump (self )
173
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['7' , 'District Heating' ]:
174
+ self .surfaceplant = SurfacePlantDistrictHeating (self )
175
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['8' , 'Reservoir Thermal Energy Storage' ]:
176
+ self .surfaceplant = SurfacePlantSUTRA (self )
177
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['9' , 'Industrial' ]:
178
+ self .surfaceplant = SurfacePlantIndustrialHeat (self )
146
179
147
180
# if we find out we have an add-ons, we need to instantiate it, then read for the parameters
148
181
if 'AddOn Nickname 1' in self .InputParameters :
@@ -159,6 +192,7 @@ def __init__(self, enable_geophires_logging_config=True, input_file=None):
159
192
160
193
self .logger .info (f'Complete { __class__ } : { __name__ } ' )
161
194
195
+
162
196
def __str__ (self ):
163
197
return "Model"
164
198
0 commit comments