Implemented in solpo.py, this class handles steady-state boundary value problems where the system has reached a state of equilibrium under an external driving force scipy.sparse.kron) and directly solves the static system across an spsolve). The script also features an automated system that reads the raw Python code of the input function and translates it into formal
Implemented in solhe.py, this class simulates how thermal energy diffuses through a two-dimensional medium over time under a diffusion coefficient
Implemented in solwe.py, this class models the physical propagation of displacement waves (such as ripples on a surface) through a dynamic spatial domain. It solves a second-order time-stepping scheme using a leap-frog integration style, meaning it references both the current and previous time steps to compute the system's acceleration. A key feature of this class is its capability to enforce zero-boundary Dirichlet conditions across irregular, non-rectangular spaces by applying custom geometric masks (such as a circle or ellipse) directly to the flattened grid at every step of the simulation loop.
Generating high-resolution 2D contours and 3D surface frames over long time series creates a severe bottleneck when executed sequentially on a single CPU core. To bypass this, the framework parallelizes frame rendering across an arbitrary pool of worker threads using joblib.Parallel.
[Time Steps 1...T] ──> [Joblib Parallel Pool] ──> [Asynchronous Worker Cores]
│
[Saved Video] <── [FFmpeg Libx264 Engine] <── [Target Output Directory (.png)]
The rendering environment uses a headless backend (matplotlib.use('Agg')) to generate and serialize individual frames concurrently. Once the frame sequence is complete, ffmpeg compiles the files directly into a single video asset via native command execution:
-vf "scale={width}:{height}:flags=lanczos": Re-samples dimensions to satisfy strict H.264 even-pixel constraints while applying high-quality Lanczos sinc filtering to eliminate spatial aliasing in dynamic gradients.-c:v libx264 -crf 18: Invokes the H.264 encoder at a Constant Rate Factor of 18, delivering visually lossless output by dynamically adjusting spatial compression ratios relative to frame-to-frame motion deltas.-pix_fmt yuv420p: Transcodes arrays into standard 4:2:0 planar chroma subsampling to guarantee native playback compatibility inside downstream IPython notebook display engines.
Evaluating a standard five-point central finite difference scheme across a continuous 2D spatial domain using nested scalar loops incurs an inefficient
Where
[1D Finite Difference Stencil] [2D Sparsity Matrix Structure]
[ -1 4 -1 ] [ D -I 0 0 ] where D contains
[-I D -I 0 ] the main 1D diagonal
[ 0 -I D -I ] and -I defines the
[ 0 0 -I D ] spatial grid coupling
Because an CSR) schema using scipy.sparse, tracking only non-zero coordinates (rows, cols, values).
This structural optimization dramatically accelerates performance:
-
Dynamic Evolutionary Systems (Parabolic/Hyperbolic Solvers): Explicit time-dependent integration steps collapse into optimized sparse matrix-vector products (
L @ v[t-1, :]), reducing processing time to linear complexity$\mathcal{O}(n^2)$ within cache memory. -
Static Equilibrium Systems (Elliptic Solver): The zero-order system
$L u = f$ is passed directly toscipy.sparse.linalg.spsolve. It bypasses slow, iterative relaxation methods (e.g., Jacobi or Gauss-Seidel) by performing direct SuperLU sparse LU factorization, computing the complete global solution instantly.