Class AbstractEquationSolver<E extends Equation>

java.lang.Object
by.andd3dfx.math.pde.solver.AbstractEquationSolver<E>
Type Parameters:
E - the type of equation this solver handles
All Implemented Interfaces:
EquationSolver<E>
Direct Known Subclasses:
HyperbolicEquationSolver, ParabolicEquationSolver

public abstract class AbstractEquationSolver<E extends Equation> extends Object implements EquationSolver<E>
Abstract base class for partial differential equation solvers. Provides common functionality and utility methods used by specific equation solvers. Implements the core numerical methods and algorithms shared across different types of PDE solvers.
See Also:
  • Constructor Details

    • AbstractEquationSolver

      public AbstractEquationSolver()
  • Method Details

    • buildArea

      protected Area buildArea(Equation eqn, double h, double tau)
      Builds a space-time computational domain for the equation solution. Creates a grid with specified spatial and temporal step sizes.
      Parameters:
      eqn - the equation to solve
      h - spatial step size (must be positive)
      tau - temporal step size (must be positive)
      Returns:
      the computational domain with defined grid points
      Throws:
      IllegalArgumentException - if parameters h or tau are non-positive
    • prepare

      protected Matrix2D prepare(Equation eqn, Area area)
      Initializes the solution matrix with initial conditions. Creates a matrix to store the solution and sets the initial values based on the equation's initial condition.
      Parameters:
      eqn - the equation to solve
      area - the computational domain where solution will be found
      Returns:
      initialized matrix with initial conditions
    • solve3DiagonalEquationsSystem

      public static double[] solve3DiagonalEquationsSystem(double[] A, double[] B, double[] C, double[] F, AbstractEquationSolver.KappaNu leftCond, AbstractEquationSolver.KappaNu rightCond)
      Solves a tridiagonal system of linear algebraic equations using the Thomas algorithm. The system has the form: A[i]*y[i-1] - C[i]*y[i] + B[i]*y[i+1] = -F[i], 0<i<N

      The algorithm consists of two phases:

      1. Forward phase: computes coefficients Alpha[i] and Beta[i]
      2. Backward phase: computes the solution Y[i]

      Variable notations follow "Tikhonov, Samarskii - Equations of Mathematical Physics", p.590-592

      Parameters:
      A - coefficients for y[i-1] terms
      B - coefficients for y[i+1] terms
      C - coefficients for y[i] terms
      F - right-hand side terms
      leftCond - left boundary condition parameters
      rightCond - right boundary condition parameters
      Returns:
      solution vector Y[i]
      Throws:
      IllegalArgumentException - if arrays have different lengths or invalid coefficients
    • calcKappaNu

      protected AbstractEquationSolver.KappaNu calcKappaNu(BorderCondition borderCondition, double h, double time)
      Calculates Kappa and Nu parameters for the tridiagonal algorithm based on boundary conditions. These parameters are used to incorporate different types of boundary conditions into the solution.
      Parameters:
      borderCondition - the boundary condition to process
      h - spatial step size
      time - current time point
      Returns:
      KappaNu record containing calculated parameters
      Throws:
      IllegalStateException - if an unsupported boundary condition type is encountered