Alfvén velocity calculator
The Alfvén velocity API computes the speed at which magnetic disturbances travel through a plasma: v = B / √(μ·ρ), from the magnetic field strength in tesla, the mass density in kilograms per cubic metre, and the magnetic permeability in henries per metre (defaulting to the vacuum permeability μ₀).
Run — free
You get the velocity in metres per second, the validated inputs echoed back, the formula, a step-by-step derivation and a human-readable message. It is the characteristic speed of magnetohydrodynamic waves, computed deterministically in one call — no simulation, no approximation tables, and no stored data.
What the Alfvén velocity tells you
In any magnetised plasma, the magnetic field lines behave like stretched elastic strings: pluck them and a transverse wave travels along them at a characteristic speed named after Hannes Alfvén, who predicted these waves in 1942 and later won the Nobel Prize for the work. That speed, the Alfvén velocity, sets the timescale for almost everything dynamic in a plasma — how fast solar wind disturbances reach Earth's magnetosphere, how quickly energy released in a solar flare propagates through the corona, and how turbulence cascades in the interstellar medium. A higher magnetic field means a faster wave; a denser plasma means a slower one, because there is more inertia for the same restoring force. The endpoint computes exactly this ratio. You supply B in tesla and ρ in kg/m³, optionally overriding the permeability μ, and it returns v in metres per second. Comparing the result against a flow speed or a sound speed immediately tells you whether a plasma flow is sub-Alfvénic or super-Alfvénic, which is one of the first questions in any space-physics or fusion-energy analysis.
Inputs, defaults and validation rules
Three inputs control the computation. The magnetic field B is a magnitude in tesla, so it must be finite and non-negative — the sign of a field component belongs to a vector calculation, not to this one. The mass density ρ must be strictly positive: at zero density there is no plasma, and the formula would divide by zero, so the request is rejected with a clear invalid-input error rather than a misleading infinity. The permeability μ is optional and defaults to the vacuum permeability μ₀ = 4π×10⁻⁷ H/m, which is the right choice for essentially all space and laboratory plasmas, since they are non-magnetic materials in the classical sense. You only need to override it for exotic media with a genuinely different effective permeability. All numeric fields also accept strings, because HTML forms submit text; a trimmed numeric string like "5e-5" parses exactly like the number it denotes. Every input is bounded by an absolute limit of 10¹² to keep results finite and meaningful, and every emitted number is rounded to a fixed twelve decimal places so the same request always returns byte-identical JSON.
Where teams use it
Space-weather pipelines use the Alfvén velocity to convert upstream solar-wind measurements into propagation estimates: with B from a magnetometer and ρ derived from particle instruments at L1, one call yields the Alfvén speed that anchors shock-arrival models. Fusion researchers use it when sanity-checking tokamak and stellarator scenarios, because Alfvén eigenmodes become unstable when fast-ion velocities approach this threshold, and a quick deterministic check beats pulling out a full MHD solver for a first pass. Astrophysics teaching labs use it to let students explore orders of magnitude — the corona, the magnetosphere and the interstellar medium differ by many decades in both B and ρ, and seeing the resulting velocities side by side builds intuition no table can. The same code runs free in your browser on this page and via the paid API at $0.002 per request, so you can prototype by hand and only pay when you automate the call inside a pipeline. Nothing is logged or stored; the numbers go in, the velocity comes out.
What you can do with it
Estimate solar-wind disturbance timing
Feed magnetometer B and plasma density from an upstream monitor into the API to get the Alfvén speed that anchors propagation and shock-arrival estimates.
Sanity-check a fusion plasma scenario
Verify that fast-ion velocities stay clear of the Alfvén threshold before investing in a full magnetohydrodynamic stability analysis.
Teach orders of magnitude in plasma physics
Let students compare the corona, the magnetosphere and the interstellar medium by computing v = B/√(μ·ρ) for each regime.
FAQ
What does it cost?
$0.002 per request. It is also free to run in your browser on this page, with the same code and the same result.
Which permeability should I use?
For almost every plasma the vacuum permeability μ₀ = 4π×10⁻⁷ H/m is correct, and it is the default. Override it only for media with a genuinely different effective permeability.
Why is my request rejected when the density is zero?
The formula divides by the square root of the density, so zero density is undefined, not infinite. The API rejects it with an invalid-input error naming the field.
Can I pass numbers as strings?
Yes. Trimmed numeric strings such as "5e-5" are accepted, because web forms submit text. Non-numeric or non-finite values are rejected.
What units does it use and return?
Inputs are tesla for the magnetic field, kg/m³ for the mass density and H/m for the permeability. The velocity is returned in metres per second (m/s).
Is any of my data stored?
No. The request is processed in memory and discarded; only the computed result is returned.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/phys/alfven-velocity \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"magnetic_field":0.00005,"mass_density":1.67e-13}'const res = await fetch("https://api.kit.forhosting.com/phys/alfven-velocity", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"magnetic_field": 0.00005,
"mass_density": 1.67e-13
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/phys/alfven-velocity",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"magnetic_field": 0.00005,
"mass_density": 1.67e-13
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/phys/alfven-velocity", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"magnetic_field":0.00005,"mass_density":1.67e-13}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"magnetic_field":0.00005,"mass_density":1.67e-13}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/phys/alfven-velocity", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"magnetic_field": 0.00005,
"mass_density": 1.67e-13
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "phys.alfven_velocity",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_abs | 1000000000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |