Heat, fluids & energy

Tank Draining Dynamics Lab

A tank of four shapes (vertical cylinder, cone, sphere, lying cylinder) draining by Torricelli's law through a bottom outlet, with an optional constant inflow and side outlet: 200 fixed RK4 steps on the square root of the level, step doubling and an explicit Euler comparison, the closed-form exact times to empty and to any level, the steady level and its stiffness, the RK4 stability limit, and diagnostics that name a false empty, a false steady level and a reversal. Five challenges are scored for you. For learning how the head drives the outflow and when a numerical method fails.

Last updated

Calculator overview

Inputs and outputs

This summary comes from the calculator's published input and output contract.

Inputs

Your prediction: the longest stable RK4 step
When omitted Blank
About this input

Challenge 5 only: your prediction of the longest RK4 time step, in seconds, that stays stable at the steady level of the trickle-fed tank. Blank until you predict; the stiffness results appear once you predict. Shown only in challenge 5.

Unit s Default Not set Range 0 to 10000
Starting level (required)
About this input

The starting level in percent of the tank height, 1 to 100 (at most 95 for the sphere and the lying cylinder). Set with the handle on the tank wall.

Unit % Default 100 Range 1 to 100
Side outlet height (required)
About this input

The side outlet height in percent of the tank height, 1 to 99 (used while the side outlet is On). Set with the handle on the tank wall.

Unit % Default 50 Range 1 to 99
Side outlet (required)
About this input

Off or On: a second outlet in the tank wall, which drains only while the water is above it. Chosen with the chip on the canvas.

Default Off Allowed Off, On
Tank length (required)
About this input

The length of the lying cylinder, 0.5 to 20 m (not used by the other shapes; it is still checked).

Unit m Default 2 Range 0.5 to 20
Tank shape (required)
About this input

The tank: a vertical cylinder, a cone narrowing to the outlet, a sphere or a horizontal (lying) cylinder. Chosen with the chips on the canvas.

Default Vertical cylinder Allowed Vertical cylinder, Cone, Sphere, Horizontal cylinder
Tank diameter (required)
About this input

The tank diameter, 0.2 to 10 m (for the cone, the diameter at the top).

Unit m Default 1 Range 0.2 to 10
Tank height (required)
About this input

The height of the vertical cylinder or the cone, 0.3 to 10 m. A sphere or a lying cylinder is as high as it is wide, so this field is not used for them (it is still checked).

Unit m Default 2 Range 0.3 to 10
Your prediction: the top half's share of the draining time
When omitted Blank
About this input

Challenge 1 only: your prediction of the share of the full cylinder's draining time that the top half of the water takes, in percent. Blank until you predict; the results appear once you predict. Shown only in challenge 1.

Unit % Default Not set Range 0 to 100
Inflow (required)
About this input

A constant inflow: 0, or 0.01 to 100 L/s.

Unit L/s Default 0 Range 0 to 100
Challenge number (required)
About this input

Selects a challenge: 0 for none, 1 to 5 for a predefined challenge, which fixes the settings except the one it leaves to you.

Default 0 Range 0 to 5
Discharge coefficient (required)
About this input

The discharge coefficient of both outlets, 0.5 to 1: about 0.61 for a sharp-edged hole, near 1 for a well-rounded nozzle.

Default 0.61 Range 0.5 to 1
Run length (required)
About this input

The simulated time, 1 to 600 minutes, in 200 equal steps; a longer run means a longer time step.

Unit min Default 10 Range 1 to 600
Side outlet diameter (required)
About this input

The side outlet diameter, 5 to 300 mm (used while the side outlet is On; its area must then be less than a quarter of the largest cross-section).

Unit mm Default 50 Range 5 to 300
Bottom outlet diameter (required)
About this input

The bottom outlet diameter, 5 to 300 mm. Its area must be less than a quarter of the tank's largest cross-section.

Unit mm Default 50 Range 5 to 300
Query level (required)
About this input

A level in percent of the tank height, 1 to 100: the model gives the computed and exact time the water reaches it. Set by dragging the line on the level chart.

Unit % Default 50 Range 1 to 100

Outputs

Run length used
About this output

The run length used, in minutes. Blank when the inputs are not valid.

Unit min
RK4 stability limit
About this output

The RK4 real-axis stability limit, about 2.785: the stiffness number above which RK4 is unstable at the steady level (the stiffness chart draws it as a line). Blank when the inputs are not valid.

No unit declared
Side outlet diameter used
About this output

The side outlet diameter used, in mm. Blank while the side outlet is Off and when the inputs are not valid.

Unit mm
Side outlet used
About this output

The side outlet setting used, Off or On. Blank when the inputs are not valid.

No unit declared
Side outlet height used
About this output

The side outlet height used, in percent of the height. Blank while the side outlet is Off and when the inputs are not valid.

Unit %
Query level used
About this output

The query level used, in percent of the height. Blank when the inputs are not valid.

Unit %
Model version
About this output

The model version.

No unit declared
Model Status
About this output

NOT VALID with the reason when an input cannot be used; CHECK when the computed level fell to empty although water flows in, stopped at a false steady level, the time step is above the RK4 stability limit at the steady level, the level rose and fell, or the tank overflows; otherwise OK.

No unit declared
Formula module versions
About this output

The formula modules the model is built from, with their versions.

No unit declared
Time the tank overflows
About this output

The time the computed level reaches the brim, in s. Blank when the tank does not overflow, while challenge 1 awaits a prediction and when the inputs are not valid.

Unit s
Bottom outlet diameter used
About this output

The bottom outlet diameter used, in mm. Blank when the inputs are not valid.

Unit mm
Starting level used
About this output

The starting level used, in percent of the height. Blank when the inputs are not valid.

Unit %
The tank outline: height and half-width at 41 points
About this output

The tank outline at 41 points from the bottom to the top: the height and the half-width (the circle of the sphere or the end view of the lying cylinder). Blank when the inputs are not valid.

No unit declared
Tank length used
About this output

The tank length used, in m (the lying cylinder only; blank for the other shapes and when the inputs are not valid).

Unit m
Tank shape used
About this output

The tank shape used (a challenge may set its own). Blank when the inputs are not valid.

No unit declared
Volume balance error
About this output

Start volume plus inflow minus end volume minus the outflow summed over the run (trapezoid), in L: the run's own consistency. Blank unless the status reads OK, while challenge 1 awaits a prediction and when the inputs are not valid.

Unit L
Tank volume
About this output

The volume of the full tank, in m3. Blank when the inputs are not valid.

Unit m³
Tank height used
About this output

The height used: the tank height for the vertical cylinder and the cone, the diameter for the sphere and the lying cylinder, in m. Blank when the inputs are not valid.

Unit m
Steady level
About this output

With inflow, the level where the outflow equals the inflow, in m. Blank without inflow, when that level is at or above the brim (the tank overflows) and when the inputs are not valid.

Unit m
Starting volume
About this output

The volume of water at the start, in m3. Blank when the inputs are not valid.

Unit m³
Time step
About this output

The time step of the run, the run length over 200 steps, in s. Blank when the inputs are not valid.

Unit s
Tank diameter used
About this output

The tank diameter used, in m. Blank when the inputs are not valid.

Unit m
Stiffness number at the steady level
About this output

The time step times the decay rate at the steady level; RK4 is stable while it is below the RK4 stability limit. Blank without a steady level, while challenge 5 awaits a prediction and when the inputs are not valid.

No unit declared
Largest exact-time error
About this output

The largest difference between a frame's time and the exact time to its level, in s (without inflow or side outlet). Blank otherwise, while challenge 1 awaits a prediction and when the inputs are not valid.

Unit s
Computed time to the query level
About this output

The computed time the level reaches the query level, in s. Blank when not reached, while challenge 1 awaits a prediction and when the inputs are not valid.

Unit s
Computed time to half the starting level
About this output

The computed time to reach half the starting level, in s. Blank when not reached, while challenge 1 awaits a prediction and when the inputs are not valid.

Unit s
Discharge coefficient used
About this output

The discharge coefficient used. Blank when the inputs are not valid.

No unit declared
Euler time to empty
About this output

The time the explicit Euler run takes to empty the tank, in s. Blank with inflow, when not reached, while challenge 1 awaits a prediction and when the inputs are not valid.

Unit s
Error estimate of the time to empty
About this output

The step-doubling estimate of the error of the computed time to empty (coarse minus fine, over 15), in s. Blank when either empty time is blank, while challenge 1 awaits a prediction and when the inputs are not valid.

Unit s
Computed time to empty
About this output

The time the computed run takes to empty the tank, in s. Blank with inflow, when the run ends before the tank is empty, while challenge 1 awaits a prediction and when the inputs are not valid.

Unit s
Challenge goal
About this output

The goal of the selected challenge (blank with none).

No unit declared
Challenge feedback
About this output

Feedback on the selected challenge: the prompt while a prediction is awaited, else the met text or the not-met hint (blank with none).

No unit declared
Challenge: the value scored
About this output

The value the selected challenge scores: the top half's share (1), the computed time to empty (2), the steady level (3), the computed time to the query level (4) or the longest stable RK4 step (5); blank with none, while a prediction is awaited, when the measure is blank and when the inputs are not valid.

No unit declared
Challenge result
About this output

No challenge selected, MET or NOT MET.

No unit declared
Challenge score
About this output

The challenge score: 100 when met, else 0.

No unit declared
Longest stable Euler step
About this output

The longest explicit Euler time step that stays stable at the steady level, in s. Blank as for the stiffness number.

Unit s
Error estimate of the final level
About this output

The step-doubling estimate of the error of the final level, in m. Blank while challenge 1 awaits a prediction and when the inputs are not valid.

Unit m
Inflow used
About this output

The inflow used, in L/s. Blank when the inputs are not valid.

Unit L/s
The run, frame by frame: time, level, volume, outflow, the exact-time error, the Euler level and the stiffness number
About this output

One row per frame n = 0 to 200: the time, the level, the volume, the outflow, the exact-time error (without inflow or side outlet), the explicit Euler level and the stiffness number. Rows 1 to 200 are blank while challenge 1 awaits a prediction; the stiffness column is blank while challenge 5 awaits one; every cell is blank when the inputs are not valid.

No unit declared
Longest stable RK4 step
About this output

The longest RK4 time step that stays stable at the steady level, in s. Blank as for the stiffness number.

Unit s
Longest stable run length
About this output

The longest run length (200 steps) that stays stable at the steady level, in minutes. Blank as for the stiffness number.

Unit min
Top half's share of the draining time
About this output

The time to half the starting level as a percent of the time to empty. Blank when either time is blank, while challenge 1 awaits a prediction and when the inputs are not valid.

Unit %
Exact time to half the starting level
About this output

The exact time to reach half the starting level, in s: a closed form without inflow or side outlet, and for the vertical cylinder with inflow. Blank otherwise, while challenge 1 awaits a prediction and when the inputs are not valid.

Unit s
Exact time to empty
About this output

The exact time to empty from the starting level (closed form), in s. Blank with inflow or the side outlet On, while challenge 1 awaits a prediction and when the inputs are not valid.

Unit s
Exact time to the query level
About this output

The exact time to the query level, in s (the same closed forms as the half-level time). Blank as for the exact half-level time.

Unit s
Volume at the end of the run
About this output

The volume of water at the end of the run, in m3. Blank as for the final level.

Unit m³
Level at the end of the run
About this output

The computed level at the end of the run, in m. Blank while challenge 1 awaits a prediction and when the inputs are not valid.

Unit m
This page is provided by LogicCommons for informational purposes only. Results are analysis outputs computed from the inputs you supply and are not professional advice. Verify all inputs and results independently.

LogicCommons is in beta. If a result, label, or reference looks wrong, tell us here; we read every message.

Methodology

Purpose and model boundary

This lab drains a tank through a hole in its bottom. The tank is a vertical cylinder, a cone narrowing to the outlet, a sphere or a lying (horizontal) cylinder. Water leaves by Torricelli's law with a discharge coefficient; water may also flow in at a constant rate, and a second outlet may be opened in the side wall at a chosen height. The model steps the level through a chosen run length in 200 fixed fourth-order Runge-Kutta (RK4) steps, taken on the square root of the level, and beside that run it gives the exact closed-form times to empty and to any level, an explicit Euler run for comparison, a step-doubling error estimate, the steady level where inflow and outflow balance, how stiff the problem is there, and the longest time step RK4 can take there without going unstable. Five scored challenges go with it.

It is a lab for learning two things: how the head of water drives the outflow (so a tank drains fast at first and slowly at the end, and its shape changes how long each part takes), and how a numerical method that is accurate with a short time step can give a false empty, a false steady level or a jumping level when the step is too long. It is not a design method for a real tank or drain: the outlet is a simple hole with one coefficient, there are no pipe losses or vortex, and spilled water is not followed.

The model is the calculation authority. The page sends the values you set to the model and draws only what it returns: the tank outline, the water level frame by frame, the level chart with the explicit Euler level beside it, and the stiffness chart with the RK4 stability limit all come from the model's own rows. The page computes no level, time, outflow or stability limit itself.

Inputs and units

Input Meaning and unit
Tank shape Vertical cylinder (default), Cone, Sphere or Horizontal cylinder.
Tank diameter From 0.2 to 10 m (default 1 m); for the cone, the diameter at the top.
Tank height From 0.3 to 10 m (default 2 m): the height of the vertical cylinder or the cone. A sphere or a lying cylinder is as high as it is wide, so this value is not used for them (it is still checked).
Tank length From 0.5 to 20 m (default 2 m): the length of the lying cylinder; not used by the other shapes (it is still checked).
Bottom outlet diameter From 5 to 300 mm (default 50 mm). Its area must be less than a quarter of the tank's largest cross-section.
Discharge coefficient From 0.5 to 1 (default 0.61), for both outlets: about 0.61 for a sharp-edged hole, near 1 for a well-rounded nozzle.
Starting level From 1% to 100% of the tank height (default 100%); at most 95% for the sphere and the lying cylinder.
Inflow A constant inflow: 0 (default), or from 0.01 to 100 L/s.
Side outlet Off (default) or On: a second outlet in the wall, which drains only while the water is above it.
Side outlet height From 1% to 99% of the tank height (default 50%), used while the side outlet is On.
Side outlet diameter From 5 to 300 mm (default 50 mm), used while the side outlet is On; its area must then be less than a quarter of the largest cross-section.
Run length From 1 to 600 minutes (default 10), always in 200 equal steps, so a longer run means a longer time step.
Query level From 1% to 100% of the tank height (default 50%): the level whose computed and exact arrival times the model reports.
Challenge number 0 for free exploration, or 1 to 5 to load a challenge.
Your prediction: the top half's share of the draining time Challenge 1 only, from 0 to 100%. It starts blank, and a blank means not yet predicted.
Your prediction: the longest stable RK4 step Challenge 5 only, from 0 to 10,000 s. It starts blank, and a blank means not yet predicted.

Where each input is set:

  • On the canvas only: the tank shape and the side outlet setting (chips), the starting level and the side outlet height (handles on the tank wall, snapped to 1%, with an exact entry in the handle's popover), and the query level (a line dragged on the level chart). None of these is in the input panel. When the shape changes to a sphere or a lying cylinder, the starting level handle is held at 95% or below.
  • In the input panel: the tank diameter, the tank height (shown for the vertical cylinder and the cone), the tank length (shown for the lying cylinder), the bottom outlet diameter, the discharge coefficient, the inflow, the side outlet diameter (shown while the side outlet is On), the run length and the challenge number.
  • Your two predictions appear in the panel only while their own challenge is selected.

Governing relationships

Torricelli's law. Water leaving a small hole a depth h below the surface has the speed √(2·g·h), with g = 9.80665 m/s², and a real hole passes a fraction C_d of the ideal flow. The bottom outlet, of area a, therefore passes k·√h, with k = C_d·a·√(2·g). A side outlet of area a₂ at height z₂ passes k₂·√(h - z₂) while h is above z₂, and nothing below it.

The level equation. With A(h) the horizontal cross-section of the tank at level h and Q the inflow (in m³/s),

A(h)·dh/dt = Q - k·√h - k₂·√max(h - z₂, 0).

The cross-section is: vertical cylinder, π·R² (R = D/2); cone, π·(r₀ + s·h)², narrowing from the radius R at the top to the outlet radius r₀ at the bottom, with s = (R - r₀)/H; sphere, π·h·(D - h); lying cylinder of length L, 2·L·√(h·(D - h)). The sphere and the lying cylinder are never taken as narrower than the outlet: within a thin band at the very bottom and top, well under a millimetre for ordinary outlets, their area is held at the outlet's area.

The square root of the level. The model steps u = √h rather than h, with

du/dt = F(u) = [Q - k·u - k₂·√max(u² - z₂, 0)] / (2·u·A(u²)).

Without inflow or a side outlet this is F = -k / (2·A(u²)), which stays finite as the tank empties. For the vertical cylinder it is constant, so the run is exact to rounding there. Where F divides by u, the divisor is held at no less than 1×10⁻⁶·√H, so it is never 0.

RK4. With the step Δt = run length / 200, each step takes four slopes, K₁ = F(u), K₂ = F(u + Δt·K₁/2), K₃ = F(u + Δt·K₂/2), K₄ = F(u + Δt·K₃), and moves u to u + (Δt/6)·(K₁ + 2·K₂ + 2·K₃ + K₄). A value at or below 0 is empty, and an empty tank stays empty. A value above the brim is held at the brim: the tank overflows.

Step doubling. A second RK4 run takes 100 steps of 2·Δt. Since the error of RK4 shrinks with the fourth power of the step, the error of the 200-step result is estimated as (coarse - fine)/15, for the time to empty and for the final level.

Explicit Euler, for comparison. A run on the level itself, h + Δt·[Q - k·√h - k₂·√max(h - z₂, 0)] / A(h), held between 0 and the brim.

Exact times (inverse height). Without inflow or a side outlet, the time to drain from a level h to empty is

T(h) = the integral from 0 to h of A(y) / (k·√y) dy,

which has a closed form for each shape: vertical cylinder 2·A·√h / k; cone (π·√h / k)·(2·r₀² + (4/3)·r₀·s·h + (2/5)·s²·h²); sphere (π/k)·((4/3)·R·h^1.5 - (2/5)·h^2.5); lying cylinder (4·L / (3·k))·(D^1.5 - (D - h)^1.5) (each with the thin outlet-area bands added). The exact time to reach a lower level h_t from the start h₀ is T(h₀) - T(h_t). For the vertical cylinder with inflow and no side outlet, with q = Q/k the steady value of u, the exact time from u₀ to a level u_t between u₀ and q is (2·A / k)·((u₀ - u_t) + q·ln((q - u₀) / (q - u_t))).

Steady level. With inflow, the level settles where the outflow equals the inflow. With the bottom outlet alone that is h_s = (Q/k)². With the side outlet also flowing there (Q² > k²·z₂), it is h_s = z₂ + w², with w = (Q² - k²·z₂) / (Q·k₂ + k·√(Q² + (k₂² - k²)·z₂)). There is no steady level inside the tank when h_s is at or above the brim; the tank then overflows.

Stiffness at the steady level. Near the steady level the run behaves like dy/dt = λ·y, with the decay rate λ = -(k + k₂·u_s/w) / (2·u_s·A(h_s)) (the k₂ term only when the side outlet flows there), which for the bottom outlet alone is -k² / (2·Q·A(h_s)). A small inflow gives a low steady level, a large rate and a stiff problem. The stiffness number is Δt·|λ|. RK4 is stable there while it stays below 2.785293563405282, the size of the negative real root of 1 + z + z²/2 + z³/6 + z⁴/24 = 1; explicit Euler while it stays below 2. Hence the longest stable RK4 step is 2.785293563405282 / |λ|, the longest stable run is 200 times that, and Euler's longest stable step is 2 / |λ|.

Crossings. A level is reached in the first step whose start and end lie on its two sides; the time is interpolated linearly in u within that step.

Volume balance. Start volume plus inflow over the run, minus end volume, minus the outflow summed over the run by the trapezoid rule, in L: a measure of the run's own consistency.

Calculation sequence

  1. The model checks your values in the order of the status list under Errors and warnings, up to the challenge number and your predictions.
  2. It fixes the values in use: yours, or in a challenge the challenge's, except the input that challenge leaves free.
  3. It checks the outlet sizes against the tank's largest cross-section and the start of a sphere or lying cylinder.
  4. It works out the geometry: the height in use, the outlet constants, the step, the tank volume and the start volume, and the 41-point tank outline.
  5. It runs RK4 for 200 steps, the coarse RK4 run for 100 steps and the explicit Euler run for 200 steps.
  6. It finds the crossing times (empty, half the starting level, the query level, the brim) and the exact closed-form times, the steady level and the stiffness values, the error estimates and the volume balance.
  7. It runs the diagnostics (false empty, false steady level, stability at the steady level, reversals, overflow), sets the status and, in a challenge, scores the challenge and withholds what the challenge keeps back.

Outputs and interpretation

  • Computed time to empty (s), from the RK4 run, and the exact time to empty (s), from the closed form. The first is blank with inflow (the real tank never empties then) or when the run ends before the tank is empty; the second is blank with inflow or with the side outlet On.
  • Top half's share of the draining time (%): the time to half the starting level over the time to empty.
  • Computed and exact times to half the starting level and to the query level (s). The exact ones exist without inflow or side outlet, and for the vertical cylinder with inflow; elsewhere they are blank.
  • Level and volume at the end of the run (m, m³); tank volume and starting volume (m³).
  • Steady level (m); the time the tank overflows (s), when it does.
  • Stiffness number at the steady level, the longest stable RK4 step (s), the longest stable run length (minutes), the longest stable Euler step (s) and the RK4 stability limit, about 2.785.
  • Time step (s): the run length over 200.
  • Euler time to empty (s), the error estimates of the time to empty (s) and of the final level (m) from step doubling, the largest exact-time error (s: the largest gap between a frame's time and the exact time to its level, without inflow or side outlet), and the volume balance error (L, shown only when the status is OK).
  • The run, frame by frame: for frames 0 to 200, the time, level, volume, outflow (L/s), exact-time error, explicit Euler level and stiffness number.
  • The tank outline: 41 points of height and half-width (for the sphere and the lying cylinder, the circle of its end view).
  • Settings used: every value in effect (a challenge's while one is selected), and the model and module versions.

Reading the canvas: the tank is drawn from the outline the model returns, and the water surface moves through the 200 frames. The level chart draws the RK4 level and the explicit Euler level together; where they part, Euler's larger error, or its instability, shows. The stiffness chart draws each frame's stiffness number against the RK4 stability limit; a run whose stiffness number at the steady level lies above the line can jump between false levels or falsely empty.

What to take from the lab: the outflow grows with the square root of the depth, so the top half of a full cylinder leaves in about 29% of the draining time and the shallow bottom half takes the rest; the shape of the tank moves where the time goes. A smaller inflow gives a lower steady level that is also stiffer, so the same step that is safe for a large inflow can make RK4 fail for a small one.

Challenges

Selecting a challenge loads a vertical cylinder and its own settings and leaves one input to you. The model scores each one MET (100) or NOT MET (0) and gives a one-line hint while it is not met.

  1. Predict the top half (introductory). For a full 1 m by 2 m cylinder draining through a 50 mm outlet, predict what share of the draining time the top half of the water takes. It is met when your prediction is within 3 percentage points of the computed share.
  2. Drain it in ten minutes (introductory). Choose the bottom outlet diameter so the full 1 m by 2 m cylinder empties in 600 s, within 2% (12 s). The value scored is the computed time to empty.
  3. Hold the level (intermediate). With 3 L/s flowing in, choose the bottom outlet diameter so the level settles at 1.50 m, within 0.02 m. The value scored is the steady level.
  4. Place the side outlet (intermediate). With a 50 mm side outlet added, place it so the level falls from 2.0 m to 1.0 m in 100 s, within 1 s. The value scored is the computed time to the query level, half the height.
  5. Predict the stable step (advanced). For a narrow tank (0.36 m wide, 2.5 m high) fed with 3 L/s and run for 240 minutes, predict the longest RK4 time step, in seconds, that stays stable at the steady level. It is met when your prediction is within 10% of the model's longest stable RK4 step.

Challenges 1 and 5 hold back their answers until you predict, and the feedback asks you to predict first. In challenge 1 every time-course result is blank (the times, the end level and volume, the overflow time, the Euler time, the error estimates and the volume balance), the frames after frame 0 are blank, and the canvas shows only the full tank, with no playback and no level chart. In challenge 5 the stiffness number, the longest stable RK4 step, the longest stable run, Euler's stable step and the frame stiffness column are blank, the stiffness chart is hidden, and the status skips the stability warning; the run itself still shows, and at 240 minutes it visibly jumps. Any prediction, 0 included, reveals everything, met or not. Challenges 2, 3 and 4 hold nothing back, since the time or level they score is the feedback and no result names a diameter or a height.

Validation and status logic

The status reads the first match in the list under Errors and warnings. The first eight checks read the values you entered, whether or not the selected shape, setting or challenge uses them; the outlet-size and sphere-start checks read the values in use. The CHECK items apply inside challenges too; the stability warning is skipped while challenge 5 awaits a prediction. A challenge number that is not a whole number from 0 to 5 counts as no challenge selected.

Assumptions and limitations

  • Torricelli outflow with one discharge coefficient for both outlets; a steady jet at each moment; no pipe losses or vortex; water incompressible; the inflow constant.
  • Outlets are small: each outlet's area must be below a quarter of the tank's largest cross-section. The sphere and the lying cylinder are never narrower than the outlet (a thin band at the bottom and top).
  • When the tank overflows the level is held at the brim; the spilled water is not followed.
  • Exactly 200 RK4 steps over the run. For the vertical cylinder without inflow or side outlet the run is exact to rounding. For the sphere and the lying cylinder the slope changes fast in the last millimetres, so the computed time to empty comes out about 0.1% to 0.2% early, with the exact time beside it. Near the side outlet's height the slope has a kink, so RK4 is less accurate in that step.
  • The stability test is linear and local to the steady level. RK4 can also settle at a false steady level just below the limit, and a run can reverse direction because of stiffness elsewhere; both are named. These tests can miss a run that is merely inaccurate; the error estimates and the exact times show accuracy.
  • A run flagged by the false-empty, false-steady or stability warning can be chaotic, so its last digits may differ between calculation engines.
  • A value within about 1×10⁻⁹ (relative) of a threshold may flip a status or a challenge result.

Restrictions and non-computing states

Under NOT VALID every result, the frames and the outline are blank, except the model and module versions; the challenge status (No challenge selected, or NOT MET when a challenge is selected), a score of 0, and the goal and not-met hint of a selected challenge.

While challenge 1 or 5 awaits a prediction, the results listed under Challenges stay blank, the challenge reads NOT MET and the value scored is blank.

The volume balance is shown only while the status reads OK, because an overflow spills water and a flagged run is not trustworthy.

Errors and warnings

The status messages, first match wins:

  • NOT VALID: choose a tank shape from the list
  • NOT VALID: the tank diameter must be from 0.2 to 10 m, the height from 0.3 to 10 m and the length from 0.5 to 20 m: each is checked even when the shape does not use it.
  • NOT VALID: each outlet diameter must be from 5 to 300 mm, and the discharge coefficient from 0.5 to 1
  • NOT VALID: choose the side outlet setting from the list, and set its height from 1% to 99% of the tank height
  • NOT VALID: the starting level and the query level must be from 1% to 100% of the tank height
  • NOT VALID: the inflow must be 0, or from 0.01 to 100 L/s
  • NOT VALID: the run length must be from 1 to 600 minutes
  • NOT VALID: the challenge number must be a whole number from 0 to 5; a top-half prediction must be blank or from 0 to 100%, and a stable-step prediction blank or from 0 to 10000 s
  • NOT VALID: the bottom outlet is too large for this tank; its area must be less than a quarter of the tank's largest cross-section
  • NOT VALID: the side outlet is too large for this tank; its area must be less than a quarter of the tank's largest cross-section: checked only while the side outlet is On.
  • NOT VALID: a sphere or a lying cylinder can start at most 95% full
  • CHECK: the computed level fell to empty although water flows in, which the real tank never does; the time step is too long, so shorten the run
  • CHECK: the computed level stopped at a false steady level where inflow and outflow do not balance; the time step is too long, so shorten the run: the level has stopped changing, to within a millionth of what one step of the slope would move it, at a point where that slope is not near zero.
  • CHECK: the time step is above the RK4 stability limit at the steady level, so the computed level can jump between false values or falsely empty; shorten the run: the stiffness number at the steady level is above about 2.785.
  • CHECK: the computed level rose and fell in a run where it can only move one way, a sign that the time step is too long; shorten the run: a tank with constant inflow can only fill or drain towards one level, so a reversal is the method's error.
  • CHECK: the tank overflows during the run; the level is held at the brim while the extra water spills over the top
  • OK

A blank tank shape or side outlet setting is refused by the page before the model runs.

References

This laboratory is an educational model of a tank draining through a small outlet. The outflow follows Torricelli's law, the jet speed of a body falling through the depth of water, reduced by a discharge coefficient. The level is stepped by the classical fourth-order Runge-Kutta method on the square root of the level, with a step-doubling (Richardson) error estimate and an explicit Euler run beside it, and the exact draining times come from integrating the tank's cross-section over the outflow. Near the steady level the problem is linearised, and the step is measured against the real-axis stability limits of the two methods, about 2.785 for RK4 and 2 for Euler.

Sources and further reading

  • Torricelli's theorem as an application of Bernoulli's equation: OpenStax, College Physics 2e, section 12.3, The Most General Applications of Bernoulli's Equation, 2022. OpenStax
  • Flow through an orifice and the contraction of the jet, about 0.61 for a sharp-edged opening with full contraction: U.S. Bureau of Reclamation, Water Measurement Manual, chapter 2, Basic Concepts Related to Flowing Water and Measurement, section 8, Orifice Relationships. U.S. Bureau of Reclamation
  • Euler's method, the fourth-order Runge-Kutta method, and their absolute stability on the real axis (Euler for steps up to 2 over the decay rate, RK4 up to about 2.7853): L. R. Hellevik, Numerical Methods for Engineers, Department of Structural Engineering, NTNU, 2020, chapter 2, sections 2.6, 2.11 and 2.15, Absolute stability of numerical methods for ODE IVPs. NTNU course text
  • Runge-Kutta methods, step doubling and Richardson error estimates: W. H. Press, S. A. Teukolsky, W. T. Vetterling and B. P. Flannery, Numerical Recipes: The Art of Scientific Computing, 3rd edition, Cambridge University Press, 2007, chapter 17, Integration of Ordinary Differential Equations.
  • Stiff problems and the stability of explicit methods: E. Hairer and G. Wanner, Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems, 2nd edition, Springer, 1996, chapter IV.

No table or text from any of these publications is reproduced, and none of their authors or publishers has reviewed or endorses this laboratory.

This laboratory is for learning. Its results hold only within its stated ranges; a real drain with piping, valves or a vortex empties more slowly than this simple outlet suggests.

Links were current at build time. If one moves, search the document's title rather than reporting a broken link as a defect.

Results are informational and not professional advice. See our Terms of Use. Powered by SpreadsheetWeb · About · Privacy · Terms