{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $a \\in \\R$, and consider the [[transport equation|PVD7VZJZ9B]] $u_t + a u_x = 0$.\nFix $\\Delta x \u003e 0$ and $\\Delta t \u003e 0$, put $\\nu = a \\Delta t / \\Delta x$, and let $u_j^n$ approximate $u(j \\Delta x, n \\Delta t)$.\nThe first-order *upwind scheme* is the explicit [[finite difference|X7HYEBA5SA]] scheme\n$$u_j^{n+1} = \\begin{cases} u_j^n - \\nu \\left( u_j^n - u_{j-1}^n \\right) \u0026 \\text{if } a \\ge 0, \\\\ u_j^n - \\nu \\left( u_{j+1}^n - u_j^n \\right) \u0026 \\text{if } a \u003c 0. \\end{cases}$$\nEquivalently, with $a^+ = \\max(a, 0)$ and $a^- = \\min(a, 0)$,\n$$u_j^{n+1} = u_j^n - \\frac{\\Delta t}{\\Delta x} \\left( a^+ (u_j^n - u_{j-1}^n) + a^- (u_{j+1}^n - u_j^n) \\right).$$\n\n## Remarks\n\nExample: let $a \u003e 0$ and $0 \\le \\nu \\le 1$.\nThen $u_j^{n+1} = (1 - \\nu) u_j^n + \\nu u_{j-1}^n$ is a convex combination, so $\\min_j u_j^n \\le u_j^{n+1} \\le \\max_j u_j^n$, and the scheme is stable in the maximum norm.\nThe condition $\\nu \\le 1$ is the [[Courant–Friedrichs–Lewy condition|FQVVNYV6N8]]: the numerical domain of dependence must contain the characteristic through the point.\nNon-example: for $a \u003e 0$, the downwind scheme $u_j^{n+1} = u_j^n - \\nu (u_{j+1}^n - u_j^n)$ uses the wrong side.\nIt multiplies the Fourier mode $e^{i j \\xi}$ by $g = 1 + \\nu - \\nu e^{i\\xi}$, with $\\abs{g}^2 = 1 + 2\\nu(1 + \\nu)(1 - \\cos \\xi) \u003e 1$ for $\\xi \\ne 0$, so it is unstable for every $\\nu \u003e 0$.\nFor a scalar conservation law $u_t + f(u)_x = 0$, upwinding takes the difference on the side given by the sign of the characteristic speed $f'(u)$.\nThe scheme is first-order accurate in $\\Delta x$ for fixed $\\nu$.\n\n## Explanations\n\n### L1 human\n\nThe difference is taken towards the side the wave comes from.\nThis simple rule is what makes the scheme stable.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "MTCRZC5QKT",
    "kind": "definition",
    "msc": [
      "65M06",
      "65M08"
    ],
    "name": "Upwind scheme",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Upwind_scheme"
      }
    ],
    "tag": "G5RB8T2WKD",
    "uses": [
      "PVD7VZJZ9B",
      "X7HYEBA5SA",
      "FQVVNYV6N8"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/G5RB8T2WKD/",
  "links": [
    {
      "field": "defines",
      "target": "MTCRZC5QKT"
    },
    {
      "field": "uses",
      "target": "PVD7VZJZ9B"
    },
    {
      "field": "uses",
      "target": "X7HYEBA5SA"
    },
    {
      "field": "uses",
      "target": "FQVVNYV6N8"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/G5RB8T2WKD.md",
  "msc": [
    "65M06",
    "65M08"
  ],
  "name": "Upwind scheme",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/G5R/G5RB8T2WKD.md",
  "status": null,
  "tag": "G5RB8T2WKD",
  "uri": "m2://G5RB8T2WKD",
  "url": "https://tamnd.github.io/math2/wiki/upwind-scheme-definition/",
  "writing": {
    "tag": "G5RB8T2WKD",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
