# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.analysis.differentialequation.pde.finitedifference.parabolic.dim1.heatequation

## Class HeatEquation1D

• java.lang.Object
• com.numericalmethod.suanshu.analysis.differentialequation.pde.finitedifference.parabolic.dim1.heatequation.HeatEquation1D
• All Implemented Interfaces:
PDE

public class HeatEquation1D
extends Object
implements PDE
A one-dimensional heat equation (or diffusion equation) is a parabolic PDE that takes the following form. $\frac{\partial u}{\partial t} = \beta \frac{\partial^2 u}{\partial x^2},$ The initial condition has this form: $u(0,x) = f(x), 0 < x < a$ The mixed boundary conditions have this form: $(1-c_1)u(t,0) - c_1\frac{\partial u}{\partial x}(t,0) = g_1(t), \\ (1-c_2)u(t,a) + c_2\frac{\partial u}{\partial x}(t,a) = g_2(t)$ where $$0 \leq c_k \leq 1, k = 1, 2$$.
Wikipedia: Parabolic partial differential equation, Wikipedia: Heat equation
• ### Constructor Summary

Constructors
Constructor and Description
HeatEquation1D(double beta, double a, double T, UnivariateRealFunction f, double c1, UnivariateRealFunction g1, double c2, UnivariateRealFunction g2)
Constructs a heat equation problem.
• ### Method Summary

All Methods
Modifier and Type Method and Description
double a()
Gets the size of the one-dimensional space, that is, the range of x, (0 < x < a).
double beta()
Gets β in the equation (also called thermal diffusivity in case of the heat equation).
double c1()
Gets the coefficient c1 in the mixed boundary condition at the boundary x = 0.
double c2()
Gets the coefficient c2 in the mixed boundary condition at the boundary x = a.
double f(double x)
Gets the initial condition of u at the given position x.
double g2(double t)
Gets the value of the linear combination of $$u$$ and $$\frac{\partial u}{\partial x}$$ at the boundary $$x = a$$ at the given time $$t$$.
double T()
Gets the time period of interest, that is, the range of t, (0 < t < T).
• ### Methods inherited from class java.lang.Object

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

• #### HeatEquation1D

public HeatEquation1D(double beta,
double a,
double T,
UnivariateRealFunction f,
double c1,
UnivariateRealFunction g1,
double c2,
UnivariateRealFunction g2)
Constructs a heat equation problem.
Parameters:
beta - the beta in the equation
a - the region of interest (0, a)
T - the time period of interest (0, T)
f - the initial condition of u, i.e., u(0,x)
c1 - the coefficient in the mixed boundary condition at x = 0
g1 - the mixed boundary condition at x = 0
c2 - the coefficient in the mixed boundary condition at x = a
g2 - the mixed boundary condition at x = a
• ### Method Detail

• #### beta

public double beta()
Gets β in the equation (also called thermal diffusivity in case of the heat equation).
Returns:
β
• #### a

public double a()
Gets the size of the one-dimensional space, that is, the range of x, (0 < x < a).
Returns:
the size of the space
• #### T

public double T()
Gets the time period of interest, that is, the range of t, (0 < t < T).
Returns:
the time period of interest
• #### f

public double f(double x)
Gets the initial condition of u at the given position x.
Parameters:
x - the position
Returns:
u(0, x)
• #### c1

public double c1()
Gets the coefficient c1 in the mixed boundary condition at the boundary x = 0. $(1-c_1)u(t,0) - c_1\frac{\partial u}{\partial x}(t,0) = g_1(t)$ where $$0 \leq c_1 \leq 1$$. If $$c_1 = 0$$, this is the Dirichlet boundary condition. If $$c_1 = 1$$, this is the Neumann boundary condition.
Returns:
the coefficient c1
• #### c2

public double c2()
Gets the coefficient c2 in the mixed boundary condition at the boundary x = a. $(1-c_2)u(t,a) + c_2\frac{\partial u}{\partial x}(t,a) = g_2(t)$ where $$0 \leq c_2 \leq 1$$. If $$c_2 = 0$$, this is the Dirichlet boundary condition. If $$c_2 = 1$$, this is the Neumann boundary condition.
Returns:
the coefficient c2
• #### g2

public double g2(double t)
Gets the value of the linear combination of $$u$$ and $$\frac{\partial u}{\partial x}$$ at the boundary $$x = a$$ at the given time $$t$$. $(1-c_2)u(t,a) + c_2\frac{\partial u}{\partial x}(t,a) = g_2(t)$
Parameters:
t - the time
Returns:
$$g_2(t)$$