Ir al contenido
Español
Fuente y sumidero viene con Pro. La vista previa aparece al desbloquearlo.

Cómo funciona

A textbook figure of a 2D potential flow. A source of strength Q pushes fluid outward at Q / 2πr and an equal sink pulls it in; the velocity anywhere is the vector sum. The plate (x from −8 to 8 m, y from −4 to 4 m) shows the direction of flow as a grid of small arrows and as streamlines traced from the source. At the probe the source's and the sink's contributions are drawn tip to tail with their sum in ink, and the row under the plate reads the speed, its direction and both contributions. Drag the source, the sink or the probe; a press on the empty plate moves the probe there. Inside half a metre of a source or a sink the speed is capped, a finite core.

Úsalo para

  • Teach potential flow and superposition: let learners see that the velocity at a point is the source's outward push plus the sink's inward pull.
  • Show how the streamlines change as the source and the sink move closer, until the pattern approaches a doublet.

Busca otra opción cuando

  • For measured flow data or viscous flow, use a real flow visualisation: this figure is an ideal, inviscid model.

Uso

import React, { useState } from 'react'
import { SourceSinkSampler } from './SourceSinkSampler.jsx'

export function FlowLesson() {
  const [points, setPoints] = useState({
    source: { x: -4, y: -1 },
    sink: { x: 4, y: 1 },
    probe: { x: 0, y: 2 },
  })
  return (
    <SourceSinkSampler
      value={points}
      onChange={(next, { speed }) => setPoints(next)}
      strength={20}
      labels={{ title: 'A source and a sink' }}
    />
  )
}

Propiedades

PropiedadTipoPor defectoQué hace
value{ source, sink, probe }—Posiciones controladas, cada una { x, y } en metros, x de −8 a 8 e y de −4 a 4 (redondeadas a 0,1).
defaultValue{ source, sink, probe }{ source: { x: -4, y: -1 }, sink: { x: 4, y: 1 }, probe: { x: 0, y: 2 } }Posiciones iniciales sin control externo y el destino de Restablecer en ambos modos.
onChange(points, reading) => void—Recibe las nuevas posiciones y, en la sonda, { object ('source', 'sink', 'probe' o null al restablecer), reason ('drag', 'press', 'tap', 'key', 'cancel' o 'reset'), velocity, speed, angle (grados, null sin flujo), source, sink } en m/s.
strengthnumber20Intensidad Q de la fuente y del sumidero en m²/s. Todas las velocidades escalan con ella.
labelsobject—Sustituye cualquier texto integrado: title, caption ('{q}' es la intensidad), source, sink, probe, velocity, readout ('{point}'), direction ('{angle}'), undefinedDirection, fromSource, fromSink, pointText ('{name}', '{point}'), movable, plate, speedUnit, strengthUnit y reset.
localestring'en'Etiqueta de idioma para las cifras decimales.
classNamestring—Clase extra para la tarjeta, por ejemplo para fijar su ancho (30rem por defecto, nunca más que su contenedor).

Accesibilidad

  • The source, the sink and the probe are each one tab stop, a button with the role description 'movable point' and a name that reads its position. Arrow keys move the focused point by 0.5 m, with Shift by 2 m, clamped to the plate.
  • The readout is a polite live region: it reads the position of the probe, the speed, its direction and the two contributions. Reset is a button, marked unavailable while nothing has changed.
  • Dragging uses pointer capture. A handle sets touch-action: none, so the page does not scroll while a point is dragged; on the empty plate a tap places the probe and a swipe still scrolls the page. A cancelled gesture puts the point back where it started.
  • Colour is not the only key: the source and the sink carry + and − signs, the legend names every colour, and the readout names each contribution.

Movimiento

After a key press, a tap or Reset, the moved point glides for --ds-duration-fast while the field, streamlines and probe arrows redraw at once; while a point is dragged it follows the pointer directly. With reduced motion every change lands at once.

Añádelo a tu proyecto

Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.

SourceSinkSampler.jsxsource-sink-sampler.csstokens.cssREADME.md

Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.

Formularios
Cuadrícula de disponibilidad viene con Pro. La vista previa aparece al desbloquearlo.
Operaciones booleanas viene con Pro. La vista previa aparece al desbloquearlo.
Selector en cascada viene con Pro. La vista previa aparece al desbloquearlo.