Skip to content

qttools.boundary_conditions.boundary_system#

source module qttools.boundary_conditions.boundary_system

Classes

  • IdentityCompressor Identity cache compressor that does not perform any compression.

  • BaseBoundarySystem Abstract base class to solve boundary systems with memoization and system reduction.

source class IdentityCompressor()

Identity cache compressor that does not perform any compression.

Methods

  • compress Compress the data to be cached. In this case, it simply returns the input as is.

  • decompress Decompress the cached data. In this case, it simply returns the input as is.

source method IdentityCompressor.compress(x: NDArray)

Compress the data to be cached. In this case, it simply returns the input as is.

Parameters

  • x : NDArray The data to be compressed.

  • Returns

  • -------

  • compressed_x : NDArray The compressed data, which is the same as the input in this case, but potentially copied to ensure immutability.

source method IdentityCompressor.decompress(x: NDArray)

Decompress the cached data. In this case, it simply returns the input as is.

Parameters

  • x : NDArray The data to be decompressed.

  • Returns

  • -------

  • decompressed_x : NDArray The decompressed data, which is the same as the input in this case.

source class BaseBoundarySystem(boundary_solver, cache_compressor: None = None, system_reducer: SystemReducer | None = None, num_ref_iterations: int = 2, relative_tol: float = 0.2, absolute_tol: float = 1e-06, warning_threshold: float = 0.1, memoization_mode: str = 'auto', agreement_threshold: float = 0.999)

Bases : ABC

Abstract base class to solve boundary systems with memoization and system reduction.

Initializes the boundary method.

Parameters

  • boundary_solver : callable The boundary system solver to be memoized.

  • cache_compressor : object, optional An object with 'compress' and 'decompress' methods to handle cache compression. If None, no compression is applied.

  • num_ref_iterations : int, optional The number of fixed-point iterations to refine the solution. Default is 2.

  • relative_tol : float, optional The relative tolerance for convergence. Default is 0.2.

  • absolute_tol : float, optional The absolute tolerance for convergence. Default is 1e-6.

  • warning_threshold : float, optional The threshold for issuing a warning about high residuals. Default is 0.1.

  • memoization_mode : str, optional The memoization mode. Can be 'off', 'auto', 'force-after-first', or 'force'. Default is 'auto'.

  • agreement_threshold : float, optional The threshold for agreement across MPI ranks to consider a memoized solution valid. Default is 0.999.