---
id: wiki-2026-0508-partial-differential-equations
title: Partial Differential Equations
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [PDE, Distributed Parameter Systems]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [pde, numerical-methods, scientific-computing, pinn]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: Python
  framework: FEniCSx/JAX/PyTorch
---

# Partial Differential Equations

## 매 한 줄
> **"매 multivariable function 의 partial derivative relations"**. 매 PDE는 매 fluid (Navier-Stokes), heat, wave, elasticity, EM (Maxwell), QM (Schrödinger), finance (Black-Scholes) 의 universal language, 매 2026 numerical solving은 매 FDM/FEM/FVM/spectral + PINN/Neural Operator (FNO, DeepONet) 의 hybrid 시대.

## 매 핵심

### 매 분류 (2nd order linear)
- B² - 4AC 로:
  - **Elliptic** (<0): Laplace ∇²u=0, Poisson — equilibrium.
  - **Parabolic** (=0): heat uₜ = α∇²u — diffusion.
  - **Hyperbolic** (>0): wave uₜₜ = c²∇²u — propagation.

### 매 well-posed (Hadamard)
- Existence, uniqueness, continuous dependence on data.
- Boundary conditions: Dirichlet, Neumann, Robin.

### 매 numerical methods
- **FDM**: structured grid, easy, low geometry flexibility.
- **FEM**: weak form, complex geometry, h/p refinement.
- **FVM**: conservation laws (CFD).
- **Spectral**: smooth solutions, exponential convergence.
- **PINN (2026)**: NN minimizing PDE residual, mesh-free, inverse problems.
- **Neural Operator**: FNO/DeepONet learn solution operator.

### 매 응용
1. CFD (aerospace, weather).
2. Heat transfer / thermal analysis.
3. Structural mechanics.
4. EM simulation (CST, COMSOL).
5. Option pricing (Black-Scholes PDE).
6. Diffusion models (LLM/image gen with score-PDE).

## 💻 패턴

### 1D Heat Equation — explicit FDM
```python
import numpy as np
def heat_explicit(u0, alpha, dx, dt, T):
    r = alpha*dt/dx**2
    assert r <= 0.5, "CFL violated"
    u = u0.copy(); steps = int(T/dt)
    for _ in range(steps):
        u[1:-1] = u[1:-1] + r*(u[2:] - 2*u[1:-1] + u[:-2])
    return u
```

### Crank-Nicolson (implicit, 2nd order)
```python
from scipy.sparse import diags
from scipy.sparse.linalg import spsolve
def crank_nicolson(u0, alpha, dx, dt, T):
    n = len(u0); r = alpha*dt/(2*dx**2)
    A = diags([-r, 1+2*r, -r], [-1,0,1], shape=(n-2, n-2)).tocsc()
    B = diags([ r, 1-2*r,  r], [-1,0,1], shape=(n-2, n-2))
    u = u0.copy()
    for _ in range(int(T/dt)):
        u[1:-1] = spsolve(A, B @ u[1:-1])
    return u
```

### 2D Poisson via FEM (FEniCSx)
```python
from dolfinx import mesh, fem
from ufl import TrialFunction, TestFunction, dx, grad, inner
import numpy as np
domain = mesh.create_unit_square(MPI.COMM_WORLD, 64, 64)
V = fem.FunctionSpace(domain, ("Lagrange", 1))
u, v = TrialFunction(V), TestFunction(V)
f = fem.Constant(domain, 1.0)
a = inner(grad(u), grad(v))*dx
L = f*v*dx
bc = fem.dirichletbc(0.0, ..., V)
problem = fem.petsc.LinearProblem(a, L, bcs=[bc])
uh = problem.solve()
```

### 1D Wave — leapfrog
```python
def wave_leapfrog(u0, v0, c, dx, dt, T):
    r = c*dt/dx
    assert r <= 1, "CFL"
    u_prev = u0.copy()
    u = u0 + dt*v0  # half-step init
    steps = int(T/dt)
    for _ in range(steps):
        u_next = 2*u[1:-1] - u_prev[1:-1] + r**2*(u[2:] - 2*u[1:-1] + u[:-2])
        u_prev[1:-1] = u[1:-1]; u[1:-1] = u_next
    return u
```

### PINN for Burgers' equation
```python
import torch, torch.nn as nn
class PINN(nn.Module):
    def __init__(self):
        super().__init__()
        self.net = nn.Sequential(
            nn.Linear(2,64), nn.Tanh(), nn.Linear(64,64), nn.Tanh(),
            nn.Linear(64,64), nn.Tanh(), nn.Linear(64,1))
    def forward(self, xt): return self.net(xt)

def pde_residual(model, xt, nu=0.01/np.pi):
    xt.requires_grad_(True)
    u = model(xt)
    grads = torch.autograd.grad(u, xt, torch.ones_like(u), create_graph=True)[0]
    u_x, u_t = grads[:,0:1], grads[:,1:2]
    u_xx = torch.autograd.grad(u_x, xt, torch.ones_like(u_x), create_graph=True)[0][:,0:1]
    return u_t + u*u_x - nu*u_xx
# Loss = MSE(pde_residual) + MSE(IC) + MSE(BC); Adam optimize.
```

### Fourier Neural Operator (FNO, 2026)
```python
import torch, torch.nn as nn
class SpectralConv1d(nn.Module):
    def __init__(self, in_ch, out_ch, modes):
        super().__init__()
        self.modes = modes
        self.weight = nn.Parameter(torch.randn(in_ch, out_ch, modes, dtype=torch.cfloat)*0.02)
    def forward(self, x):  # x: (B, C, N)
        N = x.size(-1)
        x_ft = torch.fft.rfft(x)
        out_ft = torch.zeros(x.size(0), self.weight.size(1), N//2+1, dtype=torch.cfloat, device=x.device)
        out_ft[..., :self.modes] = torch.einsum("bcm,com->bom", x_ft[..., :self.modes], self.weight)
        return torch.fft.irfft(out_ft, n=N)
```

## 매 결정 기준
| 상황 | Approach |
|---|---|
| Simple geometry, structured | FDM |
| Complex geometry / multi-physics | FEM |
| Conservation laws, shocks | FVM (CFD) |
| Smooth, periodic | Spectral / pseudo-spectral |
| Inverse / sparse data | PINN |
| Many similar PDEs (parametric) | Neural Operator (FNO/DeepONet) |
| Stochastic / high-dim | Deep BSDE / Monte Carlo |

**기본값**: classical solving은 FEM (FEniCSx) or FVM (OpenFOAM); ML-side는 FNO; inverse problem은 PINN.

## 🔗 Graph
- Adjacent: [[PINN]] · [[Diffusion-Models]] · [[Finite-Element-Method]]

## 🤖 LLM 활용
**언제**: PDE classification 설명, BC formulation help, weak form derivation, PINN architecture suggestion.
**언제 X**: actual numerical solving (FEniCSx/JAX/OpenFOAM 매 use).

## ❌ 안티패턴
- **CFL violation**: explicit scheme에 dt 매 too large → blow up.
- **PINN as universal**: PINN 매 hard problems 에 매 종종 fail (high-freq/turbulent) — 매 classical FEM 매 첫 baseline.
- **No mesh convergence study**: 매 must show error vs h/p refinement.
- **Wrong BC**: Neumann ↔ Dirichlet mistake → 매 entire solution wrong.
- **Ignoring stability**: implicit ≠ unconditionally accurate (just stable).

## 🧪 검증 / 중복
- Verified (Strikwerda "Finite Difference Schemes", Brenner & Scott "FEM", Karniadakis et al PINN review).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — classical methods + PINN/FNO (2026) |
