PhysSandbox
Classical MechanicsWaves & SoundElectricity & MagnetismOptics & LightGravity & OrbitsLabs
🌙Astronomy & The Sky🌡️Thermodynamics🌍Biophysics, Fluids & Geoscience📐Math Visualization🔧Engineering🧪Chemistry

More from Math Visualization

Other simulators in this category — or see all 72.

View category →
NewUniversity / research

Multigrid Relaxation

1D Poisson error dynamics: Jacobi and Gauss-Seidel smooth high-frequency error, while a V-cycle uses residual restriction and coarse-grid correction to remove low-frequency modes.

Launch Simulator
NewUniversity / research

Gaussian Process Regression

Interactive GP regression with RBF and Matérn kernels: tune length scale/noise, add observations by clicking, view posterior mean with uncertainty bands, and sample at max posterior variance.

Launch Simulator
NewUniversity / research

Rössler Attractor

RK4 integration of ẋ=−y−z, ẏ=x+ay, ż=b+z(x−c); period-doubling cascade as c grows.

Launch Simulator
NewSchool

L-Systems (Turtle)

Lindenmayer string rewriting + turtle: Koch, Sierpinski, Hilbert, Heighway dragon, plant.

Launch Simulator
NewSchool

Bézier & de Casteljau

Drag control points; live recursive linear-interpolation scaffolding evaluates B(t).

Launch Simulator
NewSchool

Convex Hull (Graham & QuickHull)

Click to add points, drag to move; Graham scan with step playback or QuickHull divide-by-farthest; compare vertex sets.

Launch Simulator
PhysSandbox

Interactive physics, chemistry, and engineering simulators for students, teachers, and curious minds.

Physics

  • Classical Mechanics
  • Waves & Sound
  • Electricity & Magnetism

Science

  • Optics & Light
  • Gravity & Orbits
  • Astronomy & The Sky

More

  • Thermodynamics
  • Biophysics, Fluids & Geoscience
  • Math Visualization
  • Engineering
  • Chemistry

© 2026 PhysSandbox. Free interactive science simulators.

PrivacyTermsContact
Home/Math Visualization/Finite Element Poisson Solver (2D)

Finite Element Poisson Solver (2D)

This page is a compact finite-element Poisson solver for −Δu = f on the unit square. The domain is split into a regular triangular mesh and each triangle uses linear P1 basis functions. For every element, the local stiffness matrix is assembled from the gradients of the basis functions, Kᵉ_ij = (b_i b_j + c_i c_j)/(4A), then accumulated into a sparse global system. Source terms are integrated by a centroid rule. In pure Dirichlet mode all boundary nodes are pinned to u=0, like a membrane clamped to a frame. In mixed mode, the left/right sides are Dirichlet while top/bottom edges contribute natural Neumann flux terms to the right-hand side. The resulting symmetric positive-definite system is solved by conjugate gradients. The left view colors the potential on the triangular mesh; the right view lifts the same scalar field into a “deformable membrane” surface.

Who it's for: Students in numerical PDEs, finite elements, electrostatics, and computational mechanics learning weak forms, triangular P1 elements, and boundary-condition handling.

Key terms

  • Finite element method
  • Poisson equation
  • Triangular mesh
  • P1 element
  • Weak form
  • Dirichlet boundary
  • Neumann boundary
  • Conjugate gradients

FEM Poisson

18
35
1.2
0.45

Each triangle uses linear P1 basis functions. Dirichlet nodes are pinned; Neumann flux enters the RHS naturally on the top/bottom edges in mixed mode.

Measured values

nodes361
triangles648
Dirichlet nodes72
u range0.000 … 0.390
CG iters / residual39 / 5.8e-9

How it works

A compact 2D finite-element Poisson solver: assemble linear triangular P1 elements for -Δu=f, apply Dirichlet or natural Neumann boundaries, solve the sparse system by conjugate gradients, and view the potential as a colored membrane.

Key equations

Weak form: find u such that ∫Ω ∇u·∇v dΩ = ∫Ω f v dΩ + ∫Γ_N g v ds. P1 triangles give local stiffness K_ij^e = (b_i b_j + c_i c_j)/(4A); Dirichlet values are pinned.

Frequently asked questions

What is being solved physically?
The equation −Δu=f can model electrostatic potential from charge density, steady heat conduction with sources, or a membrane deflection under load. The interpretation changes, but the elliptic operator and boundary-condition ideas are the same.
Why are Neumann boundaries “natural” in FEM?
After integrating by parts, flux boundary terms appear on the right-hand side as ∫Γ_N g v ds. Dirichlet values must be imposed by pinning degrees of freedom, while Neumann data enters directly as load contributions.
Is this a production-quality FEM code?
No. It is a teaching model on a structured triangular mesh with simple quadrature and a basic CG solver. Real FEM software adds mesh generation, higher-order elements, robust preconditioning, error estimators, and careful treatment of complex geometries.