Class Equation

java.lang.Object
by.andd3dfx.math.pde.equation.Equation
Direct Known Subclasses:
HyperbolicEquation, ParabolicEquation

public abstract class Equation extends Object
Abstract base class representing a second-order partial differential equation. The equation has the general form:

M(x,t,U)*∂²U/∂t² + L(x,t,U)*∂U/∂t = ∂U( K(x,t,U)*∂U/∂x )/∂x + V(x,t,U)*∂U/∂x + F(x,t,U)

where U = U(x,t) is the unknown function.

The equation is defined on a space-time domain [x1,x2]×[0,t2] with boundary conditions specified on the left and right boundaries. This class provides default implementations for the coefficient functions that can be overridden by specific equation types.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Equation(double x1, double x2, double t2, BorderCondition leftBorderCondition, BorderCondition rightBorderCondition)
    Creates a new partial differential equation with specified domain and boundary conditions.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    gF(double x, double t, double U)
    Returns the source term F(x,t,U) of the equation.
    double
    gK(double x, double t, double U)
    Returns the coefficient K(x,t,U) of the second-order space derivative term.
    double
    gL(double x, double t, double U)
    Returns the coefficient L(x,t,U) of the first-order time derivative term.
    double
    gM(double x, double t, double U)
    Returns the coefficient M(x,t,U) of the second-order time derivative term.
    double
    gU0(double x)
    Returns the initial condition U(x) at time t = 0.
    double
    gV(double x, double t, double U)
    Returns the coefficient V(x,t,U) of the first-order space derivative term.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Equation

      public Equation(double x1, double x2, double t2, BorderCondition leftBorderCondition, BorderCondition rightBorderCondition)
      Creates a new partial differential equation with specified domain and boundary conditions.
      Parameters:
      x1 - left boundary of the spatial domain
      x2 - right boundary of the spatial domain
      t2 - right boundary of the temporal domain
      leftBorderCondition - boundary condition at x = x1
      rightBorderCondition - boundary condition at x = x2
      Throws:
      IllegalArgumentException - if x1 >= x2 or t2 <= 0
  • Method Details

    • gU0

      public double gU0(double x)
      Returns the initial condition U(x) at time t = 0. This method should be overridden by specific equation types to provide the actual initial condition.
      Parameters:
      x - spatial coordinate
      Returns:
      initial value U(x,0)
    • gM

      public double gM(double x, double t, double U)
      Returns the coefficient M(x,t,U) of the second-order time derivative term. This coefficient represents the mass or inertia term in the equation. The default implementation returns 0, which should be overridden for equations containing second-order time derivatives.
      Parameters:
      x - spatial coordinate
      t - time coordinate
      U - value of the solution at (x,t)
      Returns:
      coefficient M(x,t,U)
    • gL

      public double gL(double x, double t, double U)
      Returns the coefficient L(x,t,U) of the first-order time derivative term. This coefficient represents damping or dissipation in the equation. The default implementation returns 0, which should be overridden for equations containing first-order time derivatives.
      Parameters:
      x - spatial coordinate
      t - time coordinate
      U - value of the solution at (x,t)
      Returns:
      coefficient L(x,t,U)
    • gK

      public double gK(double x, double t, double U)
      Returns the coefficient K(x,t,U) of the second-order space derivative term. This coefficient represents diffusion or conductivity in the equation. The default implementation returns 1, which should be overridden for equations with variable diffusion coefficients.
      Parameters:
      x - spatial coordinate
      t - time coordinate
      U - value of the solution at (x,t)
      Returns:
      coefficient K(x,t,U)
    • gV

      public double gV(double x, double t, double U)
      Returns the coefficient V(x,t,U) of the first-order space derivative term. This coefficient represents convection or advection in the equation. The default implementation returns 0, which should be overridden for equations containing convective terms.
      Parameters:
      x - spatial coordinate
      t - time coordinate
      U - value of the solution at (x,t)
      Returns:
      coefficient V(x,t,U)
    • gF

      public double gF(double x, double t, double U)
      Returns the source term F(x,t,U) of the equation. This term represents external forces or sources in the equation. The default implementation returns 0, which should be overridden for equations containing source terms.
      Parameters:
      x - spatial coordinate
      t - time coordinate
      U - value of the solution at (x,t)
      Returns:
      source term F(x,t,U)