GFunction

class GHEtool.VariableClasses.GFunction.FIFO(length: int = 2)

Bases: object

This class is a container with n elements. If the n+1th element is added, the first is removed

Parameters
lengthint

Length of the fifo-array

add(value: float) None

This function adds the value to the fifo array. If the array is full, the first element is removed.

Parameters
valuefloat

Value to be added to the array

Returns
None
clear() None

This function clears the fifo_array.

Returns
None
in_fifo_list(value: float) bool

This function checks whether the value is in the fifo list, but not the last element!

Parameters
valuefloat

Value potentially in the fifo list

Returns
bool

True if the value is in the fifo list, false otherwise

class GHEtool.VariableClasses.GFunction.GFunction

Bases: object

Class that contains the functionality to calculate gfunctions and to store previously calculated values that can potentially be used for interpolation to save time. This is done by storing previously calculated gvalues.

calculate(time_value: Union[list, float, ndarray], borefield: List[Borehole], alpha: float, interpolate: Optional[bool] = None)

This function returns the gvalues either by interpolation or by calculating them. It does so by calling the function gvalues which does this calculation. This calculation function also stores the previous calculated data and makes interpolations whenever the requested list of time_value are longer then DEFAULT_NUMBER_OF_TIMESTEPS.

Parameters
time_valuelist, float, np.ndarray

Array with all the time values [s] for which gvalues should be calculated

borefieldlist[pygfunction.boreholes.Borehole]

Borefield model for which the gvalues should be calculated

alphafloat

Thermal diffusivity of the ground [m2/s]

interpolatebool

True if results should be interpolated when possible, False otherwise. If None, the default is chosen.

Returns
gvaluesnp.ndarray

1D array with all the requested gvalues

interpolate_gfunctions(time_value: Union[list, float, ndarray], depth: float, alpha: float, borefield: List[Borehole]) ndarray

This function returns the gvalues by interpolation them. If interpolation is not possible, an emtpy array is returned.

Parameters
time_valuelist, float, np.ndarray

Time value(s) [s] for which gvalues should be calculated

depthfloat

Depth of the borefield [m]

alphafloat

Thermal diffusivity of the ground [m2/s]

borefieldlist[pygfunction.boreholes.Borehole]

Borefield model for which the gvalues should be calculated

Returns
gvaluesnp.ndarray

1D array with all the requested gvalues

remove_previous_data() None

This function removes the previous calculated data by setting the depth_array, time_array and previous_gfunctions back to empty arrays.

Returns
None
set_new_calculated_data(time_values: ndarray, depth: float, gvalues: ndarray, borefield, alpha) bool

This function stores the newly calculated gvalues if this is needed.

Parameters
time_valuesnp.ndarray

Array with all the time values [s] for which gvalues should be calculated

depthfloat

Depth of the borefield [m]

gvaluesnp.ndarray

Array with all the calculated gvalues for the corresponding borefield, alpha and time_values

borefieldlist[pygfunction.borehole]

Borefield model for which the gvalues should be calculated

alphafloat

Thermal diffusivity of the ground [m2/s]

Returns
bool

True if the data is saved, False otherwise

set_options_gfunction_calculation(options: dict, add: bool = True) None

This function sets the options for the gfunction calculation of pygfunction. This dictionary is directly passed through to the gFunction class of pygfunction. For more information, please visit the documentation of pygfunction.

Parameters
optionsdict

Dictionary with options for the gFunction class of pygfunction

addbool

True if the options should be added, False is the options should be replaced.

Returns
None