From 2f5d47edcc34b026da83ec572f4146e36ab0012b Mon Sep 17 00:00:00 2001 From: Thomas Baumann <39156931+brownbaerchen@users.noreply.github.com> Date: Wed, 19 Jun 2024 09:38:48 +0200 Subject: [PATCH 01/38] Some fixes for new numpy version --- .../implementations/problem_classes/AllenCahn_Temp_MPIFFT.py | 4 ++-- .../problem_classes/generic_MPIFFT_Laplacian.py | 4 ++-- pySDC/projects/DAE/tests/test_SemiImplicitDAE.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py b/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py index d2ad696b36..01f2e99e32 100644 --- a/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py +++ b/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py @@ -123,7 +123,7 @@ def __init__( L = np.array([self.L] * ndim, dtype=float) # get local mesh - X = np.ogrid[self.fft.local_slice(False)] + X = list(np.ogrid[self.fft.local_slice(False)]) N = self.fft.global_shape() for i in range(len(N)): X[i] = X[i] * L[i] / N[i] @@ -135,7 +135,7 @@ def __init__( k = [np.fft.fftfreq(n, 1.0 / n).astype(int) for n in N[:-1]] k.append(np.fft.rfftfreq(N[-1], 1.0 / N[-1]).astype(int)) K = [ki[si] for ki, si in zip(k, s)] - Ks = np.meshgrid(*K, indexing='ij', sparse=True) + Ks = list(np.meshgrid(*K, indexing='ij', sparse=True)) Lp = 2 * np.pi / L for i in range(ndim): Ks[i] = (Ks[i] * Lp[i]).astype(float) diff --git a/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py b/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py index 0142045340..883494a6bf 100644 --- a/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py +++ b/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py @@ -102,7 +102,7 @@ def __init__( ) # get local mesh - X = self.xp.ogrid[self.fft.local_slice(False)] + X = list(self.xp.ogrid[self.fft.local_slice(False)]) N = self.fft.global_shape() for i in range(len(N)): X[i] = x0 + (X[i] * L[i] / N[i]) @@ -113,7 +113,7 @@ def __init__( N = self.fft.global_shape() k = [self.xp.fft.fftfreq(n, 1.0 / n).astype(int) for n in N] K = [ki[si] for ki, si in zip(k, s)] - Ks = self.xp.meshgrid(*K, indexing='ij', sparse=True) + Ks = list(self.xp.meshgrid(*K, indexing='ij', sparse=True)) Lp = 2 * np.pi / self.L for i in range(self.ndim): Ks[i] = (Ks[i] * Lp[i]).astype(float) diff --git a/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py b/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py index ccd37ebec1..6f69448cf1 100644 --- a/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py +++ b/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py @@ -207,7 +207,7 @@ def testComputeEndpoint(quad_type): L.sweep.compute_end_point() - assert np.isclose(L.u[-1], L.uend), "Endpoint is not computed correctly!" + assert np.allclose(L.u[-1], L.uend), "Endpoint is not computed correctly!" @pytest.mark.base From fccb757e1281320add3b24e1259045a2c0a3a2b8 Mon Sep 17 00:00:00 2001 From: Thomas Baumann <39156931+brownbaerchen@users.noreply.github.com> Date: Wed, 19 Jun 2024 10:24:33 +0200 Subject: [PATCH 02/38] Fix for Allen-Cahn project --- .../AllenCahn_Bayreuth/run_temp_forcing_verification.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pySDC/projects/AllenCahn_Bayreuth/run_temp_forcing_verification.py b/pySDC/projects/AllenCahn_Bayreuth/run_temp_forcing_verification.py index 8ade08fb4c..7cabcee841 100644 --- a/pySDC/projects/AllenCahn_Bayreuth/run_temp_forcing_verification.py +++ b/pySDC/projects/AllenCahn_Bayreuth/run_temp_forcing_verification.py @@ -182,7 +182,9 @@ def main(nprocs_space=None, cwd='.'): print(f'Order of accuracy: {orders[-1]:4.2f}\n') assert errors[2 + 1] < 8e-10, f'Errors are too high, got {errors[2 + 1]}' - assert np.isclose(orders[1], 4.6, rtol=7e-02), f'Order of accuracy is not within tolerance, got {orders[1]}' + assert np.isclose( + orders[1].view(np.ndarray), 4.6, rtol=7e-02 + ), f'Order of accuracy is not within tolerance, got {orders[1]}' if __name__ == "__main__": From 700b211767a46b29d1a3384f620fc36c58192851 Mon Sep 17 00:00:00 2001 From: Robert Speck Date: Thu, 20 Jun 2024 08:15:34 +0200 Subject: [PATCH 03/38] Update environment.yml --- pySDC/projects/parallelSDC/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySDC/projects/parallelSDC/environment.yml b/pySDC/projects/parallelSDC/environment.yml index 1961bb5c3b..7d5baaebbd 100644 --- a/pySDC/projects/parallelSDC/environment.yml +++ b/pySDC/projects/parallelSDC/environment.yml @@ -7,7 +7,7 @@ channels: dependencies: - numpy>=1.15.4 - scipy>=0.17.1 - - matplotlib>=3.0,<=3.5.3 + - matplotlib>=3.0 - dill>=0.2.6 - mpich - mpi4py>=3.0.0 From e1ee9b732863cff88f44c1bb130534fc2cd990aa Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Fri, 21 Jun 2024 14:23:10 +0200 Subject: [PATCH 04/38] TL: added qmat dependency in env files --- etc/environment-base.yml | 3 +++ etc/environment-cupy.yml | 3 +++ etc/environment-fenics.yml | 3 +++ etc/environment-mpi4py.yml | 3 +++ etc/environment-petsc.yml | 3 +++ etc/environment-postprocess.yml | 1 + etc/environment-pytorch.yml | 3 +++ 7 files changed, 19 insertions(+) diff --git a/etc/environment-base.yml b/etc/environment-base.yml index 3f326fbf87..54c2abf0bd 100644 --- a/etc/environment-base.yml +++ b/etc/environment-base.yml @@ -11,3 +11,6 @@ dependencies: - sympy>=1.0 - numba>=0.35 - dill>=0.2.6 + - pip + - pip: + - qmat diff --git a/etc/environment-cupy.yml b/etc/environment-cupy.yml index a1de245346..0a28d63deb 100644 --- a/etc/environment-cupy.yml +++ b/etc/environment-cupy.yml @@ -10,3 +10,6 @@ dependencies: - matplotlib>=3.0 - dill>=0.2.6 - cupy + - pip + - pip: + - qmat diff --git a/etc/environment-fenics.yml b/etc/environment-fenics.yml index 13129e61a8..05c2384b6a 100644 --- a/etc/environment-fenics.yml +++ b/etc/environment-fenics.yml @@ -11,3 +11,6 @@ dependencies: - dill>=0.2.6 - fenics>=2019.1.0 - mpi4py<=3.1.4 + - pip + - pip: + - qmat diff --git a/etc/environment-mpi4py.yml b/etc/environment-mpi4py.yml index e1d82af566..58768c81b6 100644 --- a/etc/environment-mpi4py.yml +++ b/etc/environment-mpi4py.yml @@ -12,3 +12,6 @@ dependencies: - mpich - mpi4py-fft>=2.0.2 - mpi4py>=3.0.0 + - pip + - pip: + - qmat diff --git a/etc/environment-petsc.yml b/etc/environment-petsc.yml index d7c1500c7a..0bb86d0ab1 100644 --- a/etc/environment-petsc.yml +++ b/etc/environment-petsc.yml @@ -12,3 +12,6 @@ dependencies: - mpich - petsc4py<3.20 - mpi4py>=3.0.0 + - pip + - pip: + - qmat diff --git a/etc/environment-postprocess.yml b/etc/environment-postprocess.yml index 8069e154d0..19dba4a93d 100644 --- a/etc/environment-postprocess.yml +++ b/etc/environment-postprocess.yml @@ -18,3 +18,4 @@ dependencies: - sphinxemoji - m2r2 - genbadge[all] + - qmat diff --git a/etc/environment-pytorch.yml b/etc/environment-pytorch.yml index ff5ce4f24d..17ca25fd70 100644 --- a/etc/environment-pytorch.yml +++ b/etc/environment-pytorch.yml @@ -13,3 +13,6 @@ dependencies: - dill - mpich - mpi4py>=3.0.0 + - pip + - pip: + - qmat From bf0032527cea3d99bb49f6588170a0a3f420240b Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Fri, 21 Jun 2024 14:27:05 +0200 Subject: [PATCH 05/38] TL: corrected pyproject.toml --- pyproject.toml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a0eab643e8..b750977ef8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,9 +15,7 @@ authors=[ {name='Lisa Wimmer', email='wimmer@uni-wuppertal.de'}, {name='Ikrom Akramov', email='ikrom.akramov@tuhh.de'}, ] -homepage = "http://www.parallel-in-time.org/pySDC/" -repository = "https://github.com/Parallel-in-Time/pySDC/" -documentation = "http://www.parallel-in-time.org/pySDC/" + classifiers = [ "Topic :: Scientific/Engineering :: Mathematics", @@ -30,8 +28,15 @@ dependencies = [ 'sympy>=1.0', 'numba>=0.35', 'dill>=0.2.6', + 'qmat', ] +[project.urls] +Homepage = "http://www.parallel-in-time.org/pySDC/" +Repository = "https://github.com/Parallel-in-Time/pySDC/" +Documentation = "http://www.parallel-in-time.org/pySDC/" +Tracker = "https://github.com/Parallel-in-Time/pySDC/issues" + [project.optional-dependencies] apps = [ 'petsc4py>=3.10.0', From d785efe50b2c04c86e39a216a4e1aadac29252e6 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Fri, 21 Jun 2024 17:23:55 +0200 Subject: [PATCH 06/38] TL: full qmat integration --- pySDC/core/BaseTransfer.py | 2 +- pySDC/core/Collocation.py | 173 ++------- pySDC/core/Lagrange.py | 247 ------------- pySDC/core/Nodes.py | 211 ----------- pySDC/core/Sweeper.py | 344 +----------------- .../adaptive_collocation.py | 2 +- .../estimate_polynomial_error.py | 2 +- .../interpolate_between_restarts.py | 2 +- .../sweeper_classes/generic_implicit.py | 9 +- pySDC/playgrounds/Diagonal/qmatrix.py | 4 +- pySDC/playgrounds/lagrange/quadrature.py | 3 +- pySDC/projects/PinTSimE/switch_estimator.py | 2 +- pySDC/projects/Resilience/quench.py | 2 +- pySDC/tests/test_collocation.py | 189 +++++----- .../test_InterpolateBetweenRestarts.py | 3 +- pySDC/tests/test_lagrange.py | 25 -- pySDC/tests/test_nodes.py | 59 --- 17 files changed, 159 insertions(+), 1120 deletions(-) delete mode 100644 pySDC/core/Lagrange.py delete mode 100644 pySDC/core/Nodes.py delete mode 100644 pySDC/tests/test_lagrange.py delete mode 100644 pySDC/tests/test_nodes.py diff --git a/pySDC/core/BaseTransfer.py b/pySDC/core/BaseTransfer.py index 32439075fa..87dd6f993d 100644 --- a/pySDC/core/BaseTransfer.py +++ b/pySDC/core/BaseTransfer.py @@ -4,7 +4,7 @@ from pySDC.core.Errors import UnlockError from pySDC.helpers.pysdc_helper import FrozenClass -from pySDC.core.Lagrange import LagrangeApproximation +from qmat.lagrange import LagrangeApproximation # short helper class to add params as attributes diff --git a/pySDC/core/Collocation.py b/pySDC/core/Collocation.py index 0a48019fc2..6c03aae14d 100644 --- a/pySDC/core/Collocation.py +++ b/pySDC/core/Collocation.py @@ -1,9 +1,8 @@ import logging import numpy as np +from qmat import Q_GENERATORS -from pySDC.core.Nodes import NodesGenerator from pySDC.core.Errors import CollocationError -from pySDC.core.Lagrange import LagrangeApproximation class CollBase(object): @@ -25,30 +24,12 @@ class CollBase(object): - LEGENDRE : distribution from Legendre polynomials - CHEBY-{1,2,3,4} : distribution from Chebyshev polynomials of a given kind - The type of quadrature cann be GAUSS (only inner nodes), RADAU-LEFT + The type of quadrature can be GAUSS (only inner nodes), RADAU-LEFT (inclusion of the left boundary), RADAU-RIGHT (inclusion of the right boundary) and LOBATTO (inclusion of left and right boundary). - Here is the equivalency table with the (old) original classes implemented - in pySDC : - - +-------------------------+-----------+-------------+ - | Original Class | node_type | quad_type | - +=========================+===========+=============+ - | Equidistant | EQUID | LOBATTO | - +-------------------------+-----------+-------------+ - | EquidistantInner | EQUID | GAUSS | - +-------------------------+-----------+-------------+ - | EquidistantNoLeft | EQUID | RADAU-RIGHT | - +-------------------------+-----------+-------------+ - | CollGaussLegendre | LEGENDRE | GAUSS | - +-------------------------+-----------+-------------+ - | CollGaussLobatto | LEGENDRE | LOBATTO | - +-------------------------+-----------+-------------+ - | CollGaussRadau_Left | LEGENDRE | RADAU-LEFT | - +-------------------------+-----------+-------------+ - | CollGaussRadau_Right | LEGENDRE | RADAU-RIGHT | - +-------------------------+-----------+-------------+ + All coefficients are generated using + [qmat](https://qmat.readthedocs.io/en/latest/autoapi/qmat/qcoeff/collocation/index.html) Attributes: num_nodes (int): number of collocation nodes @@ -74,39 +55,47 @@ def __init__(self, num_nodes=None, tleft=0, tright=1, node_type='LEGENDRE', quad """ if not num_nodes > 0: - raise CollocationError('At least one quadrature node required, got %s' % num_nodes) + raise CollocationError('at least one quadrature node required, got %s' % num_nodes) if not tleft < tright: - raise CollocationError('Interval boundaries are corrupt, got %s and %s' % (tleft, tright)) + raise CollocationError('interval boundaries are corrupt, got %s and %s' % (tleft, tright)) self.logger = logging.getLogger('collocation') - - # Set number of nodes, left and right interval boundaries + try: + self.generator = Q_GENERATORS["Collocation"]( + nNodes=num_nodes, nodeType=node_type, quadType=quad_type, tLeft=tleft, tRight=tright + ) + except Exception as e: + raise CollocationError(f"could not instantiate qmat generator, got error : {e}") + + # Set base attributes self.num_nodes = num_nodes self.tleft = tleft self.tright = tright - self.node_type = node_type self.quad_type = quad_type - - # Instantiate attributes - self.nodeGenerator = NodesGenerator(self.node_type, self.quad_type) - if self.node_type == 'EQUID': - self.order = num_nodes - else: - if self.quad_type == 'GAUSS': - self.order = 2 * num_nodes - elif self.quad_type.startswith('RADAU'): - self.order = 2 * num_nodes - 1 - elif self.quad_type == 'LOBATTO': - self.order = 2 * num_nodes - 2 - self.left_is_node = self.quad_type in ['LOBATTO', 'RADAU-LEFT'] self.right_is_node = self.quad_type in ['LOBATTO', 'RADAU-RIGHT'] - self.nodes = self._getNodes - self.weights = self._getWeights(tleft, tright) - self.Qmat = self._gen_Qmatrix - self.Smat = self._gen_Smatrix + # Integration order + self.order = self.generator.order + + # Compute coefficients + self.nodes = self.generator.nodes + self.weights = self.generator.weights + + Q = np.zeros([num_nodes + 1, num_nodes + 1], dtype=float) + Q[1:, 1:] = self.generator.Q + self.Qmat = Q + + S = np.zeros([num_nodes + 1, num_nodes + 1], dtype=float) + S[1:, 1:] = super(self.generator.__class__, self.generator).S + # Note : qmat redefines the S matrix for collocation with integrals, + # instead of differences of the Q matrix coefficients. + # This does not passes the pySDC tests ... however the default S computation + # in qmat uses Q matrix coefficients differences, and that's what we + # use by using the parent property from the generator object. + self.Smat = S + self.delta_m = self._gen_deltas @staticmethod @@ -126,100 +115,6 @@ def evaluate(weights, data): return np.dot(weights, data) - def _getWeights(self, a, b): - """ - Computes weights using barycentric interpolation - - Args: - a (float): left interval boundary - b (float): right interval boundary - - Returns: - numpy.ndarray: weights of the collocation formula given by the nodes - """ - if self.nodes is None: - raise CollocationError(f"Need nodes before computing weights, got {self.nodes}") - - # Instantiate the Lagrange interpolator object - approx = LagrangeApproximation(self.nodes) - - # Compute weights - tLeft = np.ravel(self.tleft)[0] - tRight = np.ravel(self.tright)[0] - weights = approx.getIntegrationMatrix([(tLeft, tRight)], numQuad='FEJER') - - return np.ravel(weights) - - @property - def _getNodes(self): - """ - Computes nodes using an internal NodesGenerator object - - Returns: - np.ndarray: array of Gauss-Legendre nodes - """ - # Generate normalized nodes in [-1, 1] - nodes = self.nodeGenerator.getNodes(self.num_nodes) - - # Scale nodes to [tleft, tright] - a = self.tleft - b = self.tright - nodes += 1.0 - nodes /= 2.0 - nodes *= b - a - nodes += a - - if self.left_is_node: - nodes[0] = self.tleft - if self.right_is_node: - nodes[-1] = self.tright - - return nodes - - @property - def _gen_Qmatrix(self): - """ - Compute tleft-to-node integration matrix for later use in collocation formulation - - Returns: - numpy.ndarray: matrix containing the weights for tleft to node - """ - if self.nodes is None: - raise CollocationError(f"Need nodes before computing weights, got {self.nodes}") - M = self.num_nodes - Q = np.zeros([M + 1, M + 1]) - - # Instantiate the Lagrange interpolator object - approx = LagrangeApproximation(self.nodes) - - # Compute tleft-to-node integration matrix - tLeft = np.ravel(self.tleft)[0] - intervals = [(tLeft, tau) for tau in self.nodes] - intQ = approx.getIntegrationMatrix(intervals, numQuad='FEJER') - - # Store into Q matrix - Q[1:, 1:] = intQ - - return Q - - @property - def _gen_Smatrix(self): - """ - Compute node-to-node integration matrix for later use in collocation formulation - - Returns: - numpy.ndarray: matrix containing the weights for node to node - """ - M = self.num_nodes - Q = self.Qmat - S = np.zeros([M + 1, M + 1]) - - S[1, :] = Q[1, :] - for m in np.arange(2, M + 1): - S[m, :] = Q[m, :] - Q[m - 1, :] - - return S - @property def _gen_deltas(self): """ diff --git a/pySDC/core/Lagrange.py b/pySDC/core/Lagrange.py deleted file mode 100644 index 3733eee1a0..0000000000 --- a/pySDC/core/Lagrange.py +++ /dev/null @@ -1,247 +0,0 @@ -import numpy as np -from scipy.special import roots_legendre - - -def computeFejerRule(n): - """ - Compute a Fejer rule of the first kind, using DFT (Waldvogel 2006) - Inspired from quadpy (https://github.com/nschloe/quadpy @Nico_Schlömer) - - Parameters - ---------- - n : int - Number of points for the quadrature rule. - - Returns - ------- - nodes : np.1darray(n) - The nodes of the quadrature rule - weights : np.1darray(n) - The weights of the quadrature rule. - """ - # Initialize output variables - n = int(n) - nodes = np.empty(n, dtype=float) - weights = np.empty(n, dtype=float) - - # Compute nodes - theta = np.arange(1, n + 1, dtype=float)[-1::-1] - theta *= 2 - theta -= 1 - theta *= np.pi / (2 * n) - np.cos(theta, out=nodes) - - # Compute weights - # -- Initial variables - N = np.arange(1, n, 2) - lN = len(N) - m = n - lN - K = np.arange(m) - # -- Build v0 - v0 = np.concatenate([2 * np.exp(1j * np.pi * K / n) / (1 - 4 * K**2), np.zeros(lN + 1)]) - # -- Build v1 from v0 - v1 = np.empty(len(v0) - 1, dtype=complex) - np.conjugate(v0[:0:-1], out=v1) - v1 += v0[:-1] - # -- Compute inverse Fourier transform - w = np.fft.ifft(v1) - if max(w.imag) > 1.0e-15: - raise ValueError(f'Max imaginary value to important for ifft: {max(w.imag)}') - # -- Store weights - weights[:] = w.real - - return nodes, weights - - -class LagrangeApproximation(object): - r""" - Class approximating any function on a given set of points using barycentric - Lagrange interpolation. - - Let note :math:`(t_j)_{0\leq j`_. - - Parameters - ---------- - points : list, tuple or np.1darray - The given interpolation points, no specific scaling, but must be - ordered in increasing order. - - Attributes - ---------- - points : np.1darray - The interpolating points - weights : np.1darray - The associated barycentric weights - """ - - def __init__(self, points, fValues=None): - points = np.asarray(points).ravel() - - diffs = points[:, None] - points[None, :] - diffs[np.diag_indices_from(diffs)] = 1 - - def analytic(diffs): - # Fast implementation (unstable for large number of points) - invProd = np.prod(diffs, axis=1) - invProd **= -1 - return invProd - - with np.errstate(divide='raise', over='ignore'): - try: - weights = analytic(diffs) - except FloatingPointError: - raise ValueError('Lagrange formula unstable for that much nodes') - - # Store attributes - self.points = points - self.weights = weights - - # Store function values if provided - if fValues is not None: - fValues = np.asarray(fValues) - if fValues.shape != points.shape: - raise ValueError(f'fValues {fValues.shape} has not the correct shape: {points.shape}') - self.fValues = fValues - - def __call__(self, t): - assert self.fValues is not None, "cannot evaluate polynomial without fValues" - t = np.asarray(t) - values = self.getInterpolationMatrix(t.ravel()).dot(self.fValues) - values.shape = t.shape - return values - - @property - def n(self): - return self.points.size - - def getInterpolationMatrix(self, times): - r""" - Compute the interpolation matrix for a given set of discrete "time" - points. - - For instance, if we note :math:`\vec{f}` the vector containing the - :math:`f_j=f(t_j)` values, and :math:`(\tau_m)_{0\leq m`_. - - Attributes - ---------- - node_type : str - The type of node distribution - quad_type : str - The quadrature type - - """ - - def __init__(self, node_type='LEGENDRE', quad_type='LOBATTO'): - """ - - Parameters - ---------- - node_type : str, optional - The type of node distribution, can be - - - EQUID : equidistant nodes - - LEGENDRE : node distribution from Legendre polynomials - - CHEBY-1 : node distribution from Chebychev polynomials (1st kind) - - CHEBY-2 : node distribution from Chebychev polynomials (2nd kind) - - CHEBY-3 : node distribution from Chebychev polynomials (3rd kind) - - CHEBY-4 : node distribution from Chebychev polynomials (4th kind) - - The default is 'LEGENDRE'. - - quad_type : str, optional - The quadrature type, can be - - - GAUSS : inner point only, no node at boundary - - RADAU-LEFT : only left boundary as node - - RADAU-RIGHT : only right boundary as node - - LOBATTO : left and right boundary as node - - The default is 'LOBATTO'. - """ - - # Check argument validity - for arg, vals in zip(['node_type', 'quad_type'], [NODE_TYPES, QUAD_TYPES]): - val = eval(arg) - if val not in vals: - raise NodesError(f"{arg}='{val}' not implemented, must be in {vals}") - - # Store attributes - self.node_type = node_type - self.quad_type = quad_type - - def getNodes(self, num_nodes): - """ - Computes a given number of quadrature nodes. - - Parameters - ---------- - num_nodes : int - Number of nodes to compute. - - Returns - ------- - nodes : np.1darray - Nodes located in [-1, 1], in increasing order. - """ - # Check number of nodes - if self.quad_type in ['LOBATTO', 'RADAU-LEFT'] and num_nodes < 2: - raise NodesError(f"num_nodes must be larger than 2 for {self.quad_type}, but got {num_nodes}") - elif num_nodes < 1: - raise NodesError("you surely want at least one node ;)") - - # Equidistant nodes - if self.node_type == 'EQUID': - if self.quad_type == 'GAUSS': - return np.linspace(-1, 1, num=num_nodes + 2)[1:-1] - elif self.quad_type == 'LOBATTO': - return np.linspace(-1, 1, num=num_nodes) - elif self.quad_type == 'RADAU-RIGHT': - return np.linspace(-1, 1, num=num_nodes + 1)[1:] - elif self.quad_type == 'RADAU-LEFT': - return np.linspace(-1, 1, num=num_nodes + 1)[:-1] - - # Quadrature nodes linked to orthogonal polynomials - alpha, beta = self.getTridiagCoefficients(num_nodes) - nodes = eigh_tridiagonal(alpha, np.sqrt(beta[1:]))[0] - nodes.sort() - - return nodes - - def getOrthogPolyCoefficients(self, num_coeff): - """ - Produces a given number of analytic three-term recurrence coefficients. - - Parameters - ---------- - num_coeff : int - Number of coefficients to compute. - - Returns - ------- - alpha : np.1darray - The alpha coefficients of the three-term recurrence. - beta : np.1darray - The beta coefficients of the three-term recurrence. - """ - if self.node_type == 'LEGENDRE': - k = np.arange(num_coeff, dtype=float) - alpha = 0 * k - beta = k**2 / (4 * k**2 - 1) - beta[0] = 2 - elif self.node_type == 'CHEBY-1': - alpha = np.zeros(num_coeff) - beta = np.full(num_coeff, 0.25) - beta[0] = np.pi - if num_coeff > 1: - beta[1] = 0.5 - elif self.node_type == 'CHEBY-2': - alpha = np.zeros(num_coeff) - beta = np.full(num_coeff, 0.25) - beta[0] = np.pi / 2 - elif self.node_type == 'CHEBY-3': - alpha = np.zeros(num_coeff) - alpha[0] = 0.5 - beta = np.full(num_coeff, 0.25) - beta[0] = np.pi - elif self.node_type == 'CHEBY-4': - alpha = np.zeros(num_coeff) - alpha[0] = -0.5 - beta = np.full(num_coeff, 0.25) - beta[0] = np.pi - return alpha, beta - - def evalOrthogPoly(self, t, alpha, beta): - """ - Evaluates the two higher order orthogonal polynomials corresponding - to the given (alpha,beta) coefficients. - - Parameters - ---------- - t : float or np.1darray - The point where to evaluate the orthogonal polynomials. - alpha : np.1darray - The alpha coefficients of the three-term recurrence. - beta : np.1darray - The beta coefficients of the three-term recurrence. - - Returns - ------- - pi[0] : float or np.1darray - The second higher order orthogonal polynomial evaluation. - pi[1] : float or np.1darray - The higher oder orthogonal polynomial evaluation. - """ - t = np.asarray(t, dtype=float) - pi = np.array([np.zeros_like(t) for i in range(3)]) - pi[1:] += 1 - for alpha_j, beta_j in zip(alpha, beta): - pi[2] *= t - alpha_j - pi[0] *= beta_j - pi[2] -= pi[0] - pi[0] = pi[1] - pi[1] = pi[2] - return pi[0], pi[1] - - def getTridiagCoefficients(self, num_nodes): - """ - Computes recurrence coefficients for the tridiagonal Jacobian matrix, - taking into account the quadrature type. - - Parameters - ---------- - num_nodes : int - Number of nodes that should be computed from those coefficients. - - Returns - ------- - alpha : np.1darray - The modified alpha coefficients of the three-term recurrence. - beta : np.1darray - The modified beta coefficients of the three-term recurrence. - """ - # Coefficients for Gauss quadrature type - alpha, beta = self.getOrthogPolyCoefficients(num_nodes) - - # If not Gauss quadrature type, modify the alpha/beta coefficients - if self.quad_type.startswith('RADAU'): - b = -1.0 if self.quad_type.endswith('LEFT') else 1.0 - b1, b2 = self.evalOrthogPoly(b, alpha[:-1], beta[:-1])[:2] - alpha[-1] = b - beta[-1] * b1 / b2 - elif self.quad_type == 'LOBATTO': - a, b = -1.0, 1.0 - a2, a1 = self.evalOrthogPoly(a, alpha[:-1], beta[:-1])[:2] - b2, b1 = self.evalOrthogPoly(b, alpha[:-1], beta[:-1])[:2] - alpha[-1], beta[-1] = np.linalg.solve([[a1, a2], [b1, b2]], [a * a1, b * b1]) - return alpha, beta diff --git a/pySDC/core/Sweeper.py b/pySDC/core/Sweeper.py index 2761f2acd8..f9c38370d3 100644 --- a/pySDC/core/Sweeper.py +++ b/pySDC/core/Sweeper.py @@ -1,10 +1,6 @@ import logging -import warnings - import numpy as np -import scipy as sp -import scipy.linalg -import scipy.optimize as opt +from qmat import QDELTA_GENERATORS from pySDC.core.Errors import ParameterError from pySDC.core.Level import level @@ -78,322 +74,25 @@ def __init__(self, params): self.parallelizable = False - def get_Qdelta_implicit(self, coll, qd_type): - def rho(x): - return max(abs(np.linalg.eigvals(np.eye(m) - np.diag([x[i] for i in range(m)]).dot(coll.Qmat[1:, 1:])))) + def get_Qdelta_implicit(self, coll:CollBase, qd_type, k=None): QDmat = np.zeros(coll.Qmat.shape) - if qd_type == 'LU': - QT = coll.Qmat[1:, 1:].T - [_, _, U] = scipy.linalg.lu(QT, overwrite_a=True) - QDmat[1:, 1:] = U.T - elif qd_type == 'LU2': - QT = coll.Qmat[1:, 1:].T - [_, _, U] = scipy.linalg.lu(QT, overwrite_a=True) - QDmat[1:, 1:] = 2 * U.T - elif qd_type == 'TRAP': - for m in range(coll.num_nodes + 1): - QDmat[m, 1 : m + 1] = coll.delta_m[0:m] - for m in range(coll.num_nodes + 1): - QDmat[m, 0:m] += coll.delta_m[0:m] - QDmat /= 2.0 - elif qd_type == 'IE': - for m in range(coll.num_nodes + 1): - QDmat[m, 1 : m + 1] = coll.delta_m[0:m] - elif qd_type == 'IEpar': - for m in range(coll.num_nodes + 1): - QDmat[m, m] = np.sum(coll.delta_m[0:m]) - self.parallelizable = True - elif qd_type == 'Qpar': - QDmat = np.diag(np.diag(coll.Qmat)) - self.parallelizable = True - elif qd_type == 'GS': - QDmat = np.tril(coll.Qmat) - elif qd_type == 'PIC': - QDmat = np.zeros(coll.Qmat.shape) - self.parallelizable = True - elif qd_type == 'MIN': - m = QDmat.shape[0] - 1 - x0 = 10 * np.ones(m) - d = opt.minimize(rho, x0, method='Nelder-Mead') - QDmat[1:, 1:] = np.linalg.inv(np.diag(d.x)) - self.parallelizable = True - elif qd_type.startswith('MIN-SR-FLEX'): - m = QDmat.shape[0] - 1 - try: - k = abs(int(qd_type[11:])) - except ValueError: - k = 1 - d = min(k, m) - QDmat[1:, 1:] = np.diag(coll.nodes) / d - self.parallelizable = True - elif qd_type in ['MIN_GT', 'MIN-SR-NS']: - m = QDmat.shape[0] - 1 - QDmat[1:, 1:] = np.diag(coll.nodes) / m - self.parallelizable = True - elif qd_type == 'MIN3': - m = QDmat.shape[0] - 1 - x = None - # These values have been obtained using Indie Solver, a commercial solver for black-box optimization which - # aggregates several state-of-the-art optimization methods (free academic subscription plan) - # objective function: sum over 17^2 values of lamdt, real and imaginary (WORKS SURPRISINGLY WELL!) - if coll.node_type == 'LEGENDRE' and coll.quad_type == 'LOBATTO': - if m == 9: - # rho = 0.154786693955 - x = [ - 0.0, - 0.14748983547536937, - 0.1243753767395874, - 0.08797965969063823, - 0.03249792877433364, - 0.06171633442251176, - 0.08995295998705832, - 0.1080641868728824, - 0.11621787232558443, - ] - elif m == 7: - # rho = 0.0979351256833 - x = [ - 0.0, - 0.18827968699454273, - 0.1307213945012976, - 0.04545003319140543, - 0.08690617895312261, - 0.12326429119922168, - 0.13815746843252427, - ] - elif m == 5: - # rho = 0.0513543155235 - x = [0.0, 0.2994085231050721, 0.07923154575177252, 0.14338847088077, 0.17675509273708057] - elif m == 4: - # rho = 0.0381589713397 - x = [0.0, 0.2865524188780046, 0.11264992497015984, 0.2583063168320655] - elif m == 3: - # rho = 0.013592619664 - x = [0.0, 0.2113181799416633, 0.3943250920445912] - elif m == 2: - # rho = 0 - x = [0.0, 0.5] - else: - NotImplementedError( - 'This combination of preconditioner, node type and node number is not ' 'implemented' - ) - elif coll.node_type == 'LEGENDRE' and coll.quad_type == 'RADAU-RIGHT': - if m == 9: - # rho = 0.151784861385 - x = [ - 0.14208076083211416, - 0.1288153963623986, - 0.10608601069476883, - 0.07509520272252024, - 0.027986167728305308, - 0.05351160749903067, - 0.07911315989747868, - 0.09514844658836666, - 0.10204992319487571, - ] - elif m == 7: - # rho = 0.116400161888 - x = [ - 0.15223871397682717, - 0.12625448001038536, - 0.08210714764924298, - 0.03994434742760019, - 0.1052662547386142, - 0.14075805578834127, - 0.15636085758812895, - ] - elif m == 5: - # rho = 0.0783352996958 (iteration 5355) - x = [ - 0.2818591930905709, - 0.2011358490453793, - 0.06274536689514164, - 0.11790265267514095, - 0.1571629578515223, - ] - elif m == 4: - # rho = 0.057498908343 - x = [0.3198786751412953, 0.08887606314792469, 0.1812366328324738, 0.23273925017954] - elif m == 3: - # rho = 0.038744192979 (iteration 11188) - x = [0.3203856825077055, 0.1399680686269595, 0.3716708461097372] - elif m == 2: - # rho = 0.0208560702294 (iteration 6690) - x = [0.2584092406077449, 0.6449261740461826] - else: - raise NotImplementedError( - 'This combination of preconditioner, node type and node number is not implemented' - ) - elif coll.node_type == 'EQUID' and coll.quad_type == 'RADAU-RIGHT': - if m == 9: - # rho = 0.251820022583 (iteration 32402) - x = [ - 0.04067333763109274, - 0.06893408176924318, - 0.0944460427779633, - 0.11847528720123894, - 0.14153236351607695, - 0.1638856774260845, - 0.18569759470199648, - 0.20707543960267513, - 0.2280946565716198, - ] - elif m == 7: - # rho = 0.184582997611 (iteration 44871) - x = [ - 0.0582690792096515, - 0.09937620459067688, - 0.13668728443669567, - 0.1719458323664216, - 0.20585615258818232, - 0.2387890485242656, - 0.27096908017041393, - ] - elif m == 5: - # rho = 0.118441339197 (iteration 34581) - x = [ - 0.0937126798932547, - 0.1619131388001843, - 0.22442341539247537, - 0.28385142992912565, - 0.3412523013467262, - ] - elif m == 4: - # rho = 0.0844043254542 (iteration 33099) - x = [0.13194852204686872, 0.2296718892453916, 0.3197255970017318, 0.405619746972393] - elif m == 3: - # rho = 0.0504635143866 (iteration 9783) - x = [0.2046955744931575, 0.3595744268324041, 0.5032243650307717] - elif m == 2: - # rho = 0.0214806480623 (iteration 6109) - x = [0.3749891032632652, 0.6666472946796036] - else: - NotImplementedError( - 'This combination of preconditioner, node type and node number is not ' 'implemented' - ) - else: - NotImplementedError( - 'This combination of preconditioner, node type and node number is not ' 'implemented' + try: + assert QDELTA_GENERATORS[qd_type] == type(self.generator) + except (AssertionError, AttributeError): + self.generator = QDELTA_GENERATORS[qd_type]( + # for algebraic types (LU, ...) + Q=coll.generator.Q, + # for MIN in tables, MIN-SR-S ... + nNodes=coll.num_nodes, nodeType=coll.node_type, quadType=coll.quad_type, + # for time-stepping types, MIN-SR-NS + nodes=coll.nodes, ) - QDmat[1:, 1:] = np.diag(x) - self.parallelizable = True - - elif qd_type == "MIN-SR-S": - M = QDmat.shape[0] - 1 - quadType = coll.quad_type - nodeType = coll.node_type - - # Main function to compute coefficients - def computeCoeffs(M, a=None, b=None): - """ - Compute diagonal coefficients for a given number of nodes M. - If `a` and `b` are given, then it uses as initial guess: - - >>> a * nodes**b / M - - If `a` is not given, then do not care about `b` and uses as initial guess: - - >>> nodes / M - - Parameters - ---------- - M : int - Number of collocation nodes. - a : float, optional - `a` coefficient for the initial guess. - b : float, optional - `b` coefficient for the initial guess. - - Returns - ------- - coeffs : array - The diagonal coefficients. - nodes : array - The nodes associated to the current coefficients. - """ - collM = CollBase(num_nodes=M, node_type=nodeType, quad_type=quadType) - - QM = collM.Qmat[1:, 1:] - nodesM = collM.nodes - - if quadType in ['LOBATTO', 'RADAU-LEFT']: - QM = QM[1:, 1:] - nodesM = nodesM[1:] - nCoeffs = len(nodesM) - - if nCoeffs == 1: - coeffs = np.diag(QM) - - else: - - def nilpotency(coeffs): - """Function verifying the nilpotency from given coefficients""" - coeffs = np.asarray(coeffs) - kMats = [(1 - z) * np.eye(nCoeffs) + z * np.diag(1 / coeffs) @ QM for z in nodesM] - vals = [np.linalg.det(K) - 1 for K in kMats] - return np.array(vals) - - if a is None: - coeffs0 = nodesM / M - else: - coeffs0 = a * nodesM**b / M - - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - coeffs = sp.optimize.fsolve(nilpotency, coeffs0, xtol=1e-15) - - # Handle first node equal to zero - if quadType in ['LOBATTO', 'RADAU-LEFT']: - coeffs = np.asarray([0.0] + list(coeffs)) - nodesM = np.asarray([0.0] + list(nodesM)) - - return coeffs, nodesM - - def fit(coeffs, nodes): - """Function fitting given coefficients to a power law""" - - def lawDiff(ab): - a, b = ab - return np.linalg.norm(a * nodes**b - coeffs) - - sol = sp.optimize.minimize(lawDiff, [1.0, 1.0], method="nelder-mead") - return sol.x - - # Compute coefficients incrementaly - a, b = None, None - m0 = 2 if quadType in ['LOBATTO', 'RADAU-LEFT'] else 1 - for m in range(m0, M + 1): - coeffs, nodes = computeCoeffs(m, a, b) - if m > 1: - a, b = fit(coeffs * m, nodes) - - QDmat[1:, 1:] = np.diag(coeffs) - self.parallelizable = True - - elif qd_type == "VDHS": - # coefficients from Van der Houwen & Sommeijer, 1991 - - m = QDmat.shape[0] - 1 - - if m == 4 and coll.node_type == 'LEGENDRE' and coll.quad_type == "RADAU-RIGHT": - coeffs = [3055 / 9532, 531 / 5956, 1471 / 8094, 1848 / 7919] - else: - raise NotImplementedError('no VDHS diagonal coefficients for this node configuration') - - QDmat[1:, 1:] = np.diag(coeffs) - self.parallelizable = True - - else: - # see if an explicit preconditioner with this name is available - try: - QDmat = self.get_Qdelta_explicit(coll, qd_type) - self.logger.warning(f'Using explicit preconditioner \"{qd_type}\" on the left hand side!') - except NotImplementedError: - raise NotImplementedError(f'qd_type implicit "{qd_type}" not implemented') + except Exception as e: + raise ValueError(f"could not generate {qd_type=!r} with qmat, got error : {e}") + QDmat[1:, 1:] = self.generator.genCoeffs(k=k) # check if we got not more than a lower triangular matrix - # TODO : this should be a regression test, not run-time ... np.testing.assert_array_equal( np.triu(QDmat, k=1), np.zeros(QDmat.shape), err_msg='Lower triangular matrix expected!' ) @@ -401,22 +100,11 @@ def lawDiff(ab): return QDmat def get_Qdelta_explicit(self, coll, qd_type): - QDmat = np.zeros(coll.Qmat.shape) - if qd_type == 'EE': - for m in range(self.coll.num_nodes + 1): - QDmat[m, 0:m] = self.coll.delta_m[0:m] - elif qd_type == 'GS': - QDmat = np.tril(self.coll.Qmat, k=-1) - elif qd_type == 'PIC': - QDmat = np.zeros(coll.Qmat.shape) - else: - raise NotImplementedError('qd_type explicit not implemented') - + QDmat = self.get_Qdelta_implicit(coll, qd_type) # check if we got not more than a lower triangular matrix np.testing.assert_array_equal( np.triu(QDmat, k=0), np.zeros(QDmat.shape), err_msg='Strictly lower triangular matrix expected!' ) - return QDmat def predict(self): diff --git a/pySDC/implementations/convergence_controller_classes/adaptive_collocation.py b/pySDC/implementations/convergence_controller_classes/adaptive_collocation.py index e4169170a5..d7557bbdcc 100644 --- a/pySDC/implementations/convergence_controller_classes/adaptive_collocation.py +++ b/pySDC/implementations/convergence_controller_classes/adaptive_collocation.py @@ -1,6 +1,6 @@ import numpy as np -from pySDC.core.Lagrange import LagrangeApproximation +from qmat.lagrange import LagrangeApproximation from pySDC.core.ConvergenceController import ConvergenceController, Status from pySDC.core.Collocation import CollBase diff --git a/pySDC/implementations/convergence_controller_classes/estimate_polynomial_error.py b/pySDC/implementations/convergence_controller_classes/estimate_polynomial_error.py index 3f8bcb2c9a..56e1d8dca7 100644 --- a/pySDC/implementations/convergence_controller_classes/estimate_polynomial_error.py +++ b/pySDC/implementations/convergence_controller_classes/estimate_polynomial_error.py @@ -1,6 +1,6 @@ import numpy as np -from pySDC.core.Lagrange import LagrangeApproximation +from qmat.lagrange import LagrangeApproximation from pySDC.core.ConvergenceController import ConvergenceController diff --git a/pySDC/implementations/convergence_controller_classes/interpolate_between_restarts.py b/pySDC/implementations/convergence_controller_classes/interpolate_between_restarts.py index 96383802a8..5ae36d8d20 100644 --- a/pySDC/implementations/convergence_controller_classes/interpolate_between_restarts.py +++ b/pySDC/implementations/convergence_controller_classes/interpolate_between_restarts.py @@ -1,6 +1,6 @@ import numpy as np from pySDC.core.ConvergenceController import ConvergenceController, Status -from pySDC.core.Lagrange import LagrangeApproximation +from qmat.lagrange import LagrangeApproximation class InterpolateBetweenRestarts(ConvergenceController): diff --git a/pySDC/implementations/sweeper_classes/generic_implicit.py b/pySDC/implementations/sweeper_classes/generic_implicit.py index f64bf62db6..6ac5d8119b 100644 --- a/pySDC/implementations/sweeper_classes/generic_implicit.py +++ b/pySDC/implementations/sweeper_classes/generic_implicit.py @@ -66,13 +66,8 @@ def update_nodes(self): M = self.coll.num_nodes # update the MIN-SR-FLEX preconditioner - if self.params.QI.startswith('MIN-SR-FLEX'): - k = L.status.sweep - if k > M: - self.params.QI = "MIN-SR-S" - else: - self.params.QI = 'MIN-SR-FLEX' + str(k) - self.QI = self.get_Qdelta_implicit(self.coll, qd_type=self.params.QI) + if self.params.QI == 'MIN-SR-FLEX': + self.QI = self.get_Qdelta_implicit(self.coll, qd_type="MIN-SR-FLEX", k=L.status.sweep) # gather all terms which are known already (e.g. from the previous iteration) # this corresponds to u0 + QF(u^k) - QdF(u^k) + tau diff --git a/pySDC/playgrounds/Diagonal/qmatrix.py b/pySDC/playgrounds/Diagonal/qmatrix.py index 2e2dba482d..15e114281f 100644 --- a/pySDC/playgrounds/Diagonal/qmatrix.py +++ b/pySDC/playgrounds/Diagonal/qmatrix.py @@ -8,8 +8,8 @@ import numpy as np from scipy.linalg import lu -from pySDC.core.Nodes import NodesGenerator -from pySDC.core.Lagrange import LagrangeApproximation +from qmat.nodes import NodesGenerator +from qmat.lagrange import LagrangeApproximation # Storage for diagonaly optimized QDelta matrices OPT_COEFFS = { diff --git a/pySDC/playgrounds/lagrange/quadrature.py b/pySDC/playgrounds/lagrange/quadrature.py index 3e66745c9b..b10ee0fb77 100644 --- a/pySDC/playgrounds/lagrange/quadrature.py +++ b/pySDC/playgrounds/lagrange/quadrature.py @@ -9,7 +9,8 @@ import matplotlib.pyplot as plt from time import time -from pySDC.core import NodesGenerator, LagrangeApproximation +from qmat.nodes import NodesGenerator +from qmat.lagrange import LagrangeApproximation from pySDC.implementations.collocations import Collocation from pySDC.core.Errors import CollocationError diff --git a/pySDC/projects/PinTSimE/switch_estimator.py b/pySDC/projects/PinTSimE/switch_estimator.py index d9e9574544..32ce40ae2a 100644 --- a/pySDC/projects/PinTSimE/switch_estimator.py +++ b/pySDC/projects/PinTSimE/switch_estimator.py @@ -5,7 +5,7 @@ from pySDC.core.Collocation import CollBase from pySDC.core.ConvergenceController import ConvergenceController, Status from pySDC.implementations.convergence_controller_classes.check_convergence import CheckConvergence -from pySDC.core.Lagrange import LagrangeApproximation +from qmat.lagrange import LagrangeApproximation class SwitchEstimator(ConvergenceController): diff --git a/pySDC/projects/Resilience/quench.py b/pySDC/projects/Resilience/quench.py index 9cc1767b5b..ee6fe2e173 100644 --- a/pySDC/projects/Resilience/quench.py +++ b/pySDC/projects/Resilience/quench.py @@ -248,7 +248,7 @@ def get_crossing_time(stats, controller, num_points=5, inter_points=50, temperat Returns: float: The time when the temperature threshold is crossed """ - from pySDC.core.Lagrange import LagrangeApproximation + from qmat.lagrange import LagrangeApproximation from pySDC.core.Collocation import CollBase P = controller.MS[0].levels[0].prob diff --git a/pySDC/tests/test_collocation.py b/pySDC/tests/test_collocation.py index 8bfad123e7..928de1ebf9 100644 --- a/pySDC/tests/test_collocation.py +++ b/pySDC/tests/test_collocation.py @@ -3,115 +3,118 @@ from pySDC.core.Collocation import CollBase -t_start = np.random.rand(1) * 0.2 -t_end = 0.8 + np.random.rand(1) * 0.2 +t_start = np.random.rand(1)[0] * 0.2 +t_end = 0.8 + np.random.rand(1)[0] * 0.2 tolQuad = 1e-13 -node_types = ['EQUID', 'LEGENDRE'] -quad_types = ['GAUSS', 'LOBATTO', 'RADAU-RIGHT', 'RADAU-LEFT'] +NODE_TYPES = ['EQUID', 'LEGENDRE'] +QUAD_TYPES = ['GAUSS', 'LOBATTO', 'RADAU-RIGHT', 'RADAU-LEFT'] @pytest.mark.base -@pytest.mark.parametrize("node_type", node_types) -@pytest.mark.parametrize("quad_type", quad_types) -def test_canintegratepolynomials(node_type, quad_type): - for M in range(2, 13): - coll = CollBase(M, t_start, t_end, node_type=node_type, quad_type=quad_type) +@pytest.mark.parametrize("quadType", QUAD_TYPES) +@pytest.mark.parametrize("nodeType", NODE_TYPES) +@pytest.mark.parametrize("nNodes", range(2, 13)) +def test_canintegratepolynomials(nNodes, nodeType, quadType): + M = nNodes + coll = CollBase(M, t_start, t_end, node_type=nodeType, quad_type=quadType) + # some basic consistency tests + assert np.size(coll.nodes) == np.size(coll.weights), ( + "For node type " + coll.__class__.__name__ + ", number of entries in nodes and weights is different" + ) + assert np.size(coll.nodes) == M, ( + "For node type " + + coll.__class__.__name__ + + ", requesting M nodes did not produce M entries in nodes and weights" + ) - # some basic consistency tests - assert np.size(coll.nodes) == np.size(coll.weights), ( - "For node type " + coll.__class__.__name__ + ", number of entries in nodes and weights is different" - ) - assert np.size(coll.nodes) == M, ( + # generate random set of polynomial coefficients + poly_coeff = np.random.rand(coll.order - 1) + # evaluate polynomial at collocation nodes + poly_vals = np.polyval(poly_coeff, coll.nodes) + # use python's polyint function to compute anti-derivative of polynomial + poly_int_coeff = np.polyint(poly_coeff) + # Compute integral from 0.0 to 1.0 + int_ex = np.polyval(poly_int_coeff, t_end) - np.polyval(poly_int_coeff, t_start) + # use quadrature rule to compute integral + int_coll = coll.evaluate(coll.weights, poly_vals) + # For large values of M, substantial differences from different round of error have to be considered + assert abs(int_ex - int_coll) < tolQuad, ( + "For node type " + + coll.__class__.__name__ + + ", failed to integrate polynomial of degree " + + str(coll.order - 1) + + " exactly. Error: %5.3e" % abs(int_ex - int_coll) + ) + + +@pytest.mark.base +@pytest.mark.parametrize("quadType", QUAD_TYPES) +@pytest.mark.parametrize("nodeType", NODE_TYPES) +@pytest.mark.parametrize("nNodes", range(2, 13)) +def test_relateQandSmat(nNodes, nodeType, quadType): + M = nNodes + coll = CollBase(M, t_start, t_end, node_type=nodeType, quad_type=quadType) + Q = coll.Qmat[1:, 1:] + S = coll.Smat[1:, 1:] + assert np.shape(Q) == np.shape(S), ( + "For node type " + coll.__class__.__name__ + ", Qmat and Smat have different shape" + ) + shape = np.shape(Q) + assert shape[0] == shape[1], "For node type " + coll.__class__.__name__ + ", Qmat / Smat are not quadratic" + SSum = np.cumsum(S[:, :], axis=0) + for i in range(0, M): + assert np.linalg.norm(Q[i, :] - SSum[i, :]) < 1e-15, ( "For node type " + coll.__class__.__name__ - + ", requesting M nodes did not produce M entries in nodes and weights" + + ", Qmat and Smat did not satisfy the expected summation property." ) - # generate random set of polynomial coefficients - poly_coeff = np.random.rand(coll.order - 1) - # evaluate polynomial at collocation nodes - poly_vals = np.polyval(poly_coeff, coll.nodes) - # use python's polyint function to compute anti-derivative of polynomial - poly_int_coeff = np.polyint(poly_coeff) - # Compute integral from 0.0 to 1.0 - int_ex = np.polyval(poly_int_coeff, t_end) - np.polyval(poly_int_coeff, t_start) - # use quadrature rule to compute integral - int_coll = coll.evaluate(coll.weights, poly_vals) - # For large values of M, substantial differences from different round of error have to be considered + +@pytest.mark.base +@pytest.mark.parametrize("quadType", QUAD_TYPES) +@pytest.mark.parametrize("nodeType", NODE_TYPES) +@pytest.mark.parametrize("nNodes", range(2, 13)) +def test_partialquadraturewithQ(nNodes, nodeType, quadType): + M = nNodes + coll = CollBase(M, t_start, t_end, node_type=nodeType, quad_type=quadType) + Q = coll.Qmat[1:, 1:] + # as in TEST 1, create and integrate a polynomial with random coefficients, but now of degree M-1 + degree = min(coll.order, M - 1) + poly_coeff = np.random.rand(degree) + poly_vals = np.polyval(poly_coeff, coll.nodes) + poly_int_coeff = np.polyint(poly_coeff) + for i in range(0, M): + int_ex = np.polyval(poly_int_coeff, coll.nodes[i]) - np.polyval(poly_int_coeff, t_start) + int_coll = np.dot(poly_vals, Q[i, :]) assert abs(int_ex - int_coll) < tolQuad, ( "For node type " + coll.__class__.__name__ - + ", failed to integrate polynomial of degree " - + str(coll.order - 1) - + " exactly. Error: %5.3e" % abs(int_ex - int_coll) + + ", partial quadrature from Qmat rule failed to integrate polynomial of degree M-1 exactly for M = " + + str(M) ) @pytest.mark.base -@pytest.mark.parametrize("node_type", node_types) -@pytest.mark.parametrize("quad_type", quad_types) -def test_relateQandSmat(node_type, quad_type): - for M in range(2, 13): - coll = CollBase(M, t_start, t_end, node_type=node_type, quad_type=quad_type) - Q = coll.Qmat[1:, 1:] - S = coll.Smat[1:, 1:] - assert np.shape(Q) == np.shape(S), ( - "For node type " + coll.__class__.__name__ + ", Qmat and Smat have different shape" +@pytest.mark.parametrize("quadType", QUAD_TYPES) +@pytest.mark.parametrize("nodeType", NODE_TYPES) +@pytest.mark.parametrize("nNodes", range(2, 13)) +def test_partialquadraturewithS(nNodes, nodeType, quadType): + M = nNodes + coll = CollBase(M, t_start, t_end, node_type=nodeType, quad_type=quadType) + S = coll.Smat[1:, 1:] + # as in TEST 1, create and integrate a polynomial with random coefficients, but now of degree M-1 + degree = min(coll.order, M - 1) + poly_coeff = np.random.rand(degree) + poly_vals = np.polyval(poly_coeff, coll.nodes) + poly_int_coeff = np.polyint(poly_coeff) + for i in range(1, M): + int_ex = np.polyval(poly_int_coeff, coll.nodes[i]) - np.polyval(poly_int_coeff, coll.nodes[i - 1]) + int_coll = np.dot(poly_vals, S[i, :]) + assert abs(int_ex - int_coll) < tolQuad, ( + "For node type " + + coll.__class__.__name__ + + ", partial quadrature rule from Smat failed to integrate polynomial of degree M-1 exactly for M = " + + str(M) ) - shape = np.shape(Q) - assert shape[0] == shape[1], "For node type " + coll.__class__.__name__ + ", Qmat / Smat are not quadratic" - SSum = np.cumsum(S[:, :], axis=0) - for i in range(0, M): - assert np.linalg.norm(Q[i, :] - SSum[i, :]) < 1e-15, ( - "For node type " - + coll.__class__.__name__ - + ", Qmat and Smat did not satisfy the expected summation property." - ) - - -@pytest.mark.base -@pytest.mark.parametrize("node_type", node_types) -@pytest.mark.parametrize("quad_type", quad_types) -def test_partialquadraturewithQ(node_type, quad_type): - for M in range(2, 13): - coll = CollBase(M, t_start, t_end, node_type=node_type, quad_type=quad_type) - Q = coll.Qmat[1:, 1:] - # as in TEST 1, create and integrate a polynomial with random coefficients, but now of degree M-1 - degree = min(coll.order, M - 1) - poly_coeff = np.random.rand(degree) - poly_vals = np.polyval(poly_coeff, coll.nodes) - poly_int_coeff = np.polyint(poly_coeff) - for i in range(0, M): - int_ex = np.polyval(poly_int_coeff, coll.nodes[i]) - np.polyval(poly_int_coeff, t_start) - int_coll = np.dot(poly_vals, Q[i, :]) - assert abs(int_ex - int_coll) < tolQuad, ( - "For node type " - + coll.__class__.__name__ - + ", partial quadrature from Qmat rule failed to integrate polynomial of degree M-1 exactly for M = " - + str(M) - ) - - -@pytest.mark.base -@pytest.mark.parametrize("node_type", node_types) -@pytest.mark.parametrize("quad_type", quad_types) -def test_partialquadraturewithS(node_type, quad_type): - for M in range(2, 13): - coll = CollBase(M, t_start, t_end, node_type=node_type, quad_type=quad_type) - S = coll.Smat[1:, 1:] - # as in TEST 1, create and integrate a polynomial with random coefficients, but now of degree M-1 - degree = min(coll.order, M - 1) - poly_coeff = np.random.rand(degree) - poly_vals = np.polyval(poly_coeff, coll.nodes) - poly_int_coeff = np.polyint(poly_coeff) - for i in range(1, M): - int_ex = np.polyval(poly_int_coeff, coll.nodes[i]) - np.polyval(poly_int_coeff, coll.nodes[i - 1]) - int_coll = np.dot(poly_vals, S[i, :]) - assert abs(int_ex - int_coll) < tolQuad, ( - "For node type " - + coll.__class__.__name__ - + ", partial quadrature rule from Smat failed to integrate polynomial of degree M-1 exactly for M = " - + str(M) - ) diff --git a/pySDC/tests/test_convergence_controllers/test_InterpolateBetweenRestarts.py b/pySDC/tests/test_convergence_controllers/test_InterpolateBetweenRestarts.py index c26a739a69..4204327e79 100644 --- a/pySDC/tests/test_convergence_controllers/test_InterpolateBetweenRestarts.py +++ b/pySDC/tests/test_convergence_controllers/test_InterpolateBetweenRestarts.py @@ -1,8 +1,7 @@ import pytest from pySDC.core.Hooks import hooks -from pySDC.core.Lagrange import LagrangeApproximation -from pySDC.core.Collocation import CollBase +from qmat.lagrange import LagrangeApproximation import numpy as np diff --git a/pySDC/tests/test_lagrange.py b/pySDC/tests/test_lagrange.py deleted file mode 100644 index 58833a2135..0000000000 --- a/pySDC/tests/test_lagrange.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Fri Jan 20 14:52:18 2023 - -@author: telu -""" -import pytest -import numpy as np - -from pySDC.core.Lagrange import LagrangeApproximation - -# Pre-compute reference integration matrix -nNodes = 5 -approx = LagrangeApproximation(np.linspace(0, 1, nNodes)) -nIntegPoints = 13 -tEndVals = np.linspace(0, 1, nIntegPoints) -integMatRef = approx.getIntegrationMatrix([(0, t) for t in tEndVals]) - - -@pytest.mark.base -@pytest.mark.parametrize("numQuad", ["LEGENDRE_NUMPY", "LEGENDRE_SCIPY"]) -def test_numericalQuadrature(numQuad): - integMat = approx.getIntegrationMatrix([(0, t) for t in tEndVals], numQuad=numQuad) - assert np.allclose(integMat, integMatRef) diff --git a/pySDC/tests/test_nodes.py b/pySDC/tests/test_nodes.py deleted file mode 100644 index dc98f6766e..0000000000 --- a/pySDC/tests/test_nodes.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Wed Jan 4 11:58:05 2023 - -@author: cpf5546 -""" -import pytest -import numpy as np - -from pySDC.core.Nodes import NodesGenerator - - -def chebyNodes(kind, n): - i = np.arange(n, dtype=float) + 1 - i = i[-1::-1] - if kind == 1: - nodes = np.cos((i - 0.5) / n * np.pi) - elif kind == 2: - nodes = np.cos(i / (n + 1) * np.pi) - elif kind == 3: - nodes = np.cos((i - 0.5) / (n + 0.5) * np.pi) - elif kind == 4: - nodes = np.cos(i / (n + 0.5) * np.pi) - return tuple(nodes) - - -REF_NODES = { - 'LEGENDRE': { - 2: (-1 / 3**0.5, 1 / 3**0.5), - 3: (-((3 / 5) ** 0.5), 0, (3 / 5) ** 0.5), - 4: ( - -((3 / 7 + 2 / 7 * (6 / 5) ** 0.5) ** 0.5), - -((3 / 7 - 2 / 7 * (6 / 5) ** 0.5) ** 0.5), - (3 / 7 - 2 / 7 * (6 / 5) ** 0.5) ** 0.5, - (3 / 7 + 2 / 7 * (6 / 5) ** 0.5) ** 0.5, - ), - 5: ( - -1 / 3 * (5 + 2 * (10 / 7) ** 0.5) ** 0.5, - -1 / 3 * (5 - 2 * (10 / 7) ** 0.5) ** 0.5, - 0, - 1 / 3 * (5 - 2 * (10 / 7) ** 0.5) ** 0.5, - 1 / 3 * (5 + 2 * (10 / 7) ** 0.5) ** 0.5, - ), - } -} - -nTests = list(REF_NODES['LEGENDRE'].keys()) -for kind in [1, 2, 3, 4]: - REF_NODES[f'CHEBY-{kind}'] = {n: chebyNodes(kind, n) for n in nTests} - - -@pytest.mark.base -@pytest.mark.parametrize("node_type", REF_NODES.keys()) -def test_nodesGeneration(node_type): - gen = NodesGenerator(node_type=node_type, quad_type='GAUSS') - ref = REF_NODES[node_type] - for n, nodes in ref.items(): - assert np.allclose(nodes, gen.getNodes(n)) From 01846effd04c840cd321967879c6d77bff42667d Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Fri, 21 Jun 2024 17:26:42 +0200 Subject: [PATCH 07/38] TL: adapted numpy2 changes --- pySDC/projects/parallelSDC/environment.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pySDC/projects/parallelSDC/environment.yml b/pySDC/projects/parallelSDC/environment.yml index 7d5baaebbd..a335f3d4ca 100644 --- a/pySDC/projects/parallelSDC/environment.yml +++ b/pySDC/projects/parallelSDC/environment.yml @@ -11,3 +11,6 @@ dependencies: - dill>=0.2.6 - mpich - mpi4py>=3.0.0 + - pip + - pip: + - qmat From f4d056957e8e80a196e3a9a8b37f9157a2bf18b8 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Fri, 21 Jun 2024 17:33:17 +0200 Subject: [PATCH 08/38] TL: of course ... --- pySDC/core/Sweeper.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pySDC/core/Sweeper.py b/pySDC/core/Sweeper.py index f9c38370d3..c3ce1d1794 100644 --- a/pySDC/core/Sweeper.py +++ b/pySDC/core/Sweeper.py @@ -74,7 +74,7 @@ def __init__(self, params): self.parallelizable = False - def get_Qdelta_implicit(self, coll:CollBase, qd_type, k=None): + def get_Qdelta_implicit(self, coll: CollBase, qd_type, k=None): QDmat = np.zeros(coll.Qmat.shape) try: @@ -84,10 +84,12 @@ def get_Qdelta_implicit(self, coll:CollBase, qd_type, k=None): # for algebraic types (LU, ...) Q=coll.generator.Q, # for MIN in tables, MIN-SR-S ... - nNodes=coll.num_nodes, nodeType=coll.node_type, quadType=coll.quad_type, + nNodes=coll.num_nodes, + nodeType=coll.node_type, + quadType=coll.quad_type, # for time-stepping types, MIN-SR-NS - nodes=coll.nodes, - ) + nodes=coll.nodes, + ) except Exception as e: raise ValueError(f"could not generate {qd_type=!r} with qmat, got error : {e}") QDmat[1:, 1:] = self.generator.genCoeffs(k=k) From 44757de2a63bb38dc5ad60af795bdeae70e9afce Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Fri, 21 Jun 2024 18:31:59 +0200 Subject: [PATCH 09/38] TL: fixing tests ... --- pySDC/core/Sweeper.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pySDC/core/Sweeper.py b/pySDC/core/Sweeper.py index c3ce1d1794..4c15553e6b 100644 --- a/pySDC/core/Sweeper.py +++ b/pySDC/core/Sweeper.py @@ -74,11 +74,10 @@ def __init__(self, params): self.parallelizable = False - def get_Qdelta_implicit(self, coll: CollBase, qd_type, k=None): - - QDmat = np.zeros(coll.Qmat.shape) + def setupGenerator(self, coll: CollBase, qd_type): try: assert QDELTA_GENERATORS[qd_type] == type(self.generator) + assert self.generator.QDelta.shape[0] == coll.Qmat.shape[0] - 1 except (AssertionError, AttributeError): self.generator = QDELTA_GENERATORS[qd_type]( # for algebraic types (LU, ...) @@ -92,18 +91,24 @@ def get_Qdelta_implicit(self, coll: CollBase, qd_type, k=None): ) except Exception as e: raise ValueError(f"could not generate {qd_type=!r} with qmat, got error : {e}") + + def get_Qdelta_implicit(self, coll: CollBase, qd_type, k=None): + QDmat = np.zeros(coll.Qmat.shape) + self.setupGenerator(coll, qd_type) QDmat[1:, 1:] = self.generator.genCoeffs(k=k) # check if we got not more than a lower triangular matrix np.testing.assert_array_equal( np.triu(QDmat, k=1), np.zeros(QDmat.shape), err_msg='Lower triangular matrix expected!' ) - return QDmat - def get_Qdelta_explicit(self, coll, qd_type): - QDmat = self.get_Qdelta_implicit(coll, qd_type) - # check if we got not more than a lower triangular matrix + def get_Qdelta_explicit(self, coll, qd_type, k=None): + QDmat = np.zeros(coll.Qmat.shape) + self.setupGenerator(coll, qd_type) + QDmat[1:, 1:], QDmat[1:, 0] = self.generator.genCoeffs(k=k, dTau=True) + + # check if we got not more than a strictly lower triangular matrix np.testing.assert_array_equal( np.triu(QDmat, k=0), np.zeros(QDmat.shape), err_msg='Strictly lower triangular matrix expected!' ) From 672461e6db2668815e478e155af5b01c6b57d1bd Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Fri, 21 Jun 2024 18:40:35 +0200 Subject: [PATCH 10/38] TL: fix projects dependencies --- pySDC/projects/AllenCahn_Bayreuth/environment.yml | 3 +++ pySDC/projects/AsympConv/environment.yml | 3 +++ pySDC/projects/DAE/environment.yml | 3 +++ pySDC/projects/FastWaveSlowWave/environment.yml | 3 +++ pySDC/projects/Hamiltonian/environment.yml | 3 +++ pySDC/projects/PinTSimE/environment.yml | 3 +++ pySDC/projects/RDC/environment.yml | 3 +++ pySDC/projects/Resilience/environment.yml | 3 +++ pySDC/projects/SDC_showdown/environment.yml | 3 +++ pySDC/projects/Second_orderSDC/environment.yml | 3 +++ pySDC/projects/TOMS/environment.yml | 3 +++ pySDC/projects/matrixPFASST/environment.yml | 3 +++ pySDC/projects/parallelSDC_reloaded/environment.yml | 3 +++ pySDC/projects/soft_failure/environment.yml | 3 +++ 14 files changed, 42 insertions(+) diff --git a/pySDC/projects/AllenCahn_Bayreuth/environment.yml b/pySDC/projects/AllenCahn_Bayreuth/environment.yml index 0e5aae0eb1..18e59ac6be 100644 --- a/pySDC/projects/AllenCahn_Bayreuth/environment.yml +++ b/pySDC/projects/AllenCahn_Bayreuth/environment.yml @@ -10,3 +10,6 @@ dependencies: - matplotlib>=3.0 - dill>=0.2.6 - scipy>=0.17.1 + - pip + - pip: + - qmat diff --git a/pySDC/projects/AsympConv/environment.yml b/pySDC/projects/AsympConv/environment.yml index 2cc7e8544a..814c66afd0 100644 --- a/pySDC/projects/AsympConv/environment.yml +++ b/pySDC/projects/AsympConv/environment.yml @@ -8,3 +8,6 @@ dependencies: - matplotlib>=3.0 - scipy>=0.17.1 - dill>=0.2.6 + - pip + - pip: + - qmat diff --git a/pySDC/projects/DAE/environment.yml b/pySDC/projects/DAE/environment.yml index f492334a90..5d64e524b5 100644 --- a/pySDC/projects/DAE/environment.yml +++ b/pySDC/projects/DAE/environment.yml @@ -10,3 +10,6 @@ dependencies: - dill>=0.2.6 - mpich - mpi4py>=3.0.0 + - pip + - pip: + - qmat diff --git a/pySDC/projects/FastWaveSlowWave/environment.yml b/pySDC/projects/FastWaveSlowWave/environment.yml index 8d2324247c..ea2a42c5b0 100644 --- a/pySDC/projects/FastWaveSlowWave/environment.yml +++ b/pySDC/projects/FastWaveSlowWave/environment.yml @@ -10,3 +10,6 @@ dependencies: - scipy>=0.17.1 - sympy>=1.0 - dill>=0.2.6 + - pip + - pip: + - qmat diff --git a/pySDC/projects/Hamiltonian/environment.yml b/pySDC/projects/Hamiltonian/environment.yml index ad705cea1a..b9ddea64df 100644 --- a/pySDC/projects/Hamiltonian/environment.yml +++ b/pySDC/projects/Hamiltonian/environment.yml @@ -9,3 +9,6 @@ dependencies: - numpy - matplotlib>=3.0 - scipy>=0.17.1 + - pip + - pip: + - qmat diff --git a/pySDC/projects/PinTSimE/environment.yml b/pySDC/projects/PinTSimE/environment.yml index 63f08b5344..a94bb461c7 100644 --- a/pySDC/projects/PinTSimE/environment.yml +++ b/pySDC/projects/PinTSimE/environment.yml @@ -9,3 +9,6 @@ dependencies: - scipy>=0.17.1 - dill>=0.2.6 - matplotlib>=3.0 + - pip + - pip: + - qmat diff --git a/pySDC/projects/RDC/environment.yml b/pySDC/projects/RDC/environment.yml index 142bd3dcd8..8140822e75 100644 --- a/pySDC/projects/RDC/environment.yml +++ b/pySDC/projects/RDC/environment.yml @@ -8,3 +8,6 @@ dependencies: - numpy - dill>=0.2.6 - scipy>=0.17.1 + - pip + - pip: + - qmat diff --git a/pySDC/projects/Resilience/environment.yml b/pySDC/projects/Resilience/environment.yml index 70ddb575a5..40bfcc572f 100644 --- a/pySDC/projects/Resilience/environment.yml +++ b/pySDC/projects/Resilience/environment.yml @@ -11,3 +11,6 @@ dependencies: - matplotlib>=3.0 - dill>=0.2.6 - scipy>=0.17.1 + - pip + - pip: + - qmat diff --git a/pySDC/projects/SDC_showdown/environment.yml b/pySDC/projects/SDC_showdown/environment.yml index 54a7112dff..9201700950 100644 --- a/pySDC/projects/SDC_showdown/environment.yml +++ b/pySDC/projects/SDC_showdown/environment.yml @@ -9,3 +9,6 @@ dependencies: - matplotlib>=3.0 - dill>=0.2.6 - scipy>=0.17.1 + - pip + - pip: + - qmat diff --git a/pySDC/projects/Second_orderSDC/environment.yml b/pySDC/projects/Second_orderSDC/environment.yml index d36deda800..e11459ea30 100644 --- a/pySDC/projects/Second_orderSDC/environment.yml +++ b/pySDC/projects/Second_orderSDC/environment.yml @@ -10,3 +10,6 @@ dependencies: - dill>=0.2.6 - matplotlib>=3.0 - scipy>=0.17.1 + - pip + - pip: + - qmat diff --git a/pySDC/projects/TOMS/environment.yml b/pySDC/projects/TOMS/environment.yml index 8c434afb9d..e7c13c518f 100644 --- a/pySDC/projects/TOMS/environment.yml +++ b/pySDC/projects/TOMS/environment.yml @@ -8,3 +8,6 @@ dependencies: - dill>=0.2.6 - matplotlib>=3.0 - scipy>=0.17.1 + - pip + - pip: + - qmat diff --git a/pySDC/projects/matrixPFASST/environment.yml b/pySDC/projects/matrixPFASST/environment.yml index e5da507653..9e86ee48bd 100644 --- a/pySDC/projects/matrixPFASST/environment.yml +++ b/pySDC/projects/matrixPFASST/environment.yml @@ -8,3 +8,6 @@ dependencies: - numpy - scipy>=0.17.1 - dill>=0.2.6 + - pip + - pip: + - qmat diff --git a/pySDC/projects/parallelSDC_reloaded/environment.yml b/pySDC/projects/parallelSDC_reloaded/environment.yml index 540fdb25f2..d4c58801c3 100644 --- a/pySDC/projects/parallelSDC_reloaded/environment.yml +++ b/pySDC/projects/parallelSDC_reloaded/environment.yml @@ -9,3 +9,6 @@ dependencies: - matplotlib>=3.0 - dill>=0.2.6 - scipy>=0.17.1 + - pip + - pip: + - qmat diff --git a/pySDC/projects/soft_failure/environment.yml b/pySDC/projects/soft_failure/environment.yml index 9f2b84243a..c1751d170a 100644 --- a/pySDC/projects/soft_failure/environment.yml +++ b/pySDC/projects/soft_failure/environment.yml @@ -9,3 +9,6 @@ dependencies: - numpy - scipy>=0.17.1 - matplotlib>=3.0 + - pip + - pip: + - qmat From 4f0b5a7783c6f419b134e4889d53693900e896f7 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Fri, 21 Jun 2024 18:42:21 +0200 Subject: [PATCH 11/38] TL: still adapting to numpy2 --- pySDC/playgrounds/optimization/playground.py | 2 +- pySDC/tests/test_sweepers/test_imexsweeper.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pySDC/playgrounds/optimization/playground.py b/pySDC/playgrounds/optimization/playground.py index c046187cef..e12f74ec41 100644 --- a/pySDC/playgrounds/optimization/playground.py +++ b/pySDC/playgrounds/optimization/playground.py @@ -49,7 +49,7 @@ def rho(x): for i, ldt in enumerate(ldt_list): R = np.linalg.matrix_power(ldt * np.linalg.inv(np.eye(M) - ldt * QDelta).dot(Q - QDelta), 1) - result_Rnorm[i] = np.linalg.norm(R, np.infty) + result_Rnorm[i] = np.linalg.norm(R, np.inf) result_Rrho[i] = np.amax(abs(np.linalg.eigvals(R))) # result_est[i] = abs(ldt) * np.linalg.norm(np.linalg.inv(np.eye(M) - ldt * QDelta), np.inf) * np.linalg.norm(Q - QDelta, np.inf) # result_est[i] = abs(ldt) * np.linalg.norm(np.linalg.inv(np.eye(M) - ldt * QDD), np.inf) * np.linalg.norm(np.linalg.inv(np.eye(M) - ldt * np.linalg.inv(np.eye(M) - ldt * QDD).dot(QDL)), np.inf) * np.linalg.norm(Q - QDelta, np.inf) diff --git a/pySDC/tests/test_sweepers/test_imexsweeper.py b/pySDC/tests/test_sweepers/test_imexsweeper.py index 2cb3572fa1..c09a6131a3 100644 --- a/pySDC/tests/test_sweepers/test_imexsweeper.py +++ b/pySDC/tests/test_sweepers/test_imexsweeper.py @@ -124,7 +124,7 @@ def test_sweepequalmatrix(self): unew = np.linalg.inv(LHS).dot(u0full + RHS.dot(u0full)) usweep = np.array([level.u[l].flatten() for l in range(1, nnodes + 1)]) assert ( - np.linalg.norm(unew - usweep, np.infty) < 1e-14 + np.linalg.norm(unew - usweep, np.inf) < 1e-14 ), "Single SDC sweeps in matrix and node-to-node formulation yield different results" # @@ -152,7 +152,7 @@ def test_updateformula(self): else: uend_mat = ustages[-1] assert ( - np.linalg.norm(uend_sweep - uend_mat, np.infty) < 1e-14 + np.linalg.norm(uend_sweep - uend_mat, np.inf) < 1e-14 ), "Update formula in sweeper gives different result than matrix update formula" # @@ -189,12 +189,12 @@ def test_collocationinvariant(self): # Make sure both matrix and node-to-node sweep leave collocation unaltered unew = np.linalg.inv(LHS).dot(u0full + RHS.dot(ucoll)) assert ( - np.linalg.norm(unew - ucoll, np.infty) < 1e-14 + np.linalg.norm(unew - ucoll, np.inf) < 1e-14 ), "Collocation solution not invariant under matrix SDC sweep" unew_sweep = np.array([level.u[l].flatten() for l in range(1, nnodes + 1)]) - print(np.linalg.norm(unew_sweep - ucoll, np.infty)) + print(np.linalg.norm(unew_sweep - ucoll, np.inf)) assert ( - np.linalg.norm(unew_sweep - ucoll, np.infty) < 1e-14 + np.linalg.norm(unew_sweep - ucoll, np.inf) < 1e-14 ), "Collocation solution not invariant under node-to-node sweep" # @@ -222,13 +222,13 @@ def test_manysweepsequalmatrix(self): unew = np.linalg.inv(LHS).dot(u0full + RHS.dot(unew)) assert ( - np.linalg.norm(unew - usweep, np.infty) < 1e-14 + np.linalg.norm(unew - usweep, np.inf) < 1e-14 ), "Doing multiple node-to-node sweeps yields different result than same number of matrix-form sweeps" Mat_sweep = level.sweep.get_scalar_problems_manysweep_mat(nsweeps=K, lambdas=lambdas) usweep_onematrix = Mat_sweep.dot(u0full) assert ( - np.linalg.norm(usweep_onematrix - usweep, np.infty) < 1e-14 + np.linalg.norm(usweep_onematrix - usweep, np.inf) < 1e-14 ), "Single-matrix multiple sweep formulation yields different result than multiple sweeps in node-to-node or matrix form form" # @@ -317,5 +317,5 @@ def test_updateformula_no_coll_update(self): q[nnodes - 1] = 1.0 uend_mat = q.dot(ustages) assert ( - np.linalg.norm(uend_sweep - uend_mat, np.infty) < 1e-14 + np.linalg.norm(uend_sweep - uend_mat, np.inf) < 1e-14 ), "For do_coll_update=False, update formula in sweeper gives different result than matrix update formula with q=(0,..,0,1)" From 755032582f7f4f48f726d2100920e32e2139801f Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Fri, 21 Jun 2024 23:35:21 +0200 Subject: [PATCH 12/38] TL: still fixing project tests ... --- pySDC/core/Collocation.py | 6 +++--- pySDC/core/Sweeper.py | 7 +++++-- pySDC/helpers/testing.py | 2 +- pySDC/projects/DAE/tests/test_SemiImplicitDAE.py | 4 ++-- pySDC/projects/Monodomain/etc/environment-monodomain.yml | 3 +++ .../projects/parallelSDC_reloaded/scripts/fig03_lorenz.py | 2 +- .../parallelSDC_reloaded/scripts/fig04_protheroRobinson.py | 2 +- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/pySDC/core/Collocation.py b/pySDC/core/Collocation.py index 6c03aae14d..8ba758f4c6 100644 --- a/pySDC/core/Collocation.py +++ b/pySDC/core/Collocation.py @@ -80,8 +80,8 @@ def __init__(self, num_nodes=None, tleft=0, tright=1, node_type='LEGENDRE', quad self.order = self.generator.order # Compute coefficients - self.nodes = self.generator.nodes - self.weights = self.generator.weights + self.nodes = self._getNodes = self.generator.nodes.copy() + self.weights = self.generator.weights.copy() Q = np.zeros([num_nodes + 1, num_nodes + 1], dtype=float) Q[1:, 1:] = self.generator.Q @@ -94,7 +94,7 @@ def __init__(self, num_nodes=None, tleft=0, tright=1, node_type='LEGENDRE', quad # This does not passes the pySDC tests ... however the default S computation # in qmat uses Q matrix coefficients differences, and that's what we # use by using the parent property from the generator object. - self.Smat = S + self.Smat = self._gen_Smatrix = S self.delta_m = self._gen_deltas diff --git a/pySDC/core/Sweeper.py b/pySDC/core/Sweeper.py index 4c15553e6b..e841852b8c 100644 --- a/pySDC/core/Sweeper.py +++ b/pySDC/core/Sweeper.py @@ -88,12 +88,13 @@ def setupGenerator(self, coll: CollBase, qd_type): quadType=coll.quad_type, # for time-stepping types, MIN-SR-NS nodes=coll.nodes, + tLeft=coll.tleft, ) except Exception as e: raise ValueError(f"could not generate {qd_type=!r} with qmat, got error : {e}") def get_Qdelta_implicit(self, coll: CollBase, qd_type, k=None): - QDmat = np.zeros(coll.Qmat.shape) + QDmat = np.zeros(coll.Qmat.shape, dtype=float) self.setupGenerator(coll, qd_type) QDmat[1:, 1:] = self.generator.genCoeffs(k=k) @@ -101,10 +102,12 @@ def get_Qdelta_implicit(self, coll: CollBase, qd_type, k=None): np.testing.assert_array_equal( np.triu(QDmat, k=1), np.zeros(QDmat.shape), err_msg='Lower triangular matrix expected!' ) + if np.allclose(np.diag(np.diag(QDmat)), QDmat): + self.parallelizable = True return QDmat def get_Qdelta_explicit(self, coll, qd_type, k=None): - QDmat = np.zeros(coll.Qmat.shape) + QDmat = np.zeros(coll.Qmat.shape, dtype=float) self.setupGenerator(coll, qd_type) QDmat[1:, 1:], QDmat[1:, 0] = self.generator.genCoeffs(k=k, dTau=True) diff --git a/pySDC/helpers/testing.py b/pySDC/helpers/testing.py index f1b6187348..bb31ddbef5 100644 --- a/pySDC/helpers/testing.py +++ b/pySDC/helpers/testing.py @@ -93,7 +93,7 @@ def storeAndCheck(self, key, data, rtol=1e-5, atol=1e-8): assert len(data) == len(ref), f"data with len:{len(data)}) cannot be compared to ref with len:{len(ref)})" assert np.allclose( data, ref, atol=atol, rtol=rtol, equal_nan=True - ), f"difference between data:{data} and ref:{ref}" + ), f"{key}, difference between data:{data} and ref:{ref}" def writeToJSON(self): """Write cached data into a json file""" diff --git a/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py b/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py index 6f69448cf1..a6578e9f99 100644 --- a/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py +++ b/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py @@ -261,9 +261,9 @@ def testCompareResults(M): @pytest.mark.base -@pytest.mark.parametrize('case', [0, 1]) -@pytest.mark.parametrize('M', [2, 3]) @pytest.mark.parametrize('QI', ['IE', 'LU']) +@pytest.mark.parametrize('M', [2, 3]) +@pytest.mark.parametrize('case', [0, 1]) def testOrderAccuracy(case, M, QI): r""" In this test, the order of accuracy of the ``SemiImplicitDAE`` sweeper is tested for an index-1 DAE diff --git a/pySDC/projects/Monodomain/etc/environment-monodomain.yml b/pySDC/projects/Monodomain/etc/environment-monodomain.yml index 4151479679..052df2cda1 100644 --- a/pySDC/projects/Monodomain/etc/environment-monodomain.yml +++ b/pySDC/projects/Monodomain/etc/environment-monodomain.yml @@ -24,3 +24,6 @@ dependencies: - mpich - tqdm - pymp-pypi + - pip + - pip: + - qmat diff --git a/pySDC/projects/parallelSDC_reloaded/scripts/fig03_lorenz.py b/pySDC/projects/parallelSDC_reloaded/scripts/fig03_lorenz.py index 891689abe5..3c3b424180 100644 --- a/pySDC/projects/parallelSDC_reloaded/scripts/fig03_lorenz.py +++ b/pySDC/projects/parallelSDC_reloaded/scripts/fig03_lorenz.py @@ -160,7 +160,7 @@ def getCost(counters): # error VS cost ls = '-' if qDelta.startswith("MIN-SR-") else "--" plt.loglog(costs, errors, sym + ls, label=qDelta) - data.storeAndCheck(f"{figName}_{qDelta}", errors[2:]) + data.storeAndCheck(f"{figName}_{qDelta}", errors[2:], rtol=1e-3) plt.gca().set( xlabel="Cost", diff --git a/pySDC/projects/parallelSDC_reloaded/scripts/fig04_protheroRobinson.py b/pySDC/projects/parallelSDC_reloaded/scripts/fig04_protheroRobinson.py index ae004ca75b..d1323c3d41 100644 --- a/pySDC/projects/parallelSDC_reloaded/scripts/fig04_protheroRobinson.py +++ b/pySDC/projects/parallelSDC_reloaded/scripts/fig04_protheroRobinson.py @@ -88,7 +88,7 @@ def getCost(counters): plt.figure(figNameConv) plt.loglog(dtVals, errors, sym + ls, label=qDelta) - data.storeAndCheck(f"{figNameConv}_{qDelta}", errors) + data.storeAndCheck(f"{figNameConv}_{qDelta}", errors, rtol=1e-2) plt.figure(figNameCost) plt.loglog(costs, errors, sym + ls, label=qDelta) From 639f4ee5b480569d9f129c53dc7bf5fc6b3648be Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Fri, 21 Jun 2024 23:44:27 +0200 Subject: [PATCH 13/38] TL: minor change to trigger CI --- pySDC/projects/parallelSDC_reloaded/scripts/fig03_lorenz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySDC/projects/parallelSDC_reloaded/scripts/fig03_lorenz.py b/pySDC/projects/parallelSDC_reloaded/scripts/fig03_lorenz.py index 3c3b424180..04527c625a 100644 --- a/pySDC/projects/parallelSDC_reloaded/scripts/fig03_lorenz.py +++ b/pySDC/projects/parallelSDC_reloaded/scripts/fig03_lorenz.py @@ -160,7 +160,7 @@ def getCost(counters): # error VS cost ls = '-' if qDelta.startswith("MIN-SR-") else "--" plt.loglog(costs, errors, sym + ls, label=qDelta) - data.storeAndCheck(f"{figName}_{qDelta}", errors[2:], rtol=1e-3) + data.storeAndCheck(f"{figName}_{qDelta}", errors[2:], rtol=1e-2) plt.gca().set( xlabel="Cost", From 04a605a20bce709b29a565a7ad5e0d68461e85e0 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 00:38:32 +0200 Subject: [PATCH 14/38] TL: opening Pandora's box ... --- pySDC/core/Sweeper.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pySDC/core/Sweeper.py b/pySDC/core/Sweeper.py index e841852b8c..8c57ffed46 100644 --- a/pySDC/core/Sweeper.py +++ b/pySDC/core/Sweeper.py @@ -78,6 +78,7 @@ def setupGenerator(self, coll: CollBase, qd_type): try: assert QDELTA_GENERATORS[qd_type] == type(self.generator) assert self.generator.QDelta.shape[0] == coll.Qmat.shape[0] - 1 + assert False # because some project change coll dynamically ... except (AssertionError, AttributeError): self.generator = QDELTA_GENERATORS[qd_type]( # for algebraic types (LU, ...) From d41a6e0daf88a34b80b019828ad63188cf284d8c Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 00:42:01 +0200 Subject: [PATCH 15/38] TL: ty linting --- pySDC/core/Sweeper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySDC/core/Sweeper.py b/pySDC/core/Sweeper.py index 8c57ffed46..91826b36b1 100644 --- a/pySDC/core/Sweeper.py +++ b/pySDC/core/Sweeper.py @@ -78,7 +78,7 @@ def setupGenerator(self, coll: CollBase, qd_type): try: assert QDELTA_GENERATORS[qd_type] == type(self.generator) assert self.generator.QDelta.shape[0] == coll.Qmat.shape[0] - 1 - assert False # because some project change coll dynamically ... + raise AssertionError() # because some project change coll dynamically ... except (AssertionError, AttributeError): self.generator = QDELTA_GENERATORS[qd_type]( # for algebraic types (LU, ...) From 130c4d816e671bee1b2c69ebee19a5a2fe1ee63e Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 01:26:37 +0200 Subject: [PATCH 16/38] TL: adding a note --- pySDC/core/Sweeper.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pySDC/core/Sweeper.py b/pySDC/core/Sweeper.py index 91826b36b1..fa63f5e42e 100644 --- a/pySDC/core/Sweeper.py +++ b/pySDC/core/Sweeper.py @@ -78,7 +78,12 @@ def setupGenerator(self, coll: CollBase, qd_type): try: assert QDELTA_GENERATORS[qd_type] == type(self.generator) assert self.generator.QDelta.shape[0] == coll.Qmat.shape[0] - 1 - raise AssertionError() # because some project change coll dynamically ... + # Note : the following projects change coll dynamically : + # - DAE + # - Resilience + # Storing the QDelta generator (and the QDelta) make the tests for those projects fail + # => we force the re-instantiation of the generator, until some fix is found for those projects + raise AssertionError() except (AssertionError, AttributeError): self.generator = QDELTA_GENERATORS[qd_type]( # for algebraic types (LU, ...) From 3dd1fe0cba8008f5db5eb08f52185710d5a01859 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 12:35:27 +0200 Subject: [PATCH 17/38] TL: corrected bugged reference data for parallelSDC_reloaded --- .../tests/test_preconditioner_MPI.py | 1 - .../scripts/_dataRef.json | 1292 ++++++++--------- .../scripts/fig04_protheroRobinson.py | 2 +- 3 files changed, 647 insertions(+), 648 deletions(-) diff --git a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py index 9e0a72aabe..4cc7fc5513 100644 --- a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py +++ b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py @@ -5,7 +5,6 @@ @pytest.mark.slow @pytest.mark.mpi4py -@pytest.mark.timeout(0) @pytest.mark.parametrize('num_procs', [3, 5]) def test_preconditioner_playground_MPI(num_procs): # Set python path once diff --git a/pySDC/projects/parallelSDC_reloaded/scripts/_dataRef.json b/pySDC/projects/parallelSDC_reloaded/scripts/_dataRef.json index 06808f3078..671bb83349 100644 --- a/pySDC/projects/parallelSDC_reloaded/scripts/_dataRef.json +++ b/pySDC/projects/parallelSDC_reloaded/scripts/_dataRef.json @@ -2,51 +2,51 @@ "fig05_allenCahn_conv_0_MIN-SR-NS": [Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity ], "fig05_allenCahn_conv_0_MIN-SR-S": [Infinity, Infinity, - 0.08446537069000407, - 0.02891511006232282, - 0.009359670325087922, - 0.001767579860121379, - 0.0005909667201255001, - 0.0003061432031026652, - 0.00023374010540145703 + 0.08446537055293353, + 0.02891510971706477, + 0.009359670118495731, + 0.0017675798346279735, + 0.0005909667105923976, + 0.0003061432458722677, + 0.000233740082465354 ], "fig05_allenCahn_conv_0_MIN-SR-FLEX": [Infinity, Infinity, - 0.0396190805552386, - 0.003964060100959606, - 0.0003691156499204657, - 7.944071577391686e-05, - 0.000155031091490917, - 0.00019389551312441983, - 0.00021499308058079686 + 0.03961908028763937, + 0.003963578959233919, + 0.0003691116001822194, + 7.944059091555469e-05, + 0.00015503113030299905, + 0.00019389551968445538, + 0.00021499305226875678 ], "fig05_allenCahn_conv_0_VDHS": [Infinity, - 0.19321965556422843, - 0.5345708076570097, - 0.2014047982991399, - 0.056209742223901835, - 0.00840458872364862, - 0.001698984589120872, - 0.00016807940176517884, - 0.00018753795544307371 + 0.1932196556772485, + 0.5345708075891601, + 0.20140479812575454, + 0.05620974256627712, + 0.008404588766557962, + 0.0016989846252961774, + 0.00016807940141687374, + 0.0001875379340551794 ], "fig05_allenCahn_conv_0_ESDIRK43": [Infinity, - 2.171214365559374, - 0.22484822454317072, - 0.018644029886009206, - 0.0013501854462701615, - 0.00023722702915712814, - 0.00022105433212314375, - 0.00022273327778025385, - 0.00022354533745006197 + 2.1712139992719637, + 0.22484823728586387, + 0.018644034062360124, + 0.0013501854062157983, + 0.00023722708007943585, + 0.00022105426812846953, + 0.00022273332127340696, + 0.0002235453435056003 ], "fig05_allenCahn_conv_0_LU": [Infinity, Infinity, - 0.004808051505233471, - 0.0006654205463199496, - 0.0002662368479721481, - 0.00022781884527065633, - 0.00022518481870875735, - 0.00022443406747357908, - 0.00022951363585211392 + 0.0048080489209774285, + 0.0006654206107703006, + 0.00026623686663334385, + 0.0002278193055409893, + 0.0002251848068728332, + 0.000224433969255424, + 0.0002295136162850787 ], "fig04_protheroRobinson_conv_0_MIN-SR-NS": [ 0.16043962210305474, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, @@ -55,7 +55,7 @@ ], "fig04_protheroRobinson_conv_0_MIN-SR-S": [ 8.320184141030751e-05, - 3.1197879747368873e-06, + 3.1197879747923984e-06, 1.0144571577219708e-06, 9.096042259404413e-07, 7.523811357268428e-07, @@ -115,9 +115,9 @@ 4.0878700424684666e-10 ], "fig04_protheroRobinson_conv_1_MIN-SR-S": [ - 8.12045931322114e-05, - 2.24192650638555e-06, - 1.473240173188728e-07, + 8.120459313243344e-05, + 2.2419265063300386e-06, + 1.473240174298951e-07, 8.852951038917922e-09, 1.798949900155833e-08, 2.0804090783421714e-08, @@ -126,7 +126,7 @@ 2.7277079484022693e-09 ], "fig04_protheroRobinson_conv_1_MIN-SR-FLEX": [ - 8.636998630784376e-05, + 8.647424247021362e-05, 5.608272452994889e-06, 3.6692412339611735e-06, 2.8100552619259034e-06, @@ -134,7 +134,7 @@ 4.1292747054999523e-07, 1.4597440034513909e-08, 1.2456305209518348e-08, - 2.728971937315805e-09 + 1.1687627532452893e-09 ], "fig04_protheroRobinson_conv_1_VDHS": [ 8.124124800135135e-05, @@ -162,7 +162,7 @@ 8.11675360774533e-05, 2.2272239728615695e-06, 1.4324239350216317e-07, - 8.631915602498352e-09, + 8.63191560158431e-09, 2.2413865208292805e-10, 2.091979922624887e-10, 5.1993187533128093e-11, @@ -217,7 +217,7 @@ ], "fig03_lorenz_conv_MIN-SR-NS_$K=1$": [ 225.21792648743696, - 136.42084302368366, + 136.42084302368386, 27.157587748510718, 13.343595414381037, 11.27004763703939, @@ -226,8 +226,8 @@ 1.9297102390492427 ], "fig03_lorenz_conv_MIN-SR-NS_$K=2$": [ - 32.90488586292916, - 11.752175617703474, + 32.904885862929135, + 11.75217561770346, 4.805323467476697, 0.4557648700864476, 0.07650140611684719, @@ -236,7 +236,7 @@ 0.00044390538899286014 ], "fig03_lorenz_conv_MIN-SR-NS_$K=3$": [ - 14.624578379904424, + 14.624578379904413, 0.5346939810970284, 0.041553302636680556, 0.0009631505998228818, @@ -246,8 +246,8 @@ 4.912024564873718e-09 ], "fig03_lorenz_conv_MIN-SR-NS_$K=4$": [ - 16.217452889738567, - 0.0546509456450579, + 16.217452889738706, + 0.05465094564505435, 0.009336357792545158, 8.067327115313105e-05, 2.284149523745782e-06, @@ -256,17 +256,17 @@ 7.648814914773538e-11 ], "fig03_lorenz_conv_MIN-SR-NS_$K=5$": [ - 9.154704936308956, - 0.07621878748729749, + 9.154704936309091, + 0.07621878748718913, 0.0002509432007666845, 1.6872603509909823e-06, 1.9030105491424365e-08, - 2.091358197731097e-10, + 2.091322670594309e-10, 4.9684700798025005e-11, 7.648814914773538e-11 ], "fig03_lorenz_cost_0_MIN-SR-NS": [ - 0.0546509456450579, + 0.05465094564505435, 0.009336357792545158, 8.067327115313105e-05, 2.284149523745782e-06, @@ -275,17 +275,17 @@ 7.648814914773538e-11 ], "fig03_lorenz_cost_0_MIN-SR-S": [ - 1.9287434051082037, - 0.10832440856908576, - 0.0017611980333889221, - 5.638746364411418e-05, - 1.569950427438016e-06, - 2.3746524746570685e-08, - 1.5012915355328005e-09 + 1.9287434051083139, + 0.10832440856911418, + 0.001761198033527478, + 5.6387463708063024e-05, + 1.5699505659938495e-06, + 2.374653540471172e-08, + 1.5012826537486035e-09 ], "fig03_lorenz_cost_0_MIN-SR-FLEX": [ - 3.5837961197815886, - 0.217358561202861, + 3.5837961197815353, + 0.21735856120286812, 0.00496643239847927, 0.00028952343006949377, 1.0061587467191657e-05, @@ -293,13 +293,13 @@ 2.6501236760623215e-09 ], "fig03_lorenz_cost_0_LU": [ - 0.6989210472155172, - 0.22845443868738258, - 0.004508294448669403, - 0.00013817901455581705, - 4.367674454996973e-06, - 1.1594240589829496e-07, - 7.328716300492033e-09 + 0.6989210472155349, + 0.2284544386873364, + 0.0045082944486658505, + 0.00013817901460200233, + 4.367674460326043e-06, + 1.1594242721457704e-07, + 7.328717188670453e-09 ], "fig03_lorenz_cost_0_EE": [ 3.516010310744873, @@ -320,7 +320,7 @@ 7.310388205894469e-08 ], "fig03_lorenz_cost_1_MIN-SR-NS": [ - 0.0546509456450579, + 0.05465094564505435, 0.009336357792545158, 8.067327115313105e-05, 2.284149523745782e-06, @@ -329,17 +329,17 @@ 7.648814914773538e-11 ], "fig03_lorenz_cost_1_MIN-SR-S": [ - 1.9287434051082037, - 0.10832440856908576, - 0.0017611980333889221, - 5.638746364411418e-05, - 1.569950427438016e-06, - 2.3746524746570685e-08, - 1.5012915355328005e-09 + 1.9287434051083139, + 0.10832440856911418, + 0.001761198033527478, + 5.6387463708063024e-05, + 1.5699505659938495e-06, + 2.374653540471172e-08, + 1.5012826537486035e-09 ], "fig03_lorenz_cost_1_MIN-SR-FLEX": [ - 3.5837961197815886, - 0.217358561202861, + 3.5837961197815353, + 0.21735856120286812, 0.00496643239847927, 0.00028952343006949377, 1.0061587467191657e-05, @@ -347,7 +347,7 @@ 2.6501236760623215e-09 ], "fig03_lorenz_cost_1_VDHS": [ - 0.5573075506927019, + 0.557307550692677, 0.03802418895329396, 0.0004979941844496238, 1.6712101515992117e-05, @@ -365,7 +365,7 @@ 4.594594216200676e-08 ], "fig03_lorenz_cost_1_ESDIRK43": [ - 1.0414477669801077, + 1.041447766980104, 0.05906753442312329, 0.001273883913817997, 7.275281019403224e-05, @@ -374,31 +374,31 @@ 6.590447299004154e-09 ], "fig03_lorenz_cost_2_MIN-SR-NS": [ - 0.07621878748729749, + 0.07621878748718913, 0.0002509432007666845, 1.6872603509909823e-06, 1.9030105491424365e-08, - 2.091358197731097e-10, + 2.091322670594309e-10, 4.9684700798025005e-11, 7.648814914773538e-11 ], "fig03_lorenz_cost_2_MIN-SR-S": [ - 1.0967974307495858, - 0.018626305586472824, - 3.362806956452857e-05, - 2.988167040030021e-06, - 1.1313348480257446e-07, - 1.2265992666016245e-09, - 1.2313350339354656e-10 + 1.0967974307496284, + 0.01862630558642664, + 3.362806955031772e-05, + 2.988167125295149e-06, + 1.1313348835528814e-07, + 1.226663215447843e-09, + 1.2314416153458296e-10 ], "fig03_lorenz_cost_2_MIN-SR-FLEX": [ - 1.1178621898212064, - 0.018539394122594643, - 3.381578668992802e-05, - 2.983625694952252e-06, - 1.1295919577491986e-07, - 1.2257999060238944e-09, - 1.2305889640629175e-10 + 1.393636422396252, + 0.031396794712181375, + 0.0006106603985038817, + 1.9444461063500285e-06, + 2.3517075575796298e-07, + 3.1684592727287963e-09, + 2.540012644658418e-10 ], "fig03_lorenz_cost_2_PIC": [ 1.7877261553173138, @@ -419,7 +419,7 @@ 4.594594216200676e-08 ], "fig03_lorenz_cost_2_ESDIRK43": [ - 1.0414477669801077, + 1.041447766980104, 0.05906753442312329, 0.001273883913817997, 7.275281019403224e-05, @@ -852,216 +852,216 @@ 1.083996695228847 ], "fig02_stab_MIN-SR-S_K1": [ - 1.5681895510408013, - 1.5658887471083591, - 1.5632973852393248, - 1.5603652194507684, - 1.5570308630083416, - 1.5532187546673577, - 1.5488351422109645, - 1.5437627147645652, - 1.5378533596866597, - 1.530918292609237, - 1.5227144767544705, - 1.5129257625608559, - 1.5011364790337547, - 1.4867942279400221, - 1.4691573461660574, - 1.4472210763301527, - 1.4196157169969439, - 1.384472550825699, - 1.3392668482352628, - 1.2806922985637377, - 1.2047484164901567, - 1.1075391751245447, - 0.9879444356716439, - 0.8542321620751417, - 0.7355427463848079, - 0.684918002089284, - 0.7355427463848079, - 0.8542321620751422, - 0.9879444356716439, - 1.1075391751245451, - 1.2047484164901563, - 1.2806922985637377, - 1.3392668482352628, - 1.384472550825699, - 1.4196157169969439, - 1.4472210763301518, - 1.4691573461660574, - 1.4867942279400217, - 1.501136479033755, - 1.5129257625608559, - 1.5227144767544702, - 1.530918292609237, - 1.5378533596866597, - 1.5437627147645658, - 1.5488351422109645, - 1.5532187546673577, - 1.5570308630083411, - 1.5603652194507684, - 1.5632973852393248, - 1.5658887471083591, - 1.5681895510408013 + 1.5681895510408026, + 1.5658887471083605, + 1.5632973852393262, + 1.56036521945077, + 1.5570308630083427, + 1.5532187546673588, + 1.5488351422109659, + 1.5437627147645667, + 1.537853359686661, + 1.530918292609238, + 1.522714476754472, + 1.512925762560857, + 1.501136479033756, + 1.4867942279400235, + 1.4691573461660585, + 1.4472210763301538, + 1.4196157169969448, + 1.3844725508256999, + 1.3392668482352639, + 1.2806922985637386, + 1.2047484164901574, + 1.1075391751245456, + 0.9879444356716448, + 0.8542321620751424, + 0.7355427463848084, + 0.6849180020892845, + 0.7355427463848084, + 0.8542321620751427, + 0.9879444356716448, + 1.107539175124546, + 1.2047484164901574, + 1.2806922985637386, + 1.3392668482352643, + 1.3844725508256999, + 1.4196157169969448, + 1.4472210763301538, + 1.4691573461660585, + 1.4867942279400235, + 1.5011364790337562, + 1.512925762560857, + 1.5227144767544718, + 1.530918292609238, + 1.537853359686661, + 1.543762714764567, + 1.5488351422109659, + 1.5532187546673588, + 1.5570308630083427, + 1.56036521945077, + 1.5632973852393262, + 1.5658887471083605, + 1.5681895510408026 ], "fig02_stab_MIN-SR-S_K2": [ - 1.3708218383534185, - 1.3579513518385802, - 1.3438509708065396, - 1.3283695691097568, - 1.3113332738609318, - 1.2925412821780513, - 1.2717607116992884, - 1.2487202063415532, - 1.2231019315784655, - 1.1945314893102643, - 1.1625651760378246, - 1.126673945563966, - 1.0862235358219618, - 1.0404507497016098, - 0.9884374344735098, - 0.9290875196735912, - 0.8611209987232731, - 0.7831164827676054, - 0.6936681388072764, - 0.5917814683990976, - 0.4777118570044506, - 0.3544946392037084, - 0.2302541872379886, - 0.12093031742731288, - 0.0537321766559337, - 0.04311743624296375, - 0.0537321766559337, - 0.12093031742731288, - 0.2302541872379886, - 0.35449463920370855, - 0.47771185700445157, - 0.5917814683990976, - 0.6936681388072766, - 0.7831164827676054, - 0.8611209987232731, - 0.9290875196735923, - 0.9884374344735098, - 1.0404507497016104, - 1.0862235358219623, - 1.126673945563966, - 1.1625651760378235, - 1.1945314893102643, - 1.2231019315784655, - 1.2487202063415537, - 1.2717607116992884, - 1.2925412821780513, - 1.3113332738609316, - 1.3283695691097568, - 1.3438509708065396, - 1.3579513518385802, - 1.3708218383534185 + 1.3708218383534203, + 1.3579513518385824, + 1.3438509708065414, + 1.3283695691097595, + 1.3113332738609331, + 1.292541282178054, + 1.2717607116992902, + 1.2487202063415554, + 1.223101931578468, + 1.1945314893102665, + 1.162565176037826, + 1.1266739455639685, + 1.0862235358219643, + 1.0404507497016116, + 0.9884374344735115, + 0.9290875196735928, + 0.861120998723275, + 0.7831164827676069, + 0.6936681388072777, + 0.5917814683990987, + 0.4777118570044515, + 0.3544946392037089, + 0.23025418723798888, + 0.12093031742731308, + 0.053732176655933696, + 0.0431174362429638, + 0.053732176655933696, + 0.120930317427313, + 0.23025418723798888, + 0.35449463920370894, + 0.4777118570044518, + 0.5917814683990987, + 0.6936681388072776, + 0.7831164827676069, + 0.861120998723275, + 0.9290875196735936, + 0.9884374344735115, + 1.040450749701612, + 1.0862235358219652, + 1.1266739455639685, + 1.162565176037826, + 1.1945314893102665, + 1.223101931578468, + 1.2487202063415563, + 1.2717607116992902, + 1.292541282178054, + 1.311333273860934, + 1.3283695691097595, + 1.3438509708065414, + 1.3579513518385824, + 1.3708218383534203 ], "fig02_stab_MIN-SR-S_K3": [ - 0.7019597064051052, - 0.700639986353974, - 0.6989563251583067, - 0.6968292277767597, - 0.6941616392123222, - 0.6908348696472933, - 0.6867035142028252, - 0.6815891004978799, - 0.6752721224826195, - 0.6674820277027697, - 0.6578846239121174, - 0.6460662864838697, - 0.6315143566388963, - 0.6135934141589331, - 0.5915181377004075, - 0.5643262347255502, - 0.5308615509834347, - 0.4897921217908585, - 0.43971782436185886, - 0.3794767988565869, - 0.30884092019477216, - 0.22986527278508043, - 0.1491673046559928, - 0.08181325565241776, - 0.054213794782107624, - 0.056002050608889714, - 0.054213794782107624, - 0.08181325565241794, - 0.1491673046559928, - 0.22986527278508043, - 0.3088409201947729, - 0.3794767988565869, - 0.4397178243618592, - 0.4897921217908585, - 0.5308615509834347, - 0.5643262347255511, - 0.5915181377004075, - 0.6135934141589333, - 0.631514356638896, - 0.6460662864838697, - 0.6578846239121168, - 0.6674820277027697, - 0.6752721224826195, - 0.6815891004978796, - 0.6867035142028252, - 0.6908348696472933, - 0.6941616392123227, - 0.6968292277767597, - 0.6989563251583067, - 0.700639986353974, - 0.7019597064051052 + 0.7019597064051023, + 0.7006399863539714, + 0.698956325158304, + 0.6968292277767573, + 0.694161639212319, + 0.6908348696472909, + 0.6867035142028219, + 0.681589100497877, + 0.6752721224826178, + 0.667482027702767, + 0.6578846239121141, + 0.6460662864838671, + 0.6315143566388935, + 0.61359341415893, + 0.591518137700404, + 0.5643262347255472, + 0.5308615509834318, + 0.48979212179085596, + 0.4397178243618567, + 0.3794767988565849, + 0.30884092019477066, + 0.22986527278507884, + 0.1491673046559918, + 0.08181325565241691, + 0.0542137947821069, + 0.05600205060888923, + 0.0542137947821069, + 0.08181325565241698, + 0.1491673046559918, + 0.2298652727850788, + 0.3088409201947705, + 0.3794767988565849, + 0.4397178243618568, + 0.48979212179085596, + 0.5308615509834318, + 0.5643262347255479, + 0.591518137700404, + 0.6135934141589297, + 0.6315143566388938, + 0.6460662864838671, + 0.6578846239121146, + 0.667482027702767, + 0.6752721224826178, + 0.6815891004978775, + 0.6867035142028219, + 0.6908348696472909, + 0.6941616392123195, + 0.6968292277767573, + 0.698956325158304, + 0.7006399863539714, + 0.7019597064051023 ], "fig02_stab_MIN-SR-S_K4": [ - 0.44011537615089086, - 0.44451545893925326, - 0.4483353654715732, - 0.4514427584678487, - 0.4536844082782443, - 0.4548838863726303, - 0.45483935528631736, - 0.4533216227588659, - 0.4500726854993916, - 0.44480505221875155, - 0.4372022036748745, - 0.42692062049011736, - 0.41359390374110105, - 0.3968396884852424, - 0.376270469741531, - 0.35151050735691625, - 0.322223449995591, - 0.2881606756539803, - 0.24925069092677496, - 0.2057666499512023, - 0.1586275405701332, - 0.10988984627678099, - 0.06348660644760294, - 0.027217456756445747, - 0.020208065924905174, - 0.025837923521782987, - 0.020208065924905174, - 0.027217456756445754, - 0.06348660644760294, - 0.10988984627678103, - 0.15862754057013365, - 0.2057666499512023, - 0.24925069092677504, - 0.2881606756539803, - 0.322223449995591, - 0.3515105073569162, - 0.376270469741531, - 0.3968396884852424, - 0.4135939037411013, - 0.42692062049011736, - 0.437202203674873, - 0.44480505221875155, - 0.4500726854993916, - 0.4533216227588673, - 0.45483935528631736, - 0.4548838863726303, - 0.45368440827824313, - 0.4514427584678487, - 0.4483353654715732, - 0.44451545893925326, - 0.44011537615089086 + 0.4401153761509063, + 0.4445154589392672, + 0.4483353654715866, + 0.451442758467863, + 0.4536844082782588, + 0.45488388637264376, + 0.45483935528633096, + 0.45332162275888116, + 0.45007268549940344, + 0.44480505221876415, + 0.4372022036748853, + 0.42692062049012874, + 0.41359390374111005, + 0.39683968848525075, + 0.37627046974153755, + 0.3515105073569223, + 0.32222344999559543, + 0.2881606756539837, + 0.2492506909267765, + 0.2057666499512027, + 0.15862754057013245, + 0.10988984627677967, + 0.0634866064476017, + 0.02721745675644473, + 0.020208065924904487, + 0.025837923521782293, + 0.020208065924904487, + 0.027217456756444845, + 0.0634866064476017, + 0.10988984627677968, + 0.15862754057013242, + 0.2057666499512027, + 0.2492506909267767, + 0.2881606756539837, + 0.32222344999559543, + 0.35151050735692235, + 0.37627046974153755, + 0.39683968848525136, + 0.41359390374110977, + 0.42692062049012874, + 0.4372022036748844, + 0.44480505221876415, + 0.45007268549940344, + 0.45332162275888066, + 0.45483935528633096, + 0.45488388637264376, + 0.45368440827825707, + 0.451442758467863, + 0.4483353654715866, + 0.4445154589392672, + 0.4401153761509063 ], "fig02_stab_MIN-SR-FLEX_K1": [ 0.028187024643050368, @@ -1276,216 +1276,216 @@ 0.14981088090996628 ], "fig02_stab_LU_K1": [ - 0.05437157508556943, - 0.05730883943673234, - 0.06051627319722353, - 0.06402342777397946, - 0.06786237664748208, - 0.07206730548157753, - 0.07667364560558954, - 0.08171648344237094, - 0.08722784223683687, - 0.09323223525601045, - 0.09973961363197617, - 0.10673446792240499, - 0.1141594160563379, - 0.12189124864736355, - 0.12970748833173718, - 0.1372430311176931, - 0.1439416485684184, - 0.14902089288130416, - 0.15150042817806994, - 0.1504058287433658, - 0.14534878085373315, + 0.054371575085570154, + 0.05730883943673267, + 0.06051627319722387, + 0.0640234277739798, + 0.06786237664748289, + 0.072067305481578, + 0.0766736456055899, + 0.08171648344237104, + 0.08722784223683748, + 0.09323223525601054, + 0.09973961363197652, + 0.10673446792240557, + 0.1141594160563377, + 0.12189124864736368, + 0.12970748833173737, + 0.13724303111769312, + 0.1439416485684183, + 0.14902089288130407, + 0.15150042817806988, + 0.15040582874336567, + 0.1453487808537329, + 0.13766289654398423, + 0.13147789285511022, + 0.13171083272067297, + 0.13742137999626647, + 0.14087643459468813, + 0.13742137999626647, + 0.13171083272067283, + 0.13147789285511022, 0.13766289654398445, - 0.13147789285511044, - 0.13171083272067322, - 0.13742137999626672, - 0.1408764345946884, - 0.13742137999626672, - 0.1317108327206731, - 0.13147789285511044, - 0.13766289654398467, - 0.1453487808537331, - 0.1504058287433658, - 0.15150042817807022, - 0.14902089288130416, - 0.1439416485684184, - 0.13724303111769165, - 0.12970748833173718, - 0.1218912486473635, - 0.11415941605633655, - 0.10673446792240499, - 0.0997396136319749, - 0.09323223525601045, - 0.08722784223683687, - 0.08171648344237142, - 0.07667364560558954, - 0.07206730548157753, - 0.0678623766474818, - 0.06402342777397946, - 0.06051627319722353, - 0.05730883943673234, - 0.05437157508556943 + 0.14534878085373293, + 0.15040582874336567, + 0.15150042817807008, + 0.14902089288130407, + 0.1439416485684183, + 0.13724303111769182, + 0.12970748833173737, + 0.12189124864736368, + 0.1141594160563366, + 0.10673446792240557, + 0.0997396136319755, + 0.09323223525601054, + 0.08722784223683748, + 0.08171648344237178, + 0.0766736456055899, + 0.072067305481578, + 0.06786237664748214, + 0.0640234277739798, + 0.06051627319722387, + 0.05730883943673267, + 0.054371575085570154 ], "fig02_stab_LU_K2": [ - 0.11064218235397395, - 0.11412472322561518, - 0.11775069468730881, - 0.12151122437601981, - 0.1253899975063768, - 0.12936024356753256, - 0.13338062670480047, - 0.13738967785962927, + 0.11064218235397433, + 0.11412472322561487, + 0.1177506946873089, + 0.12151122437601988, + 0.12538999750637683, + 0.12936024356753245, + 0.1333806267048007, + 0.13738967785962924, 0.1412983233472439, - 0.1449800021823555, - 0.14825787947478664, - 0.1508888737559997, - 0.15254485343283147, - 0.15279284616510466, - 0.15107916537517393, + 0.14498000218235582, + 0.14825787947478675, + 0.15088887375599966, + 0.1525448534328315, + 0.15279284616510486, + 0.15107916537517377, 0.1467280754201414, - 0.13897527276768473, - 0.12707060482289403, - 0.11050024283721877, - 0.08938502076115579, - 0.06509187382424403, - 0.041098070056879994, - 0.024413514151413452, - 0.02216709387778496, - 0.02535687626513552, - 0.02647951310305598, - 0.02535687626513552, - 0.02216709387778487, - 0.024413514151413452, - 0.04109807005687992, - 0.06509187382424421, - 0.08938502076115579, - 0.11050024283721899, - 0.12707060482289403, - 0.13897527276768473, - 0.14672807542014113, - 0.15107916537517393, + 0.13897527276768484, + 0.12707060482289376, + 0.11050024283721882, + 0.0893850207611559, + 0.06509187382424388, + 0.04109807005687995, + 0.02441351415141335, + 0.022167093877785007, + 0.025356876265135265, + 0.026479513103055713, + 0.025356876265135265, + 0.02216709387778491, + 0.02441351415141335, + 0.04109807005687978, + 0.06509187382424425, + 0.0893850207611559, + 0.11050024283721896, + 0.12707060482289376, + 0.13897527276768484, + 0.14672807542014135, + 0.15107916537517377, 0.15279284616510516, - 0.1525448534328315, - 0.1508888737559997, - 0.14825787947478603, - 0.1449800021823555, + 0.15254485343283158, + 0.15088887375599966, + 0.1482578794747862, + 0.14498000218235582, 0.1412983233472439, 0.13738967785962952, - 0.13338062670480047, - 0.12936024356753256, - 0.1253899975063767, - 0.12151122437601981, - 0.11775069468730881, - 0.11412472322561518, - 0.11064218235397395 + 0.1333806267048007, + 0.12936024356753245, + 0.12538999750637694, + 0.12151122437601988, + 0.1177506946873089, + 0.11412472322561487, + 0.11064218235397433 ], "fig02_stab_LU_K3": [ 0.09924313175535365, - 0.10256936864678223, - 0.1060740364703216, - 0.1097594691137235, - 0.11362287982045535, - 0.1176535115486785, + 0.1025693686467821, + 0.10607403647032156, + 0.10975946911372353, + 0.11362287982045534, + 0.11765351154867845, 0.12182847759772418, - 0.1261067405313517, + 0.12610674053135174, 0.13042048754191238, 0.13466295524986524, - 0.13867160343578624, - 0.1422056002562168, - 0.14491721775363417, - 0.1463186453830178, - 0.14575014762144484, - 0.14236430205492528, - 0.1351563480424143, - 0.1230925791051279, - 0.10540918335808579, - 0.08214443687378736, - 0.054867645006157005, - 0.027343588100267213, - 0.006893725147935451, - 0.010717208266320699, - 0.012048817253435427, - 0.009600340425261084, - 0.012048817253435427, - 0.010717208266320688, - 0.006893725147935451, - 0.027343588100267307, - 0.054867645006157116, - 0.08214443687378736, - 0.10540918335808583, - 0.1230925791051279, - 0.1351563480424143, - 0.1423643020549253, - 0.14575014762144484, - 0.14631864538301773, - 0.14491721775363423, - 0.1422056002562168, 0.13867160343578622, + 0.1422056002562167, + 0.14491721775363411, + 0.14631864538301773, + 0.1457501476214449, + 0.1423643020549253, + 0.13515634804241436, + 0.12309257910512775, + 0.10540918335808555, + 0.08214443687378735, + 0.05486764500615696, + 0.027343588100267015, + 0.006893725147935594, + 0.010717208266320652, + 0.012048817253435451, + 0.009600340425260952, + 0.012048817253435451, + 0.01071720826632069, + 0.006893725147935594, + 0.027343588100267158, + 0.054867645006157074, + 0.08214443687378735, + 0.10540918335808579, + 0.12309257910512775, + 0.13515634804241436, + 0.14236430205492526, + 0.1457501476214449, + 0.14631864538301778, + 0.14491721775363434, + 0.1422056002562167, + 0.1386716034357861, 0.13466295524986524, 0.13042048754191238, - 0.12610674053135176, + 0.1261067405313517, 0.12182847759772418, - 0.1176535115486785, - 0.11362287982045538, - 0.1097594691137235, - 0.1060740364703216, - 0.10256936864678223, + 0.11765351154867845, + 0.1136228798204554, + 0.10975946911372353, + 0.10607403647032156, + 0.1025693686467821, 0.09924313175535365 ], "fig02_stab_LU_K4": [ - 0.10000826479194143, - 0.10308077565753798, - 0.10629748047902912, - 0.10965959258663721, - 0.113164833329334, - 0.11680550433107302, - 0.1205655597328731, - 0.12441614222250086, - 0.12830877151867878, - 0.13216499453037694, - 0.13586084158547385, - 0.1392040071797701, - 0.14190166272427712, - 0.14351810827578076, - 0.14342589089685656, - 0.14076462648445495, + 0.10000826479194148, + 0.10308077565753802, + 0.10629748047902915, + 0.1096595925866374, + 0.1131648333293341, + 0.11680550433107308, + 0.12056555973287318, + 0.12441614222250094, + 0.12830877151867875, + 0.13216499453037692, + 0.13586084158547387, + 0.13920400717977002, + 0.14190166272427696, + 0.1435181082757807, + 0.1434258908968566, + 0.14076462648445487, 0.134442420761918, - 0.12324687798730673, - 0.10616530072892094, - 0.08300436681668819, - 0.05525778128121263, - 0.026809130814036408, - 0.004036128019128927, - 0.009816170908131286, - 0.01064139202386972, - 0.006890913854016109, - 0.01064139202386972, - 0.009816170908131212, - 0.004036128019128927, - 0.026809130814036377, - 0.05525778128121262, - 0.08300436681668819, - 0.1061653007289208, - 0.12324687798730673, + 0.12324687798730669, + 0.10616530072892066, + 0.08300436681668824, + 0.05525778128121254, + 0.02680913081403634, + 0.004036128019128918, + 0.009816170908131312, + 0.010641392023869723, + 0.00689091385401626, + 0.010641392023869723, + 0.009816170908131213, + 0.004036128019128918, + 0.026809130814036495, + 0.055257781281212864, + 0.08300436681668824, + 0.10616530072892087, + 0.12324687798730669, 0.134442420761918, - 0.14076462648445495, - 0.14342589089685656, - 0.14351810827578088, + 0.14076462648445492, + 0.1434258908968566, + 0.1435181082757807, 0.14190166272427712, - 0.1392040071797701, - 0.13586084158547385, - 0.13216499453037694, - 0.12830877151867878, - 0.12441614222250086, - 0.1205655597328731, - 0.11680550433107302, - 0.11316483332933404, - 0.10965959258663721, - 0.10629748047902912, - 0.10308077565753798, - 0.10000826479194143 + 0.13920400717977002, + 0.13586084158547368, + 0.13216499453037692, + 0.12830877151867875, + 0.12441614222250089, + 0.12056555973287318, + 0.11680550433107308, + 0.11316483332933408, + 0.1096595925866374, + 0.10629748047902915, + 0.10308077565753802, + 0.10000826479194148 ], "fig02_stab_VDHS_K1": [ 3.195612004593886, @@ -1746,156 +1746,156 @@ "fig01_conv_MIN-SR-NS_LOBATTO_$K=1$": [ 6.190193985474138, 4.564431644023643, - 1.9562903819473227, - 0.7859748528680782, - 0.2663724122131104, - 0.12563792577697364, + 1.9562903819473236, + 0.785974852868078, + 0.2663724122131102, + 0.12563792577697386, 0.060995085922845756, - 0.023969146511500658, - 0.011913855170148572 + 0.02396914651149977, + 0.011913855170148346 ], "fig01_conv_MIN-SR-NS_LOBATTO_$K=2$": [ - 3.4183636540209306, - 0.4386943664507052, - 0.10065070949512224, + 3.418363654020929, + 0.43869436645070525, + 0.10065070949512242, 0.024844725733692022, - 0.0039689544670134195, - 0.0009921912084584923, - 0.0002480490021368055, - 3.968799370062174e-05, - 9.922005815852604e-06 + 0.0039689544670131706, + 0.0009921912084583397, + 0.00024804900213685484, + 3.96879937003745e-05, + 9.922005815704286e-06 ], "fig01_conv_MIN-SR-NS_LOBATTO_$K=3$": [ - 0.49881232709192924, - 0.02583461969153564, - 0.0031470127174889344, - 0.00039063173361450823, - 2.494735811068925e-05, - 3.117427913310439e-06, - 3.896469685786101e-07, - 2.4936833185918742e-08, + 0.4988123270919272, + 0.025834619691535176, + 0.0031470127174890125, + 0.00039063173361431037, + 2.494735811072265e-05, + 3.1174279135271488e-06, + 3.896469683783007e-07, + 2.4936832963924592e-08, 3.1169809783648595e-09 ], "fig01_conv_MIN-SR-NS_LOBATTO_$K=4$": [ - 0.0407925305246079, - 0.0003045358483721667, - 8.557543641014717e-06, - 2.591841341298208e-07, - 2.6298737836684637e-09, - 8.208436720886738e-11, - 2.5630599673444606e-12, - 2.22895549914363e-14, - 1.1524745754669983e-13 + 0.0407925305246074, + 0.0003045358483718143, + 8.55754364055517e-06, + 2.5918413408541336e-07, + 2.6298739870763276e-09, + 8.208416267785566e-11, + 2.5632877668940456e-12, + 2.2290047864320692e-14, + 1.150242306383502e-13 ], "fig01_conv_MIN-SR-NS_LOBATTO_$K=5$": [ - 0.007985940152898533, - 2.3310631988454857e-05, - 3.1431424527307014e-07, - 4.6822478703638075e-09, - 1.8905080337620303e-11, - 2.968083987775387e-13, - 6.651597296487977e-15, - 5.3032945191522335e-15, - 1.152452015824958e-13 + 0.007985940152898014, + 2.3310631988167164e-05, + 3.1431424476440854e-07, + 4.682248037318085e-09, + 1.8904879864477213e-11, + 2.9622562780277866e-13, + 6.665350522796423e-15, + 5.6354755596085694e-15, + 1.1535218360993602e-13 ], "fig01_conv_MIN-SR-S_RADAU-RIGHT_$K=1$": [ - 2.7106421300605414, - 1.3468140257640926, - 0.5765788475798426, - 0.25579156308503515, - 0.09502132072691982, - 0.04639275748537765, - 0.022927873436374358, - 0.009108177881982187, - 0.004543718474032761 + 2.7106421300605437, + 1.3468140257640955, + 0.576578847579846, + 0.25579156308503487, + 0.09502132072692027, + 0.046392757485376544, + 0.022927873436373904, + 0.00910817788198196, + 0.004543718474032763 ], "fig01_conv_MIN-SR-S_RADAU-RIGHT_$K=2$": [ - 0.8645651094810126, - 0.14815111847603668, - 0.03462832011582988, - 0.008382901044432052, - 0.0013266717622784736, - 0.00033112028589555513, - 8.274549728412895e-05, - 1.3237724989094307e-05, - 3.3093756439013806e-06 + 0.8645651094810148, + 0.14815111847603815, + 0.03462832011583011, + 0.008382901044432078, + 0.0013266717622783125, + 0.00033112028589540345, + 8.274549728422219e-05, + 1.3237724989206715e-05, + 3.309375644078146e-06 ], "fig01_conv_MIN-SR-S_RADAU-RIGHT_$K=3$": [ - 0.42980107795084854, - 0.02667779994762687, - 0.00271591963330548, - 0.0003095002809453826, - 1.92041647635049e-05, - 2.389404731133338e-06, - 2.9832640065613164e-07, - 1.9086659714773144e-08, - 2.385649202563511e-09 + 0.4298010779508495, + 0.026677799947627832, + 0.002715919633304206, + 0.00030950028094617847, + 1.92041647635082e-05, + 2.389404730933085e-06, + 2.983264008792323e-07, + 1.9086659486783344e-08, + 2.3856496449159033e-09 ], "fig01_conv_MIN-SR-S_RADAU-RIGHT_$K=4$": [ - 0.23247161868411034, - 0.006719952620684487, - 0.00028264905419148913, - 1.351226471653935e-05, - 3.082596809060139e-07, - 1.890464103164041e-08, - 1.1758208295949162e-09, - 3.00600897372531e-11, - 1.87876958978415e-12 + 0.23247161868410973, + 0.0067199526206845415, + 0.0002826490541899085, + 1.351226471665981e-05, + 3.0825968109268906e-07, + 1.890464100072884e-08, + 1.1758199404629256e-09, + 3.006029953745942e-11, + 1.8782237449535506e-12 ], "fig01_conv_MIN-SR-S_LOBATTO_$K=1$": [ - 4.3318685135819885, - 2.857995474384535, - 1.2649197356983224, - 0.5377561633505761, - 0.19049025456855553, - 0.09125061453813002, - 0.04464684843607603, - 0.01762690989178756, - 0.00877508244660792 + 4.3318685135819806, + 2.857995474384527, + 1.264919735698316, + 0.5377561633505759, + 0.19049025456855534, + 0.09125061453812933, + 0.04464684843607647, + 0.017626909891787335, + 0.00877508244660881 ], "fig01_conv_MIN-SR-S_LOBATTO_$K=2$": [ - 1.2264461026987865, - 0.11674766437677365, - 0.022912998894168042, - 0.005286871059936933, - 0.0008256196332030201, - 0.00020568259160717883, - 5.137570934826785e-05, - 8.218106665925478e-06, - 2.05445513321366e-06 + 1.226446102698781, + 0.11674766437677406, + 0.02291299889416756, + 0.005286871059937208, + 0.0008256196332025488, + 0.0002056825916073464, + 5.137570934836869e-05, + 8.218106664970002e-06, + 2.0544551322796618e-06 ], "fig01_conv_MIN-SR-S_LOBATTO_$K=3$": [ - 0.2831020228917702, - 0.013372662509927104, - 0.0014187424529362442, - 0.00016749309299216408, - 1.0531954045215518e-05, - 1.3130948830520997e-06, - 1.6403044391928728e-07, - 1.0496069545472758e-08, - 1.3119578066245256e-09 + 0.28310202289177866, + 0.013372662509928818, + 0.0014187424529356583, + 0.00016749309299286488, + 1.0531954045954046e-05, + 1.313094882360866e-06, + 1.6403044435799092e-07, + 1.0496070209985396e-08, + 1.3119578107284453e-09 ], "fig01_conv_MIN-SR-S_LOBATTO_$K=4$": [ - 0.09459785256987645, - 0.0015958539060761836, - 7.836275861453235e-05, - 4.49754998021275e-06, - 1.1212761097971252e-07, - 6.980770763856037e-09, - 4.35870324288637e-10, - 1.1154262258148805e-11, - 6.949468200938221e-13 + 0.09459785256988129, + 0.0015958539060772876, + 7.836275861434503e-05, + 4.4975499809452525e-06, + 1.1212761174217777e-07, + 6.980771069057821e-09, + 4.358711326180496e-10, + 1.1154475333650612e-11, + 6.95205941019221e-13 ], "fig01_conv_MIN-SR-S_LOBATTO_$K=5$": [ - 0.036953883603893734, - 0.00024577045180101134, - 5.324185968619995e-06, - 1.4367291992122873e-07, - 1.4025075157666007e-09, - 4.3513568454071483e-11, - 1.3491207844008615e-12, - 1.3522437266264141e-14, - 1.351438910099341e-14 + 0.03695388360389624, + 0.000245770451800986, + 5.324185969220942e-06, + 1.436729197663023e-07, + 1.40250710127061e-09, + 4.351381003201316e-11, + 1.3484302392564367e-12, + 1.3381744596555016e-14, + 1.3528575924223423e-14 ], "fig01_conv_MIN-SR-FLEX_RADAU-RIGHT_$K=1$": [ 1.1296012593172537, @@ -1942,58 +1942,58 @@ 3.397735730401283e-12 ], "fig01_conv_MIN-SR-FLEX_LOBATTO_$K=1$": [ - 1.1296012593172537, + 1.1296012593172535, 1.0244379690830323, 0.8600638566995474, 0.6218954441914761, 0.32521014689477934, 0.17896839255044764, - 0.09395842480535632, + 0.09395842480535666, 0.038707661192999315, 0.019545455623633533 ], "fig01_conv_MIN-SR-FLEX_LOBATTO_$K=2$": [ 1.0754387340055667, - 0.433860928312898, - 0.16549671967510293, - 0.048868091036633324, - 0.008202056407930255, - 0.0020631591714900003, - 0.000516533589114674, - 8.267744383958278e-05, - 2.0670481227268063e-05 + 0.4338609283128982, + 0.16549671967510324, + 0.04886809103663277, + 0.008202056407930118, + 0.002063159171490027, + 0.0005165335891145978, + 8.267744383918885e-05, + 2.0670481226320904e-05 ], "fig01_conv_MIN-SR-FLEX_LOBATTO_$K=3$": [ 0.6358733551797489, - 0.1000929615831124, - 0.013707657328314872, - 0.0015163764245318834, - 8.863864986158586e-05, - 1.0889414501929428e-05, - 1.354988221290613e-06, - 8.660720414096238e-08, - 1.0823777693251798e-08 + 0.10009296158311205, + 0.013707657328314964, + 0.001516376424531832, + 8.863864986138237e-05, + 1.0889414501795507e-05, + 1.3549882214737685e-06, + 8.660720460453337e-08, + 1.0823777915525586e-08 ], "fig01_conv_MIN-SR-FLEX_LOBATTO_$K=4$": [ - 0.2683402781257809, - 0.014666007432830145, - 0.0008440493056453323, - 3.658879510702298e-05, - 6.34311734271313e-07, - 3.552633352155699e-08, - 2.1494663013225486e-09, - 5.4498602104157756e-11, - 3.3971325117286916e-12 + 0.2683402781257816, + 0.014666007432829956, + 0.0008440493056451221, + 3.6588795107039056e-05, + 6.343117347073724e-07, + 3.552633359813088e-08, + 2.149466191672074e-09, + 5.449892379754082e-11, + 3.3973264557351417e-12 ], "fig01_conv_MIN-SR-FLEX_LOBATTO_$K=5$": [ - 0.1058558285699054, - 0.0019763887586471958, - 4.330592799751463e-05, - 7.454355761257005e-07, - 3.7229148855304855e-09, - 8.480839728703253e-11, - 2.3377761651159793e-12, - 1.8352664197006546e-14, - 1.1480244080879017e-13 + 0.10585582856990569, + 0.001976388758647382, + 4.330592799790996e-05, + 7.454355760413361e-07, + 3.7229149283904196e-09, + 8.480862567868766e-11, + 2.3378291026409775e-12, + 1.7890750547857405e-14, + 1.1502408431505933e-13 ] } \ No newline at end of file diff --git a/pySDC/projects/parallelSDC_reloaded/scripts/fig04_protheroRobinson.py b/pySDC/projects/parallelSDC_reloaded/scripts/fig04_protheroRobinson.py index d1323c3d41..ae004ca75b 100644 --- a/pySDC/projects/parallelSDC_reloaded/scripts/fig04_protheroRobinson.py +++ b/pySDC/projects/parallelSDC_reloaded/scripts/fig04_protheroRobinson.py @@ -88,7 +88,7 @@ def getCost(counters): plt.figure(figNameConv) plt.loglog(dtVals, errors, sym + ls, label=qDelta) - data.storeAndCheck(f"{figNameConv}_{qDelta}", errors, rtol=1e-2) + data.storeAndCheck(f"{figNameConv}_{qDelta}", errors) plt.figure(figNameCost) plt.loglog(costs, errors, sym + ls, label=qDelta) From dd3e7f7e627825e129fd4c3ff3c7510949a58393 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 14:21:32 +0200 Subject: [PATCH 18/38] TL: trying stuff for parallelSDC tests --- pySDC/projects/parallelSDC/preconditioner_playground_MPI.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py index c2a1e66bdf..92e3e0f1fd 100644 --- a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py +++ b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py @@ -5,6 +5,8 @@ import numpy as np from mpi4py import MPI +import matplotlib as mpl +mpl.use("Agg") import pySDC.helpers.plot_helper as plt_helper from pySDC.helpers.stats_helper import get_sorted From f63de357570d765bbd4285221ce26c2a0f16d4e7 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 14:56:37 +0200 Subject: [PATCH 19/38] TL: investigating --- pySDC/projects/parallelSDC/preconditioner_playground_MPI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py index 92e3e0f1fd..008872fe6e 100644 --- a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py +++ b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py @@ -247,5 +247,5 @@ def plot_iterations(): if __name__ == "__main__": comm = MPI.COMM_WORLD main(comm=comm) - if comm.Get_rank() == 0: - plot_iterations() + # if comm.Get_rank() == 0: + # plot_iterations() From 5b86ae72ff4883b55b13dfedf703fd89a4392631 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 14:57:04 +0200 Subject: [PATCH 20/38] TL: adapted to new qmat version --- pySDC/core/Sweeper.py | 6 ------ pySDC/projects/parallelSDC/preconditioner_playground_MPI.py | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/pySDC/core/Sweeper.py b/pySDC/core/Sweeper.py index fa63f5e42e..e841852b8c 100644 --- a/pySDC/core/Sweeper.py +++ b/pySDC/core/Sweeper.py @@ -78,12 +78,6 @@ def setupGenerator(self, coll: CollBase, qd_type): try: assert QDELTA_GENERATORS[qd_type] == type(self.generator) assert self.generator.QDelta.shape[0] == coll.Qmat.shape[0] - 1 - # Note : the following projects change coll dynamically : - # - DAE - # - Resilience - # Storing the QDelta generator (and the QDelta) make the tests for those projects fail - # => we force the re-instantiation of the generator, until some fix is found for those projects - raise AssertionError() except (AssertionError, AttributeError): self.generator = QDELTA_GENERATORS[qd_type]( # for algebraic types (LU, ...) diff --git a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py index 008872fe6e..1a10687766 100644 --- a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py +++ b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py @@ -6,6 +6,7 @@ from mpi4py import MPI import matplotlib as mpl + mpl.use("Agg") import pySDC.helpers.plot_helper as plt_helper from pySDC.helpers.stats_helper import get_sorted From b0aaa6316908fa9e532554d08895877a7a8357b0 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 15:47:40 +0200 Subject: [PATCH 21/38] TL: let's stop beeing stupid --- pySDC/core/Sweeper.py | 26 +++++++++---------- .../sweeper_classes/boris_2nd_order.py | 4 +-- .../sweeper_classes/explicit.py | 2 +- .../sweeper_classes/generic_implicit.py | 4 +-- .../sweeper_classes/imex_1st_order.py | 4 +-- .../sweeper_classes/multi_implicit.py | 4 +-- .../implementations/sweeper_classes/verlet.py | 4 +-- .../12th_PinT_Workshop/3_Custom_sweeper.ipynb | 2 +- .../12th_PinT_Workshop/playground.ipynb | 2 +- pySDC/playgrounds/FEniCS/fenics_sdc.py | 4 +-- pySDC/playgrounds/Gander/matrix_based.py | 10 +++---- .../Hackfest 2022/playground.ipynb | 2 +- pySDC/playgrounds/optimization/playground.py | 4 +-- .../projects/DAE/sweepers/SemiImplicitDAE.py | 2 +- .../DAE/sweepers/fully_implicit_DAE.py | 2 +- .../imexexp_1st_order.py | 2 +- .../runge_kutta/imexexp_1st_order.py | 2 +- .../tests/test_preconditioner_MPI.py | 3 ++- .../parallelSDC_reloaded/nilpotency.py | 4 +-- .../test_sweepers/test_preconditioners.py | 14 +++++----- 20 files changed, 51 insertions(+), 50 deletions(-) diff --git a/pySDC/core/Sweeper.py b/pySDC/core/Sweeper.py index e841852b8c..9505eb9483 100644 --- a/pySDC/core/Sweeper.py +++ b/pySDC/core/Sweeper.py @@ -74,7 +74,8 @@ def __init__(self, params): self.parallelizable = False - def setupGenerator(self, coll: CollBase, qd_type): + def setupGenerator(self, qd_type): + coll = self.coll try: assert QDELTA_GENERATORS[qd_type] == type(self.generator) assert self.generator.QDelta.shape[0] == coll.Qmat.shape[0] - 1 @@ -93,28 +94,27 @@ def setupGenerator(self, coll: CollBase, qd_type): except Exception as e: raise ValueError(f"could not generate {qd_type=!r} with qmat, got error : {e}") - def get_Qdelta_implicit(self, coll: CollBase, qd_type, k=None): - QDmat = np.zeros(coll.Qmat.shape, dtype=float) - self.setupGenerator(coll, qd_type) + def get_Qdelta_implicit(self, qd_type, k=None): + QDmat = np.zeros_like(self.coll.Qmat) + self.setupGenerator(qd_type) QDmat[1:, 1:] = self.generator.genCoeffs(k=k) - # check if we got not more than a lower triangular matrix - np.testing.assert_array_equal( - np.triu(QDmat, k=1), np.zeros(QDmat.shape), err_msg='Lower triangular matrix expected!' - ) + err_msg = 'Lower triangular matrix expected!' + np.testing.assert_array_equal(np.triu(QDmat, k=1), np.zeros(QDmat.shape), err_msg=err_msg) if np.allclose(np.diag(np.diag(QDmat)), QDmat): self.parallelizable = True return QDmat - def get_Qdelta_explicit(self, coll, qd_type, k=None): + def get_Qdelta_explicit(self, qd_type, k=None): + coll = self.coll QDmat = np.zeros(coll.Qmat.shape, dtype=float) self.setupGenerator(coll, qd_type) QDmat[1:, 1:], QDmat[1:, 0] = self.generator.genCoeffs(k=k, dTau=True) - # check if we got not more than a strictly lower triangular matrix - np.testing.assert_array_equal( - np.triu(QDmat, k=0), np.zeros(QDmat.shape), err_msg='Strictly lower triangular matrix expected!' - ) + err_msg = 'Strictly lower triangular matrix expected!' + np.testing.assert_array_equal(np.triu(QDmat, k=0), np.zeros(QDmat.shape), err_msg=err_msg) + if np.allclose(np.diag(np.diag(QDmat)), QDmat): + self.parallelizable = True # for PIC ;) return QDmat def predict(self): diff --git a/pySDC/implementations/sweeper_classes/boris_2nd_order.py b/pySDC/implementations/sweeper_classes/boris_2nd_order.py index d7c234dac8..9264716828 100644 --- a/pySDC/implementations/sweeper_classes/boris_2nd_order.py +++ b/pySDC/implementations/sweeper_classes/boris_2nd_order.py @@ -60,8 +60,8 @@ def __get_Qd(self): """ # set implicit and explicit Euler matrices (default, but can be changed) - QI = self.get_Qdelta_implicit(self.coll, qd_type=self.params.QI) - QE = self.get_Qdelta_explicit(self.coll, qd_type=self.params.QE) + QI = self.get_Qdelta_implicit(qd_type=self.params.QI) + QE = self.get_Qdelta_explicit(qd_type=self.params.QE) # trapezoidal rule QT = 1 / 2 * (QI + QE) diff --git a/pySDC/implementations/sweeper_classes/explicit.py b/pySDC/implementations/sweeper_classes/explicit.py index 44b0b7ce19..751eb8272f 100644 --- a/pySDC/implementations/sweeper_classes/explicit.py +++ b/pySDC/implementations/sweeper_classes/explicit.py @@ -24,7 +24,7 @@ def __init__(self, params): super(explicit, self).__init__(params) # integration matrix - self.QE = self.get_Qdelta_explicit(coll=self.coll, qd_type=self.params.QE) + self.QE = self.get_Qdelta_explicit(qd_type=self.params.QE) def integrate(self): """ diff --git a/pySDC/implementations/sweeper_classes/generic_implicit.py b/pySDC/implementations/sweeper_classes/generic_implicit.py index 6ac5d8119b..a17466dedc 100644 --- a/pySDC/implementations/sweeper_classes/generic_implicit.py +++ b/pySDC/implementations/sweeper_classes/generic_implicit.py @@ -24,7 +24,7 @@ def __init__(self, params): super().__init__(params) # get QI matrix - self.QI = self.get_Qdelta_implicit(self.coll, qd_type=self.params.QI) + self.QI = self.get_Qdelta_implicit(qd_type=self.params.QI) def integrate(self): """ @@ -67,7 +67,7 @@ def update_nodes(self): # update the MIN-SR-FLEX preconditioner if self.params.QI == 'MIN-SR-FLEX': - self.QI = self.get_Qdelta_implicit(self.coll, qd_type="MIN-SR-FLEX", k=L.status.sweep) + self.QI = self.get_Qdelta_implicit(qd_type="MIN-SR-FLEX", k=L.status.sweep) # gather all terms which are known already (e.g. from the previous iteration) # this corresponds to u0 + QF(u^k) - QdF(u^k) + tau diff --git a/pySDC/implementations/sweeper_classes/imex_1st_order.py b/pySDC/implementations/sweeper_classes/imex_1st_order.py index c86b4facab..04c06f0472 100644 --- a/pySDC/implementations/sweeper_classes/imex_1st_order.py +++ b/pySDC/implementations/sweeper_classes/imex_1st_order.py @@ -31,8 +31,8 @@ def __init__(self, params): super().__init__(params) # IMEX integration matrices - self.QI = self.get_Qdelta_implicit(coll=self.coll, qd_type=self.params.QI) - self.QE = self.get_Qdelta_explicit(coll=self.coll, qd_type=self.params.QE) + self.QI = self.get_Qdelta_implicit(qd_type=self.params.QI) + self.QE = self.get_Qdelta_explicit(qd_type=self.params.QE) def integrate(self): """ diff --git a/pySDC/implementations/sweeper_classes/multi_implicit.py b/pySDC/implementations/sweeper_classes/multi_implicit.py index 1958bb33e1..22cd2c6567 100644 --- a/pySDC/implementations/sweeper_classes/multi_implicit.py +++ b/pySDC/implementations/sweeper_classes/multi_implicit.py @@ -30,8 +30,8 @@ def __init__(self, params): super(multi_implicit, self).__init__(params) # Integration matrices - self.Q1 = self.get_Qdelta_implicit(coll=self.coll, qd_type=self.params.Q1) - self.Q2 = self.get_Qdelta_implicit(coll=self.coll, qd_type=self.params.Q2) + self.Q1 = self.get_Qdelta_implicit(qd_type=self.params.Q1) + self.Q2 = self.get_Qdelta_implicit(qd_type=self.params.Q2) def integrate(self): """ diff --git a/pySDC/implementations/sweeper_classes/verlet.py b/pySDC/implementations/sweeper_classes/verlet.py index 49ae27981c..83d17fc8b6 100644 --- a/pySDC/implementations/sweeper_classes/verlet.py +++ b/pySDC/implementations/sweeper_classes/verlet.py @@ -49,8 +49,8 @@ def __get_Qd(self): """ # set implicit and explicit Euler matrices - QI = self.get_Qdelta_implicit(self.coll, self.params.QI) - QE = self.get_Qdelta_explicit(self.coll, self.params.QE) + QI = self.get_Qdelta_implicit(self.params.QI) + QE = self.get_Qdelta_explicit(self.params.QE) # trapezoidal rule QT = 0.5 * (QI + QE) diff --git a/pySDC/playgrounds/12th_PinT_Workshop/3_Custom_sweeper.ipynb b/pySDC/playgrounds/12th_PinT_Workshop/3_Custom_sweeper.ipynb index 5877658302..cc8f57509f 100644 --- a/pySDC/playgrounds/12th_PinT_Workshop/3_Custom_sweeper.ipynb +++ b/pySDC/playgrounds/12th_PinT_Workshop/3_Custom_sweeper.ipynb @@ -149,7 +149,7 @@ " super().__init__(params)\n", " \n", " # set Q_Delta matrix and store MPI rank\n", - " self.QI = self.get_Qdelta_implicit(self.coll, qd_type=self.params.QI)\n", + " self.QI = self.get_Qdelta_implicit(qd_type=self.params.QI)\n", " self.rank = self.params.comm.Get_rank()" ] }, diff --git a/pySDC/playgrounds/12th_PinT_Workshop/playground.ipynb b/pySDC/playgrounds/12th_PinT_Workshop/playground.ipynb index d2051f9120..21c9f2d091 100644 --- a/pySDC/playgrounds/12th_PinT_Workshop/playground.ipynb +++ b/pySDC/playgrounds/12th_PinT_Workshop/playground.ipynb @@ -982,7 +982,7 @@ " # call parent's initialization routine\n", " super(generic_implicit_MPI, self).__init__(params)\n", " # set Q_Delta matrix and store MPI rank\n", - " self.QI = self.get_Qdelta_implicit(self.coll, qd_type=self.params.QI)\n", + " self.QI = self.get_Qdelta_implicit(qd_type=self.params.QI)\n", " self.rank = self.params.comm.Get_rank()" ] }, diff --git a/pySDC/playgrounds/FEniCS/fenics_sdc.py b/pySDC/playgrounds/FEniCS/fenics_sdc.py index a36070a4c7..b5b8fceb8c 100644 --- a/pySDC/playgrounds/FEniCS/fenics_sdc.py +++ b/pySDC/playgrounds/FEniCS/fenics_sdc.py @@ -77,8 +77,8 @@ def uexact(t, order, V): params = {'num_nodes': nnodes, 'quad_type': quad_type, 'node_type': node_type} sweeper = Sweeper(params) Q = sweeper.coll.Qmat -QI = sweeper.get_Qdelta_implicit(sweeper.coll, qd_type) -QE = sweeper.get_Qdelta_explicit(sweeper.coll, 'EE') +QI = sweeper.get_Qdelta_implicit(qd_type) +QE = sweeper.get_Qdelta_explicit('EE') u = [df.Function(V) for _ in range(nnodes + 1)] fimpl = [df.Function(V) for _ in range(nnodes + 1)] diff --git a/pySDC/playgrounds/Gander/matrix_based.py b/pySDC/playgrounds/Gander/matrix_based.py index 07e48551b6..76358c06d7 100644 --- a/pySDC/playgrounds/Gander/matrix_based.py +++ b/pySDC/playgrounds/Gander/matrix_based.py @@ -9,9 +9,9 @@ def iteration_vs_estimate(): K = 10 swee = sweeper({'collocation_class': CollGaussRadau_Right, 'num_nodes': M}) Q = swee.coll.Qmat[1:, 1:] - Qd = swee.get_Qdelta_implicit(swee.coll, 'IE')[1:, 1:] - # Qd = swee.get_Qdelta_implicit(swee.coll, 'LU')[1:, 1:] - # Qd = swee.get_Qdelta_explicit(swee.coll, 'EE')[1:, 1:] + Qd = swee.get_Qdelta_implicit('IE')[1:, 1:] + # Qd = swee.get_Qdelta_implicit('LU')[1:, 1:] + # Qd = swee.get_Qdelta_explicit('EE')[1:, 1:] print(np.linalg.norm(Q - Qd, np.inf)) exit() I = np.eye(M) @@ -67,8 +67,8 @@ def estimates_over_lambda(): K = 10 swee = sweeper({'collocation_class': CollGaussRadau_Right, 'num_nodes': M}) Q = swee.coll.Qmat[1:, 1:] - # Qd = swee.get_Qdelta_implicit(swee.coll, 'IE')[1:, 1:] - Qd = swee.get_Qdelta_implicit(swee.coll, 'LU')[1:, 1:] + # Qd = swee.get_Qdelta_implicit('IE')[1:, 1:] + Qd = swee.get_Qdelta_implicit('LU')[1:, 1:] Qdinv = np.linalg.inv(Qd) I = np.eye(M) diff --git a/pySDC/playgrounds/Hackfest 2022/playground.ipynb b/pySDC/playgrounds/Hackfest 2022/playground.ipynb index fd1883531b..11ef1b0cee 100644 --- a/pySDC/playgrounds/Hackfest 2022/playground.ipynb +++ b/pySDC/playgrounds/Hackfest 2022/playground.ipynb @@ -906,7 +906,7 @@ sweeper_params['quad_type'] = 'RADAU-RIGHT'\n", " # call parent's initialization routine\n", " super(generic_implicit_MPI, self).__init__(params)\n", " # set Q_Delta matrix and store MPI rank\n", - " self.QI = self.get_Qdelta_implicit(self.coll, qd_type=self.params.QI)\n", + " self.QI = self.get_Qdelta_implicit(qd_type=self.params.QI)\n", " self.rank = self.params.comm.Get_rank()" ] }, diff --git a/pySDC/playgrounds/optimization/playground.py b/pySDC/playgrounds/optimization/playground.py index e12f74ec41..767ee771f5 100644 --- a/pySDC/playgrounds/optimization/playground.py +++ b/pySDC/playgrounds/optimization/playground.py @@ -19,9 +19,9 @@ def rho(x): for prec in prec_list: sw = sweeper({'collocation_class': CollGaussRadau_Right, 'num_nodes': M}) if prec != 'EE': - QDelta = sw.get_Qdelta_implicit(sw.coll, prec)[1:, 1:] + QDelta = sw.get_Qdelta_implicit(prec)[1:, 1:] else: - QDelta = sw.get_Qdelta_explicit(sw.coll, prec)[1:, 1:] + QDelta = sw.get_Qdelta_explicit(prec)[1:, 1:] QDL = np.tril(QDelta, -1) QDD = np.diag(np.diag(QDelta)) Q = sw.coll.Qmat[1:, 1:] diff --git a/pySDC/projects/DAE/sweepers/SemiImplicitDAE.py b/pySDC/projects/DAE/sweepers/SemiImplicitDAE.py index 9a0901650d..90734c0d63 100644 --- a/pySDC/projects/DAE/sweepers/SemiImplicitDAE.py +++ b/pySDC/projects/DAE/sweepers/SemiImplicitDAE.py @@ -96,7 +96,7 @@ def __init__(self, params): if self.coll.left_is_node: raise ParameterError(msg) - self.QI = self.get_Qdelta_implicit(coll=self.coll, qd_type=self.params.QI) + self.QI = self.get_Qdelta_implicit(qd_type=self.params.QI) def integrate(self): r""" diff --git a/pySDC/projects/DAE/sweepers/fully_implicit_DAE.py b/pySDC/projects/DAE/sweepers/fully_implicit_DAE.py index fa6cfb944e..6b94517f4d 100644 --- a/pySDC/projects/DAE/sweepers/fully_implicit_DAE.py +++ b/pySDC/projects/DAE/sweepers/fully_implicit_DAE.py @@ -59,7 +59,7 @@ def __init__(self, params): if self.coll.left_is_node: raise ParameterError(msg) - self.QI = self.get_Qdelta_implicit(coll=self.coll, qd_type=self.params.QI) + self.QI = self.get_Qdelta_implicit(qd_type=self.params.QI) def update_nodes(self): r""" diff --git a/pySDC/projects/Monodomain/sweeper_classes/exponential_runge_kutta/imexexp_1st_order.py b/pySDC/projects/Monodomain/sweeper_classes/exponential_runge_kutta/imexexp_1st_order.py index 25c0813c14..1d470ed761 100644 --- a/pySDC/projects/Monodomain/sweeper_classes/exponential_runge_kutta/imexexp_1st_order.py +++ b/pySDC/projects/Monodomain/sweeper_classes/exponential_runge_kutta/imexexp_1st_order.py @@ -32,7 +32,7 @@ def __init__(self, params): super(imexexp_1st_order, self).__init__(params) # IMEX integration matrices - self.QI = self.get_Qdelta_implicit(coll=self.coll, qd_type=self.params.QI) + self.QI = self.get_Qdelta_implicit(qd_type=self.params.QI) self.delta = np.diagonal(self.QI)[1:] # Compute weights w such that PiQ^(k)(0) = sum_{j=0}^{M-1} w[k,j]*Q[j], k=0,...,M-1 diff --git a/pySDC/projects/Monodomain/sweeper_classes/runge_kutta/imexexp_1st_order.py b/pySDC/projects/Monodomain/sweeper_classes/runge_kutta/imexexp_1st_order.py index fbd6d45341..b8536b495e 100644 --- a/pySDC/projects/Monodomain/sweeper_classes/runge_kutta/imexexp_1st_order.py +++ b/pySDC/projects/Monodomain/sweeper_classes/runge_kutta/imexexp_1st_order.py @@ -28,7 +28,7 @@ def __init__(self, params): super(imexexp_1st_order, self).__init__(params) # IMEX integration matrices - self.QI = self.get_Qdelta_implicit(coll=self.coll, qd_type=self.params.QI) + self.QI = self.get_Qdelta_implicit(qd_type=self.params.QI) self.delta = np.diagonal(self.QI)[1:] def eval_phi_f_exp(self, u, factor): diff --git a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py index 4cc7fc5513..5dbbda9017 100644 --- a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py +++ b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py @@ -5,7 +5,8 @@ @pytest.mark.slow @pytest.mark.mpi4py -@pytest.mark.parametrize('num_procs', [3, 5]) +@pytest.mark.timeout(600) +@pytest.mark.parametrize('num_procs', [3]) def test_preconditioner_playground_MPI(num_procs): # Set python path once my_env = os.environ.copy() diff --git a/pySDC/projects/parallelSDC_reloaded/nilpotency.py b/pySDC/projects/parallelSDC_reloaded/nilpotency.py index f3a2a64e64..4838bd3cd0 100644 --- a/pySDC/projects/parallelSDC_reloaded/nilpotency.py +++ b/pySDC/projects/parallelSDC_reloaded/nilpotency.py @@ -40,11 +40,11 @@ def nilpotencyNS(d, Q): Q = s.coll.Qmat[1:, 1:] nodes = s.coll.nodes - qDelta = s.get_Qdelta_implicit(s.coll, qd_type="MIN-SR-S") + qDelta = s.get_Qdelta_implicit(qd_type="MIN-SR-S") d = np.diag(qDelta)[1:] nil_MIN_SR_S.append([nilpotencyS(d, Q), nilpotencyNS(d, Q)]) - qDelta = s.get_Qdelta_implicit(s.coll, qd_type="MIN-SR-NS") + qDelta = s.get_Qdelta_implicit(qd_type="MIN-SR-NS") d = np.diag(qDelta)[1:] nil_MIN_SR_NS.append([nilpotencyS(d, Q), nilpotencyNS(d, Q)]) diff --git a/pySDC/tests/test_sweepers/test_preconditioners.py b/pySDC/tests/test_sweepers/test_preconditioners.py index a44c7e9fd4..a9d6fbdcdc 100644 --- a/pySDC/tests/test_sweepers/test_preconditioners.py +++ b/pySDC/tests/test_sweepers/test_preconditioners.py @@ -18,7 +18,7 @@ def test_MIN_SR(node_type, quad_type, M): Q = sweeper.coll.Qmat[1:, 1:] # Check non-stiff limit - QDelta = sweeper.get_Qdelta_implicit(sweeper.coll, 'MIN-SR-NS')[1:, 1:] + QDelta = sweeper.get_Qdelta_implicit('MIN-SR-NS')[1:, 1:] assert np.all(np.diag(np.diag(QDelta)) == QDelta), "no diagonal QDelta" K = Q - QDelta Km = np.linalg.matrix_power(K, M) @@ -26,7 +26,7 @@ def test_MIN_SR(node_type, quad_type, M): assert nilpotency < 1e-10, "Q-QDelta not nilpotent " f"(M={M}, norm={nilpotency})" # Check stiff limit - QDelta = sweeper.get_Qdelta_implicit(sweeper.coll, 'MIN-SR-S')[1:, 1:] + QDelta = sweeper.get_Qdelta_implicit('MIN-SR-S')[1:, 1:] assert np.all(np.diag(np.diag(QDelta)) == QDelta), "no diagonal QDelta" if params['quad_type'] in ['LOBATTO', 'RADAU-LEFT']: @@ -56,7 +56,7 @@ def test_LU(node_type, quad_type, M): Q = sweeper.coll.Qmat[1:, 1:] # Check nilpotency - QDelta = sweeper.get_Qdelta_implicit(sweeper.coll, 'LU')[1:, 1:] + QDelta = sweeper.get_Qdelta_implicit('LU')[1:, 1:] if params['quad_type'] in ['LOBATTO', 'RADAU-LEFT']: QDelta = QDelta[1:, 1:] @@ -77,7 +77,7 @@ def test_Qpar(node_type, quad_type, M): sweeper = Sweeper(params) Q = sweeper.coll.Qmat[1:, 1:] - QDelta = sweeper.get_Qdelta_implicit(sweeper.coll, 'Qpar')[1:, 1:] + QDelta = sweeper.get_Qdelta_implicit('Qpar')[1:, 1:] assert np.all(np.diag(np.diag(QDelta)) == QDelta), "no diagonal QDelta" assert np.all(np.diag(QDelta) == np.diag(Q)), "not the diagonal Q coefficients" @@ -90,7 +90,7 @@ def test_IE(node_type, quad_type, M): params = {'num_nodes': M, 'quad_type': quad_type, 'node_type': node_type} sweeper = Sweeper(params) - QDelta = sweeper.get_Qdelta_implicit(sweeper.coll, 'IE')[1:, 1:] + QDelta = sweeper.get_Qdelta_implicit('IE')[1:, 1:] for i in range(M): assert np.all(QDelta[i, : i + 1] == QDelta[-1, : i + 1]), "not the same coefficients in columns" assert np.all(np.cumsum(QDelta[-1] == sweeper.coll.nodes)), "last line cumsum not equal to nodes" @@ -104,7 +104,7 @@ def test_IEpar(node_type, quad_type, M): params = {'num_nodes': M, 'quad_type': quad_type, 'node_type': node_type} sweeper = Sweeper(params) - QDelta = sweeper.get_Qdelta_implicit(sweeper.coll, 'IEpar')[1:, 1:] + QDelta = sweeper.get_Qdelta_implicit('IEpar')[1:, 1:] assert np.all(np.diag(np.diag(QDelta)) == QDelta), "no diagonal QDelta" assert np.all(np.cumsum(np.diag(QDelta) == sweeper.coll.nodes)), "diagonal cumsum not equal to nodes" @@ -117,7 +117,7 @@ def test_PIC(node_type, quad_type, M): params = {'num_nodes': M, 'quad_type': quad_type, 'node_type': node_type} sweeper = Sweeper(params) - QDelta = sweeper.get_Qdelta_implicit(sweeper.coll, 'PIC')[1:, 1:] + QDelta = sweeper.get_Qdelta_implicit('PIC')[1:, 1:] assert np.all(QDelta == 0), "not a null matrix" From a33b80817839b52d778fe37ed179be2f470e9211 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 15:51:49 +0200 Subject: [PATCH 22/38] TL: ... starting now --- pySDC/core/Sweeper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySDC/core/Sweeper.py b/pySDC/core/Sweeper.py index 9505eb9483..5261e8eaa0 100644 --- a/pySDC/core/Sweeper.py +++ b/pySDC/core/Sweeper.py @@ -108,7 +108,7 @@ def get_Qdelta_implicit(self, qd_type, k=None): def get_Qdelta_explicit(self, qd_type, k=None): coll = self.coll QDmat = np.zeros(coll.Qmat.shape, dtype=float) - self.setupGenerator(coll, qd_type) + self.setupGenerator(qd_type) QDmat[1:, 1:], QDmat[1:, 0] = self.generator.genCoeffs(k=k, dTau=True) err_msg = 'Strictly lower triangular matrix expected!' From e05986c7d13d219813219a1d8b26304527594a1b Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 16:02:30 +0200 Subject: [PATCH 23/38] TL: checking hypothesis --- pySDC/projects/parallelSDC/preconditioner_playground_MPI.py | 4 ++-- pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py index 1a10687766..419a0392d5 100644 --- a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py +++ b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py @@ -248,5 +248,5 @@ def plot_iterations(): if __name__ == "__main__": comm = MPI.COMM_WORLD main(comm=comm) - # if comm.Get_rank() == 0: - # plot_iterations() + if comm.Get_rank() == 0: + plot_iterations() diff --git a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py index 5dbbda9017..fb27a02caa 100644 --- a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py +++ b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py @@ -6,12 +6,14 @@ @pytest.mark.slow @pytest.mark.mpi4py @pytest.mark.timeout(600) -@pytest.mark.parametrize('num_procs', [3]) +@pytest.mark.parametrize('num_procs', [3, 5]) def test_preconditioner_playground_MPI(num_procs): # Set python path once my_env = os.environ.copy() my_env['PYTHONPATH'] = '../../..:.' my_env['COVERAGE_PROCESS_START'] = 'pyproject.toml' + my_env['OPENBLAS_NUM_THREADS'] = '1' + my_env['MKL_NUM_THREADS'] = '1' cwd = '.' cmd = ( 'mpirun -np ' + str(num_procs) + ' python pySDC/projects/parallelSDC/preconditioner_playground_MPI.py' From bfde9a2803619d5703bd9ce64d89b429ef7a979c Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 16:55:14 +0200 Subject: [PATCH 24/38] TL: RK sweeper based on qmat --- .../sweeper_classes/Runge_Kutta.py | 431 ++---------------- .../tests/test_preconditioner_MPI.py | 3 +- 2 files changed, 38 insertions(+), 396 deletions(-) diff --git a/pySDC/implementations/sweeper_classes/Runge_Kutta.py b/pySDC/implementations/sweeper_classes/Runge_Kutta.py index f817cfd3b3..6db2d45e33 100644 --- a/pySDC/implementations/sweeper_classes/Runge_Kutta.py +++ b/pySDC/implementations/sweeper_classes/Runge_Kutta.py @@ -1,5 +1,6 @@ import numpy as np import logging +from qmat.qcoeff.butcher import RK_SCHEMES from pySDC.core.Sweeper import sweeper, _Pars from pySDC.core.Errors import ParameterError @@ -453,14 +454,8 @@ class ForwardEuler(RungeKutta): Not very stable first order method. """ - - nodes = np.array([0.0]) - weights = np.array([1.0]) - matrix = np.array( - [ - [0.0], - ] - ) + generator = RK_SCHEMES["FE"]() + nodes, weights, matrix = generator.genCoeffs() class BackwardEuler(RungeKutta): @@ -469,73 +464,47 @@ class BackwardEuler(RungeKutta): A-stable first order method. """ - - nodes = np.array([1.0]) - weights = np.array([1.0]) - matrix = np.array( - [ - [1.0], - ] - ) + generator = RK_SCHEMES["BE"]() + nodes, weights, matrix = generator.genCoeffs() class CrankNicholson(RungeKutta): """ Implicit Runge-Kutta method of second order, A-stable. """ - - nodes = np.array([0, 1]) - weights = np.array([0.5, 0.5]) - matrix = np.zeros((2, 2)) - matrix[1, 0] = 0.5 - matrix[1, 1] = 0.5 + generator = RK_SCHEMES["CN"]() + nodes, weights, matrix = generator.genCoeffs() class ExplicitMidpointMethod(RungeKutta): """ Explicit Runge-Kutta method of second order. """ - - nodes = np.array([0, 0.5]) - weights = np.array([0, 1]) - matrix = np.zeros((2, 2)) - matrix[1, 0] = 0.5 + generator = RK_SCHEMES["RK2"]() + nodes, weights, matrix = generator.genCoeffs() class ImplicitMidpointMethod(RungeKutta): """ Implicit Runge-Kutta method of second order. """ - - nodes = np.array([0.5]) - weights = np.array([1]) - matrix = np.zeros((1, 1)) - matrix[0, 0] = 1.0 / 2.0 + generator = RK_SCHEMES["IMP"]() + nodes, weights, matrix = generator.genCoeffs() class RK4(RungeKutta): """ Explicit Runge-Kutta of fourth order: Everybody's darling. """ - - nodes = np.array([0, 0.5, 0.5, 1]) - weights = np.array([1.0, 2.0, 2.0, 1.0]) / 6.0 - matrix = np.zeros((4, 4)) - matrix[1, 0] = 0.5 - matrix[2, 1] = 0.5 - matrix[3, 2] = 1.0 - + generator = RK_SCHEMES["RK4"]() + nodes, weights, matrix = generator.genCoeffs() class Heun_Euler(RungeKutta): """ Second order explicit embedded Runge-Kutta method. """ - - nodes = np.array([0, 1]) - weights = np.array([[0.5, 0.5], [1, 0]]) - matrix = np.zeros((2, 2)) - matrix[1, 0] = 1 - ButcherTableauClass = ButcherTableauEmbedded + generator = RK_SCHEMES["HEUN"]() + nodes, weights, matrix = generator.genCoeffs() @classmethod def get_update_order(cls): @@ -546,20 +515,8 @@ class Cash_Karp(RungeKutta): """ Fifth order explicit embedded Runge-Kutta. See [here](https://doi.org/10.1145/79505.79507). """ - - nodes = np.array([0, 0.2, 0.3, 0.6, 1.0, 7.0 / 8.0]) - weights = np.array( - [ - [37.0 / 378.0, 0.0, 250.0 / 621.0, 125.0 / 594.0, 0.0, 512.0 / 1771.0], - [2825.0 / 27648.0, 0.0, 18575.0 / 48384.0, 13525.0 / 55296.0, 277.0 / 14336.0, 1.0 / 4.0], - ] - ) - matrix = np.zeros((6, 6)) - matrix[1, 0] = 1.0 / 5.0 - matrix[2, :2] = [3.0 / 40.0, 9.0 / 40.0] - matrix[3, :3] = [0.3, -0.9, 1.2] - matrix[4, :4] = [-11.0 / 54.0, 5.0 / 2.0, -70.0 / 27.0, 35.0 / 27.0] - matrix[5, :5] = [1631.0 / 55296.0, 175.0 / 512.0, 575.0 / 13824.0, 44275.0 / 110592.0, 253.0 / 4096.0] + generator = RK_SCHEMES["CashKarp"]() + nodes, weights, matrix = generator.genCoeffs(embedded=True) ButcherTableauClass = ButcherTableauEmbedded @classmethod @@ -574,15 +531,8 @@ class DIRK43(RungeKutta): Taken from [here](https://doi.org/10.1007/BF01934920). """ - nodes = np.array([5.0 / 6.0, 10.0 / 39.0, 0, 1.0 / 6.0]) - weights = np.array( - [[61.0 / 150.0, 2197.0 / 2100.0, 19.0 / 100.0, -9.0 / 14.0], [32.0 / 75.0, 169.0 / 300.0, 1.0 / 100.0, 0.0]] - ) - matrix = np.zeros((4, 4)) - matrix[0, 0] = 5.0 / 6.0 - matrix[1, :2] = [-15.0 / 26.0, 5.0 / 6.0] - matrix[2, :3] = [215.0 / 54.0, -130.0 / 27.0, 5.0 / 6.0] - matrix[3, :] = [4007.0 / 6075.0, -31031.0 / 24300.0, -133.0 / 2700.0, 5.0 / 6.0] + generator = RK_SCHEMES["EDIRK43"]() + nodes, weights, matrix = generator.genCoeffs(embedded=True) ButcherTableauClass = ButcherTableauEmbedded @classmethod @@ -596,14 +546,8 @@ class DIRK43_2(RungeKutta): Taken from [here](https://en.wikipedia.org/wiki/List_of_Runge%E2%80%93Kutta_methods). """ - nodes = np.array([0.5, 2.0 / 3.0, 0.5, 1.0]) - weights = np.array([3.0 / 2.0, -3.0 / 2.0, 0.5, 0.5]) - matrix = np.zeros((4, 4)) - matrix[0, 0] = 0.5 - matrix[1, :2] = [1.0 / 6.0, 0.5] - matrix[2, :3] = [-0.5, 0.5, 0.5] - matrix[3, :] = [3.0 / 2.0, -3.0 / 2.0, 0.5, 0.5] - ButcherTableauClass = ButcherTableau + generator = RK_SCHEMES["DIRK43"]() + nodes, weights, matrix = generator.genCoeffs() class EDIRK4(RungeKutta): @@ -612,14 +556,8 @@ class EDIRK4(RungeKutta): [here](https://ntrs.nasa.gov/citations/20160005923), second one in eq. (216). """ - nodes = np.array([0.0, 3.0 / 2.0, 7.0 / 5.0, 1.0]) - weights = np.array([13.0, 84.0, -125.0, 70.0]) / 42.0 - matrix = np.zeros((4, 4)) - matrix[0, 0] = 0 - matrix[1, :2] = [3.0 / 4.0, 3.0 / 4.0] - matrix[2, :3] = [447.0 / 675.0, -357.0 / 675.0, 855.0 / 675.0] - matrix[3, :] = [13.0 / 42.0, 84.0 / 42.0, -125.0 / 42.0, 70.0 / 42.0] - ButcherTableauClass = ButcherTableau + generator = RK_SCHEMES["EDIRK4"]() + nodes, weights, matrix = generator.genCoeffs() class ESDIRK53(RungeKutta): @@ -627,59 +565,8 @@ class ESDIRK53(RungeKutta): A-stable embedded RK pair of orders 5 and 3, ESDIRK5(3)6L[2]SA. Taken from [here](https://ntrs.nasa.gov/citations/20160005923) """ - - nodes = np.array( - [0, 4024571134387.0 / 7237035672548.0, 14228244952610.0 / 13832614967709.0, 1.0 / 10.0, 3.0 / 50.0, 1.0] - ) - matrix = np.zeros((6, 6)) - matrix[1, :2] = [3282482714977.0 / 11805205429139.0, 3282482714977.0 / 11805205429139.0] - matrix[2, :3] = [ - 606638434273.0 / 1934588254988, - 2719561380667.0 / 6223645057524, - 3282482714977.0 / 11805205429139.0, - ] - matrix[3, :4] = [ - -651839358321.0 / 6893317340882, - -1510159624805.0 / 11312503783159, - 235043282255.0 / 4700683032009.0, - 3282482714977.0 / 11805205429139.0, - ] - matrix[4, :5] = [ - -5266892529762.0 / 23715740857879, - -1007523679375.0 / 10375683364751, - 521543607658.0 / 16698046240053.0, - 514935039541.0 / 7366641897523.0, - 3282482714977.0 / 11805205429139.0, - ] - matrix[5, :] = [ - -6225479754948.0 / 6925873918471, - 6894665360202.0 / 11185215031699, - -2508324082331.0 / 20512393166649, - -7289596211309.0 / 4653106810017.0, - 39811658682819.0 / 14781729060964.0, - 3282482714977.0 / 11805205429139, - ] - - weights = np.array( - [ - [ - -6225479754948.0 / 6925873918471, - 6894665360202.0 / 11185215031699.0, - -2508324082331.0 / 20512393166649, - -7289596211309.0 / 4653106810017, - 39811658682819.0 / 14781729060964.0, - 3282482714977.0 / 11805205429139, - ], - [ - -2512930284403.0 / 5616797563683, - 5849584892053.0 / 8244045029872, - -718651703996.0 / 6000050726475.0, - -18982822128277.0 / 13735826808854.0, - 23127941173280.0 / 11608435116569.0, - 2847520232427.0 / 11515777524847.0, - ], - ] - ) + generator = RK_SCHEMES["ESDIRK53"]() + nodes, weights, matrix = generator.genCoeffs(embedded=True) ButcherTableauClass = ButcherTableauEmbedded @classmethod @@ -693,58 +580,8 @@ class ESDIRK43(RungeKutta): Taken from [here](https://ntrs.nasa.gov/citations/20160005923) """ - s2 = 2**0.5 - - nodes = np.array([0, 1 / 2, (2 - 2**0.5) / 4, 5 / 8, 26 / 25, 1.0]) - matrix = np.zeros((6, 6)) - matrix[1, :2] = [1 / 4, 1 / 4] - matrix[2, :3] = [ - (1 - 2**0.5) / 8, - (1 - 2**0.5) / 8, - 1 / 4, - ] - matrix[3, :4] = [ - (5 - 7 * s2) / 64, - (5 - 7 * s2) / 64, - 7 * (1 + s2) / 32, - 1 / 4, - ] - matrix[4, :5] = [ - (-13796 - 54539 * s2) / 125000, - (-13796 - 54539 * s2) / 125000, - (506605 + 132109 * s2) / 437500, - 166 * (-97 + 376 * s2) / 109375, - 1 / 4, - ] - matrix[5, :] = [ - (1181 - 987 * s2) / 13782, - (1181 - 987 * s2) / 13782, - 47 * (-267 + 1783 * s2) / 273343, - -16 * (-22922 + 3525 * s2) / 571953, - -15625 * (97 + 376 * s2) / 90749876, - 1 / 4, - ] - - weights = np.array( - [ - [ - (1181 - 987 * s2) / 13782, - (1181 - 987 * s2) / 13782, - 47 * (-267 + 1783 * s2) / 273343, - -16 * (-22922 + 3525 * s2) / 571953, - -15625 * (97 + 376 * s2) / 90749876, - 1 / 4, - ], - [ - -480923228411.0 / 4982971448372, - -480923228411.0 / 4982971448372, - 6709447293961.0 / 12833189095359, - 3513175791894.0 / 6748737351361.0, - -498863281070.0 / 6042575550617.0, - 2077005547802.0 / 8945017530137.0, - ], - ] - ) + generator = RK_SCHEMES["ESDIRK43"]() + nodes, weights, matrix = generator.genCoeffs(embedded=True) ButcherTableauClass = ButcherTableauEmbedded @classmethod @@ -757,80 +594,10 @@ class ARK548L2SAERK(RungeKutta): Explicit part of the ARK54 scheme. """ + generator = RK_SCHEMES["ARK548L2SAERK"]() + nodes, weights, matrix = generator.genCoeffs(embedded=True) ButcherTableauClass = ButcherTableauEmbedded - weights = np.array( - [ - [ - -872700587467.0 / 9133579230613.0, - 0.0, - 0.0, - 22348218063261.0 / 9555858737531.0, - -1143369518992.0 / 8141816002931.0, - -39379526789629.0 / 19018526304540.0, - 32727382324388.0 / 42900044865799.0, - 41.0 / 200.0, - ], - [ - -975461918565.0 / 9796059967033.0, - 0.0, - 0.0, - 78070527104295.0 / 32432590147079.0, - -548382580838.0 / 3424219808633.0, - -33438840321285.0 / 15594753105479.0, - 3629800801594.0 / 4656183773603.0, - 4035322873751.0 / 18575991585200.0, - ], - ] - ) - - nodes = np.array( - [ - 0, - 41.0 / 100.0, - 2935347310677.0 / 11292855782101.0, - 1426016391358.0 / 7196633302097.0, - 92.0 / 100.0, - 24.0 / 100.0, - 3.0 / 5.0, - 1.0, - ] - ) - - matrix = np.zeros((8, 8)) - matrix[1, 0] = 41.0 / 100.0 - matrix[2, :2] = [367902744464.0 / 2072280473677.0, 677623207551.0 / 8224143866563.0] - matrix[3, :3] = [1268023523408.0 / 10340822734521.0, 0.0, 1029933939417.0 / 13636558850479.0] - matrix[4, :4] = [ - 14463281900351.0 / 6315353703477.0, - 0.0, - 66114435211212.0 / 5879490589093.0, - -54053170152839.0 / 4284798021562.0, - ] - matrix[5, :5] = [ - 14090043504691.0 / 34967701212078.0, - 0.0, - 15191511035443.0 / 11219624916014.0, - -18461159152457.0 / 12425892160975.0, - -281667163811.0 / 9011619295870.0, - ] - matrix[6, :6] = [ - 19230459214898.0 / 13134317526959.0, - 0.0, - 21275331358303.0 / 2942455364971.0, - -38145345988419.0 / 4862620318723.0, - -1.0 / 8.0, - -1.0 / 8.0, - ] - matrix[7, :7] = [ - -19977161125411.0 / 11928030595625.0, - 0.0, - -40795976796054.0 / 6384907823539.0, - 177454434618887.0 / 12078138498510.0, - 782672205425.0 / 8267701900261.0, - -69563011059811.0 / 9646580694205.0, - 7356628210526.0 / 4942186776405.0, - ] - + @classmethod def get_update_order(cls): return 5 @@ -840,46 +607,8 @@ class ARK548L2SAESDIRK(ARK548L2SAERK): """ Implicit part of the ARK54 scheme. Be careful with the embedded scheme. It seems that both schemes are order 5 as opposed to 5 and 4 as claimed. This may cause issues when doing adaptive time-stepping. """ - - matrix = np.zeros((8, 8)) - matrix[1, :2] = [41.0 / 200.0, 41.0 / 200.0] - matrix[2, :3] = [41.0 / 400.0, -567603406766.0 / 11931857230679.0, 41.0 / 200.0] - matrix[3, :4] = [683785636431.0 / 9252920307686.0, 0.0, -110385047103.0 / 1367015193373.0, 41.0 / 200.0] - matrix[4, :5] = [ - 3016520224154.0 / 10081342136671.0, - 0.0, - 30586259806659.0 / 12414158314087.0, - -22760509404356.0 / 11113319521817.0, - 41.0 / 200.0, - ] - matrix[5, :6] = [ - 218866479029.0 / 1489978393911.0, - 0.0, - 638256894668.0 / 5436446318841.0, - -1179710474555.0 / 5321154724896.0, - -60928119172.0 / 8023461067671.0, - 41.0 / 200.0, - ] - matrix[6, :7] = [ - 1020004230633.0 / 5715676835656.0, - 0.0, - 25762820946817.0 / 25263940353407.0, - -2161375909145.0 / 9755907335909.0, - -211217309593.0 / 5846859502534.0, - -4269925059573.0 / 7827059040749.0, - 41.0 / 200.0, - ] - matrix[7, :] = [ - -872700587467.0 / 9133579230613.0, - 0.0, - 0.0, - 22348218063261.0 / 9555858737531.0, - -1143369518992.0 / 8141816002931.0, - -39379526789629.0 / 19018526304540.0, - 32727382324388.0 / 42900044865799.0, - 41.0 / 200.0, - ] - + generator_IMP = RK_SCHEMES["ARK548L2SAESDIRK"]() + matrix = generator_IMP.Q class ARK54(RungeKuttaIMEX): """ @@ -905,68 +634,10 @@ class ARK548L2SAESDIRK2(RungeKutta): Stiffly accurate singly diagonally L-stable implicit embedded Runge-Kutta pair of orders 5 and 4 with explicit first stage from [here](https://doi.org/10.1016/j.apnum.2018.10.007). This method is part of the IMEX method ARK548L2SA. """ - + generator = RK_SCHEMES["ARK548L2SAESDIRK2"]() + nodes, weights, matrix = generator.genCoeffs(embedded=True) ButcherTableauClass = ButcherTableauEmbedded - gamma = 2.0 / 9.0 - nodes = np.array( - [ - 0.0, - 4.0 / 9.0, - 6456083330201.0 / 8509243623797.0, - 1632083962415.0 / 14158861528103.0, - 6365430648612.0 / 17842476412687.0, - 18.0 / 25.0, - 191.0 / 200.0, - 1.0, - ] - ) - - weights = np.array( - [ - [ - 0.0, - 0.0, - 3517720773327.0 / 20256071687669.0, - 4569610470461.0 / 17934693873752.0, - 2819471173109.0 / 11655438449929.0, - 3296210113763.0 / 10722700128969.0, - -1142099968913.0 / 5710983926999.0, - gamma, - ], - [ - 0.0, - 0.0, - 520639020421.0 / 8300446712847.0, - 4550235134915.0 / 17827758688493.0, - 1482366381361.0 / 6201654941325.0, - 5551607622171.0 / 13911031047899.0, - -5266607656330.0 / 36788968843917.0, - 1074053359553.0 / 5740751784926.0, - ], - ] - ) - - matrix = np.zeros((8, 8)) - matrix[2, 1] = 2366667076620.0 / 8822750406821.0 - matrix[3, 1] = -257962897183.0 / 4451812247028.0 - matrix[3, 2] = 128530224461.0 / 14379561246022.0 - matrix[4, 1] = -486229321650.0 / 11227943450093.0 - matrix[4, 2] = -225633144460.0 / 6633558740617.0 - matrix[4, 3] = 1741320951451.0 / 6824444397158.0 - matrix[5, 1] = 621307788657.0 / 4714163060173.0 - matrix[5, 2] = -125196015625.0 / 3866852212004.0 - matrix[5, 3] = 940440206406.0 / 7593089888465.0 - matrix[5, 4] = 961109811699.0 / 6734810228204.0 - matrix[6, 1] = 2036305566805.0 / 6583108094622.0 - matrix[6, 2] = -3039402635899.0 / 4450598839912.0 - matrix[6, 3] = -1829510709469.0 / 31102090912115.0 - matrix[6, 4] = -286320471013.0 / 6931253422520.0 - matrix[6, 5] = 8651533662697.0 / 9642993110008.0 - - for i in range(matrix.shape[0]): - matrix[i, i] = gamma - matrix[i, 0] = matrix[i, 1] - matrix[7, i] = weights[0][i] + @classmethod def get_update_order(cls): @@ -979,36 +650,8 @@ class ARK548L2SAERK2(ARK548L2SAESDIRK2): This method is part of the IMEX method ARK548L2SA. """ - matrix = np.zeros((8, 8)) - matrix[2, 0] = 1.0 / 9.0 - matrix[2, 1] = 1183333538310.0 / 1827251437969.0 - matrix[3, 0] = 895379019517.0 / 9750411845327.0 - matrix[3, 1] = 477606656805.0 / 13473228687314.0 - matrix[3, 2] = -112564739183.0 / 9373365219272.0 - matrix[4, 0] = -4458043123994.0 / 13015289567637.0 - matrix[4, 1] = -2500665203865.0 / 9342069639922.0 - matrix[4, 2] = 983347055801.0 / 8893519644487.0 - matrix[4, 3] = 2185051477207.0 / 2551468980502.0 - matrix[5, 0] = -167316361917.0 / 17121522574472.0 - matrix[5, 1] = 1605541814917.0 / 7619724128744.0 - matrix[5, 2] = 991021770328.0 / 13052792161721.0 - matrix[5, 3] = 2342280609577.0 / 11279663441611.0 - matrix[5, 4] = 3012424348531.0 / 12792462456678.0 - matrix[6, 0] = 6680998715867.0 / 14310383562358.0 - matrix[6, 1] = 5029118570809.0 / 3897454228471.0 - matrix[6, 2] = 2415062538259.0 / 6382199904604.0 - matrix[6, 3] = -3924368632305.0 / 6964820224454.0 - matrix[6, 4] = -4331110370267.0 / 15021686902756.0 - matrix[6, 5] = -3944303808049.0 / 11994238218192.0 - matrix[7, 0] = 2193717860234.0 / 3570523412979.0 - matrix[7, 1] = 2193717860234.0 / 3570523412979.0 - matrix[7, 2] = 5952760925747.0 / 18750164281544.0 - matrix[7, 3] = -4412967128996.0 / 6196664114337.0 - matrix[7, 4] = 4151782504231.0 / 36106512998704.0 - matrix[7, 5] = 572599549169.0 / 6265429158920.0 - matrix[7, 6] = -457874356192.0 / 11306498036315.0 - - matrix[1, 0] = ARK548L2SAESDIRK2.nodes[1] + generator_EXP = RK_SCHEMES["ARK548L2SAERK2"]() + matrix = generator_EXP.Q class ARK548L2SA(RungeKuttaIMEX): diff --git a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py index fb27a02caa..4d6cca9545 100644 --- a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py +++ b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py @@ -5,14 +5,13 @@ @pytest.mark.slow @pytest.mark.mpi4py -@pytest.mark.timeout(600) @pytest.mark.parametrize('num_procs', [3, 5]) def test_preconditioner_playground_MPI(num_procs): # Set python path once my_env = os.environ.copy() my_env['PYTHONPATH'] = '../../..:.' my_env['COVERAGE_PROCESS_START'] = 'pyproject.toml' - my_env['OPENBLAS_NUM_THREADS'] = '1' + my_env['OPENBLAS_NUM_THREADS'] = '1' my_env['MKL_NUM_THREADS'] = '1' cwd = '.' cmd = ( From 8ca1ca862f937c9d4c1b53e634f1c205248a68d3 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 16:55:44 +0200 Subject: [PATCH 25/38] TL: oh, thanks black ! --- .../sweeper_classes/Runge_Kutta.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pySDC/implementations/sweeper_classes/Runge_Kutta.py b/pySDC/implementations/sweeper_classes/Runge_Kutta.py index 6db2d45e33..3993d8d794 100644 --- a/pySDC/implementations/sweeper_classes/Runge_Kutta.py +++ b/pySDC/implementations/sweeper_classes/Runge_Kutta.py @@ -454,6 +454,7 @@ class ForwardEuler(RungeKutta): Not very stable first order method. """ + generator = RK_SCHEMES["FE"]() nodes, weights, matrix = generator.genCoeffs() @@ -464,6 +465,7 @@ class BackwardEuler(RungeKutta): A-stable first order method. """ + generator = RK_SCHEMES["BE"]() nodes, weights, matrix = generator.genCoeffs() @@ -472,6 +474,7 @@ class CrankNicholson(RungeKutta): """ Implicit Runge-Kutta method of second order, A-stable. """ + generator = RK_SCHEMES["CN"]() nodes, weights, matrix = generator.genCoeffs() @@ -480,6 +483,7 @@ class ExplicitMidpointMethod(RungeKutta): """ Explicit Runge-Kutta method of second order. """ + generator = RK_SCHEMES["RK2"]() nodes, weights, matrix = generator.genCoeffs() @@ -488,6 +492,7 @@ class ImplicitMidpointMethod(RungeKutta): """ Implicit Runge-Kutta method of second order. """ + generator = RK_SCHEMES["IMP"]() nodes, weights, matrix = generator.genCoeffs() @@ -496,13 +501,16 @@ class RK4(RungeKutta): """ Explicit Runge-Kutta of fourth order: Everybody's darling. """ + generator = RK_SCHEMES["RK4"]() nodes, weights, matrix = generator.genCoeffs() + class Heun_Euler(RungeKutta): """ Second order explicit embedded Runge-Kutta method. """ + generator = RK_SCHEMES["HEUN"]() nodes, weights, matrix = generator.genCoeffs() @@ -515,6 +523,7 @@ class Cash_Karp(RungeKutta): """ Fifth order explicit embedded Runge-Kutta. See [here](https://doi.org/10.1145/79505.79507). """ + generator = RK_SCHEMES["CashKarp"]() nodes, weights, matrix = generator.genCoeffs(embedded=True) ButcherTableauClass = ButcherTableauEmbedded @@ -565,6 +574,7 @@ class ESDIRK53(RungeKutta): A-stable embedded RK pair of orders 5 and 3, ESDIRK5(3)6L[2]SA. Taken from [here](https://ntrs.nasa.gov/citations/20160005923) """ + generator = RK_SCHEMES["ESDIRK53"]() nodes, weights, matrix = generator.genCoeffs(embedded=True) ButcherTableauClass = ButcherTableauEmbedded @@ -597,7 +607,7 @@ class ARK548L2SAERK(RungeKutta): generator = RK_SCHEMES["ARK548L2SAERK"]() nodes, weights, matrix = generator.genCoeffs(embedded=True) ButcherTableauClass = ButcherTableauEmbedded - + @classmethod def get_update_order(cls): return 5 @@ -607,9 +617,11 @@ class ARK548L2SAESDIRK(ARK548L2SAERK): """ Implicit part of the ARK54 scheme. Be careful with the embedded scheme. It seems that both schemes are order 5 as opposed to 5 and 4 as claimed. This may cause issues when doing adaptive time-stepping. """ + generator_IMP = RK_SCHEMES["ARK548L2SAESDIRK"]() matrix = generator_IMP.Q + class ARK54(RungeKuttaIMEX): """ Pair of pairs of ARK5(4)8L[2]SA-ERK and ARK5(4)8L[2]SA-ESDIRK from [here](https://doi.org/10.1016/S0168-9274(02)00138-1). @@ -634,10 +646,10 @@ class ARK548L2SAESDIRK2(RungeKutta): Stiffly accurate singly diagonally L-stable implicit embedded Runge-Kutta pair of orders 5 and 4 with explicit first stage from [here](https://doi.org/10.1016/j.apnum.2018.10.007). This method is part of the IMEX method ARK548L2SA. """ + generator = RK_SCHEMES["ARK548L2SAESDIRK2"]() nodes, weights, matrix = generator.genCoeffs(embedded=True) ButcherTableauClass = ButcherTableauEmbedded - @classmethod def get_update_order(cls): From 5f824a1df1f53cee82474dbbac43550e47543dd9 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 17:31:15 +0200 Subject: [PATCH 26/38] TL: partial solution for parallelSDC tests --- .../parallelSDC/preconditioner_playground_MPI.py | 9 +++++---- .../parallelSDC/tests/test_preconditioner_MPI.py | 12 +++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py index 419a0392d5..2ea7d1262a 100644 --- a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py +++ b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py @@ -18,8 +18,6 @@ from pySDC.implementations.problem_classes.Van_der_Pol_implicit import vanderpol from pySDC.implementations.sweeper_classes.generic_implicit_MPI import generic_implicit_MPI -# from pySDC.projects.parallelSDC.BaseTransfer_MPI import base_transfer_mpi - ID = namedtuple('ID', ['setup', 'qd_type', 'param']) @@ -246,7 +244,10 @@ def plot_iterations(): if __name__ == "__main__": + import sys + comm = MPI.COMM_WORLD - main(comm=comm) - if comm.Get_rank() == 0: + if not sys.argv[-1] == "--noRun": + main(comm=comm) + if not sys.argv[-1] == "--noPlot" and comm.Get_rank() == 0: plot_iterations() diff --git a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py index 4d6cca9545..4b96853345 100644 --- a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py +++ b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py @@ -7,6 +7,7 @@ @pytest.mark.mpi4py @pytest.mark.parametrize('num_procs', [3, 5]) def test_preconditioner_playground_MPI(num_procs): + # Set python path once my_env = os.environ.copy() my_env['PYTHONPATH'] = '../../..:.' @@ -15,7 +16,7 @@ def test_preconditioner_playground_MPI(num_procs): my_env['MKL_NUM_THREADS'] = '1' cwd = '.' cmd = ( - 'mpirun -np ' + str(num_procs) + ' python pySDC/projects/parallelSDC/preconditioner_playground_MPI.py' + 'mpirun -np ' + str(num_procs) + ' python pySDC/projects/parallelSDC/preconditioner_playground_MPI.py --noPlot' ).split() p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=my_env, cwd=cwd) p.wait() @@ -24,3 +25,12 @@ def test_preconditioner_playground_MPI(num_procs): for line in p.stderr: print(line) assert p.returncode == 0, 'ERROR: did not get return code 0, got %s with %2i processes' % (p.returncode, num_procs) + + cmd = 'python pySDC/projects/parallelSDC/preconditioner_playground_MPI.py --noRun'.split() + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=my_env, cwd=cwd) + p.wait() + for line in p.stdout: + print(line) + for line in p.stderr: + print(line) + assert p.returncode == 0, 'ERROR: did not get return code 0, got %s with %2i processes' % (p.returncode, num_procs) From 6a60d2491ab424e5b65a8cfd1d8ec868922b451f Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 18:37:30 +0200 Subject: [PATCH 27/38] TL: back to partial working version --- .../parallelSDC/preconditioner_playground_MPI.py | 9 +++------ .../parallelSDC/tests/test_preconditioner_MPI.py | 11 +---------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py index 2ea7d1262a..b88b2da491 100644 --- a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py +++ b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py @@ -244,10 +244,7 @@ def plot_iterations(): if __name__ == "__main__": - import sys - comm = MPI.COMM_WORLD - if not sys.argv[-1] == "--noRun": - main(comm=comm) - if not sys.argv[-1] == "--noPlot" and comm.Get_rank() == 0: - plot_iterations() + main(comm=comm) + # if comm.Get_rank() == 0: + # plot_iterations() diff --git a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py index 4b96853345..0ba1511611 100644 --- a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py +++ b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py @@ -16,7 +16,7 @@ def test_preconditioner_playground_MPI(num_procs): my_env['MKL_NUM_THREADS'] = '1' cwd = '.' cmd = ( - 'mpirun -np ' + str(num_procs) + ' python pySDC/projects/parallelSDC/preconditioner_playground_MPI.py --noPlot' + 'mpirun -np ' + str(num_procs) + ' python pySDC/projects/parallelSDC/preconditioner_playground_MPI.py' ).split() p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=my_env, cwd=cwd) p.wait() @@ -25,12 +25,3 @@ def test_preconditioner_playground_MPI(num_procs): for line in p.stderr: print(line) assert p.returncode == 0, 'ERROR: did not get return code 0, got %s with %2i processes' % (p.returncode, num_procs) - - cmd = 'python pySDC/projects/parallelSDC/preconditioner_playground_MPI.py --noRun'.split() - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=my_env, cwd=cwd) - p.wait() - for line in p.stdout: - print(line) - for line in p.stderr: - print(line) - assert p.returncode == 0, 'ERROR: did not get return code 0, got %s with %2i processes' % (p.returncode, num_procs) From a1b8f0e1e2e2160d80c73e8753469794acc57b80 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 19:00:50 +0200 Subject: [PATCH 28/38] TL: trying another idea --- pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py index 0ba1511611..0f54568a1a 100644 --- a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py +++ b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py @@ -16,7 +16,7 @@ def test_preconditioner_playground_MPI(num_procs): my_env['MKL_NUM_THREADS'] = '1' cwd = '.' cmd = ( - 'mpirun -np ' + str(num_procs) + ' python pySDC/projects/parallelSDC/preconditioner_playground_MPI.py' + 'mpirun -np ' + str(num_procs) + ' python -u pySDC/projects/parallelSDC/preconditioner_playground_MPI.py' ).split() p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=my_env, cwd=cwd) p.wait() From e7d9a81891d078135df821c3a0d9afc6061c92ac Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 21:12:11 +0200 Subject: [PATCH 29/38] TL: trying this --- pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py index 0f54568a1a..f83cff024f 100644 --- a/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py +++ b/pySDC/projects/parallelSDC/tests/test_preconditioner_MPI.py @@ -5,6 +5,7 @@ @pytest.mark.slow @pytest.mark.mpi4py +@pytest.mark.timeout(600) @pytest.mark.parametrize('num_procs', [3, 5]) def test_preconditioner_playground_MPI(num_procs): From c93ca5d20e38b9da0afc2bfc4302685634b652c4 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sat, 22 Jun 2024 22:10:05 +0200 Subject: [PATCH 30/38] TL: no covering for (problematic) ploting function for parallelSDC --- pySDC/projects/parallelSDC/preconditioner_playground_MPI.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py index b88b2da491..e33d2fdc3d 100644 --- a/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py +++ b/pySDC/projects/parallelSDC/preconditioner_playground_MPI.py @@ -162,6 +162,7 @@ def main(comm=None): assert os.path.isfile('data/parallelSDC_iterations_precond_MPI.pkl'), 'ERROR: pickle did not create file' +# pragma: no cover def plot_iterations(): """ Helper routine to plot iteration counts From 8b01a3909f222b92fdd2a19b69626ba011604701 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sun, 23 Jun 2024 11:52:49 +0200 Subject: [PATCH 31/38] TL: finalized qmat-switch with correct naming for core sub-packages --- CONTRIBUTING.md | 5 ++++ docs/contrib/06_new_project.md | 3 +++ .../{BaseTransfer.py => base_transfer.py} | 4 ++-- pySDC/core/{Collocation.py => collocation.py} | 4 ++-- pySDC/core/{Common.py => common.py} | 2 +- pySDC/core/{Controller.py => controller.py} | 6 ++--- ...ontroller.py => convergence_controller.py} | 0 pySDC/core/{Errors.py => errors.py} | 0 pySDC/core/{Hooks.py => hooks.py} | 2 +- pySDC/core/{Level.py => level.py} | 2 +- pySDC/core/{Problem.py => problem.py} | 4 ++-- .../{SpaceTransfer.py => space_transfer.py} | 4 ++-- pySDC/core/{Step.py => step.py} | 14 +++++------ pySDC/core/{Sweeper.py => sweeper.py} | 24 ++++++++++++++----- pySDC/helpers/setup_helper.py | 4 ++-- .../controller_classes/controller_MPI.py | 10 ++++---- .../controller_classes/controller_nonMPI.py | 12 +++++----- .../adaptive_collocation.py | 4 ++-- .../adaptivity.py | 2 +- .../basic_restarting.py | 4 ++-- .../check_convergence.py | 2 +- .../check_iteration_estimator.py | 2 +- .../convergence_controller_classes/crash.py | 4 ++-- .../estimate_contraction_factor.py | 2 +- .../estimate_embedded_error.py | 2 +- .../estimate_extrapolation_error.py | 4 ++-- .../estimate_polynomial_error.py | 4 ++-- .../convergence_controller_classes/hotrod.py | 2 +- .../inexactness.py | 2 +- .../interpolate_between_restarts.py | 2 +- .../spread_step_sizes.py | 2 +- .../step_size_limiter.py | 2 +- .../store_uold.py | 2 +- .../datatype_classes/cupy_mesh.py | 2 +- .../datatype_classes/fenics_mesh.py | 2 +- .../datatype_classes/particles.py | 2 +- .../datatype_classes/petsc_vec.py | 2 +- pySDC/implementations/hooks/default_hook.py | 4 ++-- .../hooks/log_embedded_error_estimate.py | 4 ++-- pySDC/implementations/hooks/log_errors.py | 6 ++--- .../hooks/log_extrapolated_error_estimate.py | 4 ++-- pySDC/implementations/hooks/log_restarts.py | 4 ++-- pySDC/implementations/hooks/log_solution.py | 8 +++---- pySDC/implementations/hooks/log_step_size.py | 4 ++-- pySDC/implementations/hooks/log_work.py | 6 ++--- pySDC/implementations/hooks/plotting.py | 4 ++-- .../AcousticAdvection_1D_FD_imex.py | 6 ++--- .../AdvectionDiffusionEquation_1D_FFT.py | 6 ++--- .../problem_classes/AllenCahn_1D_FD.py | 8 +++---- .../problem_classes/AllenCahn_2D_FD.py | 6 ++--- .../problem_classes/AllenCahn_2D_FD_gpu.py | 6 ++--- .../problem_classes/AllenCahn_2D_FFT.py | 6 ++--- .../problem_classes/AllenCahn_2D_FFT_gpu.py | 6 ++--- .../problem_classes/AllenCahn_Temp_MPIFFT.py | 6 ++--- .../problem_classes/Auzinger_implicit.py | 4 ++-- .../problem_classes/Battery.py | 6 ++--- .../problem_classes/Boussinesq_2D_FD_imex.py | 4 ++-- .../problem_classes/BuckConverter.py | 4 ++-- .../problem_classes/DiscontinuousTestODE.py | 6 ++--- .../problem_classes/FastWaveSlowWave_0D.py | 6 ++--- .../problem_classes/FermiPastaUlamTsingou.py | 6 ++--- .../GeneralizedFisher_1D_FD_implicit.py | 6 ++--- .../GeneralizedFisher_1D_PETSc.py | 4 ++-- .../GrayScott_1D_FEniCS_implicit.py | 6 ++--- .../GrayScott_2D_PETSc_periodic.py | 4 ++-- .../problem_classes/GrayScott_MPIFFT.py | 4 ++-- .../problem_classes/HarmonicOscillator.py | 6 ++--- .../HeatEquation_1D_FEniCS_matrix_forced.py | 4 ++-- .../HeatEquation_2D_PETSc_forced.py | 6 ++--- .../HeatEquation_ND_FD_CuPy.py | 6 ++--- .../problem_classes/HenonHeiles.py | 4 ++-- .../problem_classes/LogisticEquation.py | 6 ++--- .../implementations/problem_classes/Lorenz.py | 6 ++--- .../NonlinearSchroedinger_MPIFFT.py | 4 ++-- .../problem_classes/OuterSolarSystem.py | 4 ++-- .../problem_classes/PenningTrap_3D.py | 6 ++--- .../implementations/problem_classes/Piline.py | 4 ++-- .../implementations/problem_classes/Quench.py | 6 ++--- .../problem_classes/TestEquation_0D.py | 4 ++-- .../problem_classes/Van_der_Pol_implicit.py | 6 ++--- .../VorticityVelocity_2D_FEniCS_periodic.py | 4 ++-- .../generic_MPIFFT_Laplacian.py | 6 ++--- .../problem_classes/generic_ND_FD.py | 6 ++--- .../problem_classes/nonlinear_ODE_1.py | 6 ++--- .../problem_classes/odeScalar.py | 6 ++--- .../problem_classes/odeSystem.py | 12 +++++----- .../polynomial_test_problem.py | 4 ++-- .../sweeper_classes/Multistep.py | 6 ++--- .../sweeper_classes/Runge_Kutta.py | 10 ++++---- .../sweeper_classes/Runge_Kutta_Nystrom.py | 4 ++-- .../sweeper_classes/boris_2nd_order.py | 4 ++-- .../sweeper_classes/explicit.py | 4 ++-- .../sweeper_classes/generic_implicit.py | 4 ++-- .../sweeper_classes/generic_implicit_MPI.py | 4 ++-- .../sweeper_classes/imex_1st_order.py | 4 ++-- .../sweeper_classes/multi_implicit.py | 4 ++-- .../implementations/sweeper_classes/verlet.py | 4 ++-- .../transfer_classes/BaseTransferMPI.py | 6 ++--- .../transfer_classes/BaseTransfer_mass.py | 6 ++--- .../transfer_classes/TransferFenicsMesh.py | 6 ++--- .../transfer_classes/TransferMesh.py | 6 ++--- .../transfer_classes/TransferMesh_FFT.py | 6 ++--- .../transfer_classes/TransferMesh_FFT2D.py | 6 ++--- .../transfer_classes/TransferMesh_MPIFFT.py | 6 ++--- .../transfer_classes/TransferMesh_NoCoarse.py | 6 ++--- .../transfer_classes/TransferPETScDMDA.py | 6 ++--- .../TransferParticles_NoCoarse.py | 6 ++--- .../Allen_Cahn/AllenCahn_monitor.py | 4 ++-- .../Allen_Cahn/AllenCahn_monitor_Bayreuth.py | 4 ++-- .../Allen_Cahn/AllenCahn_output.py | 4 ++-- .../Boris/penningtrap_HookClass.py | 4 ++-- .../Boris/spiraling_particle_HookClass.py | 4 ++-- .../Boris/spiraling_particle_ProblemClass.py | 4 ++-- .../FEniCS/HookClass_FEniCS_output.py | 4 ++-- pySDC/playgrounds/FEniCS/fenics_sdc.py | 4 ++-- .../HeatEquation_1D_FEniCSx_matrix_forced.py | 6 ++--- ...HeatEquation_1D_FEniCSx_matrix_forced_2.py | 4 ++-- .../FEniCSx/HookClass_FEniCS_output.py | 4 ++-- .../Gander/HookClass_error_output.py | 4 ++-- pySDC/playgrounds/Gander/matrix_based.py | 6 ++--- .../HeatEquation/HookClass_error_output.py | 4 ++-- pySDC/playgrounds/ML_initial_guess/heat.py | 6 ++--- .../playgrounds/ODEs/trajectory_HookClass.py | 4 ++-- .../PinT_Workshop_2017/my_HookClass.py | 4 ++-- .../VSDC/hamiltonian_and_energy_output.py | 4 ++-- pySDC/playgrounds/VSDC/hamiltonian_output.py | 4 ++-- .../compression/HookClass_error_output.py | 4 ++-- .../Dedalus/AllenCahn_2D_Dedalus.py | 6 ++--- .../Dedalus/AllenCahn_2D_Dedalus_multiple.py | 6 ++--- .../Dedalus/AllenCahn_2D_Dedalus_new.py | 6 ++--- .../deprecated/Dedalus/AllenCahn_monitor.py | 4 ++-- .../deprecated/Dedalus/DynamoGP_2D_Dedalus.py | 6 ++--- .../Dedalus/DynamoGP_2D_Dedalus_NEW.py | 6 ++--- .../deprecated/Dedalus/Dynamo_2D_Dedalus.py | 6 ++--- .../Dedalus/Dynamo_2D_Dedalus_NEW.py | 6 ++--- .../deprecated/Dedalus/Dynamo_monitor.py | 4 ++-- .../Dedalus/HeatEquation_1D_Dedalus_forced.py | 6 ++--- .../Dedalus/HeatEquation_2D_Dedalus_forced.py | 6 ++--- .../Dedalus/RayleighBenard_2D_Dedalus.py | 6 ++--- .../Dedalus/RayleighBenard_monitor.py | 4 ++-- .../Dedalus/TransferDedalusFields.py | 6 ++--- .../deprecated/Dedalus/dedalus_field.py | 2 +- .../acoustic_1d_imex/ProblemClass.py | 4 ++-- .../ProblemClass_multiscale.py | 4 ++-- .../deprecated/acoustic_2d_imex/HookClass.py | 4 ++-- .../acoustic_2d_imex/ProblemClass.py | 4 ++-- .../advection_1d_implicit/ProblemClass.py | 4 ++-- .../advection_2d_explicit/HookClass.py | 4 ++-- .../advection_2d_explicit/ProblemClass.py | 4 ++-- .../burgers_2d_explicit/ProblemClass.py | 4 ++-- .../deprecated/fwsw/plot_stab_vs_m.py | 12 +++++----- .../deprecated/pmesh/AllenCahn_PMESH.py | 6 ++--- .../deprecated/pmesh/AllenCahn_PMESH_NEW.py | 6 ++--- .../AllenCahn_Temperatur_monitor_and_dump.py | 4 ++-- .../pmesh/AllenCahn_Temperature_PMESH.py | 6 ++--- .../deprecated/pmesh/AllenCahn_dump.py | 4 ++-- .../deprecated/pmesh/AllenCahn_dump_NEW.py | 4 ++-- .../pmesh/AllenCahn_monitor_and_dump.py | 4 ++-- .../pmesh/AllenCahn_monitor_and_dump_NEW.py | 4 ++-- .../deprecated/pmesh/PMESH_datatype.py | 2 +- .../deprecated/pmesh/PMESH_datatype_NEW.py | 2 +- .../deprecated/pmesh/TransferMesh_PMESH.py | 6 ++--- .../pmesh/TransferMesh_PMESH_NEW.py | 6 ++--- pySDC/playgrounds/fft/libpfasst_output.py | 4 ++-- pySDC/playgrounds/lagrange/quadrature.py | 2 +- pySDC/playgrounds/monodomain/Monodomain.py | 6 ++--- pySDC/playgrounds/optimization/playground.py | 4 ++-- .../parallel/AllenCahn_parallel_monitor.py | 4 ++-- .../playgrounds/paralpha/playground_linear.py | 2 +- .../AllenCahn_Bayreuth/AllenCahn_dump.py | 4 ++-- .../AllenCahn_Bayreuth/AllenCahn_monitor.py | 4 ++-- .../AllenCahn_monitor_and_dump.py | 4 ++-- pySDC/projects/AsympConv/conv_test_to0.py | 2 +- pySDC/projects/AsympConv/conv_test_toinf.py | 2 +- .../AsympConv/smoother_specrad_heatmap.py | 2 +- pySDC/projects/DAE/misc/HookClass_DAE.py | 6 ++--- pySDC/projects/DAE/misc/ProblemDAE.py | 4 ++-- .../DAE/problems/DiscontinuousTestDAE.py | 2 +- pySDC/projects/DAE/problems/WSCC9BusSystem.py | 2 +- .../projects/DAE/sweepers/SemiImplicitDAE.py | 2 +- .../DAE/sweepers/fully_implicit_DAE.py | 2 +- .../DAE/sweepers/fully_implicit_DAE_MPI.py | 2 +- pySDC/projects/DAE/tests/test_MPI_sweepers.py | 2 +- .../DAE/tests/test_SemiImplicitDAE.py | 18 +++++++------- .../DAE/tests/test_fully_implicit_DAE.py | 18 +++++++------- .../FastWaveSlowWave/HookClass_acoustic.py | 4 ++-- .../FastWaveSlowWave/HookClass_boussinesq.py | 4 ++-- .../FastWaveSlowWave/plot_dispersion.py | 4 ++-- .../FastWaveSlowWave/plot_stab_vs_k.py | 4 ++-- .../FastWaveSlowWave/plot_stability.py | 4 ++-- .../plot_stifflimit_specrad.py | 4 ++-- pySDC/projects/GPU/ac_fft.py | 2 +- pySDC/projects/GPU/heat.py | 2 +- .../hamiltonian_and_energy_output.py | 4 ++-- .../Hamiltonian/hamiltonian_output.py | 4 ++-- .../Hamiltonian/stop_at_error_hook.py | 4 ++-- .../Monodomain/hooks/HookClass_pde.py | 4 ++-- .../hooks/HookClass_post_iter_info.py | 4 ++-- .../problem_classes/MonodomainODE.py | 4 ++-- .../Monodomain/problem_classes/TestODE.py | 6 ++--- .../space_discretizazions/Parabolic_DCT.py | 2 +- .../run_scripts/run_MonodomainODE.py | 2 +- .../Monodomain/run_scripts/run_TestODE.py | 2 +- .../imexexp_1st_order.py | 8 +++---- .../runge_kutta/imexexp_1st_order.py | 6 ++--- .../TransferVectorOfDCTVectors.py | 4 ++-- .../transfer_classes/Transfer_DCT_Vector.py | 4 ++-- .../Performance/controller_MPI_scorep.py | 10 ++++---- pySDC/projects/PinTSimE/battery_model.py | 4 ++-- .../PinTSimE/discontinuous_test_ODE.py | 4 ++-- .../projects/PinTSimE/hardcoded_solutions.py | 2 +- .../PinTSimE/paper_PSCC2024/log_event.py | 6 ++--- .../PinTSimE/paper_PSCC2024/paper_plots.py | 2 +- pySDC/projects/PinTSimE/switch_estimator.py | 6 ++--- pySDC/projects/RDC/equidistant_RDC.py | 4 ++-- pySDC/projects/Resilience/AC.py | 8 +++---- pySDC/projects/Resilience/Lorenz.py | 2 +- pySDC/projects/Resilience/Schroedinger.py | 8 +++---- pySDC/projects/Resilience/accuracy_check.py | 4 ++-- .../Resilience/collocation_adaptivity.py | 4 ++-- pySDC/projects/Resilience/dahlquist.py | 8 +++---- pySDC/projects/Resilience/fault_injection.py | 4 ++-- pySDC/projects/Resilience/heat.py | 2 +- pySDC/projects/Resilience/hook.py | 8 +++---- pySDC/projects/Resilience/quench.py | 8 +++---- pySDC/projects/Resilience/sweepers.py | 2 +- pySDC/projects/Resilience/vdp.py | 2 +- .../Second_orderSDC/penningtrap_HookClass.py | 4 ++-- .../Second_orderSDC/stability_simulation.py | 6 ++--- pySDC/projects/TOMS/AllenCahn_monitor.py | 4 ++-- .../compression_convergence_controller.py | 2 +- .../projects/parallelSDC/ErrReductionHook.py | 4 ++-- pySDC/projects/parallelSDC/minimization.py | 2 +- .../parallelSDC_reloaded/nilpotency.py | 4 ++-- pySDC/projects/soft_failure/FaultHooks.py | 4 ++-- pySDC/tests/test_Q_transfer.py | 2 +- .../tests/test_benchmarks/test_collocation.py | 2 +- pySDC/tests/test_collocation.py | 2 +- .../test_InterpolateBetweenRestarts.py | 6 ++--- .../test_Newton_inexactness.py | 4 ++-- .../test_basic_restarting.py | 6 ++--- .../test_crash.py | 2 +- pySDC/tests/test_helpers/test_stats_helper.py | 4 ++-- pySDC/tests/test_hooks/test_entry_class.py | 4 ++-- pySDC/tests/test_problem.py | 4 ++-- .../test_AdvectionDiffusionEquation_1D_FFT.py | 2 +- .../test_problems/test_AllenCahn_1D_FD.py | 2 +- .../test_DiscontinuousTestODE.py | 2 +- pySDC/tests/test_sweepers/test_imexsweeper.py | 12 +++++----- .../test_sweepers/test_preconditioners.py | 2 +- .../test_base_transfer_MPI.py | 6 ++--- .../test_transfer_order.py | 4 ++-- pySDC/tests/tests_core.py | 4 ++-- .../step_1/C_collocation_problem_setup.py | 2 +- .../step_1/D_collocation_accuracy_check.py | 2 +- .../tutorial/step_2/A_step_data_structure.py | 4 ++-- pySDC/tutorial/step_2/B_my_first_sweeper.py | 4 ++-- pySDC/tutorial/step_3/HookClass_Particles.py | 4 ++-- .../tutorial/step_4/B_multilevel_hierarchy.py | 4 ++-- .../tutorial/step_8/HookClass_error_output.py | 4 ++-- 260 files changed, 609 insertions(+), 589 deletions(-) rename pySDC/core/{BaseTransfer.py => base_transfer.py} (99%) rename pySDC/core/{Collocation.py => collocation.py} (97%) rename pySDC/core/{Common.py => common.py} (98%) rename pySDC/core/{Controller.py => controller.py} (99%) rename pySDC/core/{ConvergenceController.py => convergence_controller.py} (100%) rename pySDC/core/{Errors.py => errors.py} (100%) rename pySDC/core/{Hooks.py => hooks.py} (99%) rename pySDC/core/{Level.py => level.py} (99%) rename pySDC/core/{Problem.py => problem.py} (98%) rename pySDC/core/{SpaceTransfer.py => space_transfer.py} (96%) rename pySDC/core/{Step.py => step.py} (97%) rename pySDC/core/{Sweeper.py => sweeper.py} (91%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 500d94c020..05dbbc3bae 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,6 +9,11 @@ Others are specific conventions chosen for the pySDC library, that may follow Py Finally, while `pySDC` provides many base functionalities that implement classical flavors of SDC, it also allows problem-specific applications through Object-Oriented Programming (OOP) and the implementation of custom inherited classes. This follows a specific OOP framework, you can look at the page on [custom implementations](./docs/contrib/04_custom_implementations.md) for more details. Additional guideline are also given on how to [document the code](./docs/contrib/05_documenting_code.md) in `pySDC`. +> 📣 Some core components (collocation matrix, $Q-\Delta$ coefficients, Lagrange barycentric interpolation) +> are currently implemented and developed in the [`qmat` companion package](https://github.com/Parallel-in-Time/qmat). +> Checkout its own [contributing guide](https://qmat.readthedocs.io/en/latest/contributing.html) +> to add any new coefficient / feature on this part. + 1. [GitHub Forks and Pull Requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/getting-started/about-collaborative-development-models) 2. [Pull Requests Recommendations](./docs/contrib/01_pull_requests.md) 3. [Continuous Integration](./docs/contrib/02_continuous_integration.md) diff --git a/docs/contrib/06_new_project.md b/docs/contrib/06_new_project.md index 059da620a5..c146978453 100644 --- a/docs/contrib/06_new_project.md +++ b/docs/contrib/06_new_project.md @@ -25,6 +25,9 @@ channels: - defaults dependencies: - numpy + - pip + - pip: + - qmat ``` The list of dependencies can be extended as needed. diff --git a/pySDC/core/BaseTransfer.py b/pySDC/core/base_transfer.py similarity index 99% rename from pySDC/core/BaseTransfer.py rename to pySDC/core/base_transfer.py index 87dd6f993d..1cdd8afd45 100644 --- a/pySDC/core/BaseTransfer.py +++ b/pySDC/core/base_transfer.py @@ -2,7 +2,7 @@ import scipy.sparse as sp -from pySDC.core.Errors import UnlockError +from pySDC.core.errors import UnlockError from pySDC.helpers.pysdc_helper import FrozenClass from qmat.lagrange import LagrangeApproximation @@ -17,7 +17,7 @@ def __init__(self, pars): self._freeze() -class base_transfer(object): +class BaseTransfer(object): """ Standard base_transfer class diff --git a/pySDC/core/Collocation.py b/pySDC/core/collocation.py similarity index 97% rename from pySDC/core/Collocation.py rename to pySDC/core/collocation.py index 8ba758f4c6..34f75596f6 100644 --- a/pySDC/core/Collocation.py +++ b/pySDC/core/collocation.py @@ -2,7 +2,7 @@ import numpy as np from qmat import Q_GENERATORS -from pySDC.core.Errors import CollocationError +from pySDC.core.errors import CollocationError class CollBase(object): @@ -29,7 +29,7 @@ class CollBase(object): boundary) and LOBATTO (inclusion of left and right boundary). All coefficients are generated using - [qmat](https://qmat.readthedocs.io/en/latest/autoapi/qmat/qcoeff/collocation/index.html) + `qmat `_. Attributes: num_nodes (int): number of collocation nodes diff --git a/pySDC/core/Common.py b/pySDC/core/common.py similarity index 98% rename from pySDC/core/Common.py rename to pySDC/core/common.py index 51e66750c5..a7986f064b 100644 --- a/pySDC/core/Common.py +++ b/pySDC/core/common.py @@ -7,7 +7,7 @@ Module containing utility classe(s) from which inherit some of the pySDC base classes. """ -from pySDC.core.Errors import ReadOnlyError +from pySDC.core.errors import ReadOnlyError class _MetaRegisterParams(type): diff --git a/pySDC/core/Controller.py b/pySDC/core/controller.py similarity index 99% rename from pySDC/core/Controller.py rename to pySDC/core/controller.py index 20b1175f3c..b77790fe10 100644 --- a/pySDC/core/Controller.py +++ b/pySDC/core/controller.py @@ -3,7 +3,7 @@ import sys import numpy as np -from pySDC.core.BaseTransfer import base_transfer +from pySDC.core.base_transfer import BaseTransfer from pySDC.helpers.pysdc_helper import FrozenClass from pySDC.implementations.convergence_controller_classes.check_convergence import CheckConvergence from pySDC.implementations.hooks.default_hook import DefaultHooks @@ -27,7 +27,7 @@ def __init__(self, params): self._freeze() -class controller(object): +class Controller(object): """ Base abstract controller class """ @@ -203,7 +203,7 @@ def dump_setup(self, step, controller_params, description): out += '--> Collocation: %s\n' % L.sweep.coll.__class__ if len(step.levels) > 1: - if 'base_transfer_class' in description and description['base_transfer_class'] is not base_transfer: + if 'base_transfer_class' in description and description['base_transfer_class'] is not BaseTransfer: out += '--> Base Transfer: %s\n' % step.base_transfer.__class__ else: out += ' Base Transfer: %s\n' % step.base_transfer.__class__ diff --git a/pySDC/core/ConvergenceController.py b/pySDC/core/convergence_controller.py similarity index 100% rename from pySDC/core/ConvergenceController.py rename to pySDC/core/convergence_controller.py diff --git a/pySDC/core/Errors.py b/pySDC/core/errors.py similarity index 100% rename from pySDC/core/Errors.py rename to pySDC/core/errors.py diff --git a/pySDC/core/Hooks.py b/pySDC/core/hooks.py similarity index 99% rename from pySDC/core/Hooks.py rename to pySDC/core/hooks.py index ef606f05ef..5cb53adec0 100644 --- a/pySDC/core/Hooks.py +++ b/pySDC/core/hooks.py @@ -17,7 +17,7 @@ # noinspection PyUnusedLocal,PyShadowingBuiltins,PyShadowingNames -class hooks(object): +class Hooks(object): """ Hook class to contain the functions called during the controller runs (e.g. for calling user-routines) diff --git a/pySDC/core/Level.py b/pySDC/core/level.py similarity index 99% rename from pySDC/core/Level.py rename to pySDC/core/level.py index 38217f85a8..66d3d3083e 100644 --- a/pySDC/core/Level.py +++ b/pySDC/core/level.py @@ -35,7 +35,7 @@ def __init__(self): self._freeze() -class level(FrozenClass): +class Level(FrozenClass): """ Level class containing all management functionality for a single level diff --git a/pySDC/core/Problem.py b/pySDC/core/problem.py similarity index 98% rename from pySDC/core/Problem.py rename to pySDC/core/problem.py index 4c5202a9b2..cdfabeb897 100644 --- a/pySDC/core/Problem.py +++ b/pySDC/core/problem.py @@ -9,7 +9,7 @@ import logging -from pySDC.core.Common import RegisterParams +from pySDC.core.common import RegisterParams class WorkCounter(object): @@ -39,7 +39,7 @@ def __str__(self): return f'{self.niter}' -class ptype(RegisterParams): +class Problem(RegisterParams): """ Prototype class for problems, just defines the attributes essential to get started. diff --git a/pySDC/core/SpaceTransfer.py b/pySDC/core/space_transfer.py similarity index 96% rename from pySDC/core/SpaceTransfer.py rename to pySDC/core/space_transfer.py index fc999630c3..36acef8225 100644 --- a/pySDC/core/SpaceTransfer.py +++ b/pySDC/core/space_transfer.py @@ -16,9 +16,9 @@ def __init__(self, pars): self._freeze() -class space_transfer(object): +class SpaceTransfer(object): """ - Abstract space_transfer class + Abstract SpaceTransfer class Attributes: params (__Pars): parameters given by the user diff --git a/pySDC/core/Step.py b/pySDC/core/step.py similarity index 97% rename from pySDC/core/Step.py rename to pySDC/core/step.py index f983c6fa96..4eae64c4a5 100644 --- a/pySDC/core/Step.py +++ b/pySDC/core/step.py @@ -1,8 +1,8 @@ import logging -from pySDC.core import Level as levclass -from pySDC.core.BaseTransfer import base_transfer -from pySDC.core.Errors import ParameterError +from pySDC.core import level as levclass +from pySDC.core.base_transfer import BaseTransfer +from pySDC.core.errors import ParameterError from pySDC.helpers.pysdc_helper import FrozenClass @@ -41,7 +41,7 @@ def __init__(self): self._freeze() -class step(FrozenClass): +class Step(FrozenClass): """ Step class, referencing most of the structure needed for the time-stepping @@ -115,7 +115,7 @@ def __generate_hierarchy(self, descr): descr['problem_params'] = descr.get('problem_params', {}) # check if base_transfer class is specified - descr['base_transfer_class'] = descr.get('base_transfer_class', base_transfer) + descr['base_transfer_class'] = descr.get('base_transfer_class', BaseTransfer) # check if base_transfer parameters are needed descr['base_transfer_params'] = descr.get('base_transfer_params', {}) # check if space_transfer class is specified @@ -143,13 +143,13 @@ def __generate_hierarchy(self, descr): raise ParameterError(msg) if len(descr_list) == 1 and ( - descr_new['space_transfer_class'] or descr_new['base_transfer_class'] is not base_transfer + descr_new['space_transfer_class'] or descr_new['base_transfer_class'] is not BaseTransfer ): self.logger.warning('you have specified transfer classes, but only a single level') # generate levels, register and connect if needed for l in range(len(descr_list)): - L = levclass.level( + L = levclass.Level( problem_class=descr_list[l]['problem_class'], problem_params=descr_list[l]['problem_params'], sweeper_class=descr_list[l]['sweeper_class'], diff --git a/pySDC/core/Sweeper.py b/pySDC/core/sweeper.py similarity index 91% rename from pySDC/core/Sweeper.py rename to pySDC/core/sweeper.py index 5261e8eaa0..f040d59786 100644 --- a/pySDC/core/Sweeper.py +++ b/pySDC/core/sweeper.py @@ -2,9 +2,9 @@ import numpy as np from qmat import QDELTA_GENERATORS -from pySDC.core.Errors import ParameterError -from pySDC.core.Level import level -from pySDC.core.Collocation import CollBase +from pySDC.core.errors import ParameterError +from pySDC.core.level import Level +from pySDC.core.collocation import CollBase from pySDC.helpers.pysdc_helper import FrozenClass @@ -22,9 +22,21 @@ def __init__(self, pars): self._freeze() -class sweeper(object): +class Sweeper(object): """ - Base abstract sweeper class + Base abstract sweeper class, provides two base methods to generate QDelta matrices : + + - get_Qdelta_implicit(qd_type): + Returns a (pySDC-type) QDelta matrix of **implicit type**, + *i.e* lower triangular with zeros on the first collumn. + - get_Qdelta_explicit(qd_type): + Returns a (pySDC-type) QDelta matrix of **explicit type**, + *i.e* strictly lower triangular with first node distance to zero on the first collumn. + + + All possible QDelta matrix coefficients are generated with + `qmat `_, + check it out to see all available coefficient types. Attributes: logger: custom logger for sweeper-related logging @@ -245,7 +257,7 @@ def level(self, L): Args: L (pySDC.Level.level): current level """ - assert isinstance(L, level) + assert isinstance(L, Level) self.__level = L @property diff --git a/pySDC/helpers/setup_helper.py b/pySDC/helpers/setup_helper.py index e98254a6e7..a0290eb8e4 100644 --- a/pySDC/helpers/setup_helper.py +++ b/pySDC/helpers/setup_helper.py @@ -9,8 +9,8 @@ def generate_description(problem_class, **kwargs): Returns: dict: A description object for running pySDC """ - from pySDC.core.Level import _Pars as level_params - from pySDC.core.Step import _Pars as step_params + from pySDC.core.level import _Pars as level_params + from pySDC.core.step import _Pars as step_params description = { 'level_params': {}, diff --git a/pySDC/implementations/controller_classes/controller_MPI.py b/pySDC/implementations/controller_classes/controller_MPI.py index fe98f24839..9870593978 100644 --- a/pySDC/implementations/controller_classes/controller_MPI.py +++ b/pySDC/implementations/controller_classes/controller_MPI.py @@ -1,13 +1,13 @@ import numpy as np from mpi4py import MPI -from pySDC.core.Controller import controller -from pySDC.core.Errors import ControllerError -from pySDC.core.Step import step +from pySDC.core.controller import Controller +from pySDC.core.errors import ControllerError +from pySDC.core.step import Step from pySDC.implementations.convergence_controller_classes.basic_restarting import BasicRestarting -class controller_MPI(controller): +class controller_MPI(Controller): """ PFASST controller, running parallel version of PFASST in blocks (MG-style) @@ -28,7 +28,7 @@ def __init__(self, controller_params, description, comm): super().__init__(controller_params, description, useMPI=True) # create single step per processor - self.S = step(description) + self.S = Step(description) # pass communicator for future use self.comm = comm diff --git a/pySDC/implementations/controller_classes/controller_nonMPI.py b/pySDC/implementations/controller_classes/controller_nonMPI.py index 83876ef18e..bd7d780322 100644 --- a/pySDC/implementations/controller_classes/controller_nonMPI.py +++ b/pySDC/implementations/controller_classes/controller_nonMPI.py @@ -3,13 +3,13 @@ import numpy as np import dill -from pySDC.core.Controller import controller -from pySDC.core import Step as stepclass -from pySDC.core.Errors import ControllerError, CommunicationError +from pySDC.core.controller import Controller +from pySDC.core import step as stepclass +from pySDC.core.errors import ControllerError, CommunicationError from pySDC.implementations.convergence_controller_classes.basic_restarting import BasicRestarting -class controller_nonMPI(controller): +class controller_nonMPI(Controller): """ PFASST controller, running serialized version of PFASST in blocks (MG-style) @@ -32,7 +32,7 @@ def __init__(self, num_procs, controller_params, description): # call parent's initialization routine super().__init__(controller_params, description, useMPI=False) - self.MS = [stepclass.step(description)] + self.MS = [stepclass.Step(description)] # try to initialize via dill.copy (much faster for many time-steps) try: @@ -42,7 +42,7 @@ def __init__(self, num_procs, controller_params, description): except (dill.PicklingError, TypeError) as error: self.logger.warning(f'Need to initialize steps separately due to pickling error: {error}') for _ in range(num_procs - 1): - self.MS.append(stepclass.step(description)) + self.MS.append(stepclass.Step(description)) self.base_convergence_controllers += [BasicRestarting.get_implementation(useMPI=False)] for convergence_controller in self.base_convergence_controllers: diff --git a/pySDC/implementations/convergence_controller_classes/adaptive_collocation.py b/pySDC/implementations/convergence_controller_classes/adaptive_collocation.py index d7557bbdcc..19877bfcfc 100644 --- a/pySDC/implementations/convergence_controller_classes/adaptive_collocation.py +++ b/pySDC/implementations/convergence_controller_classes/adaptive_collocation.py @@ -1,8 +1,8 @@ import numpy as np from qmat.lagrange import LagrangeApproximation -from pySDC.core.ConvergenceController import ConvergenceController, Status -from pySDC.core.Collocation import CollBase +from pySDC.core.convergence_controller import ConvergenceController, Status +from pySDC.core.collocation import CollBase class AdaptiveCollocation(ConvergenceController): diff --git a/pySDC/implementations/convergence_controller_classes/adaptivity.py b/pySDC/implementations/convergence_controller_classes/adaptivity.py index 75a4faaa9f..6fc0cc6528 100644 --- a/pySDC/implementations/convergence_controller_classes/adaptivity.py +++ b/pySDC/implementations/convergence_controller_classes/adaptivity.py @@ -1,5 +1,5 @@ import numpy as np -from pySDC.core.ConvergenceController import ConvergenceController, Status +from pySDC.core.convergence_controller import ConvergenceController, Status from pySDC.implementations.convergence_controller_classes.step_size_limiter import ( StepSizeLimiter, ) diff --git a/pySDC/implementations/convergence_controller_classes/basic_restarting.py b/pySDC/implementations/convergence_controller_classes/basic_restarting.py index 89678385c3..4741c62b80 100644 --- a/pySDC/implementations/convergence_controller_classes/basic_restarting.py +++ b/pySDC/implementations/convergence_controller_classes/basic_restarting.py @@ -1,8 +1,8 @@ -from pySDC.core.ConvergenceController import ConvergenceController, Pars +from pySDC.core.convergence_controller import ConvergenceController, Pars from pySDC.implementations.convergence_controller_classes.spread_step_sizes import ( SpreadStepSizesBlockwise, ) -from pySDC.core.Errors import ConvergenceError +from pySDC.core.errors import ConvergenceError import numpy as np diff --git a/pySDC/implementations/convergence_controller_classes/check_convergence.py b/pySDC/implementations/convergence_controller_classes/check_convergence.py index 40ac60c4f9..9cbe85e25e 100644 --- a/pySDC/implementations/convergence_controller_classes/check_convergence.py +++ b/pySDC/implementations/convergence_controller_classes/check_convergence.py @@ -1,6 +1,6 @@ import numpy as np -from pySDC.core.ConvergenceController import ConvergenceController +from pySDC.core.convergence_controller import ConvergenceController class CheckConvergence(ConvergenceController): diff --git a/pySDC/implementations/convergence_controller_classes/check_iteration_estimator.py b/pySDC/implementations/convergence_controller_classes/check_iteration_estimator.py index d2245ba99f..c722070ce6 100644 --- a/pySDC/implementations/convergence_controller_classes/check_iteration_estimator.py +++ b/pySDC/implementations/convergence_controller_classes/check_iteration_estimator.py @@ -1,5 +1,5 @@ import numpy as np -from pySDC.core.ConvergenceController import ConvergenceController, Status +from pySDC.core.convergence_controller import ConvergenceController, Status from pySDC.implementations.convergence_controller_classes.store_uold import StoreUOld diff --git a/pySDC/implementations/convergence_controller_classes/crash.py b/pySDC/implementations/convergence_controller_classes/crash.py index f9729e89a3..c81e25787a 100644 --- a/pySDC/implementations/convergence_controller_classes/crash.py +++ b/pySDC/implementations/convergence_controller_classes/crash.py @@ -1,5 +1,5 @@ -from pySDC.core.ConvergenceController import ConvergenceController -from pySDC.core.Errors import ConvergenceError +from pySDC.core.convergence_controller import ConvergenceController +from pySDC.core.errors import ConvergenceError import numpy as np import time diff --git a/pySDC/implementations/convergence_controller_classes/estimate_contraction_factor.py b/pySDC/implementations/convergence_controller_classes/estimate_contraction_factor.py index 7a782d6ed6..977a541a33 100644 --- a/pySDC/implementations/convergence_controller_classes/estimate_contraction_factor.py +++ b/pySDC/implementations/convergence_controller_classes/estimate_contraction_factor.py @@ -1,6 +1,6 @@ import numpy as np -from pySDC.core.ConvergenceController import ConvergenceController +from pySDC.core.convergence_controller import ConvergenceController from pySDC.implementations.convergence_controller_classes.estimate_embedded_error import EstimateEmbeddedError diff --git a/pySDC/implementations/convergence_controller_classes/estimate_embedded_error.py b/pySDC/implementations/convergence_controller_classes/estimate_embedded_error.py index 8aec1f79c3..905332b9cb 100644 --- a/pySDC/implementations/convergence_controller_classes/estimate_embedded_error.py +++ b/pySDC/implementations/convergence_controller_classes/estimate_embedded_error.py @@ -1,6 +1,6 @@ import numpy as np -from pySDC.core.ConvergenceController import ConvergenceController, Pars, Status +from pySDC.core.convergence_controller import ConvergenceController, Pars, Status from pySDC.implementations.convergence_controller_classes.store_uold import StoreUOld from pySDC.implementations.sweeper_classes.Runge_Kutta import RungeKutta diff --git a/pySDC/implementations/convergence_controller_classes/estimate_extrapolation_error.py b/pySDC/implementations/convergence_controller_classes/estimate_extrapolation_error.py index 9118fcedf5..364603fbc0 100644 --- a/pySDC/implementations/convergence_controller_classes/estimate_extrapolation_error.py +++ b/pySDC/implementations/convergence_controller_classes/estimate_extrapolation_error.py @@ -1,8 +1,8 @@ import numpy as np from scipy.special import factorial -from pySDC.core.ConvergenceController import ConvergenceController, Status -from pySDC.core.Errors import DataError +from pySDC.core.convergence_controller import ConvergenceController, Status +from pySDC.core.errors import DataError from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh from pySDC.implementations.hooks.log_extrapolated_error_estimate import LogExtrapolationErrorEstimate diff --git a/pySDC/implementations/convergence_controller_classes/estimate_polynomial_error.py b/pySDC/implementations/convergence_controller_classes/estimate_polynomial_error.py index 56e1d8dca7..d735283a29 100644 --- a/pySDC/implementations/convergence_controller_classes/estimate_polynomial_error.py +++ b/pySDC/implementations/convergence_controller_classes/estimate_polynomial_error.py @@ -1,7 +1,7 @@ import numpy as np from qmat.lagrange import LagrangeApproximation -from pySDC.core.ConvergenceController import ConvergenceController +from pySDC.core.convergence_controller import ConvergenceController class EstimatePolynomialError(ConvergenceController): @@ -51,7 +51,7 @@ def setup(self, controller, params, description, **kwargs): self.check_convergence = CheckConvergence.check_convergence if quad_type != 'GAUSS' and defaults['estimate_on_node'] > num_nodes: - from pySDC.core.Errors import ParameterError + from pySDC.core.errors import ParameterError raise ParameterError( 'You cannot interpolate with lower accuracy to the end point if the end point is a node!' diff --git a/pySDC/implementations/convergence_controller_classes/hotrod.py b/pySDC/implementations/convergence_controller_classes/hotrod.py index ce82f29f90..23b4a6e92d 100644 --- a/pySDC/implementations/convergence_controller_classes/hotrod.py +++ b/pySDC/implementations/convergence_controller_classes/hotrod.py @@ -1,6 +1,6 @@ import numpy as np -from pySDC.core.ConvergenceController import ConvergenceController +from pySDC.core.convergence_controller import ConvergenceController class HotRod(ConvergenceController): diff --git a/pySDC/implementations/convergence_controller_classes/inexactness.py b/pySDC/implementations/convergence_controller_classes/inexactness.py index 3af8a83a96..4f02ac4914 100644 --- a/pySDC/implementations/convergence_controller_classes/inexactness.py +++ b/pySDC/implementations/convergence_controller_classes/inexactness.py @@ -1,4 +1,4 @@ -from pySDC.core.ConvergenceController import ConvergenceController +from pySDC.core.convergence_controller import ConvergenceController class NewtonInexactness(ConvergenceController): diff --git a/pySDC/implementations/convergence_controller_classes/interpolate_between_restarts.py b/pySDC/implementations/convergence_controller_classes/interpolate_between_restarts.py index 5ae36d8d20..934588ad94 100644 --- a/pySDC/implementations/convergence_controller_classes/interpolate_between_restarts.py +++ b/pySDC/implementations/convergence_controller_classes/interpolate_between_restarts.py @@ -1,5 +1,5 @@ import numpy as np -from pySDC.core.ConvergenceController import ConvergenceController, Status +from pySDC.core.convergence_controller import ConvergenceController, Status from qmat.lagrange import LagrangeApproximation diff --git a/pySDC/implementations/convergence_controller_classes/spread_step_sizes.py b/pySDC/implementations/convergence_controller_classes/spread_step_sizes.py index 2246aee829..dce398caee 100644 --- a/pySDC/implementations/convergence_controller_classes/spread_step_sizes.py +++ b/pySDC/implementations/convergence_controller_classes/spread_step_sizes.py @@ -1,5 +1,5 @@ import numpy as np -from pySDC.core.ConvergenceController import ConvergenceController +from pySDC.core.convergence_controller import ConvergenceController class SpreadStepSizesBlockwise(ConvergenceController): diff --git a/pySDC/implementations/convergence_controller_classes/step_size_limiter.py b/pySDC/implementations/convergence_controller_classes/step_size_limiter.py index f390864aff..b5101c60e7 100644 --- a/pySDC/implementations/convergence_controller_classes/step_size_limiter.py +++ b/pySDC/implementations/convergence_controller_classes/step_size_limiter.py @@ -1,5 +1,5 @@ import numpy as np -from pySDC.core.ConvergenceController import ConvergenceController +from pySDC.core.convergence_controller import ConvergenceController class StepSizeLimiter(ConvergenceController): diff --git a/pySDC/implementations/convergence_controller_classes/store_uold.py b/pySDC/implementations/convergence_controller_classes/store_uold.py index ba1aca0453..7e481aa286 100644 --- a/pySDC/implementations/convergence_controller_classes/store_uold.py +++ b/pySDC/implementations/convergence_controller_classes/store_uold.py @@ -1,4 +1,4 @@ -from pySDC.core.ConvergenceController import ConvergenceController +from pySDC.core.convergence_controller import ConvergenceController class StoreUOld(ConvergenceController): diff --git a/pySDC/implementations/datatype_classes/cupy_mesh.py b/pySDC/implementations/datatype_classes/cupy_mesh.py index 77fb794297..1a6d79fe87 100644 --- a/pySDC/implementations/datatype_classes/cupy_mesh.py +++ b/pySDC/implementations/datatype_classes/cupy_mesh.py @@ -1,5 +1,5 @@ import cupy as cp -from pySDC.core.Errors import DataError +from pySDC.core.errors import DataError try: from mpi4py import MPI diff --git a/pySDC/implementations/datatype_classes/fenics_mesh.py b/pySDC/implementations/datatype_classes/fenics_mesh.py index 1cfb8ec1da..52b0ad7ae0 100644 --- a/pySDC/implementations/datatype_classes/fenics_mesh.py +++ b/pySDC/implementations/datatype_classes/fenics_mesh.py @@ -1,6 +1,6 @@ import dolfin as df -from pySDC.core.Errors import DataError +from pySDC.core.errors import DataError class fenics_mesh(object): diff --git a/pySDC/implementations/datatype_classes/particles.py b/pySDC/implementations/datatype_classes/particles.py index 92f8072caa..081a7e3e43 100644 --- a/pySDC/implementations/datatype_classes/particles.py +++ b/pySDC/implementations/datatype_classes/particles.py @@ -1,7 +1,7 @@ import numpy as np from pySDC.implementations.datatype_classes.mesh import mesh -from pySDC.core.Errors import DataError +from pySDC.core.errors import DataError try: from mpi4py import MPI diff --git a/pySDC/implementations/datatype_classes/petsc_vec.py b/pySDC/implementations/datatype_classes/petsc_vec.py index 574098bd0a..0653d18148 100644 --- a/pySDC/implementations/datatype_classes/petsc_vec.py +++ b/pySDC/implementations/datatype_classes/petsc_vec.py @@ -1,6 +1,6 @@ from petsc4py import PETSc -from pySDC.core.Errors import DataError +from pySDC.core.errors import DataError class petsc_vec(PETSc.Vec): diff --git a/pySDC/implementations/hooks/default_hook.py b/pySDC/implementations/hooks/default_hook.py index 0944539c60..c9d83feb5b 100644 --- a/pySDC/implementations/hooks/default_hook.py +++ b/pySDC/implementations/hooks/default_hook.py @@ -1,8 +1,8 @@ import time -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class DefaultHooks(hooks): +class DefaultHooks(Hooks): """ Hook class to contain the functions called during the controller runs (e.g. for calling user-routines) diff --git a/pySDC/implementations/hooks/log_embedded_error_estimate.py b/pySDC/implementations/hooks/log_embedded_error_estimate.py index 1a9c7c5863..87aad58097 100644 --- a/pySDC/implementations/hooks/log_embedded_error_estimate.py +++ b/pySDC/implementations/hooks/log_embedded_error_estimate.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class LogEmbeddedErrorEstimate(hooks): +class LogEmbeddedErrorEstimate(Hooks): """ Store the embedded error estimate at the end of each step as "error_embedded_estimate". """ diff --git a/pySDC/implementations/hooks/log_errors.py b/pySDC/implementations/hooks/log_errors.py index 93329ebc4a..06c4d09282 100644 --- a/pySDC/implementations/hooks/log_errors.py +++ b/pySDC/implementations/hooks/log_errors.py @@ -1,8 +1,8 @@ import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class LogError(hooks): +class LogError(Hooks): """ Base class with functions to add the local and global error to the stats, which can be inherited by hooks logging these at specific places. @@ -118,7 +118,7 @@ def post_iteration(self, step, level_number): self.log_global_error(step, level_number, suffix='_post_iteration') -class LogGlobalErrorPostRun(hooks): +class LogGlobalErrorPostRun(Hooks): """ Compute the global error once after the run is finished. Because of some timing issues, we cannot inherit from the `LogError` class here. diff --git a/pySDC/implementations/hooks/log_extrapolated_error_estimate.py b/pySDC/implementations/hooks/log_extrapolated_error_estimate.py index 7e2975653c..dd3eb1ee76 100644 --- a/pySDC/implementations/hooks/log_extrapolated_error_estimate.py +++ b/pySDC/implementations/hooks/log_extrapolated_error_estimate.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class LogExtrapolationErrorEstimate(hooks): +class LogExtrapolationErrorEstimate(Hooks): """ Store the extrapolated error estimate at the end of each step as "error_extrapolation_estimate". """ diff --git a/pySDC/implementations/hooks/log_restarts.py b/pySDC/implementations/hooks/log_restarts.py index 6a13e36b84..e89d4f5dc5 100644 --- a/pySDC/implementations/hooks/log_restarts.py +++ b/pySDC/implementations/hooks/log_restarts.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class LogRestarts(hooks): +class LogRestarts(Hooks): """ Record restarts as `restart` at the beginning of the step. """ diff --git a/pySDC/implementations/hooks/log_solution.py b/pySDC/implementations/hooks/log_solution.py index d6c85b8e43..fd8590a1f8 100644 --- a/pySDC/implementations/hooks/log_solution.py +++ b/pySDC/implementations/hooks/log_solution.py @@ -1,10 +1,10 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks import pickle import os import numpy as np -class LogSolution(hooks): +class LogSolution(Hooks): """ Store the solution at the end of each step as "u". """ @@ -36,7 +36,7 @@ def post_step(self, step, level_number): ) -class LogSolutionAfterIteration(hooks): +class LogSolutionAfterIteration(Hooks): """ Store the solution at the end of each iteration as "u". """ @@ -68,7 +68,7 @@ def post_iteration(self, step, level_number): ) -class LogToFile(hooks): +class LogToFile(Hooks): r""" Hook for logging the solution to file after the step using pickle. diff --git a/pySDC/implementations/hooks/log_step_size.py b/pySDC/implementations/hooks/log_step_size.py index 62dada9ab0..72a8c64433 100644 --- a/pySDC/implementations/hooks/log_step_size.py +++ b/pySDC/implementations/hooks/log_step_size.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class LogStepSize(hooks): +class LogStepSize(Hooks): """ Store the step size at the end of each step as "dt". """ diff --git a/pySDC/implementations/hooks/log_work.py b/pySDC/implementations/hooks/log_work.py index 1e9a8a10e0..ad2e900949 100644 --- a/pySDC/implementations/hooks/log_work.py +++ b/pySDC/implementations/hooks/log_work.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class LogWork(hooks): +class LogWork(Hooks): """ Log the increment of all work counters in the problem between steps """ @@ -55,7 +55,7 @@ def post_step(self, step, level_number): ) -class LogSDCIterations(hooks): +class LogSDCIterations(Hooks): """ Log the number of SDC iterations between steps. You can control the name in the stats via the class attribute ``name``. diff --git a/pySDC/implementations/hooks/plotting.py b/pySDC/implementations/hooks/plotting.py index 95b22d368d..685fc9d6df 100644 --- a/pySDC/implementations/hooks/plotting.py +++ b/pySDC/implementations/hooks/plotting.py @@ -1,8 +1,8 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks import matplotlib.pyplot as plt -class PlottingHook(hooks): # pragma: no cover +class PlottingHook(Hooks): # pragma: no cover save_plot = None # Supply a string to the path where you want to save live_plot = 1e-9 # Supply `None` if you don't want live plotting diff --git a/pySDC/implementations/problem_classes/AcousticAdvection_1D_FD_imex.py b/pySDC/implementations/problem_classes/AcousticAdvection_1D_FD_imex.py index c5b4ecba21..9a3d5864c3 100644 --- a/pySDC/implementations/problem_classes/AcousticAdvection_1D_FD_imex.py +++ b/pySDC/implementations/problem_classes/AcousticAdvection_1D_FD_imex.py @@ -1,8 +1,8 @@ import numpy as np from scipy.sparse.linalg import spsolve -from pySDC.core.Errors import ParameterError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ParameterError +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh from pySDC.implementations.problem_classes.acoustic_helpers.buildWave1DMatrix import ( getWave1DMatrix, @@ -11,7 +11,7 @@ # noinspection PyUnusedLocal -class acoustic_1d_imex(ptype): +class acoustic_1d_imex(Problem): r""" This class implements the one-dimensional acoustics advection equation on a periodic domain :math:`[0, 1]` fully investigated in [1]_. The equations are given by diff --git a/pySDC/implementations/problem_classes/AdvectionDiffusionEquation_1D_FFT.py b/pySDC/implementations/problem_classes/AdvectionDiffusionEquation_1D_FFT.py index beb56d3c79..e841387d68 100644 --- a/pySDC/implementations/problem_classes/AdvectionDiffusionEquation_1D_FFT.py +++ b/pySDC/implementations/problem_classes/AdvectionDiffusionEquation_1D_FFT.py @@ -1,12 +1,12 @@ import numpy as np -from pySDC.core.Errors import ParameterError, ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ParameterError, ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh # noinspection PyUnusedLocal -class advectiondiffusion1d_imex(ptype): +class advectiondiffusion1d_imex(Problem): r""" Example implementing the unforced one-dimensional advection diffusion equation diff --git a/pySDC/implementations/problem_classes/AllenCahn_1D_FD.py b/pySDC/implementations/problem_classes/AllenCahn_1D_FD.py index ec5a02cd65..d20e26f6b5 100644 --- a/pySDC/implementations/problem_classes/AllenCahn_1D_FD.py +++ b/pySDC/implementations/problem_classes/AllenCahn_1D_FD.py @@ -2,13 +2,13 @@ import scipy.sparse as sp from scipy.sparse.linalg import spsolve -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.helpers import problem_helper from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh, comp2_mesh -class allencahn_front_fullyimplicit(ptype): +class allencahn_front_fullyimplicit(Problem): r""" Example implementing the one-dimensional Allen-Cahn equation with driving force using inhomogeneous Dirichlet boundary conditions @@ -475,7 +475,7 @@ def eval_f(self, u, t): return f -class allencahn_periodic_fullyimplicit(ptype): +class allencahn_periodic_fullyimplicit(Problem): r""" Example implementing the one-dimensional Allen-Cahn equation with driving force and periodic boundary conditions diff --git a/pySDC/implementations/problem_classes/AllenCahn_2D_FD.py b/pySDC/implementations/problem_classes/AllenCahn_2D_FD.py index 32275368fc..7f7ff964c1 100644 --- a/pySDC/implementations/problem_classes/AllenCahn_2D_FD.py +++ b/pySDC/implementations/problem_classes/AllenCahn_2D_FD.py @@ -2,8 +2,8 @@ import scipy.sparse as sp from scipy.sparse.linalg import cg -from pySDC.core.Errors import ParameterError, ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ParameterError, ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.helpers import problem_helper from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh, comp2_mesh @@ -12,7 +12,7 @@ # noinspection PyUnusedLocal -class allencahn_fullyimplicit(ptype): +class allencahn_fullyimplicit(Problem): r""" Example implementing the two-dimensional Allen-Cahn equation with periodic boundary conditions :math:`u \in [-1, 1]^2` diff --git a/pySDC/implementations/problem_classes/AllenCahn_2D_FD_gpu.py b/pySDC/implementations/problem_classes/AllenCahn_2D_FD_gpu.py index 9a4fe2227a..2597ad1fa3 100644 --- a/pySDC/implementations/problem_classes/AllenCahn_2D_FD_gpu.py +++ b/pySDC/implementations/problem_classes/AllenCahn_2D_FD_gpu.py @@ -3,14 +3,14 @@ import cupyx.scipy.sparse as csp from cupyx.scipy.sparse.linalg import cg # , spsolve, gmres, minres -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.cupy_mesh import cupy_mesh, imex_cupy_mesh, comp2_cupy_mesh # http://www.personal.psu.edu/qud2/Res/Pre/dz09sisc.pdf -class allencahn_fullyimplicit(ptype): # pragma: no cover +class allencahn_fullyimplicit(Problem): # pragma: no cover r""" Example implementing the two-dimensional Allen-Cahn equation with periodic boundary conditions :math:`u \in [-1, 1]^2` diff --git a/pySDC/implementations/problem_classes/AllenCahn_2D_FFT.py b/pySDC/implementations/problem_classes/AllenCahn_2D_FFT.py index 9cf1a3da52..2fa05f98cb 100644 --- a/pySDC/implementations/problem_classes/AllenCahn_2D_FFT.py +++ b/pySDC/implementations/problem_classes/AllenCahn_2D_FFT.py @@ -1,12 +1,12 @@ import numpy as np -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh # noinspection PyUnusedLocal -class allencahn2d_imex(ptype): +class allencahn2d_imex(Problem): r""" Example implementing the two-dimensional Allen-Cahn equation with periodic boundary conditions :math:`u \in [-1, 1]^2` diff --git a/pySDC/implementations/problem_classes/AllenCahn_2D_FFT_gpu.py b/pySDC/implementations/problem_classes/AllenCahn_2D_FFT_gpu.py index 7635f8dcfb..a3b269b8ab 100644 --- a/pySDC/implementations/problem_classes/AllenCahn_2D_FFT_gpu.py +++ b/pySDC/implementations/problem_classes/AllenCahn_2D_FFT_gpu.py @@ -1,12 +1,12 @@ import cupy as cp import numpy as np -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.cupy_mesh import cupy_mesh, imex_cupy_mesh -class allencahn2d_imex(ptype): # pragma: no cover +class allencahn2d_imex(Problem): # pragma: no cover r""" Example implementing the two-dimensional Allen-Cahn equation with periodic boundary conditions :math:`u \in [-1, 1]^2` diff --git a/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py b/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py index 01f2e99e32..054154d172 100644 --- a/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py +++ b/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py @@ -1,14 +1,14 @@ import numpy as np from mpi4py_fft import PFFT -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh from mpi4py_fft import newDistArray -class allencahn_temp_imex(ptype): +class allencahn_temp_imex(Problem): r""" This class implements the :math:`N`-dimensional Allen-Cahn equation with periodic boundary conditions :math:`u \in [0, 1]^2` diff --git a/pySDC/implementations/problem_classes/Auzinger_implicit.py b/pySDC/implementations/problem_classes/Auzinger_implicit.py index f0ce329069..76b66f7a77 100644 --- a/pySDC/implementations/problem_classes/Auzinger_implicit.py +++ b/pySDC/implementations/problem_classes/Auzinger_implicit.py @@ -1,11 +1,11 @@ import numpy as np -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh # noinspection PyUnusedLocal -class auzinger(ptype): +class auzinger(Problem): r""" This class implements the Auzinger equation [1]_ as initial value problem. The system of two ordinary differential equations (ODEs) is given by diff --git a/pySDC/implementations/problem_classes/Battery.py b/pySDC/implementations/problem_classes/Battery.py index c6f15de717..56700755ea 100644 --- a/pySDC/implementations/problem_classes/Battery.py +++ b/pySDC/implementations/problem_classes/Battery.py @@ -1,11 +1,11 @@ import numpy as np -from pySDC.core.Errors import ParameterError, ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ParameterError, ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh -class battery_n_capacitors(ptype): +class battery_n_capacitors(Problem): r""" Example implementing the battery drain model with :math:`N` capacitors, where :math:`N` is an arbitrary integer greater than zero. First, the capacitor :math:`C` serves as a battery and provides energy. When the voltage of the capacitor :math:`v_{C_n}` for diff --git a/pySDC/implementations/problem_classes/Boussinesq_2D_FD_imex.py b/pySDC/implementations/problem_classes/Boussinesq_2D_FD_imex.py index ca7cd15277..2df1c7e0b4 100644 --- a/pySDC/implementations/problem_classes/Boussinesq_2D_FD_imex.py +++ b/pySDC/implementations/problem_classes/Boussinesq_2D_FD_imex.py @@ -1,7 +1,7 @@ import numpy as np from scipy.sparse.linalg import gmres -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh from pySDC.implementations.problem_classes.boussinesq_helpers.build2DFDMatrix import get2DMesh from pySDC.implementations.problem_classes.boussinesq_helpers.buildBoussinesq2DMatrix import getBoussinesq2DMatrix @@ -11,7 +11,7 @@ # noinspection PyUnusedLocal -class boussinesq_2d_imex(ptype): +class boussinesq_2d_imex(Problem): r""" This class implements the two-dimensional Boussinesq equations for different boundary conditions with diff --git a/pySDC/implementations/problem_classes/BuckConverter.py b/pySDC/implementations/problem_classes/BuckConverter.py index 50046ce6aa..ef76d64190 100644 --- a/pySDC/implementations/problem_classes/BuckConverter.py +++ b/pySDC/implementations/problem_classes/BuckConverter.py @@ -1,10 +1,10 @@ import numpy as np -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh -class buck_converter(ptype): +class buck_converter(Problem): r""" Example implementing the model of a buck converter, which is also called a step-down converter. The converter has two different states and each of this state can be expressed as a nonhomogeneous linear system of ordinary differential equations (ODEs) diff --git a/pySDC/implementations/problem_classes/DiscontinuousTestODE.py b/pySDC/implementations/problem_classes/DiscontinuousTestODE.py index 111a8267ea..9423fab694 100644 --- a/pySDC/implementations/problem_classes/DiscontinuousTestODE.py +++ b/pySDC/implementations/problem_classes/DiscontinuousTestODE.py @@ -1,11 +1,11 @@ import numpy as np -from pySDC.core.Errors import ParameterError, ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ParameterError, ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.mesh import mesh -class DiscontinuousTestODE(ptype): +class DiscontinuousTestODE(Problem): r""" This class implements a very simple test case of a ordinary differential equation consisting of one discrete event. The dynamics of the solution changes when the state function :math:`h(u) := u - 5` changes the sign. The problem is defined by: diff --git a/pySDC/implementations/problem_classes/FastWaveSlowWave_0D.py b/pySDC/implementations/problem_classes/FastWaveSlowWave_0D.py index e3bf083fad..bf6f03a028 100644 --- a/pySDC/implementations/problem_classes/FastWaveSlowWave_0D.py +++ b/pySDC/implementations/problem_classes/FastWaveSlowWave_0D.py @@ -1,12 +1,12 @@ import numpy as np -from pySDC.core.Errors import ParameterError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ParameterError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh # noinspection PyUnusedLocal -class swfw_scalar(ptype): +class swfw_scalar(Problem): r""" This class implements the fast-wave-slow-wave scalar problem fully investigated in [1]_. It is defined by diff --git a/pySDC/implementations/problem_classes/FermiPastaUlamTsingou.py b/pySDC/implementations/problem_classes/FermiPastaUlamTsingou.py index 2f087efc49..142d5b18d0 100644 --- a/pySDC/implementations/problem_classes/FermiPastaUlamTsingou.py +++ b/pySDC/implementations/problem_classes/FermiPastaUlamTsingou.py @@ -1,12 +1,12 @@ import numpy as np -from pySDC.core.Errors import ParameterError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ParameterError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.particles import particles, acceleration # noinspection PyUnusedLocal -class fermi_pasta_ulam_tsingou(ptype): +class fermi_pasta_ulam_tsingou(Problem): r""" The Fermi-Pasta-Ulam-Tsingou (FPUT) problem was one of the first computer experiments. E. Fermi, J. Pasta and S. Ulam investigated the behavior of a vibrating spring with a weak correction term (which is quadratic diff --git a/pySDC/implementations/problem_classes/GeneralizedFisher_1D_FD_implicit.py b/pySDC/implementations/problem_classes/GeneralizedFisher_1D_FD_implicit.py index c260307a36..9a3b79abee 100644 --- a/pySDC/implementations/problem_classes/GeneralizedFisher_1D_FD_implicit.py +++ b/pySDC/implementations/problem_classes/GeneralizedFisher_1D_FD_implicit.py @@ -2,14 +2,14 @@ import scipy.sparse as sp from scipy.sparse.linalg import spsolve -from pySDC.core.Errors import ParameterError, ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ParameterError, ProblemError +from pySDC.core.problem import Problem from pySDC.helpers import problem_helper from pySDC.implementations.datatype_classes.mesh import mesh # noinspection PyUnusedLocal -class generalized_fisher(ptype): +class generalized_fisher(Problem): r""" The following one-dimensional problem is an example of a reaction-diffusion equation with traveling waves, and can be seen as a generalized Fisher equation. This class implements a special case of the Kolmogorov-Petrovskii-Piskunov diff --git a/pySDC/implementations/problem_classes/GeneralizedFisher_1D_PETSc.py b/pySDC/implementations/problem_classes/GeneralizedFisher_1D_PETSc.py index 7d10d2be67..4a98313824 100644 --- a/pySDC/implementations/problem_classes/GeneralizedFisher_1D_PETSc.py +++ b/pySDC/implementations/problem_classes/GeneralizedFisher_1D_PETSc.py @@ -1,7 +1,7 @@ import numpy as np from petsc4py import PETSc -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.petsc_vec import petsc_vec, petsc_vec_imex, petsc_vec_comp2 @@ -226,7 +226,7 @@ def formJacobian(self, snes, X, J, P): return PETSc.Mat.Structure.SAME_NONZERO_PATTERN -class petsc_fisher_multiimplicit(ptype): +class petsc_fisher_multiimplicit(Problem): r""" The following one-dimensional problem is an example of a reaction-diffusion equation with traveling waves, and can be seen as a generalized Fisher equation. This class implements a special case of the Kolmogorov-Petrovskii-Piskunov diff --git a/pySDC/implementations/problem_classes/GrayScott_1D_FEniCS_implicit.py b/pySDC/implementations/problem_classes/GrayScott_1D_FEniCS_implicit.py index fdce175792..734e075610 100644 --- a/pySDC/implementations/problem_classes/GrayScott_1D_FEniCS_implicit.py +++ b/pySDC/implementations/problem_classes/GrayScott_1D_FEniCS_implicit.py @@ -4,13 +4,13 @@ import dolfin as df import numpy as np -from pySDC.core.Errors import ParameterError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ParameterError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.fenics_mesh import fenics_mesh # noinspection PyUnusedLocal -class fenics_grayscott(ptype): +class fenics_grayscott(Problem): r""" The Gray-Scott system [1]_ describes a reaction-diffusion process of two substances :math:`u` and :math:`v`, where they diffuse over time. During the reaction :math:`u` is used up with overall decay rate :math:`B`, diff --git a/pySDC/implementations/problem_classes/GrayScott_2D_PETSc_periodic.py b/pySDC/implementations/problem_classes/GrayScott_2D_PETSc_periodic.py index df12e58b21..42d2bc3b14 100644 --- a/pySDC/implementations/problem_classes/GrayScott_2D_PETSc_periodic.py +++ b/pySDC/implementations/problem_classes/GrayScott_2D_PETSc_periodic.py @@ -1,7 +1,7 @@ import numpy as np from petsc4py import PETSc -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.petsc_vec import petsc_vec, petsc_vec_imex, petsc_vec_comp2 @@ -282,7 +282,7 @@ def formJacobian(self, snes, X, J, P): return PETSc.Mat.Structure.SAME_NONZERO_PATTERN -class petsc_grayscott_multiimplicit(ptype): +class petsc_grayscott_multiimplicit(Problem): r""" The Gray-Scott system [1]_ describes a reaction-diffusion process of two substances :math:`u` and :math:`v`, where they diffuse over time. During the reaction :math:`u` is used up with overall decay rate :math:`B`, diff --git a/pySDC/implementations/problem_classes/GrayScott_MPIFFT.py b/pySDC/implementations/problem_classes/GrayScott_MPIFFT.py index ef597addae..26bf60cacf 100644 --- a/pySDC/implementations/problem_classes/GrayScott_MPIFFT.py +++ b/pySDC/implementations/problem_classes/GrayScott_MPIFFT.py @@ -2,8 +2,8 @@ from mpi4py import MPI from mpi4py_fft import PFFT -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh, comp2_mesh from pySDC.implementations.problem_classes.generic_MPIFFT_Laplacian import IMEX_Laplacian_MPIFFT diff --git a/pySDC/implementations/problem_classes/HarmonicOscillator.py b/pySDC/implementations/problem_classes/HarmonicOscillator.py index d38ab4a096..2a4761a7e8 100644 --- a/pySDC/implementations/problem_classes/HarmonicOscillator.py +++ b/pySDC/implementations/problem_classes/HarmonicOscillator.py @@ -1,12 +1,12 @@ import numpy as np -from pySDC.core.Errors import ParameterError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ParameterError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.particles import particles, acceleration # noinspection PyUnusedLocal -class harmonic_oscillator(ptype): +class harmonic_oscillator(Problem): r""" Example implementing the harmonic oscillator with mass :math:`1` diff --git a/pySDC/implementations/problem_classes/HeatEquation_1D_FEniCS_matrix_forced.py b/pySDC/implementations/problem_classes/HeatEquation_1D_FEniCS_matrix_forced.py index 2ee5fc990d..1e7734c956 100644 --- a/pySDC/implementations/problem_classes/HeatEquation_1D_FEniCS_matrix_forced.py +++ b/pySDC/implementations/problem_classes/HeatEquation_1D_FEniCS_matrix_forced.py @@ -3,12 +3,12 @@ import dolfin as df import numpy as np -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.fenics_mesh import fenics_mesh, rhs_fenics_mesh # noinspection PyUnusedLocal -class fenics_heat(ptype): +class fenics_heat(Problem): r""" Example implementing the forced one-dimensional heat equation with Dirichlet boundary conditions diff --git a/pySDC/implementations/problem_classes/HeatEquation_2D_PETSc_forced.py b/pySDC/implementations/problem_classes/HeatEquation_2D_PETSc_forced.py index bca21ed1db..3c282156c4 100644 --- a/pySDC/implementations/problem_classes/HeatEquation_2D_PETSc_forced.py +++ b/pySDC/implementations/problem_classes/HeatEquation_2D_PETSc_forced.py @@ -1,13 +1,13 @@ import numpy as np from petsc4py import PETSc -from pySDC.core.Errors import ParameterError, ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ParameterError, ProblemError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.petsc_vec import petsc_vec, petsc_vec_imex # noinspection PyUnusedLocal -class heat2d_petsc_forced(ptype): +class heat2d_petsc_forced(Problem): r""" Example implementing the forced two-dimensional heat equation with Dirichlet boundary conditions :math:`(x, y) \in [0,1]^2` diff --git a/pySDC/implementations/problem_classes/HeatEquation_ND_FD_CuPy.py b/pySDC/implementations/problem_classes/HeatEquation_ND_FD_CuPy.py index c4e5702ecd..d94ab7f583 100644 --- a/pySDC/implementations/problem_classes/HeatEquation_ND_FD_CuPy.py +++ b/pySDC/implementations/problem_classes/HeatEquation_ND_FD_CuPy.py @@ -3,13 +3,13 @@ import cupyx.scipy.sparse as csp from cupyx.scipy.sparse.linalg import spsolve, cg # , gmres, minres -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem from pySDC.helpers import problem_helper from pySDC.implementations.datatype_classes.cupy_mesh import cupy_mesh, imex_cupy_mesh -class heatNd_forced(ptype): # pragma: no cover +class heatNd_forced(Problem): # pragma: no cover r""" This class implements the unforced :math:`N`-dimensional heat equation with periodic boundary conditions diff --git a/pySDC/implementations/problem_classes/HenonHeiles.py b/pySDC/implementations/problem_classes/HenonHeiles.py index c3f2067ba8..2262784406 100644 --- a/pySDC/implementations/problem_classes/HenonHeiles.py +++ b/pySDC/implementations/problem_classes/HenonHeiles.py @@ -1,11 +1,11 @@ import numpy as np -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.particles import particles, acceleration # noinspection PyUnusedLocal -class henon_heiles(ptype): +class henon_heiles(Problem): r""" This class implements the second-order Hénon-Heiles system diff --git a/pySDC/implementations/problem_classes/LogisticEquation.py b/pySDC/implementations/problem_classes/LogisticEquation.py index 2ab0710167..29ce99462e 100755 --- a/pySDC/implementations/problem_classes/LogisticEquation.py +++ b/pySDC/implementations/problem_classes/LogisticEquation.py @@ -1,12 +1,12 @@ import numpy as np -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh # noinspection PyUnusedLocal -class logistics_equation(ptype): +class logistics_equation(Problem): r""" Problem implementing a specific form of the Logistic Differential Equation diff --git a/pySDC/implementations/problem_classes/Lorenz.py b/pySDC/implementations/problem_classes/Lorenz.py index dbd5260a7e..836a143f35 100644 --- a/pySDC/implementations/problem_classes/Lorenz.py +++ b/pySDC/implementations/problem_classes/Lorenz.py @@ -1,10 +1,10 @@ import numpy as np -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.mesh import mesh -from pySDC.core.Errors import ConvergenceError +from pySDC.core.errors import ConvergenceError -class LorenzAttractor(ptype): +class LorenzAttractor(Problem): r""" Simple script to run a Lorenz attractor problem. diff --git a/pySDC/implementations/problem_classes/NonlinearSchroedinger_MPIFFT.py b/pySDC/implementations/problem_classes/NonlinearSchroedinger_MPIFFT.py index 70c628ec1a..b071f35364 100644 --- a/pySDC/implementations/problem_classes/NonlinearSchroedinger_MPIFFT.py +++ b/pySDC/implementations/problem_classes/NonlinearSchroedinger_MPIFFT.py @@ -2,8 +2,8 @@ from scipy.optimize import newton_krylov from scipy.optimize.nonlin import NoConvergence -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import WorkCounter +from pySDC.core.errors import ProblemError +from pySDC.core.problem import WorkCounter from pySDC.implementations.problem_classes.generic_MPIFFT_Laplacian import IMEX_Laplacian_MPIFFT from pySDC.implementations.datatype_classes.mesh import mesh diff --git a/pySDC/implementations/problem_classes/OuterSolarSystem.py b/pySDC/implementations/problem_classes/OuterSolarSystem.py index 0bb3adc8ec..406b235580 100644 --- a/pySDC/implementations/problem_classes/OuterSolarSystem.py +++ b/pySDC/implementations/problem_classes/OuterSolarSystem.py @@ -1,11 +1,11 @@ import numpy as np -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.particles import particles, acceleration # noinspection PyUnusedLocal -class outer_solar_system(ptype): +class outer_solar_system(Problem): r""" The :math:`N`-body problem describes the mutual influence of the motion of :math:`N` bodies. Formulation of the problem is based on Newton's second law. Therefore, the :math:`N`-body problem is formulated as diff --git a/pySDC/implementations/problem_classes/PenningTrap_3D.py b/pySDC/implementations/problem_classes/PenningTrap_3D.py index 49601606de..05f1aa0986 100644 --- a/pySDC/implementations/problem_classes/PenningTrap_3D.py +++ b/pySDC/implementations/problem_classes/PenningTrap_3D.py @@ -1,13 +1,13 @@ import numpy as np from numba import jit -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.particles import particles, fields, acceleration # noinspection PyUnusedLocal -class penningtrap(ptype): +class penningtrap(Problem): r""" This class implements a standard Penning trap problem on the time interval :math:`[0, t_{end}]` fully investigated in [1]_. The equations are given by the following equation of motion diff --git a/pySDC/implementations/problem_classes/Piline.py b/pySDC/implementations/problem_classes/Piline.py index 28f682f6dd..310d7e8e1b 100644 --- a/pySDC/implementations/problem_classes/Piline.py +++ b/pySDC/implementations/problem_classes/Piline.py @@ -1,12 +1,12 @@ import numpy as np from scipy.integrate import solve_ivp -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh # noinspection PyUnusedLocal -class piline(ptype): +class piline(Problem): r""" Example implementing the model of the piline. It serves as a transmission line in an energy grid. The problem of simulating the piline consists of three ordinary differential equations (ODEs) with nonhomogeneous part: diff --git a/pySDC/implementations/problem_classes/Quench.py b/pySDC/implementations/problem_classes/Quench.py index 2175d197b6..f841af6df2 100644 --- a/pySDC/implementations/problem_classes/Quench.py +++ b/pySDC/implementations/problem_classes/Quench.py @@ -3,14 +3,14 @@ from scipy.sparse.linalg import spsolve, gmres from scipy.linalg import inv -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.helpers import problem_helper from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh # noinspection PyUnusedLocal -class Quench(ptype): +class Quench(Problem): """ This is a toy problem [1]_ to emulate a magnet that has been cooled to temperatures where superconductivity is possible. However, there is a leak! Some point in the domain is constantly heated and when this has heated up its environment diff --git a/pySDC/implementations/problem_classes/TestEquation_0D.py b/pySDC/implementations/problem_classes/TestEquation_0D.py index 602679911f..811dcf60c0 100644 --- a/pySDC/implementations/problem_classes/TestEquation_0D.py +++ b/pySDC/implementations/problem_classes/TestEquation_0D.py @@ -1,11 +1,11 @@ import numpy as np import scipy.sparse as nsp -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.mesh import mesh -class testequation0d(ptype): +class testequation0d(Problem): r""" This class implements the simple test equation of the form diff --git a/pySDC/implementations/problem_classes/Van_der_Pol_implicit.py b/pySDC/implementations/problem_classes/Van_der_Pol_implicit.py index 14f9f5a019..e6a3230d9b 100755 --- a/pySDC/implementations/problem_classes/Van_der_Pol_implicit.py +++ b/pySDC/implementations/problem_classes/Van_der_Pol_implicit.py @@ -1,12 +1,12 @@ import numpy as np -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.mesh import mesh # noinspection PyUnusedLocal -class vanderpol(ptype): +class vanderpol(Problem): r""" This class implements the stiff Van der Pol oscillator given by the equation diff --git a/pySDC/implementations/problem_classes/VorticityVelocity_2D_FEniCS_periodic.py b/pySDC/implementations/problem_classes/VorticityVelocity_2D_FEniCS_periodic.py index f48f865ec2..b0f70ffac8 100644 --- a/pySDC/implementations/problem_classes/VorticityVelocity_2D_FEniCS_periodic.py +++ b/pySDC/implementations/problem_classes/VorticityVelocity_2D_FEniCS_periodic.py @@ -3,12 +3,12 @@ import dolfin as df import numpy as np -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.fenics_mesh import fenics_mesh, rhs_fenics_mesh # noinspection PyUnusedLocal -class fenics_vortex_2d(ptype): +class fenics_vortex_2d(Problem): r""" This class implements the vorticity-velocity problem in two dimensions with periodic boundary conditions in :math:`[0, 1]^2` diff --git a/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py b/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py index 883494a6bf..215c45336d 100644 --- a/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py +++ b/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py @@ -2,14 +2,14 @@ from mpi4py import MPI from mpi4py_fft import PFFT -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh from mpi4py_fft import newDistArray -class IMEX_Laplacian_MPIFFT(ptype): +class IMEX_Laplacian_MPIFFT(Problem): r""" Generic base class for IMEX problems using a spectral method to solve the Laplacian implicitly and a possible rest explicitly. The FFTs are done with``mpi4py-fft`` [1]_. diff --git a/pySDC/implementations/problem_classes/generic_ND_FD.py b/pySDC/implementations/problem_classes/generic_ND_FD.py index fedf571dd8..8b22635069 100644 --- a/pySDC/implementations/problem_classes/generic_ND_FD.py +++ b/pySDC/implementations/problem_classes/generic_ND_FD.py @@ -7,13 +7,13 @@ import scipy.sparse as sp from scipy.sparse.linalg import gmres, spsolve, cg -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.helpers import problem_helper from pySDC.implementations.datatype_classes.mesh import mesh -class GenericNDimFinDiff(ptype): +class GenericNDimFinDiff(Problem): r""" Base class for finite difference spatial discretisation in :math:`N` dimensions diff --git a/pySDC/implementations/problem_classes/nonlinear_ODE_1.py b/pySDC/implementations/problem_classes/nonlinear_ODE_1.py index 3bb0d01208..ccb9fcd721 100755 --- a/pySDC/implementations/problem_classes/nonlinear_ODE_1.py +++ b/pySDC/implementations/problem_classes/nonlinear_ODE_1.py @@ -1,12 +1,12 @@ import numpy as np -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh # noinspection PyUnusedLocal -class nonlinear_ODE_1(ptype): +class nonlinear_ODE_1(Problem): r""" This class implements a simple nonlinear ODE with a singularity in the derivative, taken from https://www.osti.gov/servlets/purl/6111421 (Problem E-4). For :math:`0 \leq t \leq 5`, the problem is diff --git a/pySDC/implementations/problem_classes/odeScalar.py b/pySDC/implementations/problem_classes/odeScalar.py index 7463f59f3f..ff2f5b2f6b 100644 --- a/pySDC/implementations/problem_classes/odeScalar.py +++ b/pySDC/implementations/problem_classes/odeScalar.py @@ -12,12 +12,12 @@ """ import numpy as np -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.mesh import mesh -class ProtheroRobinson(ptype): +class ProtheroRobinson(Problem): r""" Implement the Prothero-Robinson problem: diff --git a/pySDC/implementations/problem_classes/odeSystem.py b/pySDC/implementations/problem_classes/odeSystem.py index 1c5127ea2d..a17393ede6 100644 --- a/pySDC/implementations/problem_classes/odeSystem.py +++ b/pySDC/implementations/problem_classes/odeSystem.py @@ -12,12 +12,12 @@ """ import numpy as np -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.implementations.datatype_classes.mesh import mesh -class ProtheroRobinsonAutonomous(ptype): +class ProtheroRobinsonAutonomous(Problem): r""" Implement the Prothero-Robinson problem into autonomous form: @@ -235,7 +235,7 @@ def solve_system(self, rhs, dt, u0, t): return u -class Kaps(ptype): +class Kaps(Problem): r""" Implement the Kaps problem: @@ -390,7 +390,7 @@ def solve_system(self, rhs, dt, u0, t): return u -class ChemicalReaction3Var(ptype): +class ChemicalReaction3Var(Problem): r""" Chemical reaction with three components, modeled by the non-linear system: @@ -741,7 +741,7 @@ def solve_system(self, rhs, dt, u0, t): return u -class JacobiElliptic(ptype): +class JacobiElliptic(Problem): r""" Implement the Jacobi Elliptic non-linear problem: diff --git a/pySDC/implementations/problem_classes/polynomial_test_problem.py b/pySDC/implementations/problem_classes/polynomial_test_problem.py index 4d813630f4..cc7cada8a8 100644 --- a/pySDC/implementations/problem_classes/polynomial_test_problem.py +++ b/pySDC/implementations/problem_classes/polynomial_test_problem.py @@ -1,10 +1,10 @@ import numpy as np -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh -class polynomial_testequation(ptype): +class polynomial_testequation(Problem): """ Dummy problem for tests only! In particular, the `solve_system` function just returns the exact solution instead of solving an appropriate system. This class is indented to be used for tests of operations that are exact on polynomials. diff --git a/pySDC/implementations/sweeper_classes/Multistep.py b/pySDC/implementations/sweeper_classes/Multistep.py index 31af685e8a..1a4de3f6ec 100644 --- a/pySDC/implementations/sweeper_classes/Multistep.py +++ b/pySDC/implementations/sweeper_classes/Multistep.py @@ -1,4 +1,4 @@ -from pySDC.core.Sweeper import sweeper, _Pars +from pySDC.core.sweeper import Sweeper, _Pars class Cache(object): @@ -51,7 +51,7 @@ def __str__(self): return string -class MultiStep(sweeper): +class MultiStep(Sweeper): alpha = None beta = None @@ -73,7 +73,7 @@ def __init__(self, params): params (dict): parameter object """ import logging - from pySDC.core.Collocation import CollBase + from pySDC.core.collocation import CollBase # set up logger self.logger = logging.getLogger('sweeper') diff --git a/pySDC/implementations/sweeper_classes/Runge_Kutta.py b/pySDC/implementations/sweeper_classes/Runge_Kutta.py index 3993d8d794..ac9f9d39a1 100644 --- a/pySDC/implementations/sweeper_classes/Runge_Kutta.py +++ b/pySDC/implementations/sweeper_classes/Runge_Kutta.py @@ -2,9 +2,9 @@ import logging from qmat.qcoeff.butcher import RK_SCHEMES -from pySDC.core.Sweeper import sweeper, _Pars -from pySDC.core.Errors import ParameterError -from pySDC.core.Level import level +from pySDC.core.sweeper import Sweeper, _Pars +from pySDC.core.errors import ParameterError +from pySDC.core.level import Level class ButcherTableau(object): @@ -122,7 +122,7 @@ def __init__(self, weights, nodes, matrix): self.implicit = any(matrix[i, i] != 0 for i in range(self.num_nodes - self.num_solution_stages)) -class RungeKutta(sweeper): +class RungeKutta(Sweeper): nodes = None weights = None matrix = None @@ -317,7 +317,7 @@ def level(self, lvl): Args: lvl (pySDC.Level.level): Current level """ - assert isinstance(lvl, level), f"You tried to set the sweeper's level with an instance of {type(lvl)}!" + assert isinstance(lvl, Level), f"You tried to set the sweeper's level with an instance of {type(lvl)}!" if lvl.params.restol > 0: lvl.params.restol = -1 self.logger.warning( diff --git a/pySDC/implementations/sweeper_classes/Runge_Kutta_Nystrom.py b/pySDC/implementations/sweeper_classes/Runge_Kutta_Nystrom.py index 6addc86672..7837c1f348 100644 --- a/pySDC/implementations/sweeper_classes/Runge_Kutta_Nystrom.py +++ b/pySDC/implementations/sweeper_classes/Runge_Kutta_Nystrom.py @@ -1,8 +1,8 @@ import numpy as np import logging -from pySDC.core.Sweeper import sweeper, _Pars -from pySDC.core.Errors import ParameterError +from pySDC.core.sweeper import Sweeper, _Pars +from pySDC.core.errors import ParameterError from pySDC.implementations.datatype_classes.particles import particles, fields, acceleration from pySDC.implementations.sweeper_classes.Runge_Kutta import ButcherTableau from copy import deepcopy diff --git a/pySDC/implementations/sweeper_classes/boris_2nd_order.py b/pySDC/implementations/sweeper_classes/boris_2nd_order.py index 9264716828..1ff5c2471c 100644 --- a/pySDC/implementations/sweeper_classes/boris_2nd_order.py +++ b/pySDC/implementations/sweeper_classes/boris_2nd_order.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Sweeper import sweeper +from pySDC.core.sweeper import Sweeper -class boris_2nd_order(sweeper): +class boris_2nd_order(Sweeper): """ Custom sweeper class, implements Sweeper.py diff --git a/pySDC/implementations/sweeper_classes/explicit.py b/pySDC/implementations/sweeper_classes/explicit.py index 751eb8272f..a69910d8c5 100644 --- a/pySDC/implementations/sweeper_classes/explicit.py +++ b/pySDC/implementations/sweeper_classes/explicit.py @@ -1,7 +1,7 @@ -from pySDC.core.Sweeper import sweeper +from pySDC.core.sweeper import Sweeper -class explicit(sweeper): +class explicit(Sweeper): """ Custom sweeper class, implements Sweeper.py diff --git a/pySDC/implementations/sweeper_classes/generic_implicit.py b/pySDC/implementations/sweeper_classes/generic_implicit.py index a17466dedc..6263a9ad76 100644 --- a/pySDC/implementations/sweeper_classes/generic_implicit.py +++ b/pySDC/implementations/sweeper_classes/generic_implicit.py @@ -1,7 +1,7 @@ -from pySDC.core.Sweeper import sweeper +from pySDC.core.sweeper import Sweeper -class generic_implicit(sweeper): +class generic_implicit(Sweeper): """ Generic implicit sweeper, expecting lower triangular matrix type as input diff --git a/pySDC/implementations/sweeper_classes/generic_implicit_MPI.py b/pySDC/implementations/sweeper_classes/generic_implicit_MPI.py index c79f7202eb..c045463fd5 100644 --- a/pySDC/implementations/sweeper_classes/generic_implicit_MPI.py +++ b/pySDC/implementations/sweeper_classes/generic_implicit_MPI.py @@ -1,11 +1,11 @@ from mpi4py import MPI from pySDC.implementations.sweeper_classes.generic_implicit import generic_implicit -from pySDC.core.Sweeper import sweeper, ParameterError +from pySDC.core.sweeper import Sweeper, ParameterError import logging -class SweeperMPI(sweeper): +class SweeperMPI(Sweeper): """ MPI based sweeper where each rank administers one collocation node. Adapt sweepers to MPI by use of multiple inheritance. See for example the `generic_implicit_MPI` sweeper, which has a class definition: diff --git a/pySDC/implementations/sweeper_classes/imex_1st_order.py b/pySDC/implementations/sweeper_classes/imex_1st_order.py index 04c06f0472..12600c64d7 100644 --- a/pySDC/implementations/sweeper_classes/imex_1st_order.py +++ b/pySDC/implementations/sweeper_classes/imex_1st_order.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Sweeper import sweeper +from pySDC.core.sweeper import Sweeper -class imex_1st_order(sweeper): +class imex_1st_order(Sweeper): """ Custom sweeper class, implements Sweeper.py diff --git a/pySDC/implementations/sweeper_classes/multi_implicit.py b/pySDC/implementations/sweeper_classes/multi_implicit.py index 22cd2c6567..807e34425c 100644 --- a/pySDC/implementations/sweeper_classes/multi_implicit.py +++ b/pySDC/implementations/sweeper_classes/multi_implicit.py @@ -1,7 +1,7 @@ -from pySDC.core.Sweeper import sweeper +from pySDC.core.sweeper import Sweeper -class multi_implicit(sweeper): +class multi_implicit(Sweeper): """ Custom sweeper class, implements Sweeper.py diff --git a/pySDC/implementations/sweeper_classes/verlet.py b/pySDC/implementations/sweeper_classes/verlet.py index 83d17fc8b6..da014dbb9a 100644 --- a/pySDC/implementations/sweeper_classes/verlet.py +++ b/pySDC/implementations/sweeper_classes/verlet.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Sweeper import sweeper +from pySDC.core.sweeper import Sweeper -class verlet(sweeper): +class verlet(Sweeper): """ Custom sweeper class, implements Sweeper.py diff --git a/pySDC/implementations/transfer_classes/BaseTransferMPI.py b/pySDC/implementations/transfer_classes/BaseTransferMPI.py index 2dae942a50..57794ffbc5 100644 --- a/pySDC/implementations/transfer_classes/BaseTransferMPI.py +++ b/pySDC/implementations/transfer_classes/BaseTransferMPI.py @@ -1,10 +1,10 @@ from mpi4py import MPI -from pySDC.core.Errors import UnlockError -from pySDC.core.BaseTransfer import base_transfer +from pySDC.core.errors import UnlockError +from pySDC.core.base_transfer import BaseTransfer -class base_transfer_MPI(base_transfer): +class base_transfer_MPI(BaseTransfer): """ Standard base_transfer class diff --git a/pySDC/implementations/transfer_classes/BaseTransfer_mass.py b/pySDC/implementations/transfer_classes/BaseTransfer_mass.py index 522ff2ddf0..ce048af843 100644 --- a/pySDC/implementations/transfer_classes/BaseTransfer_mass.py +++ b/pySDC/implementations/transfer_classes/BaseTransfer_mass.py @@ -1,8 +1,8 @@ -from pySDC.core.BaseTransfer import base_transfer -from pySDC.core.Errors import UnlockError +from pySDC.core.base_transfer import BaseTransfer +from pySDC.core.errors import UnlockError -class base_transfer_mass(base_transfer): +class base_transfer_mass(BaseTransfer): """ Standard base_transfer class diff --git a/pySDC/implementations/transfer_classes/TransferFenicsMesh.py b/pySDC/implementations/transfer_classes/TransferFenicsMesh.py index b85153d03e..4a0e46fc4b 100644 --- a/pySDC/implementations/transfer_classes/TransferFenicsMesh.py +++ b/pySDC/implementations/transfer_classes/TransferFenicsMesh.py @@ -1,11 +1,11 @@ import dolfin as df -from pySDC.core.Errors import TransferError -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.errors import TransferError +from pySDC.core.space_transfer import SpaceTransfer from pySDC.implementations.datatype_classes.fenics_mesh import fenics_mesh, rhs_fenics_mesh -class mesh_to_mesh_fenics(space_transfer): +class mesh_to_mesh_fenics(SpaceTransfer): """ This implementation can restrict and prolong between fenics meshes """ diff --git a/pySDC/implementations/transfer_classes/TransferMesh.py b/pySDC/implementations/transfer_classes/TransferMesh.py index 6f89c70e7f..43e77c11d3 100644 --- a/pySDC/implementations/transfer_classes/TransferMesh.py +++ b/pySDC/implementations/transfer_classes/TransferMesh.py @@ -2,11 +2,11 @@ import scipy.sparse as sp import pySDC.helpers.transfer_helper as th -from pySDC.core.Errors import TransferError -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.errors import TransferError +from pySDC.core.space_transfer import SpaceTransfer -class mesh_to_mesh(space_transfer): +class mesh_to_mesh(SpaceTransfer): """ Custom base_transfer class, implements Transfer.py diff --git a/pySDC/implementations/transfer_classes/TransferMesh_FFT.py b/pySDC/implementations/transfer_classes/TransferMesh_FFT.py index 2664a063a6..1a0aa8a5b4 100644 --- a/pySDC/implementations/transfer_classes/TransferMesh_FFT.py +++ b/pySDC/implementations/transfer_classes/TransferMesh_FFT.py @@ -1,10 +1,10 @@ import numpy as np -from pySDC.core.Errors import TransferError -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.errors import TransferError +from pySDC.core.space_transfer import SpaceTransfer -class mesh_to_mesh_fft(space_transfer): +class mesh_to_mesh_fft(SpaceTransfer): """ Custom base_transfer class, implements Transfer.py diff --git a/pySDC/implementations/transfer_classes/TransferMesh_FFT2D.py b/pySDC/implementations/transfer_classes/TransferMesh_FFT2D.py index 5bcb7052f1..82029a9d31 100644 --- a/pySDC/implementations/transfer_classes/TransferMesh_FFT2D.py +++ b/pySDC/implementations/transfer_classes/TransferMesh_FFT2D.py @@ -1,11 +1,11 @@ import numpy as np -from pySDC.core.Errors import TransferError -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.errors import TransferError +from pySDC.core.space_transfer import SpaceTransfer from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh -class mesh_to_mesh_fft2d(space_transfer): +class mesh_to_mesh_fft2d(SpaceTransfer): """ Custon base_transfer class, implements Transfer.py diff --git a/pySDC/implementations/transfer_classes/TransferMesh_MPIFFT.py b/pySDC/implementations/transfer_classes/TransferMesh_MPIFFT.py index 4593702171..907b826cdd 100644 --- a/pySDC/implementations/transfer_classes/TransferMesh_MPIFFT.py +++ b/pySDC/implementations/transfer_classes/TransferMesh_MPIFFT.py @@ -1,9 +1,9 @@ -from pySDC.core.Errors import TransferError -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.errors import TransferError +from pySDC.core.space_transfer import SpaceTransfer from mpi4py_fft import PFFT, newDistArray -class fft_to_fft(space_transfer): +class fft_to_fft(SpaceTransfer): """ Custom base_transfer class, implements Transfer.py diff --git a/pySDC/implementations/transfer_classes/TransferMesh_NoCoarse.py b/pySDC/implementations/transfer_classes/TransferMesh_NoCoarse.py index 5d4d6fc31e..3fa698229f 100644 --- a/pySDC/implementations/transfer_classes/TransferMesh_NoCoarse.py +++ b/pySDC/implementations/transfer_classes/TransferMesh_NoCoarse.py @@ -1,9 +1,9 @@ -from pySDC.core.Errors import TransferError -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.errors import TransferError +from pySDC.core.space_transfer import SpaceTransfer from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh -class mesh_to_mesh(space_transfer): +class mesh_to_mesh(SpaceTransfer): """ Custon base_transfer class, implements Transfer.py diff --git a/pySDC/implementations/transfer_classes/TransferPETScDMDA.py b/pySDC/implementations/transfer_classes/TransferPETScDMDA.py index d3ab954e0e..496f6c6157 100644 --- a/pySDC/implementations/transfer_classes/TransferPETScDMDA.py +++ b/pySDC/implementations/transfer_classes/TransferPETScDMDA.py @@ -1,9 +1,9 @@ -from pySDC.core.Errors import TransferError -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.errors import TransferError +from pySDC.core.space_transfer import SpaceTransfer from pySDC.implementations.datatype_classes.petsc_vec import petsc_vec, petsc_vec_imex, petsc_vec_comp2 -class mesh_to_mesh_petsc_dmda(space_transfer): +class mesh_to_mesh_petsc_dmda(SpaceTransfer): """ This implementation can restrict and prolong between PETSc DMDA grids """ diff --git a/pySDC/implementations/transfer_classes/TransferParticles_NoCoarse.py b/pySDC/implementations/transfer_classes/TransferParticles_NoCoarse.py index 897ac98e70..503f758035 100644 --- a/pySDC/implementations/transfer_classes/TransferParticles_NoCoarse.py +++ b/pySDC/implementations/transfer_classes/TransferParticles_NoCoarse.py @@ -1,9 +1,9 @@ -from pySDC.core.Errors import TransferError -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.errors import TransferError +from pySDC.core.space_transfer import SpaceTransfer from pySDC.implementations.datatype_classes.particles import particles, fields, acceleration -class particles_to_particles(space_transfer): +class particles_to_particles(SpaceTransfer): """ Custon transfer class, implements SpaceTransfer.py diff --git a/pySDC/playgrounds/Allen_Cahn/AllenCahn_monitor.py b/pySDC/playgrounds/Allen_Cahn/AllenCahn_monitor.py index a4882fb7f8..211c6bb9b4 100644 --- a/pySDC/playgrounds/Allen_Cahn/AllenCahn_monitor.py +++ b/pySDC/playgrounds/Allen_Cahn/AllenCahn_monitor.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor(hooks): +class monitor(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/playgrounds/Allen_Cahn/AllenCahn_monitor_Bayreuth.py b/pySDC/playgrounds/Allen_Cahn/AllenCahn_monitor_Bayreuth.py index 69aace686d..f9a63626e7 100644 --- a/pySDC/playgrounds/Allen_Cahn/AllenCahn_monitor_Bayreuth.py +++ b/pySDC/playgrounds/Allen_Cahn/AllenCahn_monitor_Bayreuth.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor(hooks): +class monitor(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/playgrounds/Allen_Cahn/AllenCahn_output.py b/pySDC/playgrounds/Allen_Cahn/AllenCahn_output.py index c752078103..4777074f43 100644 --- a/pySDC/playgrounds/Allen_Cahn/AllenCahn_output.py +++ b/pySDC/playgrounds/Allen_Cahn/AllenCahn_output.py @@ -1,8 +1,8 @@ import pySDC.helpers.plot_helper as plt_helper -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class output(hooks): +class output(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/playgrounds/Boris/penningtrap_HookClass.py b/pySDC/playgrounds/Boris/penningtrap_HookClass.py index e8878358a3..6db0a7cddc 100644 --- a/pySDC/playgrounds/Boris/penningtrap_HookClass.py +++ b/pySDC/playgrounds/Boris/penningtrap_HookClass.py @@ -3,10 +3,10 @@ # import progressbar -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class particles_output(hooks): +class particles_output(Hooks): def __init__(self): """ Initialization of particles output diff --git a/pySDC/playgrounds/Boris/spiraling_particle_HookClass.py b/pySDC/playgrounds/Boris/spiraling_particle_HookClass.py index 6446828103..452257839c 100644 --- a/pySDC/playgrounds/Boris/spiraling_particle_HookClass.py +++ b/pySDC/playgrounds/Boris/spiraling_particle_HookClass.py @@ -2,10 +2,10 @@ # import progressbar -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class particles_output(hooks): +class particles_output(Hooks): def __init__(self): """ Initialization of particles output diff --git a/pySDC/playgrounds/Boris/spiraling_particle_ProblemClass.py b/pySDC/playgrounds/Boris/spiraling_particle_ProblemClass.py index 152df0df14..b301678253 100644 --- a/pySDC/playgrounds/Boris/spiraling_particle_ProblemClass.py +++ b/pySDC/playgrounds/Boris/spiraling_particle_ProblemClass.py @@ -1,10 +1,10 @@ import numpy as np -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.particles import particles, fields, acceleration -class planewave_single(ptype): +class planewave_single(Problem): """ Example implementing a single particle spiraling in a trap """ diff --git a/pySDC/playgrounds/FEniCS/HookClass_FEniCS_output.py b/pySDC/playgrounds/FEniCS/HookClass_FEniCS_output.py index 20079a01fa..7f32a27b4e 100644 --- a/pySDC/playgrounds/FEniCS/HookClass_FEniCS_output.py +++ b/pySDC/playgrounds/FEniCS/HookClass_FEniCS_output.py @@ -1,11 +1,11 @@ import dolfin as df -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks file = df.File('output1d/grayscott.pvd') # dirty, but this has to be unique (and not per step or level) -class fenics_output(hooks): +class fenics_output(Hooks): """ Hook class to add output to FEniCS runs """ diff --git a/pySDC/playgrounds/FEniCS/fenics_sdc.py b/pySDC/playgrounds/FEniCS/fenics_sdc.py index b5b8fceb8c..b6a0d69f08 100644 --- a/pySDC/playgrounds/FEniCS/fenics_sdc.py +++ b/pySDC/playgrounds/FEniCS/fenics_sdc.py @@ -1,7 +1,7 @@ import dolfin as df import numpy as np -from pySDC.core.Collocation import CollBase -from pySDC.core.Sweeper import sweeper as Sweeper +from pySDC.core.collocation import CollBase +from pySDC.core.sweeper import Sweeper as Sweeper c_nvars = 128 refinements = 1 diff --git a/pySDC/playgrounds/FEniCSx/HeatEquation_1D_FEniCSx_matrix_forced.py b/pySDC/playgrounds/FEniCSx/HeatEquation_1D_FEniCSx_matrix_forced.py index c8ed02ff3c..724b6a2fd4 100644 --- a/pySDC/playgrounds/FEniCSx/HeatEquation_1D_FEniCSx_matrix_forced.py +++ b/pySDC/playgrounds/FEniCSx/HeatEquation_1D_FEniCSx_matrix_forced.py @@ -9,12 +9,12 @@ import numpy as np -from pySDC.core.Errors import ParameterError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ParameterError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh # noinspection PyUnusedLocal -class fenicsx_heat(ptype): +class fenicsx_heat(Problem): """ Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] diff --git a/pySDC/playgrounds/FEniCSx/HeatEquation_1D_FEniCSx_matrix_forced_2.py b/pySDC/playgrounds/FEniCSx/HeatEquation_1D_FEniCSx_matrix_forced_2.py index 8532928a92..4dba3609f1 100644 --- a/pySDC/playgrounds/FEniCSx/HeatEquation_1D_FEniCSx_matrix_forced_2.py +++ b/pySDC/playgrounds/FEniCSx/HeatEquation_1D_FEniCSx_matrix_forced_2.py @@ -6,12 +6,12 @@ import ufl import numpy as np -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh # noinspection PyUnusedLocal -class fenicsx_heat_mass(ptype): +class fenicsx_heat_mass(Problem): r""" Example implementing the forced one-dimensional heat equation with Dirichlet boundary conditions diff --git a/pySDC/playgrounds/FEniCSx/HookClass_FEniCS_output.py b/pySDC/playgrounds/FEniCSx/HookClass_FEniCS_output.py index 0b820c8641..074fceb3cc 100644 --- a/pySDC/playgrounds/FEniCSx/HookClass_FEniCS_output.py +++ b/pySDC/playgrounds/FEniCSx/HookClass_FEniCS_output.py @@ -1,11 +1,11 @@ # import dolfin as df -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks # file = df.File('output1d/grayscott.pvd') # dirty, but this has to be unique (and not per step or level) -class fenics_output(hooks): +class fenics_output(Hooks): """ Hook class to add output to FEniCS runs """ diff --git a/pySDC/playgrounds/Gander/HookClass_error_output.py b/pySDC/playgrounds/Gander/HookClass_error_output.py index a7c03aaf1c..76fa83845f 100644 --- a/pySDC/playgrounds/Gander/HookClass_error_output.py +++ b/pySDC/playgrounds/Gander/HookClass_error_output.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class error_output(hooks): +class error_output(Hooks): """ Hook class to add output of error """ diff --git a/pySDC/playgrounds/Gander/matrix_based.py b/pySDC/playgrounds/Gander/matrix_based.py index 76358c06d7..3f5f8e0048 100644 --- a/pySDC/playgrounds/Gander/matrix_based.py +++ b/pySDC/playgrounds/Gander/matrix_based.py @@ -1,4 +1,4 @@ -from pySDC.core.Sweeper import sweeper +from pySDC.core.sweeper import Sweeper import numpy as np import matplotlib.pyplot as plt @@ -7,7 +7,7 @@ def iteration_vs_estimate(): M = 5 K = 10 - swee = sweeper({'collocation_class': CollGaussRadau_Right, 'num_nodes': M}) + swee = Sweeper({'collocation_class': CollGaussRadau_Right, 'num_nodes': M}) Q = swee.coll.Qmat[1:, 1:] Qd = swee.get_Qdelta_implicit('IE')[1:, 1:] # Qd = swee.get_Qdelta_implicit('LU')[1:, 1:] @@ -65,7 +65,7 @@ def iteration_vs_estimate(): def estimates_over_lambda(): M = 5 K = 10 - swee = sweeper({'collocation_class': CollGaussRadau_Right, 'num_nodes': M}) + swee = Sweeper({'collocation_class': CollGaussRadau_Right, 'num_nodes': M}) Q = swee.coll.Qmat[1:, 1:] # Qd = swee.get_Qdelta_implicit('IE')[1:, 1:] Qd = swee.get_Qdelta_implicit('LU')[1:, 1:] diff --git a/pySDC/playgrounds/HeatEquation/HookClass_error_output.py b/pySDC/playgrounds/HeatEquation/HookClass_error_output.py index 644d493b1f..748d667357 100644 --- a/pySDC/playgrounds/HeatEquation/HookClass_error_output.py +++ b/pySDC/playgrounds/HeatEquation/HookClass_error_output.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class error_output(hooks): +class error_output(Hooks): """ Hook class to add output of error """ diff --git a/pySDC/playgrounds/ML_initial_guess/heat.py b/pySDC/playgrounds/ML_initial_guess/heat.py index a6661b922a..ec11bac776 100644 --- a/pySDC/playgrounds/ML_initial_guess/heat.py +++ b/pySDC/playgrounds/ML_initial_guess/heat.py @@ -2,8 +2,8 @@ import scipy.sparse as sp from scipy.sparse.linalg import gmres, spsolve, cg import torch -from pySDC.core.Errors import ProblemError -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.errors import ProblemError +from pySDC.core.problem import Problem, WorkCounter from pySDC.helpers import problem_helper from pySDC.implementations.datatype_classes.mesh import mesh from pySDC.playgrounds.ML_initial_guess.tensor import Tensor @@ -13,7 +13,7 @@ from pySDC.playgrounds.ML_initial_guess.ml_heat import HeatEquationModel -class Heat1DFDTensor(ptype): +class Heat1DFDTensor(Problem): """ Very simple 1-dimensional finite differences implementation of a heat equation using the pySDC-PyTorch interface. Still includes some mess. diff --git a/pySDC/playgrounds/ODEs/trajectory_HookClass.py b/pySDC/playgrounds/ODEs/trajectory_HookClass.py index bab054620b..030838fc84 100644 --- a/pySDC/playgrounds/ODEs/trajectory_HookClass.py +++ b/pySDC/playgrounds/ODEs/trajectory_HookClass.py @@ -2,10 +2,10 @@ # import progressbar -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class trajectories(hooks): +class trajectories(Hooks): def __init__(self): """ Initialization of particles output diff --git a/pySDC/playgrounds/PinT_Workshop_2017/my_HookClass.py b/pySDC/playgrounds/PinT_Workshop_2017/my_HookClass.py index 70b9390116..4104580e9f 100644 --- a/pySDC/playgrounds/PinT_Workshop_2017/my_HookClass.py +++ b/pySDC/playgrounds/PinT_Workshop_2017/my_HookClass.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class error_output(hooks): +class error_output(Hooks): """ Hook class to add output of error """ diff --git a/pySDC/playgrounds/VSDC/hamiltonian_and_energy_output.py b/pySDC/playgrounds/VSDC/hamiltonian_and_energy_output.py index 177e7039a0..6bbdc6535b 100644 --- a/pySDC/playgrounds/VSDC/hamiltonian_and_energy_output.py +++ b/pySDC/playgrounds/VSDC/hamiltonian_and_energy_output.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class hamiltonian_and_energy_output(hooks): +class hamiltonian_and_energy_output(Hooks): def __init__(self): """ Initialization of particles output diff --git a/pySDC/playgrounds/VSDC/hamiltonian_output.py b/pySDC/playgrounds/VSDC/hamiltonian_output.py index 5312f047e5..57d7986598 100644 --- a/pySDC/playgrounds/VSDC/hamiltonian_output.py +++ b/pySDC/playgrounds/VSDC/hamiltonian_output.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class hamiltonian_output(hooks): +class hamiltonian_output(Hooks): def __init__(self): """ Initialization of particles output diff --git a/pySDC/playgrounds/compression/HookClass_error_output.py b/pySDC/playgrounds/compression/HookClass_error_output.py index 1413f5c3a8..71e2c27cc8 100644 --- a/pySDC/playgrounds/compression/HookClass_error_output.py +++ b/pySDC/playgrounds/compression/HookClass_error_output.py @@ -1,8 +1,8 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI -class error_output(hooks): +class error_output(Hooks): """ Hook class to add output of error """ diff --git a/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus.py b/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus.py index cb5afe778d..428b49e9ad 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus.py +++ b/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus.py @@ -2,13 +2,13 @@ from dedalus import public as de -from pySDC.core.Problem import ptype -from pySDC.core.Errors import ParameterError +from pySDC.core.problem import Problem +from pySDC.core.errors import ParameterError from pySDC.playgrounds.Dedalus.dedalus_field import dedalus_field, rhs_imex_dedalus_field -class allencahn2d_dedalus(ptype): +class allencahn2d_dedalus(Problem): """ Example implementing the 2D Allen-Cahn equation with periodic BC in [-L/2,L/2]^2, discretized using Dedalus """ diff --git a/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus_multiple.py b/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus_multiple.py index cb5afe778d..428b49e9ad 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus_multiple.py +++ b/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus_multiple.py @@ -2,13 +2,13 @@ from dedalus import public as de -from pySDC.core.Problem import ptype -from pySDC.core.Errors import ParameterError +from pySDC.core.problem import Problem +from pySDC.core.errors import ParameterError from pySDC.playgrounds.Dedalus.dedalus_field import dedalus_field, rhs_imex_dedalus_field -class allencahn2d_dedalus(ptype): +class allencahn2d_dedalus(Problem): """ Example implementing the 2D Allen-Cahn equation with periodic BC in [-L/2,L/2]^2, discretized using Dedalus """ diff --git a/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus_new.py b/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus_new.py index 2a19333e90..bc31cca124 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus_new.py +++ b/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_2D_Dedalus_new.py @@ -2,13 +2,13 @@ from dedalus import public as de -from pySDC.core.Problem import ptype -from pySDC.core.Errors import ParameterError +from pySDC.core.problem import Problem +from pySDC.core.errors import ParameterError from pySDC.playgrounds.Dedalus.dedalus_field_new import dedalus_field, rhs_imex_dedalus_field -class allencahn2d_dedalus(ptype): +class allencahn2d_dedalus(Problem): """ Example implementing the 2D Allen-Cahn equation with periodic BC in [-L/2,L/2]^2, discretized using Dedalus """ diff --git a/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_monitor.py b/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_monitor.py index 79a4a0e22d..8521d0db06 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_monitor.py +++ b/pySDC/playgrounds/deprecated/Dedalus/AllenCahn_monitor.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor(hooks): +class monitor(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/playgrounds/deprecated/Dedalus/DynamoGP_2D_Dedalus.py b/pySDC/playgrounds/deprecated/Dedalus/DynamoGP_2D_Dedalus.py index f315eada3b..d2dc399bcf 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/DynamoGP_2D_Dedalus.py +++ b/pySDC/playgrounds/deprecated/Dedalus/DynamoGP_2D_Dedalus.py @@ -2,13 +2,13 @@ from dedalus import public as de -from pySDC.core.Problem import ptype -from pySDC.core.Errors import ParameterError +from pySDC.core.problem import Problem +from pySDC.core.errors import ParameterError from pySDC.playgrounds.Dedalus.dedalus_field import dedalus_field, rhs_imex_dedalus_field -class dynamogp_2d_dedalus(ptype): +class dynamogp_2d_dedalus(Problem): """ """ def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): diff --git a/pySDC/playgrounds/deprecated/Dedalus/DynamoGP_2D_Dedalus_NEW.py b/pySDC/playgrounds/deprecated/Dedalus/DynamoGP_2D_Dedalus_NEW.py index 9c5c290c41..3990f3b893 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/DynamoGP_2D_Dedalus_NEW.py +++ b/pySDC/playgrounds/deprecated/Dedalus/DynamoGP_2D_Dedalus_NEW.py @@ -2,13 +2,13 @@ from dedalus import public as de -from pySDC.core.Problem import ptype -from pySDC.core.Errors import ParameterError +from pySDC.core.problem import Problem +from pySDC.core.errors import ParameterError from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh -class dynamogp_2d_dedalus(ptype): +class dynamogp_2d_dedalus(Problem): """ """ def __init__(self, problem_params, dtype_u=mesh, dtype_f=imex_mesh): diff --git a/pySDC/playgrounds/deprecated/Dedalus/Dynamo_2D_Dedalus.py b/pySDC/playgrounds/deprecated/Dedalus/Dynamo_2D_Dedalus.py index 11f28c9899..c39344e0ed 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/Dynamo_2D_Dedalus.py +++ b/pySDC/playgrounds/deprecated/Dedalus/Dynamo_2D_Dedalus.py @@ -2,13 +2,13 @@ from dedalus import public as de -from pySDC.core.Problem import ptype -from pySDC.core.Errors import ParameterError +from pySDC.core.problem import Problem +from pySDC.core.errors import ParameterError from pySDC.playgrounds.Dedalus.dedalus_field import dedalus_field, rhs_imex_dedalus_field -class dynamo_2d_dedalus(ptype): +class dynamo_2d_dedalus(Problem): """ """ def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): diff --git a/pySDC/playgrounds/deprecated/Dedalus/Dynamo_2D_Dedalus_NEW.py b/pySDC/playgrounds/deprecated/Dedalus/Dynamo_2D_Dedalus_NEW.py index 7e59008d3e..6d9c7b08ba 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/Dynamo_2D_Dedalus_NEW.py +++ b/pySDC/playgrounds/deprecated/Dedalus/Dynamo_2D_Dedalus_NEW.py @@ -2,13 +2,13 @@ from dedalus import public as de -from pySDC.core.Problem import ptype -from pySDC.core.Errors import ParameterError +from pySDC.core.problem import Problem +from pySDC.core.errors import ParameterError from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh -class dynamo_2d_dedalus(ptype): +class dynamo_2d_dedalus(Problem): """ """ def __init__(self, problem_params, dtype_u=mesh, dtype_f=imex_mesh): diff --git a/pySDC/playgrounds/deprecated/Dedalus/Dynamo_monitor.py b/pySDC/playgrounds/deprecated/Dedalus/Dynamo_monitor.py index 4b96b3d52b..4a2f00a2e2 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/Dynamo_monitor.py +++ b/pySDC/playgrounds/deprecated/Dedalus/Dynamo_monitor.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor(hooks): +class monitor(Hooks): def pre_run(self, step, level_number): """ Overwrite standard post step hook diff --git a/pySDC/playgrounds/deprecated/Dedalus/HeatEquation_1D_Dedalus_forced.py b/pySDC/playgrounds/deprecated/Dedalus/HeatEquation_1D_Dedalus_forced.py index 360ebc61df..363fd394fb 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/HeatEquation_1D_Dedalus_forced.py +++ b/pySDC/playgrounds/deprecated/Dedalus/HeatEquation_1D_Dedalus_forced.py @@ -2,13 +2,13 @@ from dedalus import public as de -from pySDC.core.Problem import ptype -from pySDC.core.Errors import ParameterError, ProblemError +from pySDC.core.problem import Problem +from pySDC.core.errors import ParameterError, ProblemError from pySDC.playgrounds.Dedalus.dedalus_field import dedalus_field, rhs_imex_dedalus_field -class heat1d_dedalus_forced(ptype): +class heat1d_dedalus_forced(Problem): """ Example implementing the forced 1D heat equation with periodic BC in [0,1], discretized using Dedalus """ diff --git a/pySDC/playgrounds/deprecated/Dedalus/HeatEquation_2D_Dedalus_forced.py b/pySDC/playgrounds/deprecated/Dedalus/HeatEquation_2D_Dedalus_forced.py index af0e991ba9..72637bcb82 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/HeatEquation_2D_Dedalus_forced.py +++ b/pySDC/playgrounds/deprecated/Dedalus/HeatEquation_2D_Dedalus_forced.py @@ -2,13 +2,13 @@ from dedalus import public as de -from pySDC.core.Problem import ptype -from pySDC.core.Errors import ParameterError, ProblemError +from pySDC.core.problem import Problem +from pySDC.core.errors import ParameterError, ProblemError from pySDC.playgrounds.Dedalus.dedalus_field import dedalus_field, rhs_imex_dedalus_field -class heat2d_dedalus_forced(ptype): +class heat2d_dedalus_forced(Problem): """ Example implementing the forced 2D heat equation with periodic BC in [0,1], discretized using Dedalus """ diff --git a/pySDC/playgrounds/deprecated/Dedalus/RayleighBenard_2D_Dedalus.py b/pySDC/playgrounds/deprecated/Dedalus/RayleighBenard_2D_Dedalus.py index f30d431f0f..8ae2785288 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/RayleighBenard_2D_Dedalus.py +++ b/pySDC/playgrounds/deprecated/Dedalus/RayleighBenard_2D_Dedalus.py @@ -2,13 +2,13 @@ from dedalus import public as de -from pySDC.core.Problem import ptype -from pySDC.core.Errors import ParameterError +from pySDC.core.problem import Problem +from pySDC.core.errors import ParameterError from pySDC.playgrounds.Dedalus.dedalus_field import dedalus_field, rhs_imex_dedalus_field -class rayleighbenard_2d_dedalus(ptype): +class rayleighbenard_2d_dedalus(Problem): """ """ def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): diff --git a/pySDC/playgrounds/deprecated/Dedalus/RayleighBenard_monitor.py b/pySDC/playgrounds/deprecated/Dedalus/RayleighBenard_monitor.py index fdc7f2b5b9..877cb5413d 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/RayleighBenard_monitor.py +++ b/pySDC/playgrounds/deprecated/Dedalus/RayleighBenard_monitor.py @@ -2,10 +2,10 @@ import matplotlib.pyplot as plt -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor(hooks): +class monitor(Hooks): def __init__(self): super(monitor, self).__init__() self.imshow = None diff --git a/pySDC/playgrounds/deprecated/Dedalus/TransferDedalusFields.py b/pySDC/playgrounds/deprecated/Dedalus/TransferDedalusFields.py index 8c359dd2c0..f7cfc0b425 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/TransferDedalusFields.py +++ b/pySDC/playgrounds/deprecated/Dedalus/TransferDedalusFields.py @@ -1,12 +1,12 @@ import numpy as np -from pySDC.core.Errors import TransferError -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.errors import TransferError +from pySDC.core.space_transfer import SpaceTransfer from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh -class dedalus_field_transfer(space_transfer): +class dedalus_field_transfer(SpaceTransfer): """ Custon base_transfer class, implements Transfer.py diff --git a/pySDC/playgrounds/deprecated/Dedalus/dedalus_field.py b/pySDC/playgrounds/deprecated/Dedalus/dedalus_field.py index e418efd218..88851de2eb 100644 --- a/pySDC/playgrounds/deprecated/Dedalus/dedalus_field.py +++ b/pySDC/playgrounds/deprecated/Dedalus/dedalus_field.py @@ -3,7 +3,7 @@ from dedalus import public as de -from pySDC.core.Errors import DataError +from pySDC.core.errors import DataError class dedalus_field(object): diff --git a/pySDC/playgrounds/deprecated/acoustic_1d_imex/ProblemClass.py b/pySDC/playgrounds/deprecated/acoustic_1d_imex/ProblemClass.py index 2375ca086b..83c42bfc9d 100644 --- a/pySDC/playgrounds/deprecated/acoustic_1d_imex/ProblemClass.py +++ b/pySDC/playgrounds/deprecated/acoustic_1d_imex/ProblemClass.py @@ -14,7 +14,7 @@ import scipy.sparse.linalg as LA from buildWave1DMatrix import getWave1DMatrix, getWave1DAdvectionMatrix -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, rhs_imex_mesh @@ -25,7 +25,7 @@ def u_initial(x): # return np.exp(-0.5*(x-0.5)**2/0.1**2) -class acoustic_1d_imex(ptype): +class acoustic_1d_imex(Problem): """ Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] diff --git a/pySDC/playgrounds/deprecated/acoustic_1d_imex/ProblemClass_multiscale.py b/pySDC/playgrounds/deprecated/acoustic_1d_imex/ProblemClass_multiscale.py index 02574e3d89..f008bab9e7 100644 --- a/pySDC/playgrounds/deprecated/acoustic_1d_imex/ProblemClass_multiscale.py +++ b/pySDC/playgrounds/deprecated/acoustic_1d_imex/ProblemClass_multiscale.py @@ -14,11 +14,11 @@ import scipy.sparse.linalg as LA from buildWave1DMatrix import getWave1DMatrix, getWave1DAdvectionMatrix -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes import mesh, rhs_imex_mesh -class acoustic_1d_imex(ptype): +class acoustic_1d_imex(Problem): """ Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] diff --git a/pySDC/playgrounds/deprecated/acoustic_2d_imex/HookClass.py b/pySDC/playgrounds/deprecated/acoustic_2d_imex/HookClass.py index 1b18a4e76f..c00f103d32 100644 --- a/pySDC/playgrounds/deprecated/acoustic_2d_imex/HookClass.py +++ b/pySDC/playgrounds/deprecated/acoustic_2d_imex/HookClass.py @@ -1,10 +1,10 @@ from matplotlib import cm from matplotlib import pyplot as plt -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class plot_solution(hooks): +class plot_solution(Hooks): def __init__(self): """ Initialization of output diff --git a/pySDC/playgrounds/deprecated/acoustic_2d_imex/ProblemClass.py b/pySDC/playgrounds/deprecated/acoustic_2d_imex/ProblemClass.py index 092aa694e1..ac3dc696aa 100644 --- a/pySDC/playgrounds/deprecated/acoustic_2d_imex/ProblemClass.py +++ b/pySDC/playgrounds/deprecated/acoustic_2d_imex/ProblemClass.py @@ -4,11 +4,11 @@ from buildWave2DMatrix import getWave2DMatrix, getWave2DUpwindMatrix from unflatten import unflatten -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes import mesh, rhs_imex_mesh -class acoustic_2d_imex(ptype): +class acoustic_2d_imex(Problem): """ Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] diff --git a/pySDC/playgrounds/deprecated/advection_1d_implicit/ProblemClass.py b/pySDC/playgrounds/deprecated/advection_1d_implicit/ProblemClass.py index 40f9dc9abc..7458188cd0 100644 --- a/pySDC/playgrounds/deprecated/advection_1d_implicit/ProblemClass.py +++ b/pySDC/playgrounds/deprecated/advection_1d_implicit/ProblemClass.py @@ -2,12 +2,12 @@ import scipy.sparse as sp import scipy.sparse.linalg as LA -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes import mesh from pySDC.playgrounds.deprecated.advection_1d_implicit.getFDMatrix import getFDMatrix -class advection(ptype): +class advection(Problem): """ Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] diff --git a/pySDC/playgrounds/deprecated/advection_2d_explicit/HookClass.py b/pySDC/playgrounds/deprecated/advection_2d_explicit/HookClass.py index 480aea75e9..be0ad39acb 100644 --- a/pySDC/playgrounds/deprecated/advection_2d_explicit/HookClass.py +++ b/pySDC/playgrounds/deprecated/advection_2d_explicit/HookClass.py @@ -1,10 +1,10 @@ from matplotlib import cm from matplotlib import pyplot as plt -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class plot_solution(hooks): +class plot_solution(Hooks): def __init__(self): """ Initialization of output diff --git a/pySDC/playgrounds/deprecated/advection_2d_explicit/ProblemClass.py b/pySDC/playgrounds/deprecated/advection_2d_explicit/ProblemClass.py index 1a493e7cfd..c68cb0c5b0 100644 --- a/pySDC/playgrounds/deprecated/advection_2d_explicit/ProblemClass.py +++ b/pySDC/playgrounds/deprecated/advection_2d_explicit/ProblemClass.py @@ -3,11 +3,11 @@ from clawpack import riemann from unflatten import unflatten -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes import mesh, rhs_imex_mesh -class advection_2d_explicit(ptype): +class advection_2d_explicit(Problem): """ Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] diff --git a/pySDC/playgrounds/deprecated/burgers_2d_explicit/ProblemClass.py b/pySDC/playgrounds/deprecated/burgers_2d_explicit/ProblemClass.py index 123e30ea99..379d8ed76b 100644 --- a/pySDC/playgrounds/deprecated/burgers_2d_explicit/ProblemClass.py +++ b/pySDC/playgrounds/deprecated/burgers_2d_explicit/ProblemClass.py @@ -4,11 +4,11 @@ from clawpack import pyclaw from clawpack import riemann -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes import mesh, rhs_imex_mesh -class sharpclaw(ptype): +class sharpclaw(Problem): """ Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] diff --git a/pySDC/playgrounds/deprecated/fwsw/plot_stab_vs_m.py b/pySDC/playgrounds/deprecated/fwsw/plot_stab_vs_m.py index 99bb80a937..5b18ef9541 100644 --- a/pySDC/playgrounds/deprecated/fwsw/plot_stab_vs_m.py +++ b/pySDC/playgrounds/deprecated/fwsw/plot_stab_vs_m.py @@ -5,9 +5,9 @@ from pylab import rcParams from pySDC.core import CollocationClasses as collclass -from pySDC.core import Hooks as hookclass -from pySDC.core import Level as lvl -from pySDC.core import Step as stepclass +from pySDC.core import hooks as hookclass +from pySDC.core import level as lvl +from pySDC.core import step as stepclass from pySDC.implementations.datatype_classes import mesh, rhs_imex_mesh from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order as imex @@ -35,8 +35,8 @@ # # ...this is functionality copied from test_imexsweeper. Ideally, it should be available in one place. # - step = stepclass.step(params={}) - L = lvl.level( + step = stepclass.Step(params={}) + L = lvl.Level( problem_class=swfw_scalar, problem_params=pparams, dtype_u=mesh, @@ -44,7 +44,7 @@ sweeper_class=imex, sweeper_params=swparams, level_params={}, - hook_class=hookclass.hooks, + hook_class=hookclass.Hooks, id="stability", ) step.register_level(L) diff --git a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_PMESH.py b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_PMESH.py index 2dd23f47e7..d591daeab7 100644 --- a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_PMESH.py +++ b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_PMESH.py @@ -2,12 +2,12 @@ from mpi4py import MPI from pmesh.pm import ParticleMesh -from pySDC.core.Errors import ParameterError, ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ParameterError, ProblemError +from pySDC.core.problem import Problem from pySDC.playgrounds.pmesh.PMESH_datatype import pmesh_datatype, rhs_imex_pmesh -class allencahn_imex(ptype): +class allencahn_imex(Problem): """ Example implementing Allen-Cahn equation in 2-3D using PMESH for solving linear parts, IMEX time-stepping diff --git a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_PMESH_NEW.py b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_PMESH_NEW.py index 5a29f6abaa..be9a583263 100644 --- a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_PMESH_NEW.py +++ b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_PMESH_NEW.py @@ -2,12 +2,12 @@ from mpi4py import MPI from pmesh.pm import ParticleMesh -from pySDC.core.Errors import ParameterError, ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ParameterError, ProblemError +from pySDC.core.problem import Problem from pySDC.playgrounds.pmesh.PMESH_datatype_NEW import pmesh_datatype, rhs_imex_pmesh -class allencahn_imex(ptype): +class allencahn_imex(Problem): """ Example implementing Allen-Cahn equation in 2-3D using PMESH for solving linear parts, IMEX time-stepping diff --git a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_Temperatur_monitor_and_dump.py b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_Temperatur_monitor_and_dump.py index 1bdbd8e189..4202ae373f 100644 --- a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_Temperatur_monitor_and_dump.py +++ b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_Temperatur_monitor_and_dump.py @@ -1,10 +1,10 @@ import numpy as np import json from mpi4py import MPI -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor_and_dump(hooks): +class monitor_and_dump(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_Temperature_PMESH.py b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_Temperature_PMESH.py index 44db7bba35..016c6b9bcb 100644 --- a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_Temperature_PMESH.py +++ b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_Temperature_PMESH.py @@ -2,12 +2,12 @@ from mpi4py import MPI from pmesh.pm import ParticleMesh -from pySDC.core.Errors import ParameterError, ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ParameterError, ProblemError +from pySDC.core.problem import Problem from pySDC.playgrounds.pmesh.PMESH_datatype import pmesh_datatype, rhs_imex_pmesh -class allencahn_imex(ptype): +class allencahn_imex(Problem): """ Example implementing Allen-Cahn equation in 2-3D using PMESH for solving linear parts, IMEX time-stepping diff --git a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_dump.py b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_dump.py index a0750cfe5e..c22ed20ffa 100644 --- a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_dump.py +++ b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_dump.py @@ -1,10 +1,10 @@ import numpy as np import json from mpi4py import MPI -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class dump(hooks): +class dump(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_dump_NEW.py b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_dump_NEW.py index ab214be35c..3290304a4d 100644 --- a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_dump_NEW.py +++ b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_dump_NEW.py @@ -1,10 +1,10 @@ import numpy as np import json from mpi4py import MPI -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class dump(hooks): +class dump(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_monitor_and_dump.py b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_monitor_and_dump.py index f018cb3087..ef4a829625 100644 --- a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_monitor_and_dump.py +++ b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_monitor_and_dump.py @@ -1,10 +1,10 @@ import numpy as np import json from mpi4py import MPI -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor_and_dump(hooks): +class monitor_and_dump(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_monitor_and_dump_NEW.py b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_monitor_and_dump_NEW.py index 5c06c1979f..ae4a24b3fe 100644 --- a/pySDC/playgrounds/deprecated/pmesh/AllenCahn_monitor_and_dump_NEW.py +++ b/pySDC/playgrounds/deprecated/pmesh/AllenCahn_monitor_and_dump_NEW.py @@ -1,10 +1,10 @@ import numpy as np import json from mpi4py import MPI -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor_and_dump(hooks): +class monitor_and_dump(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/playgrounds/deprecated/pmesh/PMESH_datatype.py b/pySDC/playgrounds/deprecated/pmesh/PMESH_datatype.py index db54c85579..9c4b889c62 100644 --- a/pySDC/playgrounds/deprecated/pmesh/PMESH_datatype.py +++ b/pySDC/playgrounds/deprecated/pmesh/PMESH_datatype.py @@ -1,7 +1,7 @@ from mpi4py import MPI import numpy as np -from pySDC.core.Errors import DataError +from pySDC.core.errors import DataError class pmesh_datatype(object): diff --git a/pySDC/playgrounds/deprecated/pmesh/PMESH_datatype_NEW.py b/pySDC/playgrounds/deprecated/pmesh/PMESH_datatype_NEW.py index 79cb978383..a5343cd175 100644 --- a/pySDC/playgrounds/deprecated/pmesh/PMESH_datatype_NEW.py +++ b/pySDC/playgrounds/deprecated/pmesh/PMESH_datatype_NEW.py @@ -1,7 +1,7 @@ from mpi4py import MPI import numpy as np -from pySDC.core.Errors import DataError +from pySDC.core.errors import DataError class pmesh_datatype(object): diff --git a/pySDC/playgrounds/deprecated/pmesh/TransferMesh_PMESH.py b/pySDC/playgrounds/deprecated/pmesh/TransferMesh_PMESH.py index 806fa01417..17526daeb0 100644 --- a/pySDC/playgrounds/deprecated/pmesh/TransferMesh_PMESH.py +++ b/pySDC/playgrounds/deprecated/pmesh/TransferMesh_PMESH.py @@ -1,10 +1,10 @@ -from pySDC.core.Errors import TransferError -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.errors import TransferError +from pySDC.core.space_transfer import SpaceTransfer from pySDC.playgrounds.pmesh.PMESH_datatype import pmesh_datatype, rhs_imex_pmesh import time -class pmesh_to_pmesh(space_transfer): +class pmesh_to_pmesh(SpaceTransfer): """ Custon base_transfer class, implements Transfer.py diff --git a/pySDC/playgrounds/deprecated/pmesh/TransferMesh_PMESH_NEW.py b/pySDC/playgrounds/deprecated/pmesh/TransferMesh_PMESH_NEW.py index b2d9952030..f58c32939d 100644 --- a/pySDC/playgrounds/deprecated/pmesh/TransferMesh_PMESH_NEW.py +++ b/pySDC/playgrounds/deprecated/pmesh/TransferMesh_PMESH_NEW.py @@ -1,10 +1,10 @@ -from pySDC.core.Errors import TransferError -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.errors import TransferError +from pySDC.core.space_transfer import SpaceTransfer from pySDC.playgrounds.pmesh.PMESH_datatype_NEW import pmesh_datatype, rhs_imex_pmesh import time -class pmesh_to_pmesh(space_transfer): +class pmesh_to_pmesh(SpaceTransfer): """ Custon base_transfer class, implements Transfer.py diff --git a/pySDC/playgrounds/fft/libpfasst_output.py b/pySDC/playgrounds/fft/libpfasst_output.py index 8fa0e20887..9942a02f4e 100644 --- a/pySDC/playgrounds/fft/libpfasst_output.py +++ b/pySDC/playgrounds/fft/libpfasst_output.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class libpfasst_output(hooks): +class libpfasst_output(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/playgrounds/lagrange/quadrature.py b/pySDC/playgrounds/lagrange/quadrature.py index b10ee0fb77..95c1092c2f 100644 --- a/pySDC/playgrounds/lagrange/quadrature.py +++ b/pySDC/playgrounds/lagrange/quadrature.py @@ -13,7 +13,7 @@ from qmat.lagrange import LagrangeApproximation from pySDC.implementations.collocations import Collocation -from pySDC.core.Errors import CollocationError +from pySDC.core.errors import CollocationError from scipy.integrate import quad from scipy.interpolate import BarycentricInterpolator diff --git a/pySDC/playgrounds/monodomain/Monodomain.py b/pySDC/playgrounds/monodomain/Monodomain.py index 31ffff4561..463323b0b6 100644 --- a/pySDC/playgrounds/monodomain/Monodomain.py +++ b/pySDC/playgrounds/monodomain/Monodomain.py @@ -1,12 +1,12 @@ import numpy as np -from pySDC.core.Errors import ParameterError, ProblemError -from pySDC.core.Problem import ptype +from pySDC.core.errors import ParameterError, ProblemError +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh # noinspection PyUnusedLocal -class monodomain2d_imex(ptype): +class monodomain2d_imex(Problem): """ Example implementing Allen-Cahn equation in 2D using FFTs for solving linear parts, IMEX time-stepping diff --git a/pySDC/playgrounds/optimization/playground.py b/pySDC/playgrounds/optimization/playground.py index 767ee771f5..041bc41cd2 100644 --- a/pySDC/playgrounds/optimization/playground.py +++ b/pySDC/playgrounds/optimization/playground.py @@ -1,4 +1,4 @@ -from pySDC.core.Sweeper import sweeper +from pySDC.core.sweeper import Sweeper from matplotlib import pyplot as plt import scipy.optimize as opt import numpy as np @@ -17,7 +17,7 @@ def rho(x): results = {} for prec in prec_list: - sw = sweeper({'collocation_class': CollGaussRadau_Right, 'num_nodes': M}) + sw = Sweeper({'collocation_class': CollGaussRadau_Right, 'num_nodes': M}) if prec != 'EE': QDelta = sw.get_Qdelta_implicit(prec)[1:, 1:] else: diff --git a/pySDC/playgrounds/parallel/AllenCahn_parallel_monitor.py b/pySDC/playgrounds/parallel/AllenCahn_parallel_monitor.py index 13bcbffd7a..68fdaa7300 100644 --- a/pySDC/playgrounds/parallel/AllenCahn_parallel_monitor.py +++ b/pySDC/playgrounds/parallel/AllenCahn_parallel_monitor.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor(hooks): +class monitor(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/playgrounds/paralpha/playground_linear.py b/pySDC/playgrounds/paralpha/playground_linear.py index 5c5cd81133..3577d2c9e2 100644 --- a/pySDC/playgrounds/paralpha/playground_linear.py +++ b/pySDC/playgrounds/paralpha/playground_linear.py @@ -1,7 +1,7 @@ import numpy as np import matplotlib.pyplot as plt -from pySDC.core.Collocation import CollBase +from pySDC.core.collocation import CollBase from pySDC.implementations.problem_classes.AdvectionEquation_ND_FD import advectionNd diff --git a/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_dump.py b/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_dump.py index 2c6a29e573..83188878e5 100644 --- a/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_dump.py +++ b/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_dump.py @@ -2,10 +2,10 @@ import json from mpi4py import MPI from mpi4py_fft import newDistArray -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class dump(hooks): +class dump(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_monitor.py b/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_monitor.py index fb71e7a5a5..af093a85e7 100644 --- a/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_monitor.py +++ b/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_monitor.py @@ -1,9 +1,9 @@ import numpy as np from mpi4py import MPI -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor(hooks): +class monitor(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_monitor_and_dump.py b/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_monitor_and_dump.py index f66e9ffb39..3e8b652070 100644 --- a/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_monitor_and_dump.py +++ b/pySDC/projects/AllenCahn_Bayreuth/AllenCahn_monitor_and_dump.py @@ -1,10 +1,10 @@ import numpy as np import json from mpi4py import MPI -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor_and_dump(hooks): +class monitor_and_dump(Hooks): def __init__(self): """ Initialization of Allen-Cahn monitoring diff --git a/pySDC/projects/AsympConv/conv_test_to0.py b/pySDC/projects/AsympConv/conv_test_to0.py index c466b41555..51f7622d48 100644 --- a/pySDC/projects/AsympConv/conv_test_to0.py +++ b/pySDC/projects/AsympConv/conv_test_to0.py @@ -6,7 +6,7 @@ import matplotlib.pylab as plt from matplotlib import rc -from pySDC.core.Collocation import CollBase +from pySDC.core.collocation import CollBase def compute_and_plot_specrad(Nnodes, lam): diff --git a/pySDC/projects/AsympConv/conv_test_toinf.py b/pySDC/projects/AsympConv/conv_test_toinf.py index 6a4dccd4c0..2583f3e560 100644 --- a/pySDC/projects/AsympConv/conv_test_toinf.py +++ b/pySDC/projects/AsympConv/conv_test_toinf.py @@ -6,7 +6,7 @@ import matplotlib.pylab as plt from matplotlib import rc -from pySDC.core.Collocation import CollBase +from pySDC.core.collocation import CollBase def compute_and_plot_specrad(Nnodes, lam): diff --git a/pySDC/projects/AsympConv/smoother_specrad_heatmap.py b/pySDC/projects/AsympConv/smoother_specrad_heatmap.py index d0e485ec6a..94126df0a2 100644 --- a/pySDC/projects/AsympConv/smoother_specrad_heatmap.py +++ b/pySDC/projects/AsympConv/smoother_specrad_heatmap.py @@ -6,7 +6,7 @@ import matplotlib.pyplot as plt from matplotlib.colors import LogNorm -from pySDC.core.Collocation import CollBase +from pySDC.core.collocation import CollBase def compute_and_plot_specrad(): diff --git a/pySDC/projects/DAE/misc/HookClass_DAE.py b/pySDC/projects/DAE/misc/HookClass_DAE.py index df6d08e25f..aead025a7d 100644 --- a/pySDC/projects/DAE/misc/HookClass_DAE.py +++ b/pySDC/projects/DAE/misc/HookClass_DAE.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class LogGlobalErrorPostStepDifferentialVariable(hooks): +class LogGlobalErrorPostStepDifferentialVariable(Hooks): """ Hook class to log the error to the output generated by the sweeper after each time step. @@ -44,7 +44,7 @@ def post_step(self, step, level_number): ) -class LogGlobalErrorPostStepAlgebraicVariable(hooks): +class LogGlobalErrorPostStepAlgebraicVariable(Hooks): """ Logs the global error in the algebraic variable """ diff --git a/pySDC/projects/DAE/misc/ProblemDAE.py b/pySDC/projects/DAE/misc/ProblemDAE.py index 06d6bcc6fe..4fd347f93e 100644 --- a/pySDC/projects/DAE/misc/ProblemDAE.py +++ b/pySDC/projects/DAE/misc/ProblemDAE.py @@ -1,11 +1,11 @@ import numpy as np from scipy.optimize import root -from pySDC.core.Problem import ptype, WorkCounter +from pySDC.core.problem import Problem, WorkCounter from pySDC.projects.DAE.misc.DAEMesh import DAEMesh -class ptype_dae(ptype): +class ptype_dae(Problem): r""" This class implements a generic DAE class and illustrates the interface class for DAE problems. It ensures that all parameters are passed that are needed by DAE sweepers. diff --git a/pySDC/projects/DAE/problems/DiscontinuousTestDAE.py b/pySDC/projects/DAE/problems/DiscontinuousTestDAE.py index 30eae1bf17..d47205b19c 100644 --- a/pySDC/projects/DAE/problems/DiscontinuousTestDAE.py +++ b/pySDC/projects/DAE/problems/DiscontinuousTestDAE.py @@ -1,6 +1,6 @@ import numpy as np -from pySDC.core.Problem import WorkCounter +from pySDC.core.problem import WorkCounter from pySDC.projects.DAE.misc.ProblemDAE import ptype_dae diff --git a/pySDC/projects/DAE/problems/WSCC9BusSystem.py b/pySDC/projects/DAE/problems/WSCC9BusSystem.py index 3867f0443a..136bc3f5d4 100644 --- a/pySDC/projects/DAE/problems/WSCC9BusSystem.py +++ b/pySDC/projects/DAE/problems/WSCC9BusSystem.py @@ -1,6 +1,6 @@ import numpy as np from pySDC.projects.DAE.misc.ProblemDAE import ptype_dae -from pySDC.core.Errors import ParameterError +from pySDC.core.errors import ParameterError def WSCC9Bus(): diff --git a/pySDC/projects/DAE/sweepers/SemiImplicitDAE.py b/pySDC/projects/DAE/sweepers/SemiImplicitDAE.py index 90734c0d63..cf8318a6ac 100644 --- a/pySDC/projects/DAE/sweepers/SemiImplicitDAE.py +++ b/pySDC/projects/DAE/sweepers/SemiImplicitDAE.py @@ -1,4 +1,4 @@ -from pySDC.core.Errors import ParameterError +from pySDC.core.errors import ParameterError from pySDC.projects.DAE.sweepers.fully_implicit_DAE import fully_implicit_DAE diff --git a/pySDC/projects/DAE/sweepers/fully_implicit_DAE.py b/pySDC/projects/DAE/sweepers/fully_implicit_DAE.py index 6b94517f4d..9511b6fe4c 100644 --- a/pySDC/projects/DAE/sweepers/fully_implicit_DAE.py +++ b/pySDC/projects/DAE/sweepers/fully_implicit_DAE.py @@ -1,7 +1,7 @@ import numpy as np from scipy import optimize -from pySDC.core.Errors import ParameterError +from pySDC.core.errors import ParameterError from pySDC.implementations.sweeper_classes.generic_implicit import generic_implicit from pySDC.projects.DAE.misc.DAEMesh import DAEMesh diff --git a/pySDC/projects/DAE/sweepers/fully_implicit_DAE_MPI.py b/pySDC/projects/DAE/sweepers/fully_implicit_DAE_MPI.py index 165792644d..6e088e8927 100644 --- a/pySDC/projects/DAE/sweepers/fully_implicit_DAE_MPI.py +++ b/pySDC/projects/DAE/sweepers/fully_implicit_DAE_MPI.py @@ -1,6 +1,6 @@ from mpi4py import MPI -from pySDC.core.Errors import ParameterError +from pySDC.core.errors import ParameterError from pySDC.implementations.sweeper_classes.generic_implicit_MPI import SweeperMPI, generic_implicit_MPI from pySDC.projects.DAE.sweepers.fully_implicit_DAE import fully_implicit_DAE diff --git a/pySDC/projects/DAE/tests/test_MPI_sweepers.py b/pySDC/projects/DAE/tests/test_MPI_sweepers.py index 31ceffab53..61f3253508 100644 --- a/pySDC/projects/DAE/tests/test_MPI_sweepers.py +++ b/pySDC/projects/DAE/tests/test_MPI_sweepers.py @@ -79,7 +79,7 @@ def testVersions(num_nodes, residual_type, semi_implicit, index_case, initial_gu else: import numpy as np from pySDC.projects.DAE.run.accuracy_check_MPI import run - from pySDC.core.Errors import ParameterError + from pySDC.core.errors import ParameterError semi_implicit = False if semi_implicit == 'False' else True diff --git a/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py b/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py index a6578e9f99..a6100e8489 100644 --- a/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py +++ b/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py @@ -56,7 +56,7 @@ def testPredict(initial_guess): from pySDC.projects.DAE.sweepers.SemiImplicitDAE import SemiImplicitDAE from pySDC.projects.DAE.problems.DiscontinuousTestDAE import DiscontinuousTestDAE from pySDC.projects.DAE.misc.DAEMesh import DAEMesh - from pySDC.core.Step import step + from pySDC.core.step import Step description, _ = getTestSetup(DiscontinuousTestDAE, SemiImplicitDAE, []) @@ -72,7 +72,7 @@ def testPredict(initial_guess): level_params.update({'dt': 0.1}) description.update({'level_params': level_params}) - S = step(description=description) + S = Step(description=description) L = S.levels[0] P = L.prob @@ -113,8 +113,8 @@ def testComputeResidual(residual_type): from pySDC.projects.DAE.sweepers.SemiImplicitDAE import SemiImplicitDAE from pySDC.projects.DAE.problems.DiscontinuousTestDAE import DiscontinuousTestDAE - from pySDC.core.Step import step - from pySDC.core.Errors import ParameterError + from pySDC.core.step import Step + from pySDC.core.errors import ParameterError description, _ = getTestSetup(DiscontinuousTestDAE, SemiImplicitDAE, []) @@ -131,7 +131,7 @@ def testComputeResidual(residual_type): level_params.update({'residual_type': residual_type}) description.update({'level_params': level_params}) - S = step(description=description) + S = Step(description=description) L = S.levels[0] P = L.prob @@ -171,8 +171,8 @@ def testComputeEndpoint(quad_type): from pySDC.projects.DAE.sweepers.SemiImplicitDAE import SemiImplicitDAE from pySDC.projects.DAE.problems.DiscontinuousTestDAE import DiscontinuousTestDAE - from pySDC.core.Step import step - from pySDC.core.Errors import ParameterError + from pySDC.core.step import Step + from pySDC.core.errors import ParameterError description, _ = getTestSetup(DiscontinuousTestDAE, SemiImplicitDAE, []) @@ -190,11 +190,11 @@ def testComputeEndpoint(quad_type): if quad_type == 'RADAU-LEFT': with pytest.raises(ParameterError): - S = step(description=description) + S = Step(description=description) with pytest.raises(NotImplementedError): S.levels[0].sweep.compute_end_point() else: - S = step(description=description) + S = Step(description=description) L = S.levels[0] P = L.prob diff --git a/pySDC/projects/DAE/tests/test_fully_implicit_DAE.py b/pySDC/projects/DAE/tests/test_fully_implicit_DAE.py index ff1c0bfb27..000b2af7b1 100644 --- a/pySDC/projects/DAE/tests/test_fully_implicit_DAE.py +++ b/pySDC/projects/DAE/tests/test_fully_implicit_DAE.py @@ -6,7 +6,7 @@ def test_predict_main(): from pySDC.projects.DAE.problems.simple_DAE import simple_dae_1 from pySDC.projects.DAE.sweepers.fully_implicit_DAE import fully_implicit_DAE - from pySDC.core.Step import step + from pySDC.core.step import Step # initialize level parameters level_params = dict() @@ -30,7 +30,7 @@ def test_predict_main(): description['sweeper_params'] = sweeper_params description['level_params'] = level_params - S = step(description=description) + S = Step(description=description) L = S.levels[0] P = L.prob # set initial time in the status of the level @@ -49,7 +49,7 @@ def test_predict_main(): # expecting that random initialisation does not initialise to zero sweeper_params['initial_guess'] = 'random' description['sweeper_params'] = sweeper_params - S = step(description=description) + S = Step(description=description) L = S.levels[0] P = L.prob # set initial time in the status of the level @@ -67,7 +67,7 @@ def test_predict_main(): def test_residual_main(): from pySDC.projects.DAE.problems.simple_DAE import simple_dae_1 from pySDC.projects.DAE.sweepers.fully_implicit_DAE import fully_implicit_DAE - from pySDC.core.Step import step + from pySDC.core.step import Step # initialize level parameters level_params = dict() @@ -93,7 +93,7 @@ def test_residual_main(): # description['step_params'] = step_params # last_abs residual test - S = step(description=description) + S = Step(description=description) L = S.levels[0] P = L.prob # set reference values @@ -120,7 +120,7 @@ def test_residual_main(): level_params['residual_type'] = 'full_rel' description['level_params'] = level_params - S = step(description=description) + S = Step(description=description) L = S.levels[0] P = L.prob # set initial time in the status of the level @@ -136,7 +136,7 @@ def test_residual_main(): level_params['residual_type'] = 'last_rel' description['level_params'] = level_params - S = step(description=description) + S = Step(description=description) L = S.levels[0] P = L.prob # set initial time in the status of the level @@ -153,7 +153,7 @@ def test_residual_main(): def test_compute_end_point_main(): from pySDC.projects.DAE.problems.simple_DAE import simple_dae_1 from pySDC.projects.DAE.sweepers.fully_implicit_DAE import fully_implicit_DAE - from pySDC.core.Step import step + from pySDC.core.step import Step # initialize level parameters level_params = dict() @@ -178,7 +178,7 @@ def test_compute_end_point_main(): description['level_params'] = level_params # last_abs residual test - S = step(description=description) + S = Step(description=description) L = S.levels[0] P = L.prob # set initial time in the status of the level diff --git a/pySDC/projects/FastWaveSlowWave/HookClass_acoustic.py b/pySDC/projects/FastWaveSlowWave/HookClass_acoustic.py index af80a156be..510e83332b 100644 --- a/pySDC/projects/FastWaveSlowWave/HookClass_acoustic.py +++ b/pySDC/projects/FastWaveSlowWave/HookClass_acoustic.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class dump_energy(hooks): +class dump_energy(Hooks): def __init__(self): """ Initialization of output diff --git a/pySDC/projects/FastWaveSlowWave/HookClass_boussinesq.py b/pySDC/projects/FastWaveSlowWave/HookClass_boussinesq.py index 0fdb73d41b..257d6cded8 100644 --- a/pySDC/projects/FastWaveSlowWave/HookClass_boussinesq.py +++ b/pySDC/projects/FastWaveSlowWave/HookClass_boussinesq.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class gmres_tolerance(hooks): +class gmres_tolerance(Hooks): def pre_iteration(self, step, level_number): """ Routine called before iteration starts, set new GMRES tolerance depending on the initial SDC residual diff --git a/pySDC/projects/FastWaveSlowWave/plot_dispersion.py b/pySDC/projects/FastWaveSlowWave/plot_dispersion.py index e56f69eb66..cfd5d34f8a 100644 --- a/pySDC/projects/FastWaveSlowWave/plot_dispersion.py +++ b/pySDC/projects/FastWaveSlowWave/plot_dispersion.py @@ -12,7 +12,7 @@ from pySDC.implementations.problem_classes.acoustic_helpers.standard_integrators import dirk, rk_imex -from pySDC.core.Step import step +from pySDC.core.step import Step def findomega(stab_fh): @@ -75,7 +75,7 @@ def compute_and_plot_dispersion(Nsamples=15, K=3): U_speed = 0.05 # now the description contains more or less everything we need to create a step - S = step(description=description) + S = Step(description=description) L = S.levels[0] diff --git a/pySDC/projects/FastWaveSlowWave/plot_stab_vs_k.py b/pySDC/projects/FastWaveSlowWave/plot_stab_vs_k.py index 5d820cee7c..fefd1c52cd 100644 --- a/pySDC/projects/FastWaveSlowWave/plot_stab_vs_k.py +++ b/pySDC/projects/FastWaveSlowWave/plot_stab_vs_k.py @@ -11,7 +11,7 @@ from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order -from pySDC.core.Step import step +from pySDC.core.step import Step # noinspection PyShadowingNames @@ -68,7 +68,7 @@ def compute_stab_vs_k(slow_resolved): description['sweeper_params'] = sweeper_params # pass sweeper parameters # now the description contains more or less everything we need to create a step - S = step(description=description) + S = Step(description=description) L = S.levels[0] diff --git a/pySDC/projects/FastWaveSlowWave/plot_stability.py b/pySDC/projects/FastWaveSlowWave/plot_stability.py index aac3148ec3..9a6c646e0f 100644 --- a/pySDC/projects/FastWaveSlowWave/plot_stability.py +++ b/pySDC/projects/FastWaveSlowWave/plot_stability.py @@ -11,7 +11,7 @@ from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order -from pySDC.core.Step import step +from pySDC.core.step import Step # noinspection PyShadowingNames @@ -64,7 +64,7 @@ def compute_stability(): K = 3 # now the description contains more or less everything we need to create a step - S = step(description=description) + S = Step(description=description) L = S.levels[0] diff --git a/pySDC/projects/FastWaveSlowWave/plot_stifflimit_specrad.py b/pySDC/projects/FastWaveSlowWave/plot_stifflimit_specrad.py index c5817b52c8..6ec7bc2296 100644 --- a/pySDC/projects/FastWaveSlowWave/plot_stifflimit_specrad.py +++ b/pySDC/projects/FastWaveSlowWave/plot_stifflimit_specrad.py @@ -10,7 +10,7 @@ from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order -from pySDC.core.Step import step +from pySDC.core.step import Step # noinspection PyShadowingNames @@ -58,7 +58,7 @@ def compute_specrad(): description['sweeper_params'] = sweeper_params # pass sweeper parameters # now the description contains more or less everything we need to create a step - S = step(description=description) + S = Step(description=description) L = S.levels[0] P = L.prob diff --git a/pySDC/projects/GPU/ac_fft.py b/pySDC/projects/GPU/ac_fft.py index 600e73ca4f..93856c37bd 100644 --- a/pySDC/projects/GPU/ac_fft.py +++ b/pySDC/projects/GPU/ac_fft.py @@ -1,6 +1,6 @@ from pySDC.implementations.problem_classes.AllenCahn_2D_FFT import allencahn2d_imex as ac_fft_cpu from pySDC.implementations.problem_classes.AllenCahn_2D_FFT_gpu import allencahn2d_imex as ac_fft_gpu -from pySDC.core.Collocation import CollBase as Collocation +from pySDC.core.collocation import CollBase as Collocation from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI from pySDC.helpers.stats_helper import filter_stats, sort_stats diff --git a/pySDC/projects/GPU/heat.py b/pySDC/projects/GPU/heat.py index 8a45c26630..eebbd9e78d 100644 --- a/pySDC/projects/GPU/heat.py +++ b/pySDC/projects/GPU/heat.py @@ -1,6 +1,6 @@ from pySDC.implementations.problem_classes.HeatEquation_ND_FD import heatNd_forced as heat_cpu from pySDC.implementations.problem_classes.HeatEquation_ND_FD_CuPy import heatNd_forced as heat_gpu -from pySDC.core.Collocation import CollBase as Collocation +from pySDC.core.collocation import CollBase as Collocation from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI from pySDC.helpers.stats_helper import filter_stats, sort_stats diff --git a/pySDC/projects/Hamiltonian/hamiltonian_and_energy_output.py b/pySDC/projects/Hamiltonian/hamiltonian_and_energy_output.py index 177e7039a0..6bbdc6535b 100644 --- a/pySDC/projects/Hamiltonian/hamiltonian_and_energy_output.py +++ b/pySDC/projects/Hamiltonian/hamiltonian_and_energy_output.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class hamiltonian_and_energy_output(hooks): +class hamiltonian_and_energy_output(Hooks): def __init__(self): """ Initialization of particles output diff --git a/pySDC/projects/Hamiltonian/hamiltonian_output.py b/pySDC/projects/Hamiltonian/hamiltonian_output.py index 5312f047e5..57d7986598 100644 --- a/pySDC/projects/Hamiltonian/hamiltonian_output.py +++ b/pySDC/projects/Hamiltonian/hamiltonian_output.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class hamiltonian_output(hooks): +class hamiltonian_output(Hooks): def __init__(self): """ Initialization of particles output diff --git a/pySDC/projects/Hamiltonian/stop_at_error_hook.py b/pySDC/projects/Hamiltonian/stop_at_error_hook.py index 0473f6b157..ecb34a89f3 100644 --- a/pySDC/projects/Hamiltonian/stop_at_error_hook.py +++ b/pySDC/projects/Hamiltonian/stop_at_error_hook.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class stop_at_error_hook(hooks): +class stop_at_error_hook(Hooks): def post_sweep(self, step, level_number): """ Overwrite standard post iteration hook diff --git a/pySDC/projects/Monodomain/hooks/HookClass_pde.py b/pySDC/projects/Monodomain/hooks/HookClass_pde.py index e4940ee153..4aa075d986 100644 --- a/pySDC/projects/Monodomain/hooks/HookClass_pde.py +++ b/pySDC/projects/Monodomain/hooks/HookClass_pde.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class pde_hook(hooks): +class pde_hook(Hooks): """ Hook class to write the solution to file. """ diff --git a/pySDC/projects/Monodomain/hooks/HookClass_post_iter_info.py b/pySDC/projects/Monodomain/hooks/HookClass_post_iter_info.py index 6cbb98100a..1df5b5da8b 100644 --- a/pySDC/projects/Monodomain/hooks/HookClass_post_iter_info.py +++ b/pySDC/projects/Monodomain/hooks/HookClass_post_iter_info.py @@ -1,8 +1,8 @@ import time -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class post_iter_info_hook(hooks): +class post_iter_info_hook(Hooks): """ Hook class to write additional iteration information to the command line. It is used to print the final residual, after u[0] has been updated with the new value from the previous step. diff --git a/pySDC/projects/Monodomain/problem_classes/MonodomainODE.py b/pySDC/projects/Monodomain/problem_classes/MonodomainODE.py index ff22af7f18..440a7f1d65 100644 --- a/pySDC/projects/Monodomain/problem_classes/MonodomainODE.py +++ b/pySDC/projects/Monodomain/problem_classes/MonodomainODE.py @@ -1,14 +1,14 @@ from pathlib import Path import logging import numpy as np -from pySDC.core.Problem import ptype +from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh from pySDC.projects.Monodomain.datatype_classes.my_mesh import imexexp_mesh from pySDC.projects.Monodomain.problem_classes.space_discretizazions.Parabolic_DCT import Parabolic_DCT import pySDC.projects.Monodomain.problem_classes.ionicmodels.cpp as ionicmodels -class MonodomainODE(ptype): +class MonodomainODE(Problem): """ A class for the discretization of the Monodomain equation. The Monodomain equation is a parabolic PDE composed of a reaction-diffusion equation coupled with an ODE system. The unknowns are the potential V and the ionic model variables (g_1,...,g_N). diff --git a/pySDC/projects/Monodomain/problem_classes/TestODE.py b/pySDC/projects/Monodomain/problem_classes/TestODE.py index 62d4bf01b6..49f671e09d 100644 --- a/pySDC/projects/Monodomain/problem_classes/TestODE.py +++ b/pySDC/projects/Monodomain/problem_classes/TestODE.py @@ -1,7 +1,7 @@ import logging import numpy as np -from pySDC.core.Problem import ptype -from pySDC.core.Common import RegisterParams +from pySDC.core.problem import Problem +from pySDC.core.common import RegisterParams from pySDC.implementations.datatype_classes.mesh import mesh from pySDC.projects.Monodomain.datatype_classes.my_mesh import imexexp_mesh @@ -19,7 +19,7 @@ def __init__(self, **problem_params): self.init = ((1,), None, np.dtype("float64")) -class TestODE(ptype): +class TestODE(Problem): def __init__(self, **problem_params): self.logger = logging.getLogger("step") diff --git a/pySDC/projects/Monodomain/problem_classes/space_discretizazions/Parabolic_DCT.py b/pySDC/projects/Monodomain/problem_classes/space_discretizazions/Parabolic_DCT.py index 20156b95c7..41d2f488ef 100644 --- a/pySDC/projects/Monodomain/problem_classes/space_discretizazions/Parabolic_DCT.py +++ b/pySDC/projects/Monodomain/problem_classes/space_discretizazions/Parabolic_DCT.py @@ -1,6 +1,6 @@ import numpy as np import scipy as sp -from pySDC.core.Common import RegisterParams +from pySDC.core.common import RegisterParams from pySDC.implementations.datatype_classes.mesh import mesh from pathlib import Path import os diff --git a/pySDC/projects/Monodomain/run_scripts/run_MonodomainODE.py b/pySDC/projects/Monodomain/run_scripts/run_MonodomainODE.py index c1aa47db27..87faedb84c 100644 --- a/pySDC/projects/Monodomain/run_scripts/run_MonodomainODE.py +++ b/pySDC/projects/Monodomain/run_scripts/run_MonodomainODE.py @@ -4,7 +4,7 @@ import logging import os -from pySDC.core.Errors import ParameterError +from pySDC.core.errors import ParameterError from pySDC.projects.Monodomain.problem_classes.MonodomainODE import MultiscaleMonodomainODE from pySDC.projects.Monodomain.hooks.HookClass_pde import pde_hook diff --git a/pySDC/projects/Monodomain/run_scripts/run_TestODE.py b/pySDC/projects/Monodomain/run_scripts/run_TestODE.py index 6b27b1aec2..5dab8362ce 100644 --- a/pySDC/projects/Monodomain/run_scripts/run_TestODE.py +++ b/pySDC/projects/Monodomain/run_scripts/run_TestODE.py @@ -5,7 +5,7 @@ from tqdm import tqdm -from pySDC.core.Errors import ParameterError +from pySDC.core.errors import ParameterError from pySDC.projects.Monodomain.problem_classes.TestODE import MultiscaleTestODE from pySDC.projects.Monodomain.transfer_classes.TransferVectorOfDCTVectors import TransferVectorOfDCTVectors diff --git a/pySDC/projects/Monodomain/sweeper_classes/exponential_runge_kutta/imexexp_1st_order.py b/pySDC/projects/Monodomain/sweeper_classes/exponential_runge_kutta/imexexp_1st_order.py index 1d470ed761..1805131a02 100644 --- a/pySDC/projects/Monodomain/sweeper_classes/exponential_runge_kutta/imexexp_1st_order.py +++ b/pySDC/projects/Monodomain/sweeper_classes/exponential_runge_kutta/imexexp_1st_order.py @@ -1,13 +1,13 @@ import numpy as np -from pySDC.core.Sweeper import sweeper -from pySDC.core.Errors import CollocationError, ParameterError -from pySDC.core.Collocation import CollBase +from pySDC.core.sweeper import Sweeper +from pySDC.core.errors import CollocationError, ParameterError +from pySDC.core.collocation import CollBase import numdifftools.fornberg as fornberg import scipy -class imexexp_1st_order(sweeper): +class imexexp_1st_order(Sweeper): """ Custom sweeper class, implements Sweeper.py diff --git a/pySDC/projects/Monodomain/sweeper_classes/runge_kutta/imexexp_1st_order.py b/pySDC/projects/Monodomain/sweeper_classes/runge_kutta/imexexp_1st_order.py index b8536b495e..1217509d92 100644 --- a/pySDC/projects/Monodomain/sweeper_classes/runge_kutta/imexexp_1st_order.py +++ b/pySDC/projects/Monodomain/sweeper_classes/runge_kutta/imexexp_1st_order.py @@ -1,10 +1,10 @@ import numpy as np -from pySDC.core.Sweeper import sweeper -from pySDC.core.Errors import CollocationError +from pySDC.core.sweeper import Sweeper +from pySDC.core.errors import CollocationError -class imexexp_1st_order(sweeper): +class imexexp_1st_order(Sweeper): """ Custom sweeper class, implements Sweeper.py diff --git a/pySDC/projects/Monodomain/transfer_classes/TransferVectorOfDCTVectors.py b/pySDC/projects/Monodomain/transfer_classes/TransferVectorOfDCTVectors.py index 3a21390c81..331433d3ec 100644 --- a/pySDC/projects/Monodomain/transfer_classes/TransferVectorOfDCTVectors.py +++ b/pySDC/projects/Monodomain/transfer_classes/TransferVectorOfDCTVectors.py @@ -1,10 +1,10 @@ -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.space_transfer import SpaceTransfer from pySDC.projects.Monodomain.transfer_classes.Transfer_DCT_Vector import DCT_to_DCT from pySDC.implementations.datatype_classes.mesh import mesh from pySDC.projects.Monodomain.datatype_classes.my_mesh import imexexp_mesh -class TransferVectorOfDCTVectors(space_transfer): +class TransferVectorOfDCTVectors(SpaceTransfer): """ This implementation can restrict and prolong VectorOfVectors """ diff --git a/pySDC/projects/Monodomain/transfer_classes/Transfer_DCT_Vector.py b/pySDC/projects/Monodomain/transfer_classes/Transfer_DCT_Vector.py index f0bf2ca98b..b39ab2cc80 100644 --- a/pySDC/projects/Monodomain/transfer_classes/Transfer_DCT_Vector.py +++ b/pySDC/projects/Monodomain/transfer_classes/Transfer_DCT_Vector.py @@ -1,10 +1,10 @@ import scipy.fft as fft -from pySDC.core.SpaceTransfer import space_transfer +from pySDC.core.space_transfer import SpaceTransfer from pySDC.implementations.datatype_classes.mesh import mesh -class DCT_to_DCT(space_transfer): +class DCT_to_DCT(SpaceTransfer): """ Class to transfer data between two meshes using DCT. Restriction is performed by zeroing out high frequency modes, while prolongation is done by zero-padding. diff --git a/pySDC/projects/Performance/controller_MPI_scorep.py b/pySDC/projects/Performance/controller_MPI_scorep.py index 55b661b70b..e33ac08dae 100644 --- a/pySDC/projects/Performance/controller_MPI_scorep.py +++ b/pySDC/projects/Performance/controller_MPI_scorep.py @@ -1,15 +1,15 @@ import numpy as np from mpi4py import MPI -from pySDC.core.Controller import controller -from pySDC.core.Errors import ControllerError -from pySDC.core.Step import step +from pySDC.core.controller import Controller +from pySDC.core.errors import ControllerError +from pySDC.core.step import Step from pySDC.implementations.convergence_controller_classes.check_convergence import CheckConvergence import scorep.user as spu -class controller_MPI(controller): +class controller_MPI(Controller): """ PFASST controller, running parallel version of PFASST in blocks (MG-style) @@ -30,7 +30,7 @@ def __init__(self, controller_params, description, comm): super(controller_MPI, self).__init__(controller_params) # create single step per processor - self.S = step(description) + self.S = Step(description) # pass communicator for future use self.comm = comm diff --git a/pySDC/projects/PinTSimE/battery_model.py b/pySDC/projects/PinTSimE/battery_model.py index 3c09be10b8..4ee37ef276 100644 --- a/pySDC/projects/PinTSimE/battery_model.py +++ b/pySDC/projects/PinTSimE/battery_model.py @@ -9,7 +9,7 @@ import pySDC.helpers.plot_helper as plt_helper -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.implementations.hooks.log_solution import LogSolution from pySDC.implementations.hooks.log_step_size import LogStepSize from pySDC.implementations.hooks.log_embedded_error_estimate import LogEmbeddedErrorEstimate @@ -21,7 +21,7 @@ from pySDC.projects.PinTSimE.hardcoded_solutions import testSolution -class LogEventBattery(hooks): +class LogEventBattery(Hooks): """ Logs the problem dependent state function of the battery drain model. """ diff --git a/pySDC/projects/PinTSimE/discontinuous_test_ODE.py b/pySDC/projects/PinTSimE/discontinuous_test_ODE.py index 22f36fe426..eac163e883 100644 --- a/pySDC/projects/PinTSimE/discontinuous_test_ODE.py +++ b/pySDC/projects/PinTSimE/discontinuous_test_ODE.py @@ -8,12 +8,12 @@ import pySDC.helpers.plot_helper as plt_helper -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.implementations.hooks.log_errors import LogGlobalErrorPostStep from pySDC.implementations.hooks.log_solution import LogSolution -class LogEventDiscontinuousTestODE(hooks): +class LogEventDiscontinuousTestODE(Hooks): """ Logs the problem dependent state function of the discontinuous test ODE. """ diff --git a/pySDC/projects/PinTSimE/hardcoded_solutions.py b/pySDC/projects/PinTSimE/hardcoded_solutions.py index 3a8b7b93f6..511837bd93 100644 --- a/pySDC/projects/PinTSimE/hardcoded_solutions.py +++ b/pySDC/projects/PinTSimE/hardcoded_solutions.py @@ -1,6 +1,6 @@ import numpy as np -from pySDC.core.Errors import ParameterError +from pySDC.core.errors import ParameterError def testSolution(u_num, prob_cls_name, dt, use_adaptivity, use_detection): diff --git a/pySDC/projects/PinTSimE/paper_PSCC2024/log_event.py b/pySDC/projects/PinTSimE/paper_PSCC2024/log_event.py index 02e724d209..7295c5b489 100644 --- a/pySDC/projects/PinTSimE/paper_PSCC2024/log_event.py +++ b/pySDC/projects/PinTSimE/paper_PSCC2024/log_event.py @@ -1,7 +1,7 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class LogEventDiscontinuousTestDAE(hooks): +class LogEventDiscontinuousTestDAE(Hooks): """ Logs the data for the discontinuous test DAE problem containing one discrete event. Note that this logging data is dependent from the problem itself. @@ -25,7 +25,7 @@ def post_step(self, step, level_number): ) -class LogEventWSCC9(hooks): +class LogEventWSCC9(Hooks): """ Logs the data for the discontinuous test DAE problem containing one discrete event. Note that this logging data is dependent from the problem itself. diff --git a/pySDC/projects/PinTSimE/paper_PSCC2024/paper_plots.py b/pySDC/projects/PinTSimE/paper_PSCC2024/paper_plots.py index 626e518d8b..3897522d22 100644 --- a/pySDC/projects/PinTSimE/paper_PSCC2024/paper_plots.py +++ b/pySDC/projects/PinTSimE/paper_PSCC2024/paper_plots.py @@ -2,7 +2,7 @@ import numpy as np import dill -from pySDC.core.Errors import ParameterError +from pySDC.core.errors import ParameterError from pySDC.projects.DAE.sweepers.fully_implicit_DAE import fully_implicit_DAE from pySDC.projects.DAE.problems.DiscontinuousTestDAE import DiscontinuousTestDAE diff --git a/pySDC/projects/PinTSimE/switch_estimator.py b/pySDC/projects/PinTSimE/switch_estimator.py index 32ce40ae2a..7aced04ff0 100644 --- a/pySDC/projects/PinTSimE/switch_estimator.py +++ b/pySDC/projects/PinTSimE/switch_estimator.py @@ -1,9 +1,9 @@ import numpy as np import scipy as sp -from pySDC.core.Errors import ParameterError -from pySDC.core.Collocation import CollBase -from pySDC.core.ConvergenceController import ConvergenceController, Status +from pySDC.core.errors import ParameterError +from pySDC.core.collocation import CollBase +from pySDC.core.convergence_controller import ConvergenceController, Status from pySDC.implementations.convergence_controller_classes.check_convergence import CheckConvergence from qmat.lagrange import LagrangeApproximation diff --git a/pySDC/projects/RDC/equidistant_RDC.py b/pySDC/projects/RDC/equidistant_RDC.py index e3b92ae730..63f88771ab 100644 --- a/pySDC/projects/RDC/equidistant_RDC.py +++ b/pySDC/projects/RDC/equidistant_RDC.py @@ -2,8 +2,8 @@ from scipy.special import roots_legendre from scipy.interpolate import BarycentricInterpolator -from pySDC.core.Errors import CollocationError, ParameterError -from pySDC.core.Collocation import CollBase +from pySDC.core.errors import CollocationError, ParameterError +from pySDC.core.collocation import CollBase class MyBarycentricInterpolator(BarycentricInterpolator): diff --git a/pySDC/projects/Resilience/AC.py b/pySDC/projects/Resilience/AC.py index ff77e6266f..83d9c233a8 100644 --- a/pySDC/projects/Resilience/AC.py +++ b/pySDC/projects/Resilience/AC.py @@ -2,14 +2,14 @@ from pySDC.implementations.problem_classes.AllenCahn_2D_FD import allencahn_fullyimplicit, allencahn_semiimplicit from pySDC.implementations.problem_classes.AllenCahn_2D_FFT import allencahn2d_imex from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.projects.Resilience.hook import hook_collection, LogData from pySDC.projects.Resilience.strategies import merge_descriptions from pySDC.projects.Resilience.sweepers import imex_1st_order_efficient, generic_implicit_efficient import matplotlib.pyplot as plt import numpy as np -from pySDC.core.Errors import ConvergenceError +from pySDC.core.errors import ConvergenceError def run_AC( @@ -160,7 +160,7 @@ def plot_solution(stats): # pragma: no cover plt.show() -class LivePlot(hooks): # pragma: no cover +class LivePlot(Hooks): # pragma: no cover def __init__(self): super().__init__() self.fig, self.axs = plt.subplots(1, 3, figsize=(12, 4)) @@ -217,7 +217,7 @@ def post_step(self, step, level_number): plt.pause(1e-9) -class LogRadius(hooks): +class LogRadius(Hooks): @staticmethod def compute_radius(L): c = np.count_nonzero(L.u[0] > 0.0) diff --git a/pySDC/projects/Resilience/Lorenz.py b/pySDC/projects/Resilience/Lorenz.py index 1f69eee662..817ad46be4 100644 --- a/pySDC/projects/Resilience/Lorenz.py +++ b/pySDC/projects/Resilience/Lorenz.py @@ -6,7 +6,7 @@ from pySDC.implementations.problem_classes.Lorenz import LorenzAttractor from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI from pySDC.implementations.convergence_controller_classes.adaptivity import Adaptivity -from pySDC.core.Errors import ConvergenceError +from pySDC.core.errors import ConvergenceError from pySDC.projects.Resilience.hook import LogData, hook_collection from pySDC.projects.Resilience.strategies import merge_descriptions from pySDC.projects.Resilience.sweepers import generic_implicit_efficient diff --git a/pySDC/projects/Resilience/Schroedinger.py b/pySDC/projects/Resilience/Schroedinger.py index 56a593521a..5b2a4d3984 100644 --- a/pySDC/projects/Resilience/Schroedinger.py +++ b/pySDC/projects/Resilience/Schroedinger.py @@ -8,15 +8,15 @@ from pySDC.projects.Resilience.hook import LogData, hook_collection from pySDC.projects.Resilience.strategies import merge_descriptions from pySDC.projects.Resilience.sweepers import imex_1st_order_efficient, generic_implicit_efficient -from pySDC.core.Errors import ConvergenceError +from pySDC.core.errors import ConvergenceError -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable -class live_plotting_with_error(hooks): # pragma: no cover +class live_plotting_with_error(Hooks): # pragma: no cover def __init__(self): super().__init__() self.fig, self.axs = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(12, 7)) @@ -44,7 +44,7 @@ def post_step(self, step, level_number): plt.pause(1e-9) -class live_plotting(hooks): # pragma: no cover +class live_plotting(Hooks): # pragma: no cover def __init__(self): super().__init__() self.fig, self.ax = plt.subplots() diff --git a/pySDC/projects/Resilience/accuracy_check.py b/pySDC/projects/Resilience/accuracy_check.py index 2467fad5d2..772167a46f 100644 --- a/pySDC/projects/Resilience/accuracy_check.py +++ b/pySDC/projects/Resilience/accuracy_check.py @@ -7,7 +7,7 @@ from pySDC.implementations.convergence_controller_classes.estimate_extrapolation_error import ( EstimateExtrapolationErrorNonMPI, ) -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.implementations.hooks.log_errors import LogLocalErrorPostStep from pySDC.projects.Resilience.strategies import merge_descriptions @@ -15,7 +15,7 @@ from pySDC.projects.Resilience.piline import run_piline -class DoNothing(hooks): +class DoNothing(Hooks): pass diff --git a/pySDC/projects/Resilience/collocation_adaptivity.py b/pySDC/projects/Resilience/collocation_adaptivity.py index b6de627817..6f554dabc6 100644 --- a/pySDC/projects/Resilience/collocation_adaptivity.py +++ b/pySDC/projects/Resilience/collocation_adaptivity.py @@ -12,7 +12,7 @@ from pySDC.implementations.convergence_controller_classes.estimate_embedded_error import ( EstimateEmbeddedErrorCollocation, ) -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.implementations.hooks.log_errors import LogLocalErrorPostIter from pySDC.implementations.hooks.log_embedded_error_estimate import LogEmbeddedErrorEstimatePostIter @@ -56,7 +56,7 @@ # define a few hooks -class LogSweeperParams(hooks): +class LogSweeperParams(Hooks): """ Log the sweeper parameters after every iteration to check if the adaptive collocation convergence controller is doing what it's supposed to. diff --git a/pySDC/projects/Resilience/dahlquist.py b/pySDC/projects/Resilience/dahlquist.py index 5b1ebc2189..151303e0ad 100644 --- a/pySDC/projects/Resilience/dahlquist.py +++ b/pySDC/projects/Resilience/dahlquist.py @@ -2,7 +2,7 @@ from pySDC.implementations.problem_classes.TestEquation_0D import testequation0d from pySDC.implementations.sweeper_classes.generic_implicit import generic_implicit from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.helpers.stats_helper import get_sorted import numpy as np import matplotlib.pyplot as plt @@ -14,7 +14,7 @@ from pySDC.projects.Resilience.strategies import merge_descriptions -class LogLambdas(hooks): +class LogLambdas(Hooks): """ Store the lambda values at the beginning of the run """ @@ -25,14 +25,14 @@ def pre_run(self, step, level_number): self.add_to_stats(process=0, time=0, level=0, iter=0, sweep=0, type='lambdas', value=L.prob.lambdas) -hooks = [LogLambdas, LogSolutionAfterIteration, LogStepSize] +Hooks = [LogLambdas, LogSolutionAfterIteration, LogStepSize] def run_dahlquist( custom_description=None, num_procs=1, Tend=1.0, - hook_class=hooks, + hook_class=Hooks, fault_stuff=None, custom_controller_params=None, **kwargs, diff --git a/pySDC/projects/Resilience/fault_injection.py b/pySDC/projects/Resilience/fault_injection.py index 619addfd9b..698399fb56 100644 --- a/pySDC/projects/Resilience/fault_injection.py +++ b/pySDC/projects/Resilience/fault_injection.py @@ -1,7 +1,7 @@ import struct import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.implementations.datatype_classes.mesh import mesh from pySDC.helpers.pysdc_helper import FrozenClass @@ -129,7 +129,7 @@ def index_to_combination(cls, args, rnd_params, generator=None): return cls({**combination, **args}) -class FaultInjector(hooks): +class FaultInjector(Hooks): ''' Class to use as base for hooks class instead of abstract hooks class to insert faults using hooks ''' diff --git a/pySDC/projects/Resilience/heat.py b/pySDC/projects/Resilience/heat.py index 02af22c418..0f7d17e16e 100644 --- a/pySDC/projects/Resilience/heat.py +++ b/pySDC/projects/Resilience/heat.py @@ -3,7 +3,7 @@ from pySDC.implementations.problem_classes.HeatEquation_ND_FD import heatNd_unforced from pySDC.implementations.sweeper_classes.generic_implicit import generic_implicit from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.helpers.stats_helper import get_sorted from pySDC.projects.Resilience.hook import hook_collection, LogData import numpy as np diff --git a/pySDC/projects/Resilience/hook.py b/pySDC/projects/Resilience/hook.py index eb654995c3..47252a6fbb 100644 --- a/pySDC/projects/Resilience/hook.py +++ b/pySDC/projects/Resilience/hook.py @@ -1,4 +1,4 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.implementations.hooks.log_solution import LogSolution from pySDC.implementations.hooks.log_embedded_error_estimate import LogEmbeddedErrorEstimate from pySDC.implementations.hooks.log_extrapolated_error_estimate import LogExtrapolationErrorEstimate @@ -8,7 +8,7 @@ hook_collection = [LogSolution, LogEmbeddedErrorEstimate, LogExtrapolationErrorEstimate, LogStepSize] -class LogData(hooks): +class LogData(Hooks): """ Record data required for analysis of problems in the resilience project """ @@ -51,7 +51,7 @@ def post_step(self, step, level_number): ) -class LogUold(hooks): +class LogUold(Hooks): """ Log last iterate at the end of the step. Since the hook comes after override of uold, we need to do this in each iteration. But we don't know which will be the last, so we just do `iter=-1` to override the previous value. @@ -71,7 +71,7 @@ def post_iteration(self, step, level_number): ) -class LogUAllIter(hooks): +class LogUAllIter(Hooks): """ Log solution and errors after each iteration """ diff --git a/pySDC/projects/Resilience/quench.py b/pySDC/projects/Resilience/quench.py index ee6fe2e173..a4c94e14c4 100644 --- a/pySDC/projects/Resilience/quench.py +++ b/pySDC/projects/Resilience/quench.py @@ -1,7 +1,7 @@ # script to run a quench problem from pySDC.implementations.problem_classes.Quench import Quench, QuenchIMEX from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.helpers.stats_helper import get_sorted from pySDC.projects.Resilience.hook import hook_collection, LogData from pySDC.projects.Resilience.strategies import merge_descriptions @@ -9,10 +9,10 @@ import numpy as np import matplotlib.pyplot as plt -from pySDC.core.Errors import ConvergenceError +from pySDC.core.errors import ConvergenceError -class live_plot(hooks): # pragma: no cover +class live_plot(Hooks): # pragma: no cover """ This hook plots the solution and the non-linear part of the right hand side after every step. Keep in mind that using adaptivity will result in restarts, which is not marked in these plots. Prepare to see the temperature profile jumping back again after a restart. """ @@ -249,7 +249,7 @@ def get_crossing_time(stats, controller, num_points=5, inter_points=50, temperat float: The time when the temperature threshold is crossed """ from qmat.lagrange import LagrangeApproximation - from pySDC.core.Collocation import CollBase + from pySDC.core.collocation import CollBase P = controller.MS[0].levels[0].prob u_thresh = P.u_thresh diff --git a/pySDC/projects/Resilience/sweepers.py b/pySDC/projects/Resilience/sweepers.py index f75b988bb0..ac2f54486e 100644 --- a/pySDC/projects/Resilience/sweepers.py +++ b/pySDC/projects/Resilience/sweepers.py @@ -1,7 +1,7 @@ import numpy as np from pySDC.implementations.sweeper_classes.generic_implicit import generic_implicit from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order -from pySDC.core.Errors import ParameterError +from pySDC.core.errors import ParameterError class efficient_sweeper: diff --git a/pySDC/projects/Resilience/vdp.py b/pySDC/projects/Resilience/vdp.py index cae4e72ad3..e413bf4172 100644 --- a/pySDC/projects/Resilience/vdp.py +++ b/pySDC/projects/Resilience/vdp.py @@ -6,7 +6,7 @@ from pySDC.implementations.problem_classes.Van_der_Pol_implicit import vanderpol from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI from pySDC.implementations.convergence_controller_classes.adaptivity import Adaptivity -from pySDC.core.Errors import ProblemError, ConvergenceError +from pySDC.core.errors import ProblemError, ConvergenceError from pySDC.projects.Resilience.hook import LogData, hook_collection from pySDC.projects.Resilience.strategies import merge_descriptions from pySDC.projects.Resilience.sweepers import generic_implicit_efficient diff --git a/pySDC/projects/Second_orderSDC/penningtrap_HookClass.py b/pySDC/projects/Second_orderSDC/penningtrap_HookClass.py index c487e41f03..0ed10b8f73 100644 --- a/pySDC/projects/Second_orderSDC/penningtrap_HookClass.py +++ b/pySDC/projects/Second_orderSDC/penningtrap_HookClass.py @@ -1,8 +1,8 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks import numpy as np -class particles_output(hooks): +class particles_output(Hooks): def __init__(self): """ Initialization of particles output diff --git a/pySDC/projects/Second_orderSDC/stability_simulation.py b/pySDC/projects/Second_orderSDC/stability_simulation.py index bd99125359..284de3118c 100644 --- a/pySDC/projects/Second_orderSDC/stability_simulation.py +++ b/pySDC/projects/Second_orderSDC/stability_simulation.py @@ -1,7 +1,7 @@ import numpy as np import matplotlib.pyplot as plt -from pySDC.core.Errors import ProblemError -from pySDC.core.Step import step +from pySDC.core.errors import ProblemError +from pySDC.core.step import Step from pySDC.projects.Second_orderSDC.plot_helper import set_fixed_plot_params @@ -45,7 +45,7 @@ def stability_data(self): numpy.ndarray: domain_picard numpy.ndarray: domain_Kpicard """ - S = step(description=self.description) + S = Step(description=self.description) # Define L to get access level params and functions L = S.levels[0] # Number of nodes diff --git a/pySDC/projects/TOMS/AllenCahn_monitor.py b/pySDC/projects/TOMS/AllenCahn_monitor.py index dca4e457a2..77cef72309 100644 --- a/pySDC/projects/TOMS/AllenCahn_monitor.py +++ b/pySDC/projects/TOMS/AllenCahn_monitor.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class monitor(hooks): +class monitor(Hooks): phase_thresh = 0.0 # count everything above this threshold to the high phase. def __init__(self): diff --git a/pySDC/projects/compression/compression_convergence_controller.py b/pySDC/projects/compression/compression_convergence_controller.py index 10e431942b..c8b6ffb8bb 100644 --- a/pySDC/projects/compression/compression_convergence_controller.py +++ b/pySDC/projects/compression/compression_convergence_controller.py @@ -1,4 +1,4 @@ -from pySDC.core.ConvergenceController import ConvergenceController +from pySDC.core.convergence_controller import ConvergenceController import numpy as np np.bool = np.bool_ diff --git a/pySDC/projects/parallelSDC/ErrReductionHook.py b/pySDC/projects/parallelSDC/ErrReductionHook.py index f6e35311f4..cf6f384940 100644 --- a/pySDC/projects/parallelSDC/ErrReductionHook.py +++ b/pySDC/projects/parallelSDC/ErrReductionHook.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class err_reduction_hook(hooks): +class err_reduction_hook(Hooks): def pre_iteration(self, step, level_number): """ Routine called before iteration starts diff --git a/pySDC/projects/parallelSDC/minimization.py b/pySDC/projects/parallelSDC/minimization.py index ad8e3776af..470b499a6c 100644 --- a/pySDC/projects/parallelSDC/minimization.py +++ b/pySDC/projects/parallelSDC/minimization.py @@ -3,7 +3,7 @@ import numpy as np import scipy.optimize as opt -from pySDC.core.Collocation import CollBase +from pySDC.core.collocation import CollBase def main(): diff --git a/pySDC/projects/parallelSDC_reloaded/nilpotency.py b/pySDC/projects/parallelSDC_reloaded/nilpotency.py index 4838bd3cd0..d0852d3588 100644 --- a/pySDC/projects/parallelSDC_reloaded/nilpotency.py +++ b/pySDC/projects/parallelSDC_reloaded/nilpotency.py @@ -9,7 +9,7 @@ import numpy as np import matplotlib.pyplot as plt -from pySDC.core.Sweeper import sweeper +from pySDC.core.sweeper import Sweeper quadType = "LOBATTO" nodeType = "LEGENDRE" @@ -36,7 +36,7 @@ def nilpotencyNS(d, Q): nil_MIN_SR_NS = [] nNodes = range(2, 20) for m in nNodes: - s = sweeper({"num_nodes": m, "quad_type": quadType, "node_type": nodeType}) + s = Sweeper({"num_nodes": m, "quad_type": quadType, "node_type": nodeType}) Q = s.coll.Qmat[1:, 1:] nodes = s.coll.nodes diff --git a/pySDC/projects/soft_failure/FaultHooks.py b/pySDC/projects/soft_failure/FaultHooks.py index 2b3dbd7f50..473ccc6a12 100644 --- a/pySDC/projects/soft_failure/FaultHooks.py +++ b/pySDC/projects/soft_failure/FaultHooks.py @@ -2,10 +2,10 @@ import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class fault_hook(hooks): +class fault_hook(Hooks): def __init__(self): """ Initialization of fault hooks diff --git a/pySDC/tests/test_Q_transfer.py b/pySDC/tests/test_Q_transfer.py index 02d448e009..37f9703aaa 100644 --- a/pySDC/tests/test_Q_transfer.py +++ b/pySDC/tests/test_Q_transfer.py @@ -2,7 +2,7 @@ import numpy as np from numpy.polynomial.polynomial import polyval -from pySDC.core.Collocation import CollBase +from pySDC.core.collocation import CollBase import pySDC.helpers.transfer_helper as th t_start = np.random.rand(1) * 0.2 diff --git a/pySDC/tests/test_benchmarks/test_collocation.py b/pySDC/tests/test_benchmarks/test_collocation.py index d5141de575..ed21686dd8 100644 --- a/pySDC/tests/test_benchmarks/test_collocation.py +++ b/pySDC/tests/test_benchmarks/test_collocation.py @@ -1,7 +1,7 @@ import pytest import numpy as np -from pySDC.core.Collocation import CollBase +from pySDC.core.collocation import CollBase t_start = np.random.rand(1) * 0.2 t_end = 0.8 + np.random.rand(1) * 0.2 diff --git a/pySDC/tests/test_collocation.py b/pySDC/tests/test_collocation.py index 928de1ebf9..236d409a98 100644 --- a/pySDC/tests/test_collocation.py +++ b/pySDC/tests/test_collocation.py @@ -1,7 +1,7 @@ import pytest import numpy as np -from pySDC.core.Collocation import CollBase +from pySDC.core.collocation import CollBase t_start = np.random.rand(1)[0] * 0.2 t_end = 0.8 + np.random.rand(1)[0] * 0.2 diff --git a/pySDC/tests/test_convergence_controllers/test_InterpolateBetweenRestarts.py b/pySDC/tests/test_convergence_controllers/test_InterpolateBetweenRestarts.py index 4204327e79..9cbd28f1cb 100644 --- a/pySDC/tests/test_convergence_controllers/test_InterpolateBetweenRestarts.py +++ b/pySDC/tests/test_convergence_controllers/test_InterpolateBetweenRestarts.py @@ -1,11 +1,11 @@ import pytest -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from qmat.lagrange import LagrangeApproximation import numpy as np -class LogInterpolation(hooks): +class LogInterpolation(Hooks): """ Log the solution when a step is supposed to be restarted as well as the interpolated solution to the new nodes and the solution that ends up at the nodes after the restart. @@ -80,7 +80,7 @@ def post_step(self, step, level_number): ) -class CheckInterpolationOrder(hooks): +class CheckInterpolationOrder(Hooks): def __init__(self): self.mess_with_solution = True self.messed_with_solution = False diff --git a/pySDC/tests/test_convergence_controllers/test_Newton_inexactness.py b/pySDC/tests/test_convergence_controllers/test_Newton_inexactness.py index ea24c61314..a79bb94147 100644 --- a/pySDC/tests/test_convergence_controllers/test_Newton_inexactness.py +++ b/pySDC/tests/test_convergence_controllers/test_Newton_inexactness.py @@ -9,9 +9,9 @@ def test_Newton_inexactness(ratio=1e-2, min_tol=1e-11, max_tol=1e-6): from pySDC.implementations.sweeper_classes.generic_implicit import generic_implicit from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI from pySDC.helpers.stats_helper import get_sorted, filter_stats - from pySDC.core.Hooks import hooks + from pySDC.core.hooks import Hooks - class log_newton_tol(hooks): + class log_newton_tol(Hooks): def pre_iteration(self, step, level_number): lvl = step.levels[level_number] self.add_to_stats( diff --git a/pySDC/tests/test_convergence_controllers/test_basic_restarting.py b/pySDC/tests/test_convergence_controllers/test_basic_restarting.py index e25c241a24..eaa397c6b3 100644 --- a/pySDC/tests/test_convergence_controllers/test_basic_restarting.py +++ b/pySDC/tests/test_convergence_controllers/test_basic_restarting.py @@ -24,8 +24,8 @@ def run_problem( from pySDC.implementations.sweeper_classes.generic_implicit import generic_implicit from pySDC.implementations.convergence_controller_classes.basic_restarting import BasicRestarting from pySDC.implementations.convergence_controller_classes.spread_step_sizes import SpreadStepSizesBlockwise - from pySDC.core.Hooks import hooks - from pySDC.core.ConvergenceController import ConvergenceController + from pySDC.core.hooks import Hooks + from pySDC.core.convergence_controller import ConvergenceController from pySDC.implementations.hooks.log_step_size import LogStepSize from pySDC.implementations.hooks.log_restarts import LogRestarts @@ -55,7 +55,7 @@ def determine_restart(self, controller, S, **kwargs): first_updated = np.min(np.arange(len(updated))[updated]) self.restart_times = kwargs['comm'].bcast(self.restart_times, root=first_updated) - class ArtificialAdaptivity(hooks): + class ArtificialAdaptivity(Hooks): def __init__(self): super().__init__() self.min_dt = [] if min_dt is None else min_dt.copy() diff --git a/pySDC/tests/test_convergence_controllers/test_crash.py b/pySDC/tests/test_convergence_controllers/test_crash.py index 6189e43d45..1506093c8e 100644 --- a/pySDC/tests/test_convergence_controllers/test_crash.py +++ b/pySDC/tests/test_convergence_controllers/test_crash.py @@ -80,7 +80,7 @@ def single_test(MPIsweeper=False, MPIcontroller=False): machine precision. """ import numpy as np - from pySDC.core.Errors import ConvergenceError + from pySDC.core.errors import ConvergenceError args = { 'MPIsweeper': MPIsweeper, diff --git a/pySDC/tests/test_helpers/test_stats_helper.py b/pySDC/tests/test_helpers/test_stats_helper.py index f2ce1ce0ed..a0fa133082 100644 --- a/pySDC/tests/test_helpers/test_stats_helper.py +++ b/pySDC/tests/test_helpers/test_stats_helper.py @@ -41,14 +41,14 @@ def generate_stats_for_recomputed_test(num_procs=1, test_type=1, comm=None): Returns: dict: The stats generated from the pretend run """ - from pySDC.core.Hooks import hooks + from pySDC.core.hooks import Hooks if comm: ranks = [comm.rank] else: ranks = range(num_procs) - hook = hooks() + hook = Hooks() step_size = 1.0 diff --git a/pySDC/tests/test_hooks/test_entry_class.py b/pySDC/tests/test_hooks/test_entry_class.py index f2f4171e44..036f5b0c3e 100644 --- a/pySDC/tests/test_hooks/test_entry_class.py +++ b/pySDC/tests/test_hooks/test_entry_class.py @@ -1,6 +1,6 @@ import pytest -from pySDC.core.Hooks import hooks, meta_data, namedtuple +from pySDC.core.hooks import Hooks, meta_data, namedtuple # In case the starship needs manual override of the reentry sequence, we set a code for unlocking manual controls. # Because humans may go crazy, or worse, deflect to the enemy when they enter space, we can't tell them the code, or how @@ -13,7 +13,7 @@ Entry = namedtuple('Entry', convection_meta_data.keys()) -class convection_hook(hooks): +class convection_hook(Hooks): meta_data = convection_meta_data entry = Entry starship = 'vostok' diff --git a/pySDC/tests/test_problem.py b/pySDC/tests/test_problem.py index d865d0384b..86cd00c660 100644 --- a/pySDC/tests/test_problem.py +++ b/pySDC/tests/test_problem.py @@ -18,10 +18,10 @@ def test_scipy_reference(init): Returns: None """ - from pySDC.core.Problem import ptype + from pySDC.core.problem import Problem # instantiate a dummy problem - problem = ptype(init) + problem = Problem(init) # setup random initial conditions u0 = np.random.rand(*init[0]) diff --git a/pySDC/tests/test_problems/test_AdvectionDiffusionEquation_1D_FFT.py b/pySDC/tests/test_problems/test_AdvectionDiffusionEquation_1D_FFT.py index 09dbf4e05d..93745a9ca0 100644 --- a/pySDC/tests/test_problems/test_AdvectionDiffusionEquation_1D_FFT.py +++ b/pySDC/tests/test_problems/test_AdvectionDiffusionEquation_1D_FFT.py @@ -47,7 +47,7 @@ def get_error_thresholds(freq, nu): @pytest.mark.parametrize('nu', [0.02, -0.02]) def test_imex_vs_implicit(freq, nu): import numpy as np - from pySDC.core.Errors import ParameterError, ProblemError + from pySDC.core.errors import ParameterError, ProblemError from pySDC.implementations.problem_classes.AdvectionDiffusionEquation_1D_FFT import ( advectiondiffusion1d_imex, advectiondiffusion1d_implicit, diff --git a/pySDC/tests/test_problems/test_AllenCahn_1D_FD.py b/pySDC/tests/test_problems/test_AllenCahn_1D_FD.py index f2367a1956..3e7f900f2e 100644 --- a/pySDC/tests/test_problems/test_AllenCahn_1D_FD.py +++ b/pySDC/tests/test_problems/test_AllenCahn_1D_FD.py @@ -146,7 +146,7 @@ def test_capture_errors_and_warnings(caplog, stop_at_nan): Test if errors and warnings are raised correctly. """ import numpy as np - from pySDC.core.Errors import ProblemError + from pySDC.core.errors import ProblemError from pySDC.implementations.problem_classes.AllenCahn_1D_FD import ( allencahn_front_fullyimplicit, allencahn_front_semiimplicit, diff --git a/pySDC/tests/test_problems/test_DiscontinuousTestODE.py b/pySDC/tests/test_problems/test_DiscontinuousTestODE.py index add8b3c637..9efbe0d30e 100644 --- a/pySDC/tests/test_problems/test_DiscontinuousTestODE.py +++ b/pySDC/tests/test_problems/test_DiscontinuousTestODE.py @@ -43,7 +43,7 @@ def test_capture_errors_and_warnings(caplog): Test that checks if the errors in the problem classes are raised. """ import numpy as np - from pySDC.core.Errors import ProblemError + from pySDC.core.errors import ProblemError from pySDC.implementations.problem_classes.DiscontinuousTestODE import DiscontinuousTestODE problem_params = { diff --git a/pySDC/tests/test_sweepers/test_imexsweeper.py b/pySDC/tests/test_sweepers/test_imexsweeper.py index c09a6131a3..35ee831426 100644 --- a/pySDC/tests/test_sweepers/test_imexsweeper.py +++ b/pySDC/tests/test_sweepers/test_imexsweeper.py @@ -12,10 +12,10 @@ class TestImexSweeper(unittest.TestCase): # Some auxiliary functions which are not tests themselves # def setupLevelStepProblem(self): - from pySDC.core import Step as stepclass + from pySDC.core import step as stepclass self.description['sweeper_params'] = self.swparams - step = stepclass.step(description=self.description) + step = stepclass.Step(description=self.description) level = step.levels[0] level.status.time = 0.0 u0 = step.levels[0].prob.u_exact(step.time) @@ -56,27 +56,27 @@ def setUp(self): # Check that a level object can be instantiated # def test_caninstantiate(self): - from pySDC.core import Step as stepclass + from pySDC.core import step as stepclass from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order as imex for node_type, quad_type in zip(node_types, quad_types): self.swparams['node_type'] = node_type self.swparams['quad_type'] = quad_type self.description['sweeper_params'] = self.swparams - S = stepclass.step(description=self.description) + S = stepclass.Step(description=self.description) assert isinstance(S.levels[0].sweep, imex), "sweeper in generated level is not an object of type imex" # # Check that a level object can be registered in a step object (needed as prerequiste to execute update_nodes # def test_canregisterlevel(self): - from pySDC.core import Step as stepclass + from pySDC.core import step as stepclass for node_type, quad_type in zip(node_types, quad_types): self.swparams['node_type'] = node_type self.swparams['quad_type'] = quad_type self.description['sweeper_params'] = self.swparams - step = stepclass.step(description=self.description) + step = stepclass.Step(description=self.description) L = step.levels[0] with self.assertRaises(Exception): L.sweep.predict() diff --git a/pySDC/tests/test_sweepers/test_preconditioners.py b/pySDC/tests/test_sweepers/test_preconditioners.py index a9d6fbdcdc..e19fe54d8d 100644 --- a/pySDC/tests/test_sweepers/test_preconditioners.py +++ b/pySDC/tests/test_sweepers/test_preconditioners.py @@ -1,7 +1,7 @@ import numpy as np import pytest -from pySDC.core.Sweeper import sweeper as Sweeper +from pySDC.core.sweeper import Sweeper as Sweeper node_types = ['EQUID', 'LEGENDRE'] + [f'CHEBY-{i}' for i in [1, 2, 3, 4]] quad_types = ['GAUSS', 'LOBATTO', 'RADAU-RIGHT', 'RADAU-LEFT'] diff --git a/pySDC/tests/test_transfer_classes/test_base_transfer_MPI.py b/pySDC/tests/test_transfer_classes/test_base_transfer_MPI.py index 8caf7a6a9e..f837a3a8ba 100644 --- a/pySDC/tests/test_transfer_classes/test_base_transfer_MPI.py +++ b/pySDC/tests/test_transfer_classes/test_base_transfer_MPI.py @@ -2,7 +2,7 @@ def getLevel(nvars, num_nodes, index, useMPI): - from pySDC.core.Level import level + from pySDC.core.level import Level from pySDC.implementations.problem_classes.HeatEquation_ND_FD import heatNd_unforced if useMPI: @@ -18,7 +18,7 @@ def getLevel(nvars, num_nodes, index, useMPI): level_params['level_params'] = {'dt': 1.0} level_params['level_index'] = index - L = level(**level_params) + L = Level(**level_params) L.status.time = 0.0 L.status.unlocked = True @@ -33,7 +33,7 @@ def get_base_transfer(nvars, num_nodes, useMPI): if useMPI: from pySDC.implementations.transfer_classes.BaseTransferMPI import base_transfer_MPI as transfer_class else: - from pySDC.core.BaseTransfer import base_transfer as transfer_class + from pySDC.core.base_transfer import BaseTransfer as transfer_class params = {} params['fine_level'] = getLevel(nvars[0], num_nodes[0], 0, useMPI) diff --git a/pySDC/tests/test_transfer_classes/test_transfer_order.py b/pySDC/tests/test_transfer_classes/test_transfer_order.py index f74c4f18bf..4869d43bd0 100644 --- a/pySDC/tests/test_transfer_classes/test_transfer_order.py +++ b/pySDC/tests/test_transfer_classes/test_transfer_order.py @@ -13,11 +13,11 @@ def get_problem(nvars, xp, L, mpifft=False, spectral=False, x0=0, useGPU=False): Returns: Instance of pySDC problem class """ - from pySDC.core.Problem import ptype + from pySDC.core.problem import Problem from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh from pySDC.helpers.problem_helper import get_1d_grid - class DummyProblem(ptype): + class DummyProblem(Problem): dtype_u = mesh dtype_f = imex_mesh diff --git a/pySDC/tests/tests_core.py b/pySDC/tests/tests_core.py index 6b2942b514..f1558d0ee6 100644 --- a/pySDC/tests/tests_core.py +++ b/pySDC/tests/tests_core.py @@ -11,9 +11,9 @@ def test_errors(): @pytest.mark.base def check_error(subclass): - import pySDC.core.Errors + import pySDC.core.errors - err = getattr(pySDC.core.Errors, subclass) + err = getattr(pySDC.core.errors, subclass) try: raise err('bla') diff --git a/pySDC/tutorial/step_1/C_collocation_problem_setup.py b/pySDC/tutorial/step_1/C_collocation_problem_setup.py index b7d4ad5ea3..0e74936945 100644 --- a/pySDC/tutorial/step_1/C_collocation_problem_setup.py +++ b/pySDC/tutorial/step_1/C_collocation_problem_setup.py @@ -2,7 +2,7 @@ import scipy.sparse as sp from pathlib import Path -from pySDC.core.Collocation import CollBase +from pySDC.core.collocation import CollBase from pySDC.implementations.problem_classes.HeatEquation_ND_FD import heatNd_unforced diff --git a/pySDC/tutorial/step_1/D_collocation_accuracy_check.py b/pySDC/tutorial/step_1/D_collocation_accuracy_check.py index 9f0c045e5e..b5ce0888c3 100644 --- a/pySDC/tutorial/step_1/D_collocation_accuracy_check.py +++ b/pySDC/tutorial/step_1/D_collocation_accuracy_check.py @@ -9,7 +9,7 @@ import os.path import scipy.sparse as sp -from pySDC.core.Collocation import CollBase +from pySDC.core.collocation import CollBase from pySDC.implementations.problem_classes.HeatEquation_ND_FD import heatNd_unforced # setup id for gathering the results (will sort by dt) diff --git a/pySDC/tutorial/step_2/A_step_data_structure.py b/pySDC/tutorial/step_2/A_step_data_structure.py index 73a06bb307..f62bdba8b0 100644 --- a/pySDC/tutorial/step_2/A_step_data_structure.py +++ b/pySDC/tutorial/step_2/A_step_data_structure.py @@ -1,6 +1,6 @@ from pathlib import Path -from pySDC.core.Step import step +from pySDC.core.step import Step from pySDC.implementations.problem_classes.HeatEquation_ND_FD import heatNd_unforced from pySDC.implementations.sweeper_classes.generic_implicit import generic_implicit @@ -44,7 +44,7 @@ def main(): description['step_params'] = step_params # now the description contains more or less everything we need to create a step - S = step(description=description) + S = Step(description=description) # we only have a single level, make a shortcut L = S.levels[0] diff --git a/pySDC/tutorial/step_2/B_my_first_sweeper.py b/pySDC/tutorial/step_2/B_my_first_sweeper.py index 8120e94d63..19feffadfd 100644 --- a/pySDC/tutorial/step_2/B_my_first_sweeper.py +++ b/pySDC/tutorial/step_2/B_my_first_sweeper.py @@ -1,6 +1,6 @@ from pathlib import Path -from pySDC.core.Step import step +from pySDC.core.step import Step from pySDC.implementations.problem_classes.HeatEquation_ND_FD import heatNd_forced from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order @@ -41,7 +41,7 @@ def main(): description['step_params'] = step_params # instantiate the step we are going to work on - S = step(description=description) + S = Step(description=description) # run IMEX SDC test and check error, residual and number of iterations err, res, niter = run_imex_sdc(S) diff --git a/pySDC/tutorial/step_3/HookClass_Particles.py b/pySDC/tutorial/step_3/HookClass_Particles.py index a6296514c0..39ac37cdf8 100644 --- a/pySDC/tutorial/step_3/HookClass_Particles.py +++ b/pySDC/tutorial/step_3/HookClass_Particles.py @@ -1,9 +1,9 @@ import numpy as np -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks -class particle_hook(hooks): +class particle_hook(Hooks): def __init__(self): """ Initialization of particles output diff --git a/pySDC/tutorial/step_4/B_multilevel_hierarchy.py b/pySDC/tutorial/step_4/B_multilevel_hierarchy.py index 55b0219f44..e9287fa652 100644 --- a/pySDC/tutorial/step_4/B_multilevel_hierarchy.py +++ b/pySDC/tutorial/step_4/B_multilevel_hierarchy.py @@ -1,6 +1,6 @@ from pathlib import Path -from pySDC.core.Step import step +from pySDC.core.step import Step from pySDC.implementations.problem_classes.HeatEquation_ND_FD import heatNd_unforced from pySDC.implementations.sweeper_classes.generic_implicit import generic_implicit @@ -51,7 +51,7 @@ def main(): description['space_transfer_params'] = space_transfer_params # now the description contains more or less everything we need to create a step with multiple levels - S = step(description=description) + S = Step(description=description) # print out and check Path("data").mkdir(parents=True, exist_ok=True) diff --git a/pySDC/tutorial/step_8/HookClass_error_output.py b/pySDC/tutorial/step_8/HookClass_error_output.py index 4ba3ccd730..c31bbac4d2 100644 --- a/pySDC/tutorial/step_8/HookClass_error_output.py +++ b/pySDC/tutorial/step_8/HookClass_error_output.py @@ -1,9 +1,9 @@ -from pySDC.core.Hooks import hooks +from pySDC.core.hooks import Hooks from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI from pySDC.implementations.problem_classes.Auzinger_implicit import auzinger -class error_output(hooks): +class error_output(Hooks): """ Hook class to add output of error """ From 32f64bf032119f989c9302c3c077d1cb4fc07de8 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sun, 23 Jun 2024 12:05:57 +0200 Subject: [PATCH 32/38] TL: omg --- pySDC/implementations/hooks/log_errors.py | 2 +- pySDC/tests/test_helpers/test_stats_helper.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pySDC/implementations/hooks/log_errors.py b/pySDC/implementations/hooks/log_errors.py index 06c4d09282..b871bb90a6 100644 --- a/pySDC/implementations/hooks/log_errors.py +++ b/pySDC/implementations/hooks/log_errors.py @@ -167,7 +167,7 @@ def post_run(self, step, level_number): None """ super().post_run(step, level_number) - self._hooks__num_restarts = self.num_restarts + self._Hooks__num_restarts = self.num_restarts if level_number == 0 and step.status.last: L = step.levels[level_number] diff --git a/pySDC/tests/test_helpers/test_stats_helper.py b/pySDC/tests/test_helpers/test_stats_helper.py index a0fa133082..15c77e2ca7 100644 --- a/pySDC/tests/test_helpers/test_stats_helper.py +++ b/pySDC/tests/test_helpers/test_stats_helper.py @@ -23,7 +23,7 @@ def time_step(hook, time, step_size, restart, **kwargs): hook.add_to_stats(**base_values, time=time + step_size, value=not restart, type='end') if restart: - hook._hooks__num_restarts += 1 + hook._Hooks__num_restarts += 1 for t in [time, time + step_size]: hook.add_to_stats(process=-1, time=t, level=-1, iter=-1, sweep=-1, type='_recomputed', value=restart) From 7d405e4cb339e19332f57fd9aacfebac7ecb15c9 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sun, 23 Jun 2024 13:12:28 +0200 Subject: [PATCH 33/38] TL: minimum version for qmat dependencies --- docs/contrib/06_new_project.md | 2 +- etc/environment-base.yml | 2 +- etc/environment-cupy.yml | 2 +- etc/environment-fenics.yml | 2 +- etc/environment-mpi4py.yml | 2 +- etc/environment-petsc.yml | 2 +- etc/environment-postprocess.yml | 2 +- etc/environment-pytorch.yml | 2 +- pySDC/projects/AllenCahn_Bayreuth/environment.yml | 2 +- pySDC/projects/AsympConv/environment.yml | 2 +- pySDC/projects/DAE/environment.yml | 2 +- pySDC/projects/FastWaveSlowWave/environment.yml | 2 +- pySDC/projects/Monodomain/etc/environment-monodomain.yml | 2 +- pySDC/projects/PinTSimE/environment.yml | 2 +- pySDC/projects/RDC/environment.yml | 2 +- pySDC/projects/Resilience/environment.yml | 2 +- pySDC/projects/SDC_showdown/environment.yml | 2 +- pySDC/projects/Second_orderSDC/environment.yml | 2 +- pySDC/projects/TOMS/environment.yml | 2 +- pySDC/projects/matrixPFASST/environment.yml | 2 +- pySDC/projects/parallelSDC/environment.yml | 2 +- pySDC/projects/parallelSDC_reloaded/environment.yml | 2 +- pySDC/projects/soft_failure/environment.yml | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/contrib/06_new_project.md b/docs/contrib/06_new_project.md index c146978453..2da72b0cf6 100644 --- a/docs/contrib/06_new_project.md +++ b/docs/contrib/06_new_project.md @@ -27,7 +27,7 @@ dependencies: - numpy - pip - pip: - - qmat + - qmat>=0.1.8 ``` The list of dependencies can be extended as needed. diff --git a/etc/environment-base.yml b/etc/environment-base.yml index 54c2abf0bd..55abf2baed 100644 --- a/etc/environment-base.yml +++ b/etc/environment-base.yml @@ -13,4 +13,4 @@ dependencies: - dill>=0.2.6 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/etc/environment-cupy.yml b/etc/environment-cupy.yml index 0a28d63deb..452c6abef6 100644 --- a/etc/environment-cupy.yml +++ b/etc/environment-cupy.yml @@ -12,4 +12,4 @@ dependencies: - cupy - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/etc/environment-fenics.yml b/etc/environment-fenics.yml index 05c2384b6a..e2ddd7727f 100644 --- a/etc/environment-fenics.yml +++ b/etc/environment-fenics.yml @@ -13,4 +13,4 @@ dependencies: - mpi4py<=3.1.4 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/etc/environment-mpi4py.yml b/etc/environment-mpi4py.yml index 58768c81b6..a7a5e8c8a4 100644 --- a/etc/environment-mpi4py.yml +++ b/etc/environment-mpi4py.yml @@ -14,4 +14,4 @@ dependencies: - mpi4py>=3.0.0 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/etc/environment-petsc.yml b/etc/environment-petsc.yml index 0bb86d0ab1..b3d53907e1 100644 --- a/etc/environment-petsc.yml +++ b/etc/environment-petsc.yml @@ -14,4 +14,4 @@ dependencies: - mpi4py>=3.0.0 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/etc/environment-postprocess.yml b/etc/environment-postprocess.yml index 19dba4a93d..a9e0b910af 100644 --- a/etc/environment-postprocess.yml +++ b/etc/environment-postprocess.yml @@ -18,4 +18,4 @@ dependencies: - sphinxemoji - m2r2 - genbadge[all] - - qmat + - qmat>=0.1.8 diff --git a/etc/environment-pytorch.yml b/etc/environment-pytorch.yml index 17ca25fd70..9d2ba5a5f5 100644 --- a/etc/environment-pytorch.yml +++ b/etc/environment-pytorch.yml @@ -15,4 +15,4 @@ dependencies: - mpi4py>=3.0.0 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/AllenCahn_Bayreuth/environment.yml b/pySDC/projects/AllenCahn_Bayreuth/environment.yml index 18e59ac6be..8c114708a6 100644 --- a/pySDC/projects/AllenCahn_Bayreuth/environment.yml +++ b/pySDC/projects/AllenCahn_Bayreuth/environment.yml @@ -12,4 +12,4 @@ dependencies: - scipy>=0.17.1 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/AsympConv/environment.yml b/pySDC/projects/AsympConv/environment.yml index 814c66afd0..11f38f94e0 100644 --- a/pySDC/projects/AsympConv/environment.yml +++ b/pySDC/projects/AsympConv/environment.yml @@ -10,4 +10,4 @@ dependencies: - dill>=0.2.6 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/DAE/environment.yml b/pySDC/projects/DAE/environment.yml index 5d64e524b5..5d9ae0b474 100644 --- a/pySDC/projects/DAE/environment.yml +++ b/pySDC/projects/DAE/environment.yml @@ -12,4 +12,4 @@ dependencies: - mpi4py>=3.0.0 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/FastWaveSlowWave/environment.yml b/pySDC/projects/FastWaveSlowWave/environment.yml index ea2a42c5b0..8da5a7868d 100644 --- a/pySDC/projects/FastWaveSlowWave/environment.yml +++ b/pySDC/projects/FastWaveSlowWave/environment.yml @@ -12,4 +12,4 @@ dependencies: - dill>=0.2.6 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/Monodomain/etc/environment-monodomain.yml b/pySDC/projects/Monodomain/etc/environment-monodomain.yml index 052df2cda1..378f1acb11 100644 --- a/pySDC/projects/Monodomain/etc/environment-monodomain.yml +++ b/pySDC/projects/Monodomain/etc/environment-monodomain.yml @@ -26,4 +26,4 @@ dependencies: - pymp-pypi - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/PinTSimE/environment.yml b/pySDC/projects/PinTSimE/environment.yml index a94bb461c7..da97bfa7da 100644 --- a/pySDC/projects/PinTSimE/environment.yml +++ b/pySDC/projects/PinTSimE/environment.yml @@ -11,4 +11,4 @@ dependencies: - matplotlib>=3.0 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/RDC/environment.yml b/pySDC/projects/RDC/environment.yml index 8140822e75..7d40d111b5 100644 --- a/pySDC/projects/RDC/environment.yml +++ b/pySDC/projects/RDC/environment.yml @@ -10,4 +10,4 @@ dependencies: - scipy>=0.17.1 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/Resilience/environment.yml b/pySDC/projects/Resilience/environment.yml index 40bfcc572f..dd58fde82d 100644 --- a/pySDC/projects/Resilience/environment.yml +++ b/pySDC/projects/Resilience/environment.yml @@ -13,4 +13,4 @@ dependencies: - scipy>=0.17.1 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/SDC_showdown/environment.yml b/pySDC/projects/SDC_showdown/environment.yml index 9201700950..7b0014ddd4 100644 --- a/pySDC/projects/SDC_showdown/environment.yml +++ b/pySDC/projects/SDC_showdown/environment.yml @@ -11,4 +11,4 @@ dependencies: - scipy>=0.17.1 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/Second_orderSDC/environment.yml b/pySDC/projects/Second_orderSDC/environment.yml index e11459ea30..ee4966f2c4 100644 --- a/pySDC/projects/Second_orderSDC/environment.yml +++ b/pySDC/projects/Second_orderSDC/environment.yml @@ -12,4 +12,4 @@ dependencies: - scipy>=0.17.1 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/TOMS/environment.yml b/pySDC/projects/TOMS/environment.yml index e7c13c518f..d08675599f 100644 --- a/pySDC/projects/TOMS/environment.yml +++ b/pySDC/projects/TOMS/environment.yml @@ -10,4 +10,4 @@ dependencies: - scipy>=0.17.1 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/matrixPFASST/environment.yml b/pySDC/projects/matrixPFASST/environment.yml index 9e86ee48bd..e9bb1ca1c3 100644 --- a/pySDC/projects/matrixPFASST/environment.yml +++ b/pySDC/projects/matrixPFASST/environment.yml @@ -10,4 +10,4 @@ dependencies: - dill>=0.2.6 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/parallelSDC/environment.yml b/pySDC/projects/parallelSDC/environment.yml index a335f3d4ca..8427129ee9 100644 --- a/pySDC/projects/parallelSDC/environment.yml +++ b/pySDC/projects/parallelSDC/environment.yml @@ -13,4 +13,4 @@ dependencies: - mpi4py>=3.0.0 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/parallelSDC_reloaded/environment.yml b/pySDC/projects/parallelSDC_reloaded/environment.yml index d4c58801c3..5202baed8c 100644 --- a/pySDC/projects/parallelSDC_reloaded/environment.yml +++ b/pySDC/projects/parallelSDC_reloaded/environment.yml @@ -11,4 +11,4 @@ dependencies: - scipy>=0.17.1 - pip - pip: - - qmat + - qmat>=0.1.8 diff --git a/pySDC/projects/soft_failure/environment.yml b/pySDC/projects/soft_failure/environment.yml index c1751d170a..837e1653e4 100644 --- a/pySDC/projects/soft_failure/environment.yml +++ b/pySDC/projects/soft_failure/environment.yml @@ -11,4 +11,4 @@ dependencies: - matplotlib>=3.0 - pip - pip: - - qmat + - qmat>=0.1.8 From 105bfd3ed54b7ba28d5f849c33b06c9aead748b0 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Sun, 23 Jun 2024 13:57:55 +0200 Subject: [PATCH 34/38] TL: minor fixes --- pySDC/core/collocation.py | 2 +- pySDC/projects/Hamiltonian/environment.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pySDC/core/collocation.py b/pySDC/core/collocation.py index 34f75596f6..9895392d16 100644 --- a/pySDC/core/collocation.py +++ b/pySDC/core/collocation.py @@ -29,7 +29,7 @@ class CollBase(object): boundary) and LOBATTO (inclusion of left and right boundary). All coefficients are generated using - `qmat `_. + `qmat `_. Attributes: num_nodes (int): number of collocation nodes diff --git a/pySDC/projects/Hamiltonian/environment.yml b/pySDC/projects/Hamiltonian/environment.yml index b9ddea64df..d544fdccc8 100644 --- a/pySDC/projects/Hamiltonian/environment.yml +++ b/pySDC/projects/Hamiltonian/environment.yml @@ -11,4 +11,4 @@ dependencies: - scipy>=0.17.1 - pip - pip: - - qmat + - qmat>=0.1.8 From 69b17bf23adff805d0960a6826f6458fb2cbf2ad Mon Sep 17 00:00:00 2001 From: Robert Speck Date: Mon, 24 Jun 2024 07:37:09 +0200 Subject: [PATCH 35/38] Update collocation.py --- pySDC/core/collocation.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pySDC/core/collocation.py b/pySDC/core/collocation.py index 9895392d16..5cc2fd07af 100644 --- a/pySDC/core/collocation.py +++ b/pySDC/core/collocation.py @@ -12,17 +12,17 @@ class CollBase(object): It can be used to produce many kind of quadrature nodes from various distribution (awesome!). - It is based on the two main parameters that define the nodes : + It is based on the two main parameters that define the nodes: - - node_type : the node distribution used for the collocation method - - quad_type : the type of quadrature used (inclusion of not of boundary) + - node_type: the node distribution used for the collocation method + - quad_type: the type of quadrature used (inclusion of not of boundary) Current implementation provides the following available parameter values - for node_type : + for node_type: - - EQUID : equidistant node distribution - - LEGENDRE : distribution from Legendre polynomials - - CHEBY-{1,2,3,4} : distribution from Chebyshev polynomials of a given kind + - EQUID: equidistant node distribution + - LEGENDRE: distribution from Legendre polynomials + - CHEBY-{1,2,3,4}: distribution from Chebyshev polynomials of a given kind The type of quadrature can be GAUSS (only inner nodes), RADAU-LEFT (inclusion of the left boundary), RADAU-RIGHT (inclusion of the right From c36dee97dfc6ddc7a97db0b2d1d2ab3c1a038548 Mon Sep 17 00:00:00 2001 From: Robert Speck Date: Mon, 24 Jun 2024 07:37:58 +0200 Subject: [PATCH 36/38] Update collocation.py --- pySDC/core/collocation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pySDC/core/collocation.py b/pySDC/core/collocation.py index 5cc2fd07af..ec9ce238d8 100644 --- a/pySDC/core/collocation.py +++ b/pySDC/core/collocation.py @@ -65,7 +65,7 @@ def __init__(self, num_nodes=None, tleft=0, tright=1, node_type='LEGENDRE', quad nNodes=num_nodes, nodeType=node_type, quadType=quad_type, tLeft=tleft, tRight=tright ) except Exception as e: - raise CollocationError(f"could not instantiate qmat generator, got error : {e}") + raise CollocationError(f"could not instantiate qmat generator, got error: {e}") # Set base attributes self.num_nodes = num_nodes @@ -89,7 +89,7 @@ def __init__(self, num_nodes=None, tleft=0, tright=1, node_type='LEGENDRE', quad S = np.zeros([num_nodes + 1, num_nodes + 1], dtype=float) S[1:, 1:] = super(self.generator.__class__, self.generator).S - # Note : qmat redefines the S matrix for collocation with integrals, + # Note: qmat redefines the S matrix for collocation with integrals, # instead of differences of the Q matrix coefficients. # This does not passes the pySDC tests ... however the default S computation # in qmat uses Q matrix coefficients differences, and that's what we From 9647731e9545c2748b18bb69d5b821543f4c631a Mon Sep 17 00:00:00 2001 From: Robert Speck Date: Mon, 24 Jun 2024 07:38:28 +0200 Subject: [PATCH 37/38] Update sweeper.py --- pySDC/core/sweeper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySDC/core/sweeper.py b/pySDC/core/sweeper.py index f040d59786..2f65ee445e 100644 --- a/pySDC/core/sweeper.py +++ b/pySDC/core/sweeper.py @@ -24,7 +24,7 @@ def __init__(self, pars): class Sweeper(object): """ - Base abstract sweeper class, provides two base methods to generate QDelta matrices : + Base abstract sweeper class, provides two base methods to generate QDelta matrices: - get_Qdelta_implicit(qd_type): Returns a (pySDC-type) QDelta matrix of **implicit type**, From 97fc219ab67f3513045df6ebde32f691f3dcd4c7 Mon Sep 17 00:00:00 2001 From: Thibaut Lunet Date: Mon, 24 Jun 2024 09:20:46 +0200 Subject: [PATCH 38/38] TL: minor corrections following @pancetta's comments --- CONTRIBUTING.md | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 05dbbc3bae..a3e3e92088 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ Finally, while `pySDC` provides many base functionalities that implement classic This follows a specific OOP framework, you can look at the page on [custom implementations](./docs/contrib/04_custom_implementations.md) for more details. Additional guideline are also given on how to [document the code](./docs/contrib/05_documenting_code.md) in `pySDC`. > 📣 Some core components (collocation matrix, $Q-\Delta$ coefficients, Lagrange barycentric interpolation) -> are currently implemented and developed in the [`qmat` companion package](https://github.com/Parallel-in-Time/qmat). +> are implemented and developed in the [`qmat` companion package](https://github.com/Parallel-in-Time/qmat). > Checkout its own [contributing guide](https://qmat.readthedocs.io/en/latest/contributing.html) > to add any new coefficient / feature on this part. diff --git a/pyproject.toml b/pyproject.toml index b750977ef8..b6016027e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ dependencies = [ 'sympy>=1.0', 'numba>=0.35', 'dill>=0.2.6', - 'qmat', + 'qmat>=0.1.8', ] [project.urls]