See: Description
| Class | Description |
|---|---|
| CrankNicolsonHeatEquation1D |
The Crank-Nicolson method is an algorithm for obtaining a numerical solution
to parabolic PDE problems.
|
| CrankNicolsonHeatEquation1D.Coefficients |
Gets the coefficients of a discretized 1D heat equation for each time
step.
|
| HeatEquation1D |
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\).
|
HeatEquation1D
with diffusivity, interval length, terminal time, initial profile and both boundary functions.CrankNicolsonHeatEquation1D.PDESolutionTimeSpaceGrid1D
at integer grid indices and use t(m)/x(n) for physical coordinates.The model is \(u_t=\beta u_{xx}\). Diffusivity uses length-squared/time units; space, time and all boundary functions must use consistent units. At the left boundary the derivative term has a minus sign; at the right it has a plus sign. Setting c1/c2 to zero gives fixed values, while setting them to one gives Neumann derivative conditions. Check compatibility with the initial profile.
For M time intervals and N interior spatial points, \(\Delta t=T/M\) and \(\Delta x=a/(N+1)\). Use M at least one and N at least two for this implementation. Time index zero is the initial profile; spatial solution values exist only at indices 1 through N. Boundary coordinates are available, but accessing their solution values raises UnsupportedOperationException.
Start with the sine-decay and insulated-constant examples. Check a known solution, then refine space and time for the actual problem. Second-order formal accuracy assumes sufficient regularity; implicit time stepping does not remove spatial error or guarantee nonnegative values on coarse grids.
Copyright © 2010-2026 NM Group. All Rights Reserved.