Skip to content

andrei-punko/pde-solvers

Repository files navigation

Partial differential equations solvers library

Java CI with Gradle Coverage Branches Javadoc

A library for numerical solution of partial differential equations (PDE) using finite difference method and Thomas algorithm

Features

Solution of parabolic equations of the form:

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 (temperature, concentration, etc)

Solution of hyperbolic equations of the form:

M(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 (displacement of string, etc)

Support for various boundary conditions:

  • Dirichlet (function value at the boundary)
  • Neumann (derivative value at the boundary)
  • Robin (linear combination of function value and its derivative)

Efficient numerical methods:

  • Finite difference method for derivative approximation
  • Thomas algorithm for solving tridiagonal systems of linear equations

Prerequisites

  • JDK 21
  • Gradle (embedded in the project)

Building the project

./gradlew clean build

Generating documentation

./gradlew clean javadoc

Check build/doc/javadoc folder
Online documentation is available here

Supported equation types

Parabolic equations

ParabolicEquation.java

  • Describes diffusion, heat conduction, and other dissipative processes
  • Characterized by the presence of only first-order time derivative
  • Solution is defined on the space-time domain [x1,x2]×[0,t2]

Hyperbolic equations

HyperbolicEquation.java

  • Describes wave processes and oscillations
  • Characterized by the presence of second-order time derivative
  • Solution is defined on the space-time domain [x1,x2]×[0,t2]

Boundary conditions

Dirichlet (definite mode)

BorderCondition1.java

  • Specifies function value at the boundary: U(x1,t) = g1(t) or U(x2,t) = g2(t)

Neumann (definite force)

BorderCondition2.java

  • Specifies derivative value at the boundary: ∂U/∂x(x1,t) = g1(t) or ∂U/∂x(x2,t) = g2(t)

Robin (elastic fixing)

BorderCondition3.java

  • Specifies linear combination of function value and its derivative: ∂U/∂x(x1,t) = h*(U(x1,t) - Theta(t)) or ∂U/∂x(x2,t) = h*(U(x2,t) - Theta(t))

Solution methods

Finite difference method

  • Approximates derivatives using finite differences
  • Transforms PDE into a system of linear equations
  • Uses the Thomas algorithm to solve the resulting system

Thomas algorithm

  • Efficient algorithm for solving tridiagonal systems of linear equations
  • Time complexity O(n), where n is the system size

Library usage examples

Parabolic equations

Hyperbolic equations

Solution utilities

Making new library release on GitHub

See instruction

Video with description of the project

YouTube link

License

MIT License