Basic Finite Differences

Spatial and temporal grid discretization of differential operators for numerical physics simulations.

1. Domain Discretization and Differential Operators

In continuum physics, conservation laws (mass, momentum, thermal energy, electromagnetism) are formulated via Partial Differential Equations (PDEs). Unlike ODEs, PDEs govern scalar or vector fields u(x⃗,t)u(\vec{x}, t) distributed over both space and time.

The Finite Difference Method (FDM) replaces continuous derivatives with discrete difference quotients evaluated over a structured grid. For a one-dimensional spatial domain of length LL over duration TT:

xi=iΔx,i=0,1,…,Nx,Δx=LNxx_i = i \Delta x, \quad i = 0, 1, \dots, N_x, \quad \Delta x = \frac{L}{N_x} tn=nΔt,n=0,1,…,Nt,Δt=TNtt_n = n \Delta t, \quad n = 0, 1, \dots, N_t, \quad \Delta t = \frac{T}{N_t}

The discrete grid approximation to the true continuous solution at node ii and time step nn is written: uin≈u(xi,tn)u_i^n \approx u(x_i, t_n)


2. Finite Difference Formulas via Taylor Expansions

Expanding u(x±Δx)u(x \pm \Delta x) in Taylor series:

u(x+Δx)=u(x)+Δx∂u∂x+Δx22∂2u∂x2+Δx36∂3u∂x3+O(Δx4)u(x + \Delta x) = u(x) + \Delta x \frac{\partial u}{\partial x} + \frac{\Delta x^2}{2} \frac{\partial^2 u}{\partial x^2} + \frac{\Delta x^3}{6} \frac{\partial^3 u}{\partial x^3} + \mathcal{O}(\Delta x^4) u(x−Δx)=u(x)−Δx∂u∂x+Δx22∂2u∂x2−Δx36∂3u∂x3+O(Δx4)u(x - \Delta x) = u(x) - \Delta x \frac{\partial u}{\partial x} + \frac{\Delta x^2}{2} \frac{\partial^2 u}{\partial x^2} - \frac{\Delta x^3}{6} \frac{\partial^3 u}{\partial x^3} + \mathcal{O}(\Delta x^4)

Yields standard finite-difference stencils:

  1. Forward Difference: ∂u∂x∣i=ui+1−uiΔx+O(Δx)\left.\frac{\partial u}{\partial x}\right|_i = \frac{u_{i+1} - u_i}{\Delta x} + \mathcal{O}(\Delta x)
  2. Backward Difference: ∂u∂x∣i=ui−ui−1Δx+O(Δx)\left.\frac{\partial u}{\partial x}\right|_i = \frac{u_i - u_{i-1}}{\Delta x} + \mathcal{O}(\Delta x)
  3. Central Difference: ∂u∂x∣i=ui+1−ui−12Δx+O(Δx2)\left.\frac{\partial u}{\partial x}\right|_i = \frac{u_{i+1} - u_{i-1}}{2 \Delta x} + \mathcal{O}(\Delta x^2)
  4. Second-Order Central Spatial Difference: ∂2u∂x2∣i=ui+1−2ui+ui−1Δx2+O(Δx2)\left.\frac{\partial^2 u}{\partial x^2}\right|_i = \frac{u_{i+1} - 2u_i + u_{i-1}}{\Delta x^2} + \mathcal{O}(\Delta x^2)

3. The 1D Diffusion / Heat Equation and the Explicit FTCS Scheme

The canonical homogeneous heat conduction equation is: ∂u∂t=α∂2u∂x2\frac{\partial u}{\partial t} = \alpha \frac{\partial^2 u}{\partial x^2} where α\alpha denotes thermal diffusivity ([m2/s][\text{m}^2/\text{s}]).

Discretizing using forward differences in time and central differences in space yields the FTCS (Forward-Time Central-Space) scheme: uin+1−uinΔt=αui+1n−2uin+ui−1nΔx2\frac{u_i^{n+1} - u_i^n}{\Delta t} = \alpha \frac{u_{i+1}^n - 2u_i^n + u_{i-1}^n}{\Delta x^2}

Solving explicitly for the future state uin+1u_i^{n+1}: uin+1=uin+r(ui+1n−2uin+ui−1n)u_i^{n+1} = u_i^n + r \left(u_{i+1}^n - 2u_i^n + u_{i-1}^n\right) with dimensionless diffusion parameter: r=αΔtΔx2r = \frac{\alpha \Delta t}{\Delta x^2}


4. Von Neumann Stability Analysis

Von Neumann stability examines the temporal amplification of individual Fourier spatial harmonics: uin=Gneikxi=Gneik(iΔx)u_i^n = G^n e^{i k x_i} = G^n e^{i k (i \Delta x)} where GG is the amplification factor and kk is the spatial wave number. Scheme stability requires that rounding and truncation perturbations do not grow exponentially: ∣G∣≤1,∀k|G| \le 1, \quad \forall k

Substituting into the FTCS equation: Gn+1eikiΔx=GneikiΔx[1+r(eikΔx−2+e−ikΔx)]G^{n+1} e^{i k i \Delta x} = G^n e^{i k i \Delta x} \left[1 + r \left(e^{i k \Delta x} - 2 + e^{-i k \Delta x}\right)\right] G=1+2r(cos⁡(kΔx)−1)=1−4rsin⁡2(kΔx2)G = 1 + 2r(\cos(k \Delta x) - 1) = 1 - 4r \sin^2\left(\frac{k \Delta x}{2}\right)

Setting ∣G∣≤1|G| \le 1: −1≤1−4rsin⁡2(kΔx2)≤1-1 \le 1 - 4r \sin^2\left(\frac{k \Delta x}{2}\right) \le 1 At the worst-case wavenumber mode where sin⁡2(kΔx/2)=1\sin^2(k \Delta x / 2) = 1: −1≤1−4r  ⟹  4r≤2  ⟹  r=αΔtΔx2≤12-1 \le 1 - 4r \implies 4r \le 2 \implies r = \frac{\alpha \Delta t}{\Delta x^2} \le \frac{1}{2}

Severe Physical Implication:

Refining spatial grid resolution by half (Δx→Δx/2\Delta x \to \Delta x/2) forces a four-fold reduction in maximum allowable timestep Δt\Delta t: Δt≤Δx22α\Delta t \le \frac{\Delta x^2}{2\alpha}


5. 1D Wave Equation and the CFL Condition

For mechanical or electromagnetic waves traveling in 1D: ∂2u∂t2=c2∂2u∂x2\frac{\partial^2 u}{\partial t^2} = c^2 \frac{\partial^2 u}{\partial x^2} Approximating both second derivatives using central stencils: uin+1−2uin+uin−1Δt2=c2ui+1n−2uin+ui−1nΔx2\frac{u_i^{n+1} - 2u_i^n + u_i^{n-1}}{\Delta t^2} = c^2 \frac{u_{i+1}^n - 2u_i^n + u_{i-1}^n}{\Delta x^2}

Isolating uin+1u_i^{n+1}: uin+1=2uin−uin−1+C2(ui+1n−2uin+ui−1n)u_i^{n+1} = 2u_i^n - u_i^{n-1} + C^2 \left(u_{i+1}^n - 2u_i^n + u_{i-1}^n\right) where CC is the dimensionless Courant Number: C=cΔtΔxC = \frac{c \Delta t}{\Delta x}

Courant-Friedrichs-Lewy (CFL) Condition:

Stability holds if and only if: C=cΔtΔx≤1C = \frac{c \Delta t}{\Delta x} \le 1 Geometric / Physical Insight: The numerical numerical domain of dependence must fully enclose the physical characteristic domain of dependence (the wave light-cone). When C>1C > 1, physical signals propagate across cells faster than the discrete grid transfers data, triggering catastrophic blow-up.


6. Implicit Schemes and Crank-Nicolson

To eliminate the quadratic timestep barrier Δt∼Δx2\Delta t \sim \Delta x^2 in diffusive physics, implicit algorithms are deployed. The Crank-Nicolson scheme averages spatial second-derivatives between time levels nn and n+1n+1:

uin+1−uinΔt=α2[ui+1n+1−2uin+1+ui−1n+1Δx2+ui+1n−2uin+ui−1nΔx2]\frac{u_i^{n+1} - u_i^n}{\Delta t} = \frac{\alpha}{2} \left[\frac{u_{i+1}^{n+1} - 2u_i^{n+1} + u_{i-1}^{n+1}}{\Delta x^2} + \frac{u_{i+1}^n - 2u_i^n + u_{i-1}^n}{\Delta x^2}\right]

  • Accuracy: Second-order in both time and space O(Δt2+Δx2)\mathcal{O}(\Delta t^2 + \Delta x^2).
  • Stability: Unconditionally stable for all Δt>0\Delta t > 0 (∣G∣≤1|G| \le 1 universally).
  • Computational Cost: Requires solving a tridiagonal linear system at each step via the Thomas algorithm.

Protocol for Discretizing and Solving PDEs with Finite Differences

Systematic Numerical Methodology

Solving an Initial Boundary Value Problem (IBVP) modeled by PDEs using finite differences requires a structured five-stage protocol:


Step 1: Computational Domain Discretization

  1. Define the spatial domain [0,L][0, L] and target simulation window [0,T][0, T].
  2. Choose spatial discretization count NxN_x, yielding cell width Δx=L/Nx\Delta x = L / N_x.
  3. Establish coordinate array xi=iΔxx_i = i \Delta x across indices i=0,1,…,Nxi = 0, 1, \dots, N_x.

Step 2: Timestep Selection Governed by Stability Constraints

  • Parabolic PDEs (Heat / Diffusion): Δt≤Δx22α  ⟹  r=αΔtΔx2≤0.5\Delta t \le \frac{\Delta x^2}{2 \alpha} \implies r = \frac{\alpha \Delta t}{\Delta x^2} \le 0.5 Standard operational practice adopts a safety factor, e.g., r=0.4r = 0.4.
  • Hyperbolic PDEs (Wave Equations): Δt≤Δxc  ⟹  C=cΔtΔx≤1.0\Delta t \le \frac{\Delta x}{c} \implies C = \frac{c \Delta t}{\Delta x} \le 1.0 Operational practice adopts C=0.8−0.9C = 0.8 - 0.9.

Step 3: Imposing Initial Conditions (t = 0)

  1. Sample initial continuous profiles at node locations: ui0=f(xi),∀i=0,1,…,Nxu_i^0 = f(x_i), \quad \forall i = 0, 1, \dots, N_x
  2. For second-order time systems (wave equation) requiring u˙(x,0)=g(x)\dot{u}(x, 0) = g(x), employ a Taylor fictitious backward step to launch step n=1n = 1: ui1=ui0+Δt g(xi)+C22(ui+10−2ui0+ui−10)u_i^1 = u_i^0 + \Delta t \, g(x_i) + \frac{C^2}{2} (u_{i+1}^0 - 2u_i^0 + u_{i-1}^0)

Step 4: Imposing Boundary Conditions (BCs)

At each time step nn, evaluate endpoints i=0i = 0 and i=Nxi = N_x:

  • Dirichlet Boundary Conditions (Clamped values): u0n=Uleft,uNxn=Urightu_0^n = U_{\text{left}}, \quad u_{N_x}^n = U_{\text{right}}
  • Neumann Boundary Conditions (Prescribed flux / Adiabatic walls ∂u/∂x=0\partial u / \partial x = 0): Deploy a ghost node u−1nu_{-1}^n: u1n−u−1n2Δx=0  ⟹  u−1n=u1n\frac{u_1^n - u_{-1}^n}{2 \Delta x} = 0 \implies u_{-1}^n = u_1^n Injecting into the internal stencil at i=0i = 0: u0n+1=u0n+2r(u1n−u0n)u_0^{n+1} = u_0^n + 2r (u_1^n - u_0^n)

Step 5: Time Marching and Field Update

  1. Across iterations n=0,1,…,Nt−1n = 0, 1, \dots, N_t - 1:
    • Apply the numerical stencil to all internal nodes i=1,2,…,Nx−1i = 1, 2, \dots, N_x - 1.
    • Overwrite boundary points according to active BCs.
    • Advance array buffers (un←un+1u^n \leftarrow u^{n+1}).
  2. Perform periodic telemetry checks (total thermal energy, acoustic energy, mass conservation).

Worked Examples: Heat Conduction and 1D Wave Propagation

Example 1: Transient Thermal Diffusion Along a Metallic Rod

Consider a conductive metal rod of length L=1.0 mL = 1.0\text{ m} with thermal diffusivity α=1.0 m2/s\alpha = 1.0\text{ m}^2/\text{s}. Boundary ends are held at constant zero temperature: u(0,t)=0,u(1,t)=0u(0, t) = 0, \quad u(1, t) = 0 Initial sinusoidal temperature distribution: u(x,0)=100sin⁡(πx)u(x, 0) = 100 \sin(\pi x) The exact analytical Fourier series solution is: uexact(x,t)=100e−π2αtsin⁡(πx)u_{\text{exact}}(x, t) = 100 e^{-\pi^2 \alpha t} \sin(\pi x)

Numerical Grid Discretization:

  • Subdivide rod into Nx=4N_x = 4 uniform cells   ⟹  Δx=0.25 m\implies \Delta x = 0.25\text{ m}.
  • Spatial nodes:
    • x0=0.0x_0 = 0.0, x1=0.25x_1 = 0.25, x2=0.50x_2 = 0.50, x3=0.75x_3 = 0.75, x4=1.0x_4 = 1.0.
  • Initial nodal state vector at t=0t = 0:
    • u00=0u_0^0 = 0
    • u10=100sin⁡(π/4)=70.7107u_1^0 = 100 \sin(\pi/4) = 70.7107
    • u20=100sin⁡(π/2)=100.0000u_2^0 = 100 \sin(\pi/2) = 100.0000
    • u30=100sin⁡(3π/4)=70.7107u_3^0 = 100 \sin(3\pi/4) = 70.7107
    • u40=0u_4^0 = 0

Select stable diffusion parameter r=αΔtΔx2=0.40≤0.5r = \frac{\alpha \Delta t}{\Delta x^2} = 0.40 \le 0.5. Timestep: Δt=rΔx2α=0.40×(0.25)2/1.0=0.025 s\Delta t = r \frac{\Delta x^2}{\alpha} = 0.40 \times (0.25)^2 / 1.0 = 0.025\text{ s}.

First Step Computation (n=0→n=1n = 0 \to n = 1, t=0.025 st = 0.025\text{ s}):

Applying FTCS update ui1=ui0+0.4(ui+10−2ui0+ui−10)u_i^1 = u_i^0 + 0.4 (u_{i+1}^0 - 2u_i^0 + u_{i-1}^0):

  • Node 1 (x1=0.25x_1 = 0.25): u11=70.7107+0.4[100.0000−2(70.7107)+0.0]=54.1421u_1^1 = 70.7107 + 0.4 [100.0000 - 2(70.7107) + 0.0] = 54.1421

  • Node 2 (x2=0.50x_2 = 0.50): u21=100.0000+0.4[70.7107−2(100.0000)+70.7107]=76.5685u_2^1 = 100.0000 + 0.4 [70.7107 - 2(100.0000) + 70.7107] = 76.5685

  • Node 3 (x3=0.75x_3 = 0.75): By physical symmetry: u31=u11=54.1421u_3^1 = u_1^1 = 54.1421.

Comparison with Exact Benchmark at t=0.025 st = 0.025\text{ s}:

uexact(0.5,0.025)=100e−π2(1.0)(0.025)sin⁡(π/2)=100e−0.246740=78.1343u_{\text{exact}}(0.5, 0.025) = 100 e^{-\pi^2 (1.0)(0.025)} \sin(\pi / 2) = 100 e^{-0.246740} = 78.1343 Even on an ultra-coarse grid with only 4 cells, the discrete estimate (76.568576.5685) achieves a relative error of only 2.0%2.0\%.


Example 2: Pulse Propagation Along a Taut String (1D Wave Equation)

Consider a vibrating string with length L=1 mL = 1\text{ m}, propagation velocity c=1 m/sc = 1\text{ m/s}, and pinned ends u(0,t)=u(1,t)=0u(0, t) = u(1, t) = 0. Initial triangular plucked state starting from rest (g(x)=0g(x) = 0):

  • Nx=4  ⟹  Δx=0.25 mN_x = 4 \implies \Delta x = 0.25\text{ m}.
  • Courant number set to the magic stability limit C=cΔtΔx=1.0  ⟹  Δt=0.25 sC = \frac{c \Delta t}{\Delta x} = 1.0 \implies \Delta t = 0.25\text{ s}.

Base state at t=0t = 0: u0=[0.0, 0.5, 1.0, 0.5, 0.0]u^0 = [0.0, \, 0.5, \, 1.0, \, 0.5, \, 0.0]

Initial launch step (g=0g = 0): ui1=ui0+C22(ui+10−2ui0+ui−10)=12(ui+10+ui−10)u_i^1 = u_i^0 + \frac{C^2}{2}(u_{i+1}^0 - 2u_i^0 + u_{i-1}^0) = \frac{1}{2}(u_{i+1}^0 + u_{i-1}^0)

  • u11=12(1.0+0.0)=0.5u_1^1 = \frac{1}{2}(1.0 + 0.0) = 0.5
  • u21=12(0.5+0.5)=0.5u_2^1 = \frac{1}{2}(0.5 + 0.5) = 0.5
  • u31=12(0.0+1.0)=0.5u_3^1 = \frac{1}{2}(0.0 + 1.0) = 0.5 Array at t=0.25 st = 0.25\text{ s}: u1=[0.0, 0.5, 0.5, 0.5, 0.0]u^1 = [0.0, \, 0.5, \, 0.5, \, 0.5, \, 0.0].

Second step (t=0.50 st = 0.50\text{ s}): ui2=2ui1−ui0+(ui+11−2ui1+ui−11)=ui+11+ui−11−ui0u_i^2 = 2u_i^1 - u_i^0 + (u_{i+1}^1 - 2u_i^1 + u_{i-1}^1) = u_{i+1}^1 + u_{i-1}^1 - u_i^0

  • u12=0.5+0.0−0.5=0.0u_1^2 = 0.5 + 0.0 - 0.5 = 0.0
  • u22=0.5+0.5−1.0=0.0u_2^2 = 0.5 + 0.5 - 1.0 = 0.0
  • u32=0.0+0.5−0.5=0.0u_3^2 = 0.0 + 0.5 - 0.5 = 0.0 Array at t=0.50 st = 0.50\text{ s}: u2=[0.0, 0.0, 0.0, 0.0, 0.0]u^2 = [0.0, \, 0.0, \, 0.0, \, 0.0, \, 0.0]. Because C=1.0C = 1.0 matches the characteristic grid rays, D'Alembert wave splitting occurs without numerical dispersion or artificial numerical damping.

Common Pitfalls in Finite Differences and PDE Solvers

1. Violating the CFL or von Neumann Stability Threshold

  • Pitfall: Halving the spatial grid spacing Δx\Delta x to achieve finer spatial resolution while keeping timestep Δt\Delta t constant.
  • Consequence: In diffusive problems, the ratio r=αΔt/Δx2r = \alpha \Delta t / \Delta x^2 quadruples. Once r>0.5r > 0.5, amplification factor ∣G∣>1|G| > 1, triggering rapid numerical blow-up with NaN or inf outputs.
  • Remedy: Automatically adapt Δt\Delta t dynamically whenever the spatial grid is altered to enforce r≤0.5r \le 0.5 or C≤1.0C \le 1.0.

2. Using First-Order Approximations for Neumann Boundary Conditions

  • Pitfall: Discretizing insulating wall boundary condition ∂u/∂x=0\partial u / \partial x = 0 as a one-sided forward difference u1−u0Δx=0  ⟹  u0=u1\frac{u_1 - u_0}{\Delta x} = 0 \implies u_0 = u_1.
  • Consequence: This injects an O(Δx)\mathcal{O}(\Delta x) first-order truncation error at the boundary that diffuses inward, degrading the second-order accuracy of the interior grid.
  • Remedy: Implement ghost nodes with second-order central stencils O(Δx2)\mathcal{O}(\Delta x^2): u−1=u1u_{-1} = u_1.

3. Conflating Physical Dissipation with Artificial Numerical Diffusion

  • Pitfall: Adopting first-order upwind stencils for advection or acoustic wave transport.
  • Consequence: Leading truncation error behaves mathematically as an artificial diffusion coefficient proportional to Δx2(1−C)\frac{\Delta x}{2}(1 - C), excessively blurring peaks and dispersing wavepackets.
  • Remedy: Deploy second-order centered stencils (such as Lax-Wendroff) or high-resolution TVD (Total Variation Diminishing) limiters.

4. Believing Stability Guarantees Convergence Without Consistency

  • Pitfall: Assuming that because an algorithm executes without numeric overflow, it converges to the true physical solution.
  • Consequence: By Lax's Equivalence Theorem, stability guarantees convergence if and only if the discrete stencil is consistent (local truncation error vanishes as Δx,Δt→0\Delta x, \Delta t \to 0). Inconsistent stencils compute mathematically invalid states.
  • Remedy: Prove Taylor-expansion consistency analytically before programming numerical equations.

5. Mismanaging Discontinuities and Shock Fronts

  • Pitfall: Applying linear centered difference stencils across shock waves or sharp contact discontinuities.
  • Consequence: Severe Gibbs-type numerical ringing and spurious oscillations pollute the solutions upstream and downstream of the shock.
  • Remedy: Formulate equations in conservative divergence form and apply flux limiters or Godunov-type Riemann solvers.

Physical Applications of Basic Finite Differences

1. Transient Thermal Conduction in Materials and Cryogenics

In mechanical engineering and solid-state physics, spatial temperature distributions across structural components, nuclear fuel rods, and semiconductor dies are computed via 2D/3D finite differences: ρcp∂T∂t=∇⃗⋅(k∇⃗T)+Q(x⃗,t)\rho c_p \frac{\partial T}{\partial t} = \vec{\nabla} \cdot (k \vec{\nabla} T) + Q(\vec{x}, t) Discretization captures transient thermal stress in spacecraft heat shields, microprocessor heatsinks, and liquid-helium cryostats cooling superconducting MRI magnets.


2. Room Acoustics and Computational Seismology

In geophysics, tectonic earthquakes propagate elastic PP-waves and SS-waves through heterogeneous geological strata, simulated using time-domain finite differences (FDTD): ρ∂2u⃗∂t2=(λ+μ)∇⃗(∇⃗⋅u⃗)+μ∇2u⃗\rho \frac{\partial^2 \vec{u}}{\partial t^2} = (\lambda + \mu) \vec{\nabla}(\vec{\nabla} \cdot \vec{u}) + \mu \nabla^2 \vec{u} These models forecast ground shake intensity for civil engineering and optimize acoustic reflection in architectural concert hall designs.


3. Computational Electromagnetics (The Yee FDTD Algorithm)

Kane Yee's FDTD formulation discretizes Maxwell's curl equations by staggering electric E⃗\vec{E} and magnetic H⃗\vec{H} field components across interlocking spatial grids: ∇⃗×E⃗=−∂B⃗∂t,∇⃗×H⃗=J⃗+∂D⃗∂t\vec{\nabla} \times \vec{E} = -\frac{\partial \vec{B}}{\partial t}, \quad \vec{\nabla} \times \vec{H} = \vec{J} + \frac{\partial \vec{D}}{\partial t} This algorithm serves as the primary tool for modeling 5G/6G antennas, radar cross-sections, dielectric waveguides, and photonic crystal bandgaps.


4. Time-Dependent Schrödinger Equation in Quantum Systems

In condensed matter physics and quantum device modeling, electron wavepacket tunneling across potential barriers is computed via: iℏ∂ψ∂t=−ℏ22m∂2ψ∂x2+V(x)ψi \hbar \frac{\partial \psi}{\partial t} = -\frac{\hbar^2}{2m} \frac{\partial^2 \psi}{\partial x^2} + V(x) \psi The implicit Crank-Nicolson method is universally adopted here because its unitary Cayley operator strictly conserves total probability ∫∣ψ∣2dx=1\int |\psi|^2 dx = 1.


5. Hydrodynamic Contaminant Advection-Diffusion Transport

In environmental fluid dynamics and oceanography, chemical dispersion through groundwater aquifers, rivers, or the atmosphere couples velocity advection with turbulent diffusion: ∂C∂t+v⃗⋅∇⃗C=D∇2C+S\frac{\partial C}{\partial t} + \vec{v} \cdot \vec{\nabla} C = D \nabla^2 C + S Finite difference models predict contaminant plume migration following industrial spills, oil leaks, or urban particulate pollution dispersion.

Practice Problems: Finite Differences and Grid Stability

Problem 1: Catastrophic Instability from Diffusion Boundary Violation

A 1D thermal simulation with diffusivity α=2.0×10−4 m2/s\alpha = 2.0 \times 10^{-4}\text{ m}^2/\text{s} uses cell size Δx=0.01 m\Delta x = 0.01\text{ m}.

  1. Find the critical timestep Δtcrit\Delta t_{\text{crit}} above which explicit FTCS becomes unstable.
  2. If an operator mistakenly runs the code with Δt=0.3 s\Delta t = 0.3\text{ s}, demonstrate using von Neumann amplification what happens to the highest spatial frequency mode (kΔx=πk \Delta x = \pi).

Step-by-Step Solution:

  1. Stability requires: r=αΔtΔx2≤0.5r = \frac{\alpha \Delta t}{\Delta x^2} \le 0.5 Δtcrit=Δx22α=(0.01)22(2.0×10−4)=0.25 s\Delta t_{\text{crit}} = \frac{\Delta x^2}{2 \alpha} = \frac{(0.01)^2}{2(2.0 \times 10^{-4})} = 0.25\text{ s}
  2. At Δt=0.3 s\Delta t = 0.3\text{ s}: r=(2.0×10−4)(0.3)10−4=0.60>0.50r = \frac{(2.0 \times 10^{-4})(0.3)}{10^{-4}} = 0.60 > 0.50 The amplification factor for the grid Nyquist mode (kΔx=πk \Delta x = \pi) is: G=1−4rsin⁡2(π/2)=1−4(0.60)(1)=−1.40G = 1 - 4r \sin^2(\pi / 2) = 1 - 4(0.60)(1) = -1.40 Since ∣G∣=1.40>1|G| = 1.40 > 1, this mode grows in amplitude by 40%40\% per timestep with alternating signs:
    • After 10 steps: factor of (1.40)10≈28.9(1.40)^{10} \approx 28.9.
    • After 50 steps: factor of (1.40)50≈1.8×107(1.40)^{50} \approx 1.8 \times 10^7. The field degenerates into an unphysical high-frequency zigzag blowup.

Problem 2: Insulated Wall Implementation via Ghost Nodes

On a thermal rod of length L=0.5 mL = 0.5\text{ m}, the left boundary x=0x = 0 is thermally insulated (zero heat flux): ∂u∂x∣x=0=0\left.\frac{\partial u}{\partial x}\right|_{x=0} = 0

  1. Utilizing a second-order central difference stencil with fictitious ghost node x−1=−Δxx_{-1} = -\Delta x, derive the update formula for boundary temperature u0n+1u_0^{n+1}.
  2. Given Δx=0.1 m\Delta x = 0.1\text{ m}, α=1 m2/s\alpha = 1\text{ m}^2/\text{s}, Δt=0.004 s\Delta t = 0.004\text{ s}, with current values u0n=100∘Cu_0^n = 100^\circ\text{C} and u1n=90∘Cu_1^n = 90^\circ\text{C}, compute u0n+1u_0^{n+1}.

Step-by-Step Solution:

  1. Centered Neumann boundary condition: u1n−u−1n2Δx=0  ⟹  u−1n=u1n\frac{u_1^n - u_{-1}^n}{2 \Delta x} = 0 \implies u_{-1}^n = u_1^n Standard internal stencil applied at i=0i = 0: u0n+1=u0n+r(u1n−2u0n+u−1n)u_0^{n+1} = u_0^n + r (u_1^n - 2u_0^n + u_{-1}^n) Substituting ghost node identity: u0n+1=u0n+2r(u1n−u0n)u_0^{n+1} = u_0^n + 2r (u_1^n - u_0^n)
  2. Parameter rr: r=(1)(0.004)(0.1)2=0.40r = \frac{(1)(0.004)}{(0.1)^2} = 0.40 Update: u0n+1=100+2(0.40)(90−100)=100−8.0=92.0∘Cu_0^{n+1} = 100 + 2(0.40)(90 - 100) = 100 - 8.0 = 92.0^\circ\text{C} Boundary temperature cools as heat conducts into the colder adjacent internal node.

Problem 3: Numerical Dispersion in Acoustic Wavefields

An acoustic solver with speed of sound c=340 m/sc = 340\text{ m/s} runs with Δx=0.1 m\Delta x = 0.1\text{ m} and Δt=0.0002 s\Delta t = 0.0002\text{ s}.

  1. Verify if the CFL condition is satisfied.
  2. Explain why operating at a Courant number substantially below 1 (e.g., C=0.3C = 0.3) induces artificial numerical dispersion that distorts sharp wavefronts.

Step-by-Step Solution:

  1. Courant number: C=cΔtΔx=(340)(0.0002)0.1=0.68≤1.0C = \frac{c \Delta t}{\Delta x} = \frac{(340)(0.0002)}{0.1} = 0.68 \le 1.0 The solver is unconditionally bounded and stable.
  2. When C<1C < 1, the discrete numerical dispersion relation deviates from the linear physical law ω=ck\omega = ck: sin⁡(ωnumΔt2)=Csin⁡(kΔx2)\sin\left(\frac{\omega_{\text{num}} \Delta t}{2}\right) = C \sin\left(\frac{k \Delta x}{2}\right) Consequently, numerical phase velocity vphase=ωnum/kv_{\text{phase}} = \omega_{\text{num}} / k becomes wavenumber-dependent. Short wavelengths lag behind long wavelengths, generating spurious oscillations trailing shock or impulse fronts. Only at C=1.0C = 1.0 is numerical dispersion identically zero in 1D.