Vector Field Visualizer Back
Vector Field Visualizer

Vector Field & Streamline Visualizer

Visualize uniform flow, point source, vortex, dipole, and custom F(x,y) fields in real time. Streamlines, divergence, and curl color maps. Click to trace streamlines from any point.

Field Settings
Field type
Strength1.00
Source position x0.00
Source position y0.00
Superposition (2nd field)
2nd field type
2nd strength1.00
Flow animation & display
Flow particles300

Click the canvas to trace a streamline; move the cursor to probe divergence & curl.

Results
Probe X
Probe Y
Divergence ∇·F
Curl ∇×F
|F| magnitude
Classification
Flow particles
Avg speed |F|
Vector Field — arrow glyphs + flowing particles (click to trace a streamline)
Arrow glyphs F Flow particles (advection) Streamlines Probe
Theory & Key Formulas

$$\mathbf{F}(x,y) = P(x,y)\,\mathbf{i} + Q(x,y)\,\mathbf{j}$$

2D vector field: assigns a vector with magnitude and direction to every point. Particles advect by $\dot{x}=P,\ \dot{y}=Q$ (RK4 integration).

$$\nabla \times \mathbf{F} = \left(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right)\mathbf{k}$$

2D curl (vorticity): a scalar field representing the strength and sense of rotation

$$\nabla \cdot \mathbf{F} = \frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y}$$

Divergence: represents the strength of fluid outflow (source) or inflow (sink); zero for incompressible flow

Known-solution check pending…

What is a Vector Field?

🙋
What exactly is a vector field? I see the simulator shows arrows everywhere, but what does that actually represent?
🎓
Basically, it's a map that assigns a vector (an arrow with direction and magnitude) to every point in space. In practice, it describes things like fluid velocity or force. For instance, in this simulator, the "Uniform Flow" field shows arrows all pointing the same way, which models a steady wind or a constant current. Try moving the "Strength" slider to see how the arrow lengths change.
🙋
Wait, really? So those "Source" and "Vortex" options are different kinds of flows? What's the difference?
🎓
Exactly! A "Source" field, like air coming from a vent, has vectors pointing radially outward. Its strength determines how much "stuff" is flowing out. A "Vortex" field, like water draining, has vectors swirling around a center. The key difference is in their divergence and curl, which we measure. Try switching between them and watch how the streamline patterns change from radial to circular.
🙋
Okay, so what are divergence and curl? They sound like math terms, but what's the physical meaning when I'm looking at the arrows?
🎓
Great question! Think of divergence as measuring the "source-ness" or "sink-ness" at a point. Positive divergence means stuff is flowing out (like a source). Curl measures the "swirliness" or rotation at a point. A common case is a vortex, which has high curl. In the simulator, you can combine fields—try adding a "Source" and a "Vortex" with the second field controls. You'll create a spiral flow, which has both divergence and curl!

Physical Model & Key Equations

The divergence of a 2D vector field $\mathbf{F}= (F_x, F_y)$ quantifies the net flux (outflow minus inflow) per unit area at a point. It tells you if the point is a source, a sink, or neither.

$$\nabla \cdot \mathbf{F}= \frac{\partial F_x}{\partial x}+ \frac{\partial F_y}{\partial y}$$

Where $F_x(x,y)$ and $F_y(x,y)$ are the vector components you can type into the simulator's input boxes. A positive result means net outflow; negative means net inflow; zero means what flows in also flows out.

The curl (specifically its z-component in 2D) measures the tendency of the field to rotate or circulate around a point. It's a measure of local angular velocity of the field.

$$(\nabla \times \mathbf{F})_z = \frac{\partial F_y}{\partial x}- \frac{\partial F_x}{\partial y}$$

A positive curl indicates counter-clockwise rotation, negative indicates clockwise rotation, and zero indicates an irrotational (curl-free) field, like the uniform flow or a pure source.

Real-World Applications

Aerodynamic Design: Engineers use potential flow visualization (like the fields in this simulator) to model airflow over wings or car bodies in early design stages. Streamlines show how air will flow, helping to predict lift and drag before running costly CFD simulations.

Electromagnetic Field Sketching: Before setting up complex Finite Element Method (FEM) simulations, analysts sketch field lines. The "Dipole" field in the simulator, for instance, is a fundamental model for the magnetic field around a bar magnet or an electric dipole.

Heat Transfer Analysis: The vector field can represent heat flux. A "Source" could be a heat-generating component on a circuit board. Divergence in this context relates to points where heat is being generated or absorbed.

Structural Stress Analysis: In solid mechanics, the principal stress directions within a material form a vector field. Plotting these stress trajectories helps identify potential failure paths, like around a hole in a loaded plate, which is crucial for safe structural design.

Common Misconceptions and Points to Note

When you start using this tool, there are a few points that are easy to misunderstand, so be careful. First, while "arrow length = vector magnitude," the arrows are automatically scaled for visibility. Near the center of a gravity well, the values theoretically approach infinity, but in the tool they are clipped to a maximum length. Therefore, comparing magnitudes reliably is best done using the color map. For example, the areas near the charges of an electric dipole that turn bright red are the regions where the field is actually strongest.

Next, the point that "divergence and curl values depend on the calculation range (the Δx for differentiation)". The tool calculates these via numerical differentiation using a few pixels around the cursor position. Therefore, for fields with very sharp variations, the value can fluctuate significantly just by moving the cursor one pixel. Always keep in mind that when using CAE software in practice, the mesh coarseness also determines the accuracy of these differential values.

Finally, understand the limitations of 2D visualization. This tool is only visualizing a 2D slice. Almost all real physical phenomena are three-dimensional. For example, a uniform flow (uniform field) filling the screen might actually be a "helical flow" with vortices in the depth direction. It's common for a field to appear divergence-free in 2D, but have a non-zero $ \frac{\partial F_z}{\partial z} $ term in 3D, making the overall divergence non-zero.

How to Use

  1. Enter vector field components in fxExpr and fyExpr using variables x, y (e.g., fxExpr: "-y" and fyExpr: "x" for a vortex).
  2. Adjust strengthVal via strengthSlider to scale field magnitude; typical range 0.5–3.0 for stable visualization.
  3. Position source/sink centers using srcXVal, srcYVal sliders; streamlines emanate radially from sources and converge to sinks.
  4. Toggle divergence (∇·F) and curl (∇×F) overlays to identify regions of expansion, compression, and rotational intensity.

Worked Example

Model laminar pipe flow with uniform velocity plus a 3D-swirl perturbation. Set fxExpr="2.0" (axial component), fyExpr="0.15*(-y)" (tangential decay), strengthVal=1.2, srcXVal=0, srcYVal=0. Streamlines align quasi-parallel downstream with slight spiral deflection. Divergence remains ~0 (incompressible); curl magnitude peaks at 0.3 rad/s near axis. Compare against Poiseuille flow: expected parabolic profile deviation <8% for Re=1500.

Practical Notes

  1. Use polynomial expressions (x^2, y^3) or trigonometric (sin(x), cos(y)) to model boundary layer separation, vortex shedding behind cylinders, or jet mixing.
  2. Set strengthVal <0.5 for stiff fields (source/sink dominance); increase to 1.5–2.5 for balanced advection-diffusion visualization in microfluidics.
  3. Divergence spikes reveal singularities; regularize by adding epsilon damping (e.g., fxExpr="x/(x²+y²+0.01)") to prevent numerical instability near srcX, srcY.