All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----jDisco.Linkage | +----jDisco.Link | +----jDisco.Continuous | +----jDisco.PDEVariable
The class is designed mainly for the solution of nonlinear parabolic initial value problems in one space dimension within a limited interval, xLeft <= x <= xRight. Solution of hyperbolic and elliptic problems may also be attempted.
A PDEVariable-object represents a variable, u(t,x), that varies according to a partial differential equation of the following form:
du/dt = f(t, x,u, du/dx, 1/xc * d/dx(xc * D * du/dx))This equation represents the coupled system of partial differential equations, where u is a vector and xLeft < x < xRight.
At the left boundary, x = xLeft, the boundary condition is characterised as follows:
b1Left * u(t,x) + b2Left * du/dx = b3LeftAt the right boundary, x = xRight, the boundary condition is characterised as follows:
b1Right * u(t,x) + b2Right * du/dx = b3RightThe initial condition (at t = t0) is characterised as follows:
u(t0,x) = g(x)The 'diffusion coefficient', D, in the equation above is a function of t, x, and u. c is 0, 1, or 2, depending on whether the problem is Cartesian, cylindrical, or spherical, respectively. The 'left boundary coefficients', b1Left, beLeft, and b3Left, may be functions of t, x, and u. If b1Left and b2Left are both zero, the following condition is used at the left boundary:
du(t,xLeft)/dt = b3LeftThe same is true for the 'right boundary coefficients', b1Right, beRight, and b3Right.
The partial diffeerntial equations are expressed by the user in subclasses of class PDEVariable by overriding the method rate. The two independent variables are denoted by t() and x(). The initial and boundary conditions are specified by overriding the methods initialState, b1Left, b2Left, b3Left, b1Right,b2Right, and b3Right. The diffusion coefficient is specified by overriding the method D.
The equations are solved using the so-called 'method of lines' in which the spatial variable, x, is "discretized", while the time variable, t = time, remains "continuous". Roughly speaking, the method can be described as follows. If one has a time dependent partial differential equation and discretizes the spatial variable, a semi-discrete approximating system of 'ordinary' differential equations results. One then uses an ordinary differential equation integration method, for example the Runge-Kutta-Fehlberg method, for solving the resulting equations to obtain numerical approximations to the original partial differential equation.
The user specifies a spatial mesh consisting of a given number equidistant points between xLeft and xRight. This information is passed to the constructor of PDEVariable, which splits the partial differential equations into a system of approximating ordinary differential.
An example:
Consider the following partial differential equation:
du/dt = -u * du/dx + x * d/dx(u * du/dx) + tfor x between xLeft = 0 and xRight = 1, and for t beween 0 and 1.2. Further, assume the initial condition
u(0,x) = xand the non-linear boundary conditions
u(t,xLeft) = = 50 du(t,xRight)/dt = du(t,1)/dt = 1 - sin(u(t,1))A complete jDisco-program for solving this problem is given below.
import jDisco.*; import jDisco.Process; public class PDEExample extends Process { PDEVariable u;The design and implementation of class PDEVariable has been inspired by the Fortran subroutine PDEONE.
class U extends PDEVariable { U(double xLeft, double xRight, int nPoints) { super(xLeft, xRight, nPoints); } public double rate() { return -state() * dx() + x() * ddx() + t(); } public double D() { return state(); } public double initialState() { return x(); } public double b1Left() { return 1; } public double b3Left() { return 50; } public double b1Right() { return 1; } public double b3Right() { return 1 - Math.sin(state()); } }
public void actions() { dtMin = 1.0e-5; dtMax = 1.0; maxAbsError = maxRelError = 1.0e-4; u = new U(0, 1, 21); u.start(); hold(1.2); u.show(); }
public static void main(String[] args) { activate(new PDEExample()); } }
Reference:
Sincovec, R.F and Madsen, N.K.:
"Software for Nonlinear Partial Differential Equations".
ACM Transactions on Mathematical Software,
Vol. 1, No. 3, September 1975, pp. 232-260 and 261-263.
public int c
public PDEVariable(double xLeft, double xRight, int nPoints)
public abstract double rate()
public double initialState()
public double D()
public double b1Left()
public double b1Right()
public double b2Left()
public double b2Right()
public double b3Left()
public double b3Right()
public final double state()
public final double leftState()
public final double rightState()
public final double dx()
public final double ddx()
public final double d2x()
public final double x()
public final double t()
public jDisco.Continuous start()
public void stop()
public jDisco.Head points()
public void print(java.lang.String heading)
public void print()
public void show(java.lang.String title)
public void show()
protected final void derivatives()
All Packages Class Hierarchy This Package Previous Next Index