Skip to content

Commit

Permalink
Docstring changes and formatting. with JP; removed doc-author and "pa…
Browse files Browse the repository at this point in the history
…ram self"
  • Loading branch information
malcolm-dsider committed Nov 7, 2023
1 parent 00012ff commit e3c6c4c
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions src/geophires_x/AGSWellBores.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
ref Beckers, Koenraad, et al. Tabulated Database of Closed-Loop Geothermal Systems Performance for Cloud-Based
Technical and Economic Modeling of Heat Production and Electricity Generation. No. NREL/CP-5700-84979.
National Renewable Energy Lab.(NREL), Golden, CO (United States), 2023.
:doc-author: Malcolm Ross
"""
import sys
import os
Expand Down Expand Up @@ -113,7 +112,6 @@ def interp_outlet_states(self, point):
Interpolate the outlet states for a given point
param: point: tuple of (mdot, L2, L1, grad, D, Tinj, k)
:return: Tout, Pout
:doc-author: Malcolm Ross
"""
points = list(itern.product(
(point[0],),
Expand All @@ -138,17 +136,17 @@ def interp_outlet_states(self, point):
def interp_kWe_avg(self, point):
"""
Interpolate the average heat extraction rate for a given point
:param point: tuple of (mdot, L2, L1, grad, D, Tinj, k)
:return: kWe_avg
:doc-author: Malcolm Ross
"""
ivars = self.ivars[:-1]
return self.GWhr * interpn(ivars, self.We, point) / (1000. * self.time[-1] * 86400. * 365.)

def interp_kWt_avg(self, point):
"""
Interpolate the average heat extraction rate for a given point
:param point: tuple of (mdot, L2, L1, grad, D, Tinj, k)
:return: kWt_avg
:doc-author: Malcolm Ross
"""
ivars = self.ivars[:-1]
return self.GWhr * interpn(ivars, self.Wt, point) / (1000. * self.time[-1] * 86400. * 365.)
Expand All @@ -159,7 +157,6 @@ def interp_kWt_avg(self, point):
def pointsource(self, yy, zz, yt, zt, ye, ze, alpha, sp, t):
"""
point source/sink solution functions
:param self: Reference the class object itself
:param yy: y coordinate of the point source/sink
:param zz: z coordinate of the point source/sink
:param yt: y coordinate of the point source/sink
Expand All @@ -170,7 +167,6 @@ def pointsource(self, yy, zz, yt, zt, ye, ze, alpha, sp, t):
:param sp: Laplace variable
:param t: time
:return: z
:doc-author: Malcolm Ross
"""
rhorock_cprock_4 = self.rhorock * self.cprock * 4.0
theta_yt_minus_yy = thetaY(yt - yy, ye, alpha, t)
Expand All @@ -189,7 +185,6 @@ def pointsource(self, yy, zz, yt, zt, ye, ze, alpha, sp, t):
def chebeve_pointsource(self, yy, zz, yt, zt, ye, ze, alpha, sp) -> float:
"""
Chebyshev approximation for numerical Laplace transformation integration from 1e-8 to 1e30
:param self: Reference the class object itself
:param yy: y coordinate of the point source/sink
:param zz: z coordinate of the point source/sink
:param yt: y coordinate of the point source/sink
Expand All @@ -199,7 +194,6 @@ def chebeve_pointsource(self, yy, zz, yt, zt, ye, ze, alpha, sp) -> float:
:param alpha: thermal diffusivity
:param sp: Laplace variable
:return: ????
:doc-author: Malcolm Ross
"""
m = 32
t_1 = 1.0e-8
Expand All @@ -218,10 +212,8 @@ def chebeve_pointsource(self, yy, zz, yt, zt, ye, ze, alpha, sp) -> float:
def laplace_solution(self, sp) -> float:
"""
Duhamel convolution method for closed-loop system
:param self: Reference the class object itself
:param sp: Laplace variable
:return: Toutletl
:doc-author: Malcolm Ross
"""

Toutletl = 0.0
Expand All @@ -239,11 +231,9 @@ def laplace_solution(self, sp) -> float:
def inverselaplace(self, NL, MM):
"""
Numerical Laplace transformation algorithm
:param self: Reference the class object itself
:param NL: NL
:param MM: MM
:return: Toutlet
:doc-author: Malcolm Ross
"""
V = np.zeros(50)
Gi = np.zeros(50)
Expand Down Expand Up @@ -346,7 +336,6 @@ def thetaZ(zt, ze, alpha, t):
def Chebyshev(self, a, b, n, yy, zz, yt, zt, ye, ze, alpha, sp, func):
"""
Chebyshev approximation for numerical Laplace transformation integration from 1e-8 to 1e30
:param self: Reference the class object itself
:param a: a
:param b: b
:param n: n
Expand All @@ -360,7 +349,6 @@ def Chebyshev(self, a, b, n, yy, zz, yt, zt, ye, ze, alpha, sp, func):
:param sp: Laplace variable
:param func: function
:return: y * d - dd + 0.5 * cint[0]
:doc-author: Malcolm Ross
"""
bma = 0.5 * (b - a)
bpa = 0.5 * (b + a)
Expand Down Expand Up @@ -410,10 +398,8 @@ def __init__(self, model: Model):
The __init__ function is the constructor for a class. It is called whenever an instance of the class is created.
The __init__ function can take arguments, but self is always the first one. Self refers to the instance of the
object that has already been created, and it's used to access variables that belong to that object.
:param self: Reference the class object itself
:param model: The container class of the application, giving access to everything else, including the logger
:return: Nothing, and is used to initialize the class
:doc-author: Malcolm Ross
"""
model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name)

Expand Down Expand Up @@ -610,10 +596,8 @@ def read_parameters(self, model: Model) -> None:
The read_parameters function reads in the parameters from a dictionary and stores them in the parameters.
It also handles special cases that need to be handled after a value has been read in and checked.
If you choose to subclass this master class, you can also choose to override this method (or not), and if you do
:param self: Access variables that belong to a class
:param model: The container class of the application, giving access to everything else, including the logger
:return: None
:doc-author: Malcolm Ross
"""
model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name)
super().read_parameters(model) # read the default parameters
Expand Down Expand Up @@ -672,10 +656,8 @@ def read_parameters(self, model: Model) -> None:
def calculatedrillinglengths(self, model) -> tuple:
"""
returns the total length, vertical length, and horizontal lengths, depending on the configuration
:param self: Access variables that belong to a class
:param model: The container class of the application, giving access to everything else, including the logger
:return: total length, vertical length, and horizontal lengths
:doc-author: Malcolm Ross
"""
if self.Configuration.value == Configuration.ULOOP:
# Total drilling depth of both wells and laterals in U-loop [m]
Expand All @@ -691,10 +673,8 @@ def calculatedrillinglengths(self, model) -> tuple:
def initialize(self, model: Model) -> None:
"""
The initialize function reads values and arrays to be in the format that CLGS model systems expects
:param self: Access variables that belong to a class
:param model: The container class of the application, giving access to everything else, including the logger
:return: None
:doc-author: Koenraad Beckers
"""
model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name)

Expand Down Expand Up @@ -753,10 +733,8 @@ def initialize(self, model: Model) -> None:
def getTandP(self, model: Model) -> None:
"""
The getTandP function reads and prepares Temperature and Pressure values from the CLGS database
:param self: Access variables that belong to a class
:param model: The container class of the application, giving access to everything else, including the logger
:return: None
:doc-author: Koenraad Beckers
"""
model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name)
# code from Koenraad
Expand All @@ -779,10 +757,8 @@ def verify(self, model: Model) -> int:
"""
The verify function checks that all values provided are within the range expected by CLGS modeling system.
These values in within a smaller range than the value ranges available to GEOPHIRES-X
:param self: Access variables that belong to a class
:param model: The container class of the application, giving access to everything else, including the logger
:return: 0 if all OK, 1 if error.
:doc-author: Koenraad Beckers
"""
model.logger.info("Init " + str(
__class__) + ": " + sys._getframe().f_code.co_name) # Verify inputs are within allowable bounds
Expand Down Expand Up @@ -814,13 +790,11 @@ def verify(self, model: Model) -> int:
def CalculateNonverticalPressureDrop(self, model, time_operation: float, time_max: float, al: float):
"""
Calculate nonvertical pressure drops - it will vary as the temperature varies
:param self: Access variables that belong to a class
:param model: The container class of the application, giving access to everything else, including the logger
:param time_operation: time of operation
:param time_max: maximum time of operation
:param al: time step
:return: NonverticalPressureDrop, friction
:doc-author: Koenraad Beckers
"""
friction = 0.0
NonverticalPressureDrop = [0.0] * model.surfaceplant.plantlifetime.value # initialize the array
Expand Down Expand Up @@ -866,10 +840,8 @@ def CalculateNonverticalPressureDrop(self, model, time_operation: float, time_ma
def Calculate(self, model: Model) -> None:
"""
The calculate function verifies, initializes, and extracts the values from the AGS model
:param self: Access variables that belong to a class
:param model: The container class of the application, giving access to everything else, including the logger
:return: None
:doc-author: Koenraad Beckers, Malcolm Ross, and Wanju Yuan
"""
model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name)

Expand Down

0 comments on commit e3c6c4c

Please sign in to comment.