Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions pygfunction/gfunction.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from time import perf_counter
import warnings
from abc import ABC, abstractmethod

import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -226,15 +227,15 @@ def __init__(self, boreholes_or_network, alpha, time=None,
self._check_inputs()

# Load the chosen solver
if self.method.lower()=='similarities':
if self.method.lower() == 'similarities':
self.solver = _Similarities(
self.boreholes, self.network, self.time,
self.boundary_condition, **self.options)
elif self.method.lower()=='detailed':
elif self.method.lower() == 'detailed':
self.solver = _Detailed(
self.boreholes, self.network, self.time,
self.boundary_condition, **self.options)
elif self.method.lower()=='equivalent':
elif self.method.lower() == 'equivalent':
self.solver = _Equivalent(
self.boreholes, self.network, self.time,
self.boundary_condition, **self.options)
Expand Down Expand Up @@ -1368,7 +1369,7 @@ def mixed_inlet_temperature(
return gFunc.gFunc


class _BaseSolver(object):
class _BaseSolver(ABC):
"""
Template for solver classes.

Expand Down Expand Up @@ -1499,11 +1500,13 @@ def __init__(self, boreholes, network, time, boundary_condition,

return

@abstractmethod
def initialize(self, *kwargs):
"""
Perform any calculation required at the initialization of the solver
and returns the number of finite line heat sources in the borefield.


Raises
------
NotImplementedError
Expand All @@ -1515,13 +1518,12 @@ def initialize(self, *kwargs):
initialize the matrix of segment-to-segment thermal response
factors (of size: nSources x nSources).

"""
raise NotImplementedError(
'initialize class method not implemented, this method should '
'return the number of finite line heat sources in the borefield '
'used to initialize the matrix of segment-to-segment thermal '
'response factors (of size: nSources x nSources)')
return None
"""
pass

@abstractmethod
def thermal_response_factors(self, time, alpha, kind='linear'):
pass

def solve(self, time, alpha):
"""
Expand Down Expand Up @@ -2140,7 +2142,6 @@ def _thermal_response_factors_borehole_to_self(self, time, alpha):
return h, i_segment, j_segment



class _Similarities(_BaseSolver):
"""
Similarities solver for the evaluation of the g-function.
Expand Down