From fdd2ca2b6ccae6872af276bec4ddcedb041bc487 Mon Sep 17 00:00:00 2001 From: Malcolm Ross Date: Fri, 10 Nov 2023 14:46:05 -0600 Subject: [PATCH] Bring SUTRA docstrings up to standards. No functional changes. Only Docstring changes and formatting. removed doc-author and "param self"; added type and rtype. --- src/geophires_x/AGSWellBores.py | 52 +++++++++---------- src/geophires_x/SUTRAEconomics.py | 20 ++++---- src/geophires_x/SUTRAOutputs.py | 29 +++++------ src/geophires_x/SUTRAReservoir.py | 43 +++++++++------- src/geophires_x/SUTRASurfacePlant.py | 60 ++++++++++------------ src/geophires_x/SUTRAWellBores.py | 74 ++++++++++++---------------- 6 files changed, 133 insertions(+), 145 deletions(-) diff --git a/src/geophires_x/AGSWellBores.py b/src/geophires_x/AGSWellBores.py index bd3f95d5..ceea2de8 100644 --- a/src/geophires_x/AGSWellBores.py +++ b/src/geophires_x/AGSWellBores.py @@ -164,23 +164,23 @@ def interp_kWt_avg(self, point): def pointsource(self, yy, zz, yt, zt, ye, ze, alpha, sp, t): """ point source/sink solution functions - :param yy: y coordinate of the point source/sink + :param yy: y coordinate of the point source/sink (m) (yy = 0) for coaxial wellbore and (yy = 0.078) for U-loop wellbore (m) :type yy: float - :param zz: z coordinate of the point source/sink + :param zz: z coordinate of the point source/sink (m) (zz = 0) for coaxial wellbore and (zz = 0.078) for U-loop wellbore (m) :type zz: float - :param yt: y coordinate of the point source/sink + :param yt: y coordinate of the point source/sink (m) (yt = 0) for coaxial wellbore and (yt = 0.078) for U-loop wellbore (m) :type yt: float - :param zt: z coordinate of the point source/sink + :param zt: z coordinate of the point source/sink (m) (zt = 0) for coaxial wellbore and (zt = 0.078) for U-loop wellbore (m) :type zt: float - :param ye: y coordinate of the point source/sink + :param ye: y coordinate of the point source/sink (m) (ye = 0) for coaxial wellbore and (ye = 0.078) for U-loop wellbore (m) :type ye: float - :param ze: z coordinate of the point source/sink + :param ze: z coordinate of the point source/sink (m) (ze = 0) for coaxial wellbore and (ze = 0.078) for U-loop wellbore (m) :type ze: float - :param alpha: thermal diffusivity + :param alpha: thermal diffusivity (m2/s) :type alpha: float - :param sp: Laplace variable + :param sp: Laplace variable (1/s) :type sp: float - :param t: time + :param t: time (s) :type t: float :return: z :rtype: float @@ -202,23 +202,23 @@ 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 yy: y coordinate of the point source/sink + :param yy: y coordinate of the point source/sink (m) (yy = 0) for coaxial wellbore and (yy = 0.078) for U-loop wellbore (m) :type yy: float - :param zz: z coordinate of the point source/sink + :param zz: z coordinate of the point source/sink (m) (zz = 0) for coaxial wellbore and (zz = 0.078) for U-loop wellbore (m) :type zz: float - :param yt: y coordinate of the point source/sink + :param yt: y coordinate of the point source/sink (m) (yt = 0) for coaxial wellbore and (yt = 0.078) for U-loop wellbore (m) :type yt: float - :param zt: z coordinate of the point source/sink + :param zt: z coordinate of the point source/sink (m) (zt = 0) for coaxial wellbore and (zt = 0.078) for U-loop wellbore (m) :type zt: float - :param ye: y coordinate of the point source/sink + :param ye: y coordinate of the point source/sink (m) (ye = 0) for coaxial wellbore and (ye = 0.078) for U-loop wellbore (m) :type ye: float - :param ze: z coordinate of the point source/sink + :param ze: z coordinate of the point source/sink (m) (ze = 0) for coaxial wellbore and (ze = 0.078) for U-loop wellbore (m) :type ze: float - :param alpha: thermal diffusivity + :param alpha: thermal diffusivity (m2/s) :type alpha: float - :param sp: Laplace variable + :param sp: Laplace variable (1/s) :type sp: float - :return: ???? + :return: ???? (need to check) :rtype: float """ m = 32 @@ -238,7 +238,7 @@ 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 sp: Laplace variable + :param sp: Laplace variable (1/s) :type sp: float :return: Toutletl :rtype: float @@ -385,11 +385,11 @@ def Chebyshev(self, a, b, n, yy, zz, yt, zt, ye, ze, alpha, sp, func): :type ye: float :param ze: z coordinate of the point source/sink :type ze: float - :param alpha: thermal diffusivity + :param alpha: thermal diffusivity (m2/s) :type alpha: float - :param sp: Laplace variable + :param sp: Laplace variable (1/s) :type sp: float - :param func: function + :param func: function to be integrated (pointsource) :type func: function :return: y * d - dd + 0.5 * cint[0] :rtype: float @@ -844,13 +844,13 @@ def CalculateNonverticalPressureDrop(self, model, time_operation: float, time_ma Calculate nonvertical pressure drops - it will vary as the temperature varies :param model: The container class of the application, giving access to everything else, including the logger :type model: :class:`~geophires_x.Model.Model` - :param time_operation: time of operation + :param time_operation: time of operation in years (0.01) :type time_operation: float - :param time_max: maximum time of operation + :param time_max: maximum time of operation in years (100) - this is the time of the last year of operation :type time_max: float - :param al: time step + :param al: time step in years (0.01) - this is the time step of the simulation (not the time step of the CLGS model) :type al: float - :return: NonverticalPressureDrop, friction + :return: NonverticalPressureDrop, friction - pressure drop and friction factor for the nonvertical section of the wellbore :rtype: tuple """ friction = 0.0 diff --git a/src/geophires_x/SUTRAEconomics.py b/src/geophires_x/SUTRAEconomics.py index d3335cd0..31d9193f 100644 --- a/src/geophires_x/SUTRAEconomics.py +++ b/src/geophires_x/SUTRAEconomics.py @@ -8,6 +8,7 @@ from .Parameter import intParameter, floatParameter, OutputParameter, ReadParameter, boolParameter from .Units import * + class SUTRAEconomics: """ Class to support the default economic calculations in GEOPHIRES @@ -18,13 +19,10 @@ def __init__(self, model: Model): It initializes the attributes of an object, and sets default values for certain arguments that can be overridden by user input. The __init__ function is used to set up all the parameters in Economics. - - :param self: Store data that will be used by the class :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` :return: None - :doc-author: Malcolm Ross """ - model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) # Set up all the Parameters that will be predefined by this class using the different types of parameter classes. @@ -301,10 +299,13 @@ def __init__(self, model: Model): def read_parameters(self, model: Model) -> None: """ - read_parameters read and update the Economics parameters and handle the special cases - - Args: - model (Model): The container class of the application, giving access to everything else, including the logger + read_parameters read and update the Economics parameters and handle the special cases that need to be taken care of after a + value has been read in and checked. This is called from the main Model class. It is not called from the __init__ + function because the user may not want to read in the parameters from the input file, but may want to set them + in the user interface. + :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` + :return: Nothing, but it does make calculations and set values in the model """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) @@ -363,10 +364,9 @@ def Calculate(self, model: Model) -> None: """ The Calculate function is where all the calculations are done. This function can be called multiple times, and will only recalculate what has changed each time it is called. - :param self: Access variables that belongs to the class :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` :return: Nothing, but it does make calculations and set values in the model - :doc-author: Malcolm Ross """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) diff --git a/src/geophires_x/SUTRAOutputs.py b/src/geophires_x/SUTRAOutputs.py index d7bddc3c..7b6c28a1 100644 --- a/src/geophires_x/SUTRAOutputs.py +++ b/src/geophires_x/SUTRAOutputs.py @@ -3,10 +3,8 @@ import sys import numpy as np import geophires_x.Model as Model -from .Parameter import ConvertUnitsBack, ConvertOutputUnits, LookupUnits -from .OptionList import EndUseOptions, EconomicModel, ReservoirModel, FractureShape, ReservoirVolume -from matplotlib import pyplot as plt -from .Units import * +from .Parameter import LookupUnits +from .OptionList import EconomicModel NL="\n" @@ -17,10 +15,9 @@ def __init__(self, model:Model): It initializes the attributes of an object, and sets default values for certain arguments that can be overridden by user input. The __init__ function is used to set up all the parameters in the Outputs. - :param self: Store data that will be used by the class :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` :return: None - :doc-author: Malcolm Ross """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) @@ -40,18 +37,17 @@ 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 - #Deal with all the parameter values that the user has provided. They should really only provide values that + Deals with all the parameter values that the user has provided. They should really only provide values that they want to change from the default values, but they can provide a value that is already set because it is a default value set in __init__. It will ignore those. - #This also deals with all the special cases that need to be taken care of after a value has been read in + This also deals with all the special cases that need to be taken care of 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), + If you choose to subclass this master class, you can also choose to override this method (or not), and if you do, do it before or after you call you own version of this method. If you do, you can also choose to call this method from you class, which can effectively modify all these superclass parameters in your class. + :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` + :return: None """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) @@ -74,11 +70,12 @@ def read_parameters(self, model:Model) -> None: model.logger.info("Complete "+ str(__class__) + ": " + sys._getframe().f_code.co_name) - def PrintOutputs(self, model:Model): + def PrintOutputs(self, model: Model): """ PrintOutputs writes the standard outputs to the output file. - Args: - model (Model): The container class of the application, giving access to everything else, including the logger + :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` + :return: None """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) diff --git a/src/geophires_x/SUTRAReservoir.py b/src/geophires_x/SUTRAReservoir.py index 4573c3aa..eaf3ca74 100644 --- a/src/geophires_x/SUTRAReservoir.py +++ b/src/geophires_x/SUTRAReservoir.py @@ -10,35 +10,37 @@ class SUTRAReservoir(Reservoir): """ - This class reads in the output of a simulation with SUTRA. + This class reads in the output of a simulation with SUTRA. It then uses the output to calculate the heat stored, heat + supplied and efficiency for each year of the simulation. It also calculates the target heat and simulated heat for + each SUTRA time step over the lifetime of the simulation. Finally, it calculates the well flow rate and temperature + for each SUTRA time step over the lifetime of the simulation. It then stores all these values in the appropriate arrays + in the reservoir class. It also creates plots of the SUTRA output data. """ def __init__(self, model: Model): """ The __init__ function is called automatically when a class is instantiated. It initializes the attributes of an object, and sets default values for certain arguments that can be overridden by user input. - :param self: Store data that will be used by the class + Set up all the Parameters that will be predefined by this class using the different types of parameter classes. + Setting up includes giving it a name, a default value, The Unit Type (length, volume, temperature, etc.) and + Unit Name of that value, sets it as required (or not), sets allowable range, the error message if that range + is exceeded, the ToolTip Text, and the name of teh class that created it. + This includes setting up temporary variables that will be available to all the class but noy read in by user, + or used for Output + This also includes all Parameters that are calculated and then published using the Printouts function. + If you choose to subclass this master class, you can do so before or after you create your own parameters. + If you do, you can also choose to call this method from you class, which will effectively add and set all + these parameters to your class. :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` :return: None - :doc-author: Malcolm Ross """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) super().__init__(model) # initialize the parent parameters and variables sclass = str(__class__).replace("","") - # Set up all the Parameters that will be predefined by this class using the different types of parameter classes. - # Setting up includes giving it a name, a default value, The Unit Type (length, volume, temperature, etc.) and - # Unit Name of that value, sets it as required (or not), sets allowable range, the error message if that range - # is exceeded, the ToolTip Text, and the name of teh class that created it. - # This includes setting up temporary variables that will be available to all the class but noy read in by user, - # or used for Output - # This also includes all Parameters that are calculated and then published using the Printouts function. - # If you choose to subclass this master class, you can do so before or after you create your own parameters. - # If you do, you can also choose to call this method from you class, which will effectively add and set all - # these parameters to your class. # specific to this class: - self.sutraannualheatfilename = self.ParameterDict[self.sutraannualheatfilename.Name] = strParameter( "SUTRA Annual Heat File Name", value='annual_heat.csv', @@ -152,25 +154,30 @@ def read_parameters(self, model:Model) -> None: """ The read_parameters function reads in the parameters from a dictionary created by reading the user-provided file and updates the parameter values for this object. - The function reads in all the parameters that relate to this object, including those that are inherited from other objects. It then updates any of these parameter values that have been changed by the user. It also handles any special cases. - :param self: Reference the class instance (such as it is) from within the class :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` :return: None - :doc-author: Malcolm Ross """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) - super().read_parameters(model) # read the parameters for the parent. # if we call super, we don't need to deal with setting the parameters here, just deal with the special cases # for the variables in this class # because the call to the super.readparameters will set all the variables, including the ones that are specific # to this class + super().read_parameters(model) # read the parameters for the parent. model.logger.info("Complete " + str(__class__) + ": " + sys._getframe().f_code.co_name) def Calculate(self, model: Model): + """ + The Calculate function reads in the SUTRA output files and stores the data in the appropriate reservoir arrays. + It also creates plots of the SUTRA output data. It then calls the Calculate function of the parent class. + :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` + :return: None + """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) super().Calculate(model) # run calculations for the parent. diff --git a/src/geophires_x/SUTRASurfacePlant.py b/src/geophires_x/SUTRASurfacePlant.py index 7e65065d..3f17460e 100644 --- a/src/geophires_x/SUTRASurfacePlant.py +++ b/src/geophires_x/SUTRASurfacePlant.py @@ -8,6 +8,7 @@ import pandas as pd from matplotlib import pyplot as plt + class SUTRASurfacePlant: def __init__(self, model: Model): """ @@ -15,23 +16,21 @@ def __init__(self, model: Model): It initializes the attributes of an object, and sets default values for certain arguments that can be overridden by user input. The __init__ function is used to set up all the parameters in the Surfaceplant. - :param self: Store data that will be used by the class + Set up all the Parameters that will be predefined by this class using the different types of parameter classes. + Setting up includes giving it a name, a default value, The Unit Type (length, volume, temperature, etc.) and + Unit Name of that value, sets it as required (or not), sets allowable range, the error message if that range + is exceeded, the ToolTip Text, and the name of teh class that created it. + This includes setting up temporary variables that will be available to all the class but noy read in by user, + or used for Output + This also includes all Parameters that are calculated and then published using the Printouts function. :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` :return: None - :doc-author: Malcolm Ross """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) self.Tinj = 0.0 - # Set up all the Parameters that will be predefined by this class using the different types of parameter classes. - # Setting up includes giving it a name, a default value, The Unit Type (length, volume, temperature, etc.) and - # Unit Name of that value, sets it as required (or not), sets allowable range, the error message if that range - # is exceeded, the ToolTip Text, and the name of teh class that created it. - # This includes setting up temporary variables that will be available to all the class but noy read in by user, - # or used for Output - # This also includes all Parameters that are calculated and then published using the Printouts function. - # These dictionaries contain a list of all the parameters set in this object, stored as "Parameter" and # "OutputParameter" Objects. This will allow us later to access them in a user interface and get that list, # along with unit type, preferred units, etc. @@ -246,22 +245,21 @@ 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 + Deal with all the parameter values that the user has provided. They should really only provide values that + they want to change from the default values, but they can provide a value that is already set because it is a + default value set in __init__. It will ignore those. + This also deals with all the special cases that need to be taken care of 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, do it before or after you call you own version of this method. + If you do, you can also choose to call this method from you class, which can effectively modify all + these superclass parameters in your class. :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` :return: None - :doc-author: Malcolm Ross """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) - # Deal with all the parameter values that the user has provided. They should really only provide values that - # they want to change from the default values, but they can provide a value that is already set because it is a - # default value set in __init__. It will ignore those. - # This also deals with all the special cases that need to be taken care of 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, do it before or after you call you own version of this method. - # If you do, you can also choose to call this method from you class, which can effectively modify all - # these superclass parameters in your class. if len(model.InputParameters) > 0: # loop through all the parameters that the user wishes to set, looking for parameters that match this object @@ -311,23 +309,19 @@ def Calculate(self, model: Model) -> None: """ The Calculate function is where all the calculations are done. This function can be called multiple times, and will only recalculate what has changed each time it is called. - - :param self: Access variables that belongs to the class + This is where all the calculations are made using all the values that have been set. + If you subclass this class, you can choose to run these calculations before (or after) your calculations, + but that assumes you have set all the values that are required for these calculations + If you choose to subclass this master class, you can also choose to override this method (or not), + and if you do, do it before or after you call you own version of this method. If you do, you can also choose + to call this method from you class, which can effectively run the calculations of the superclass, making all + the values available to your methods. but you had better have set all the parameters! :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` :return: Nothing, but it does make calculations and set values in the model - :doc-author: Malcolm Ross """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) - # This is where all the calculations are made using all the values that have been set. - # If you subclass this class, you can choose to run these calculations before (or after) your calculations, - # but that assumes you have set all the values that are required for these calculations - # If you choose to subclass this master class, you can also choose to override this method (or not), - # and if you do, do it before or after you call you own version of this method. If you do, you can also choose - # to call this method from you class, which can effectively run the calculations of the superclass, making all - # the values available to your methods. but you had better have set all the parameters! - - # calculate and instantaneous heat injected, geothermal heat supplied, auxiliary heating required and total heat produced TimeVector = np.append(model.reserv.TimeProfile.value[0:-1:2],model.reserv.TimeProfile.value[-1]) self.SUTRATimeStep.value = TimeVector[-1]/len(TimeVector) diff --git a/src/geophires_x/SUTRAWellBores.py b/src/geophires_x/SUTRAWellBores.py index 5a709741..ae7436ce 100644 --- a/src/geophires_x/SUTRAWellBores.py +++ b/src/geophires_x/SUTRAWellBores.py @@ -2,11 +2,9 @@ import os import math import numpy as np -from .Parameter import floatParameter, intParameter, boolParameter, OutputParameter, ReadParameter -from .Reservoir import densitywater, viscositywater +from .Parameter import floatParameter, intParameter, OutputParameter, ReadParameter from .Units import * import geophires_x.Model as Model -from .OptionList import ReservoirModel class SUTRAWellBores: @@ -15,27 +13,23 @@ 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 + Set up all the Parameters that will be predefined by this class using the different types of parameter classes. + Setting up includes giving it a name, a default value, The Unit Type (length, volume, temperature, etc.) + and Unit Name of that value, sets it as required (or not), sets allowable range, the error message + if that range is exceeded, the ToolTip Text, and the name of teh class that created it. + This includes setting up temporary variables that will be available to all the class but noy read in by user, + or used for Output + This also includes all Parameters that are calculated and then published using the Printouts function. + If you choose to subclass this master class, you can do so before or after you create your own parameters. + If you do, you can also choose to call this method from you class, which will effectively add and set all + these parameters to your class. :param model: The container class of the application, giving access to everything else, including the logger - + :type model: :class:`~geophires_x.Model.Model` :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) self.rhowaterprod = self.rhowaterinj = 0.0 - # Set up all the Parameters that will be predefined by this class using the different types of parameter classes. - # Setting up includes giving it a name, a default value, The Unit Type (length, volume, temperature, etc.) - # and Unit Name of that value, sets it as required (or not), sets allowable range, the error message - # if that range is exceeded, the ToolTip Text, and the name of teh class that created it. - # This includes setting up temporary variables that will be available to all the class but noy read in by user, - # or used for Output - # This also includes all Parameters that are calculated and then published using the Printouts function. - # If you choose to subclass this master class, you can do so before or after you create your own parameters. - # If you do, you can also choose to call this method from you class, which will effectively add and set all - # these parameters to your class. - # These dictionaries contain a list of all the parameters set in this object, stored as "Parameter" and # OutputParameter Objects. This will allow us later to access them in a user interface and get that list, # along with unit type, preferred units, etc. @@ -195,24 +189,22 @@ def __str__(self): 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). - :param self: Access variables that belong to a class + 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). + Deal with all the parameter values that the user has provided. They should really only provide values that + they want to change from the default values, but they can provide a value that is already set because it is a + default value set in __init__. It will ignore those. + This also deals with all the special cases that need to be taken care of 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, do it before or after you call you own version of this method. If you do, you can also choose + to call this method from you class, which can modify all these superclass parameters in your class. :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` :return: None - :doc-author: Malcolm Ross """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) - # Deal with all the parameter values that the user has provided. They should really only provide values that - # they want to change from the default values, but they can provide a value that is already set because it is a - # default value set in __init__. It will ignore those. - # This also deals with all the special cases that need to be taken care of 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, do it before or after you call you own version of this method. If you do, you can also choose - # to call this method from you class, which can modify all these superclass parameters in your class. - if len(model.InputParameters) > 0: # loop through all the parameters that the user wishes to set, looking for parameters that match this object for item in self.ParameterDict.items(): @@ -240,21 +232,19 @@ def Calculate(self, model: Model) -> None: """ The Calculate function is where all the calculations are done. This function can be called multiple times, and will only recalculate what has changed each time it is called. - :param self: Access variables that belongs to the class + This is where all the calculations are made using all the values that have been set. + If you subclass this class, you can choose to run these calculations before (or after) your calculations, + but that assumes you have set all the values that are required for these calculations + If you choose to subclass this master class, you can also choose to override this method (or not), + and if you do, do it before or after you call you own version of this method. If you do, you can also + choose to call this method from you class, which can effectively run the calculations of the superclass, + making all thr values available to your methods. but you had better have set all the parameters! :param model: The container class of the application, giving access to everything else, including the logger + :type model: :class:`~geophires_x.Model.Model` :return: Nothing, but it does make calculations and set values in the model - :doc-author: Malcolm Ross """ model.logger.info("Init " + str(__class__) + ": " + sys._getframe().f_code.co_name) - # This is where all the calculations are made using all the values that have been set. - # If you subclass this class, you can choose to run these calculations before (or after) your calculations, - # but that assumes you have set all the values that are required for these calculations - # If you choose to subclass this master class, you can also choose to override this method (or not), - # and if you do, do it before or after you call you own version of this method. If you do, you can also - # choose to call this method from you class, which can effectively run the calculations of the superclass, - # making all thr values available to your methods. but you had better have set all the parameters! - # special case: production and injection well diameters are input as inches and call calculations # assume meters! Check and change if needed, assuming anything > 2 must be talking about inches if self.injwelldiam.value > 2.0: @@ -266,7 +256,7 @@ def Calculate(self, model: Model) -> None: self.prodwelldiam.CurrentUnits = LengthUnit.METERS self.prodwelldiam.UnitsMatch = False - # get wellbore flowrates from SUTRA data + # get wellbore flow rates from SUTRA data prodwellflowrates = np.append(model.reserv.BalanceWellFlowRate.value[0:-1:2],model.reserv.BalanceWellFlowRate.value[-1]) injwellflowrates = np.append(model.reserv.StorageWellFlowRate.value[0:-1:2],model.reserv.StorageWellFlowRate.value[-1]) self.ProductionWellFlowRates.value = prodwellflowrates