Skip to content

boundary_system#

Includes abstract boundary condition classes.

Classes:

  • IdentityCompressor

    Identity cache compressor that does not perform any compression.

  • BaseBoundarySystem

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

IdentityCompressor #

Identity cache compressor that does not perform any compression.

Methods:

compress #

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.

decompress #

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.

BaseBoundarySystem #

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.

Parameters:

  • boundary_solver (callable) –

    The boundary system solver to be memoized.

  • cache_compressor (object, default: None ) –

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

  • num_ref_iterations (int, default: 2 ) –

    The number of fixed-point iterations to refine the solution. Default is 2.

  • relative_tol (float, default: 0.2 ) –

    The relative tolerance for convergence. Default is 0.2.

  • absolute_tol (float, default: 1e-06 ) –

    The absolute tolerance for convergence. Default is 1e-6.

  • warning_threshold (float, default: 0.1 ) –

    The threshold for issuing a warning about high residuals. Default is 0.1.

  • memoization_mode (str, default: 'auto' ) –

    The memoization mode. Can be 'off', 'auto', 'force-after-first', or 'force'. Default is 'auto'.

  • agreement_threshold (float, default: 0.999 ) –

    The threshold for agreement across MPI ranks to consider a memoized solution valid. Default is 0.999.

Methods:

  • __call__

    Solve the boundary system with memoization and system reduction.

__call__ #

__call__(boundary_system: tuple[NDArray, ...], contact: str, **kwargs) -> tuple[NDArray, NDArray, NDArray | tuple[NDArray, ...]]

Solve the boundary system with memoization and system reduction.

This is a wrapper around the boundary system solver

Parameters:

  • boundary_system (tuple[NDArray, ...]) –

    The boundary system to solve.

  • contact (str) –

    The contact to which the boundary system belongs.

  • **kwargs

    Additional arguments to pass to the boundary system solver. Mostly for the injection vectors in case of OBCs / QTBM.

Returns:

  • solution ( NDArray | tuple[NDArray, ...] ) –

    The solution of the boundary system.

  • rel_residuals ( NDArray ) –

    The relative residuals of the solution.

  • abs_residuals ( NDArray ) –

    The absolute residuals of the solution.