Skip to content

๐ŸŒพ Scalar fields

JavaScriptThree.js
Source

๐ŸŽฏ An example of how to visualize scalar fields
๐Ÿ A VPython version is also available as scalar_plot.py.

A scalar field is simply a function such that that assigns a single numeric value to each point in space. Examples of scalar fields are:

  • temperature in a room
  • pressure in the atmosphere
  • electric potential of a charge

In this demo, the scalar field represents temperature in 3D space.

At the beginning, the temperature is highest near the center and decreases smoothly outward:

T(r)=eโˆ’ฮฑโˆฅrโˆฅ2T(\mathbf{r}) = e^{-\alpha \lVert \mathbf{r} \rVert^2}

This describes a localized heat source:

  • hottest at the center
  • cooler further away
  • symmetric in all directions

You can think of this as a small hot object placed in cold space.

As time passes, heat spreads out due to diffusion.

Mathematically, this is described by the heat equation:

โˆ‚Tโˆ‚t=ฮบโˆ‡2T\frac{\partial T}{\partial t} = \kappa \nabla^2 T

We donโ€™t need to solve this equation to understand what happens:

  • heat flows from hot regions to cold regions
  • sharp peaks smooth out
  • the temperature distribution becomes wider and flatter

In the animation, this means:

  • colors fade at the center
  • warmth spreads outward
  • no heat is created or destroyed, it only redistributes
  • Position of a sphere โ†’ where in space we measure temperature
  • Color of a sphere โ†’ temperature at that position
  • Time โ†’ how long heat has been spreading

This kind of visualization helps you:

  • understand abstract functions in 3D
  • see what a partial differential equation does, not just how itโ€™s written
  • connect mathematics to physical intuition
Scalar versus Vector Quantities
This visual originates from House of Physics.