Playground
The original MILAMIN was a package you downloaded and edited in MATLAB. This is the browser equivalent: define a model below – geometry, viscosities, boundary conditions, in plain JavaScript – press Run, and the full MilAMin pipeline meshes, assembles, factorizes and renders it locally. Nothing to install; start from a preset and change things.
Pressure p
Maximum shear stress τ
The model API
A model is a JavaScript function body that ends with
return { mesh, mu, bc }:
-
mesh.boundaries– closed polylines ({ pts, marker }); the marker tags the nodes on that polyline for thebcfunction. For geometries with open internal interfaces, use explicitmesh.pointsandmesh.segments([i, j, marker]) instead – the multilayer preset shows how. -
mesh.regions– one seed per enclosed region:[x, y, attribute, maxArea]. The attribute names the material;maxAreasets the local mesh density (smaller = finer). Meshes are capped at ~3 million unknowns (counted as in 2008, the bubble node included). Boundaries may not cross or touch one another: an inclusion must lie inside the box and clear of its neighbours, which is checked before meshing (Triangle would otherwise mesh the slivers where they overlap). -
mu(attr)– viscosity for a region attribute. -
view– optional initial view[cx, cy, halfWidth]; without it the panels frame the whole model. The automatic colour range is taken from the fields inside the view. -
bc(marker, x, y)– Dirichlet velocity[vx, vy]for a boundary node,nullto leave it unconstrained or aNaNcomponent for free slip in that direction.
Helpers in scope: rect(x0, y0, x1, y1),
circle(cx, cy, r, n),
ellipse(cx, cy, rx, ry, n, angleDeg). The code runs in a
Web Worker in your browser; Ctrl+Enter runs the
model, Stop terminates a runaway one. What you write is kept in your
browser: edits to your own model save as you type, while a preset or
a shared link you start editing is held apart from it until you press
“Save as my model”. The solver is the same
MILAMIN pipeline as the million page:
7-node Crouzeix–Raviart triangles from Shewchuk’s Triangle,
CHOLMOD’s supernodal Cholesky, Powell–Hestenes pressure
recovery.
Limits: linear viscous Stokes only (no gravity body force, no time stepping yet), Dirichlet or free-slip conditions, and one solve per Run – the Folder app shows what a time-stepping loop on the same stack looks like.