Gravity calculations
The engine in packages/hydraulics is pure code: no clocks, no randomness and no network, so the same inputs give the same answer and the same record. Every result comes with a CalcRecord, which says what went in, each step with its formula, what it assumes and which document it rests on. /bench runs the same code one equation at a time.
Numbers are SI in the engine and US customary on screen.
Reference tests compare against values printed in published documents, and none of those values comes from this code. They're in reference.test.ts and spacing.test.ts.
Design flow
Q = q × A, with the drainage coefficient converted to a rate over 24 hours. Source: NRCS National Engineering Handbook, Part 650, Chapter 14 (210-650-H, 2nd Ed., Feb 2021), section 650.1411(E) and (I).
A lateral in a parallel system serves its spacing times its length plus half the spacing, per 650.1411(I)(4), since water also reaches it from beyond its upstream end.
| Check | Published | Here |
|---|---|---|
| 10.65 acres at 3/8 in/day, 650.1411(I)(3) | 0.17 ft³/s | 0.168 ft³/s |
| 3,000 ft lateral at 200 ft and 0.04 in/hr, 650.1411(I)(4) | 0.575 ft³/s, read from a chart | 0.574 ft³/s, as its own formula gives |
Pipe capacity
Manning's equation for a round pipe flowing just full: V = (1/n) R^(2/3) S^(1/2), with R = D/4 and the grade as the energy slope.
It's checked against the conveyance factors in the ADS Drainage Handbook, Hydraulics (July 2014), from 3 to 60 in, and NRCS's example of an 8 in plastic main at 0.08% carrying about 0.3 ft³/s. ADS prints one decimal and uses 1.486 in the US form of the equation, where converting SI exactly gives 1.48592. Those two account for every difference.
Full flow is a simplification. It's reasonable for sizing, but a pipe under backwater or surcharge needs the analysis in PR 16.
Drain spacing
Hooghoudt: L² = (8 Kb d h + 4 Ka h²) / q, where Ka and Kb are the conductivity above and below the drain, h is how far the water table stands above the drain midway between drains, and d is the equivalent depth. It assumes steady flow, drains running half full and no resistance at the drain's entry. Source: ILRI Publication 16, Chapter 8.
Equivalent depth: water converging on a pipe loses extra head, which Hooghoudt allowed for by replacing the real depth to the barrier with a thinner layer. His tables approximate an infinite series. This uses the exact solution of Van der Molen and Wesseling (1991), ILRI's Equations 8.9 to 8.13 and Figure 8.4, and limits d to the real depth, which the formula could otherwise pass for spacings barely wider than the drain. d depends on the spacing being solved for, so spacing is found by bisection, which gives the same answer every time.
NRCS's ellipse equation: S = (4K(b² − a²)/q)^(1/2), 650.1411(H)(3)(iii) on page 650-14.65, is also here for comparison. b is from the water table midway between drains down to the barrier and a is from the drains down to the barrier (Figure 14-39), so its flow runs through all the soil between the water table and the barrier. It ignores convergence, so with one conductivity throughout, it gives a wider spacing than Hooghoudt whenever the drain isn't on the barrier.
The ellipse's one K is the soil from the target water table down to the barrier, weighted by thickness. The handbook's ellipse section gives a single K, defined only as "hydraulic conductivity, inches/hour", and its example calls it "the hydraulic conductivity of subsurface materials" (650.1411(H)(3)(v), page 650-14.66). It doesn't say how to get one K from layers. The same handbook's transient flow method also takes one K for a spacing over the same depth, and does say: "K is the weighted average hydraulic conductivity of all soils between the maximum allowable water table height and barrier" (Appendix 14E, D(5), page 650-14E.4). So that is what this uses, and each result's record says so. Carrying 14E's definition over to the ellipse equation is a reading, not something the ellipse section states, and an engineer should confirm it.
Until PR 27 it used only the soil between the water table and the drain. An audit on 2026-11-09 found that gave 119 ft for 9 µm/s over 2 µm/s with the barrier at 3 m, nearly as wide as uniform 9 µm/s soil would get, though most of the depth the water moves through was the 2. It now gives 83 ft there, against Hooghoudt's 68 ft, and 103 ft for 2 over 9 where it had given 59 ft. One average for two soils is still an approximation: it reads a little wide when the tighter soil is below the drain and a little narrow when it's above. Hooghoudt keeps the two apart and allows for convergence, and the record says to prefer it where the soil above and below the drain differ.
| Check | Published | Here |
|---|---|---|
| NRCS ellipse example, 650.1411(H)(3)(v) | 109.5 ft | 109.5 ft |
| ILRI Example 8.1, one layer | 64 m by the series | 64 m |
| ILRI Example 8.2, an open drain | 72 m | 72 m |
| ILRI Example 8.3, two layers | 95 m by Hooghoudt's table | 93 m |
| ILRI Table 8.1, 14 of its entries | 1.6% to 4.9% below the table | |
| ILRI Table 8.1, barrier at great depth, L = 50 m | 3.88 m | 3.87 m |
The table stands 2% to 5% above the exact series, which is why Example 8.3 differs. ILRI shows the same gap in its own Example 8.1: 65 m by the table and 64 m by the series.
Spacing for a soil zone
Each soil on the project's map gets a spacing, from zone-spacing.ts, by whichever method the project chooses: Hooghoudt, NRCS's ellipse equation, a guide table, or a number entered by hand. All of them are worked out anyway, so they can be compared.
The impermeable layer comes from the first of these that applies, and the panel says which:
- A depth someone has given.
- A restrictive layer NRCS records.
- A layer with a tenth or less of the conductivity of the soil above it, between the target water table and that layer. NRCS 650.1411(G)(2) defines an impermeable layer that way. This is stricter than the soil panel's five-times flag, which only says to look.
- With nothing known, twice the drain's depth, as 650.1411(H)(3)(iv) says to assume. The panel then says so, and shows what the spacing would be with the layer three times as far below the drain, so you can see how much it matters.
If that layer is above the drain depth asked for, this zone uses a drain at the layer, since 650.1411(H)(5) says drains in most cases shouldn't go under one, and says so. If it's above the target water table, there's no spacing, and it says why.
Conductivity is NRCS's layers, weighted by thickness: from the target water table to the drain, and from the drain to the impermeable layer. The ellipse equation takes one value, so it gets the whole depth from the target water table to the impermeable layer, as above. A person's own Ksat stands for the whole depth, since it isn't tied to a layer. If NRCS's layers stop at the drain, the soil below is taken to be like the soil above, and it says so.
The range is Hooghoudt with NRCS's low and high conductivity. It's often wide, which is the honest answer for a value that's an estimate for a soil type. NRCS itself says conductivity may be off by as much as 20 percent, which is why the accuracy of any equation matters less than its inputs.
The guide table is from Soil and Water Conservation Engineering, 5th edition (2006), as reproduced by Wisconsin Extension. I haven't read the book itself.
- It's looked up by conductivity, since NRCS's data gives that directly, and a zone's texture isn't stored. The row's texture is shown.
- The slide prints loam's lower conductivity as 0.02 in/hr, which would overlap clay and clay loam. Every other row starts where the last one stops, so this reads it as 0.20. Check the book before relying on loam near that end.
- It gives a range, and a design needs one number, so it uses the middle.
The drain radius starts at 2.3 in: half the 4.6 in outside of a 4 in pipe, from ADS S3.01. ILRI assumes a drain with no entrance resistance, which the record notes.
Nothing here knows about cracking. Vertisols like Fargo clay crack when dry and swell when wet, so a single published conductivity can't describe them. The spacing is only as good as that number.
On real soils near Fargo, through the real worker and NRCS's service, at 3/8 in/day, a 12 in target water table and a 3.5 ft drain:
| Soil | Hooghoudt | Ellipse | Guide table | Range |
|---|---|---|---|---|
| Fargo silty clay | 24 ft | 28 ft | 16 to 33 ft | 6 to 25 ft |
| Fargo-Ryan silty clays | 20 ft | 17 ft | 16 to 33 ft | 6 to 25 ft |
| Fairdale silt loam | 83 ft | 88 ft | 82 to 164 ft | 30 to 105 ft |
The Ellipse column was worked out before PR 27 changed which conductivity the ellipse equation uses. Fargo silty clay is the same all the way down, so its 28 ft stands. The other two are layered, will have moved, and haven't been run again.
The methods broadly agree with each other, which says the arithmetic is sound. It doesn't say the answer suits these soils, since they all start from the same published conductivity. An engineer should compare these with local experience before anyone relies on them.
What each pipe serves
The land in a project's fields goes to the nearest pipe that can reach it. That means no land can be counted twice, even where pipes run closer together than their spacing, and land out of reach of every pipe is left over as undrained. Together they always add up to the whole, and a property test checks that for random networks.
A pipe reaches half its spacing to either side. That's its lateral block's spacing if it has one, otherwise the spacing for the soil at each point along it, so a pipe crossing two soils serves a wider strip through one than the other. A number entered by hand holds everywhere. Land whose soil has no spacing, such as water, isn't drained.
Force mains collect nothing, being closed pipes. Everything else does, since nothing here says whether a main is perforated. A main running through laterals usually has little land left to claim anyway.
Land in a no-tile zone is never counted as drained (plan v3 item 432). A drain beside a no-tile zone still reaches into it and collects its water, so that land stays in the pipe's own area, and flows and pipe sizes are what they were. What changes is what is reported as drained: the acres on the design, in a layout's figures, in the estimate and in the returns. Drainable land is the fields less the no-tile zones inside them, and drained land is what the pipes reach less what they reach inside a zone, so drained can never come to more than drainable. The engineering review of 2026-11-28 found a design with a zone drawn showing 19.74 acres drained of 19.27 that could be. The zone's share of each cell is measured at sixteen points a cell, which is close and not exact: on 5 m cells a zone's edge is placed to about 1.25 m.
Reference case. A 200 m square field with one drain down its middle at 40 m spacing: the drain reaches 20 m each side, 8,000 m² of 40,000. A no-tile zone 50 m square lies beside the drain, from 100 m to 150 m across. The drain reaches the nearest 20 m of it, 1,000 m². Drainable land is 40,000 - 2,500 = 37,500 m² and drained land is 8,000 - 1,000 = 7,000 m². The pipe's own area stays 8,000 m².
Land is measured along lines, not by counting cells. The fields are divided into 5 m cells, or coarser if that would be more than 250,000 of them, and at least two lines are run across each cell, across the nearest pipe rather than along it. Along a line, the place where one pipe's land gives way to the next pipe's, to undrained land or to the field's edge is worked out exactly: halfway between two pipes, half a spacing from one, or where the line crosses the boundary. So a strip between two drains comes out at its true width wherever it falls against the cells. Cells the field's edge passes through, and cells where pipes cross or meet, get eight lines. The cells themselves remain as the picture on the map, each colored by who has its middle.
Counting whole cells was wrong at real spacings, which is why it was replaced. A lateral lined up with the cells got one cell's width or two. At 20 ft apart on 640 acres, individual laterals came out between 18% under and 64% over, and at 30 ft on 160 acres up to 45% under, though the total was right. Generated layouts try directions 15° apart from grid north, so at 0° and 90° they line up exactly.
Measured on 2026-11-09, with laterals 20, 30, 40, 60 and 66 ft apart, at 0°, 15°, 45° and 90°, filling fields of 160 and 640 acres:
| Laterals at | Each lateral against its spacing times its length |
|---|---|
| 0° and 90° | 0.037% under on 160 acres, 0.002% over on 640 |
| 15° | 0.010% under to 0.008% over |
| 45° | 0.032% under to 0.017% over |
| Before, 0° or 90° | 45% under to 64% over |
The 0.037% is the field's far edge, which is found to a sixteenth of a cell where it runs along the lines: 0.3 m in 805 m. A test holds every lateral in each of those 40 cases to 2%, and the total to the field's own area.
Two things are still placed to the nearest cell. The soil is read at each cell's middle, so the line where two soils meet is. And a pipe that ends partway across a cell is out by up to a quarter of the cell along its length, about 8 m² for a lateral 20 ft apart. A cell on the field's edge with its middle outside takes the soil of the land beside it, since a spacing entered by hand applies to exactly the fields and would otherwise stop short of their edge.
NRCS takes a parallel lateral's area as its spacing times its length plus half a spacing (650.1411(I)(4)). Nearest-pipe land past a lateral's free end is a half circle, where NRCS takes a rectangle half a spacing long, so one free end comes out a little under. The test field leaves both ends free, and its middle lateral of nine is 1.4% over NRCS's formula: 8,314 m² against 8,200.
Where a design is a hand-drawn network rather than parallel laterals, there's no formula to compare with, and this is what gives it an area at all. Against counting points 0.25 m apart, 60 random networks of up to eight straight pipes differed by at most 0.14% of the field in all, and 1.6% for any one pipe. Counting 5 m cells differed by 1.5% and 12%.
It costs a little more time and much less memory. For 640 acres of laterals 40 ft apart, this step takes about 30 ms where counting cells took about 25, and the whole design about 40 ms. While it works it holds about 3.5 MB, against 19 MB.
Flow down the network
Each pipe's own water is the coefficient over the land it serves, plus any inflows set on it. Flow at its downstream end adds what reaches it from upstream. A property test checks conservation on random trees: at every pipe, what leaves is what entered plus its own, and what reaches the end is everything that came in.
This is steady flow down a tree. Where a network splits, adding up can't say how water divides, and in a loop there's no upstream to start from. Those pipes have no flow rather than a guessed one, and the panel says so. They need the dynamic analysis in PR 16.
Surface inlets
A surface inlet lets water straight into a drain, ahead of the ground water, so NRCS has its flow added on top. It says that where surface water enters by an inlet, "the entire watershed contributing to the inlet should be included" (650.1411), and that the flow "should be measured or estimated" (note to Figure 14-66). So the area is entered for each inlet, and a pipe's own water includes the area at the head of the pipe times a rate. The rate is the design coefficient unless a measured or estimated one is entered.
An inlet with no area entered adds nothing, and the design says so under what's still assumed, rather than guessing at a watershed.
Where the inlet sits in a low spot the terrain has found, the panel says how big it is and how much land the terrain has draining through it, and that number can be used as the area. It's only as good as the terrain: lidar can't see culverts or tile, and water can reach an inlet that the ground alone wouldn't send there.
A watershed through an inlet isn't drained land, so it doesn't count towards the acres drained, and it's listed apart on each pipe. The achieved coefficient allows for it, since it shares the pipes' capacity. NRCS also says inlets "should be avoided wherever possible", with a silt trap or a blind inlet where silt is a hazard (650.1414), and that its watershed "often can be reduced by diversion ditches".
Existing tile
Tile already in the ground can be imported from a GeoJSON, KML or zipped shapefile, or set by hand with a pipe's status. Importing does what a map of tile can't say for itself:
- It joins lines up. An end within 1 m of another line's end or middle connects to it, splitting that line if it has to. Longer lines go in first so that a lateral finds its main. Lines further apart stay apart, and the import says how many separate systems they came to, which shows up a gap.
- It works out which way water runs. A single line's direction in a file means nothing, and on flat ground the surface can't settle it pipe by pipe. So each connected system flows to one place: where it meets what's already drawn, or else its lowest free end on the terrain, which becomes an outlet that still needs checking on the ground. Without terrain it's the far end of its longest line.
- It guesses only at kinds. A pipe with nothing above it is a lateral, and the rest are mains. They can be changed.
- Size comes from a column, read as inches if it's called something like
sizeordiameterand holds a number from 2 to 60, or else from one size entered for the whole file. With neither, it stays empty and the design says so. Manning's n comes from the chosen pipe line at its nearest size.
Sizing never changes an existing pipe. It says whether its capacity carries its flow, and the check for that is the same one any pipe gets. What's in the ground also isn't counted in quantities or the estimate.
Connecting new to old. A new pipe drawn onto an existing one—or an imported existing line that connects to an already-drawn proposed pipe, junction, or lateral head—makes a tie-in, which is new work, so it's priced even though the pipes around it aren't. The extra water then shows on every old pipe below it, by the same capacity check, so it's plain what adding to a system does to it. Layouts keep what's in the ground as they do what's locked: new laterals keep away from old ones, whose ground is already drained, and an old main that reaches an outlet is the main they tie into. An old pipe that can't carry what it now has to can be replaced along the same line, which makes it new again and leaves it to be sized.
The capacity of an existing pipe rests on its grade, and a map doesn't give one. Its depths and grades are worked out by the same rules as a new pipe, which is what it would ideally be, not what it is. The design lists that under what's still assumed until a survey replaces it.
Controlled drainage
NRCS: "Controlled drainage is a method of water table management using water management structures" (650.1402), and these "normally use spillways fitted with stoplogs or gates to control the water level" (650.1419). A control structure goes on a pipe, and holds a list of settings, each a name and the crest's elevation.
With the logs in, water stands level with the crest in every pipe below it, as far up as that reaches, and the water table follows. So each setting says how much land that's under, in proportion to how much of each pipe holds water, and how far down from the ground the water stands. That last is the ground less the crest, at the ground samples along pipes that hold water. It's a level pool, with no water table mounded between drains, so it's the water table at the drains rather than midway between them.
Flows and grades are for the logs out, so a structure changes nothing else in the design. NRCS: "Adequate drainage is needed at all crop stages."
Standing water on the ground is a problem. It's a caution with no settings entered, and where the ground above it falls more than NRCS's "no greater than 1 percent" (650.1420), measured as total change along the pipes above it over their length, so that up and down both count.
Not worked out: what settings to use, which NRCS correlates to monitoring wells as experience is gained, and how it affects lateral spacing. NRCS: "the average lateral spacing is about 70 percent of the recommended drainage spacing", and it recommends DRAINMOD. The panel says so, and spacing isn't changed for you. Holding water back can also reach adjoining fields, and "A topographic survey of the field or fields is needed to plan the system", which is listed under what's still assumed.
Phases and land held in reserve
Each pipe can have an install phase, and pipes with none go in first. Laterals often go in over years, into a main that went in at the start, so sizes are for everything drawn, whatever its phase. What goes in first is big enough for what comes after, and that's what future capacity means here.
Land not laid out yet can be reserved on a pipe, in acres. It comes in at the design coefficient and goes down the pipes below as if it were drained, so sizing allows for it. It isn't drained land, so it stays out of the acres drained, and it's listed apart on each pipe. The achieved coefficient allows for it.
Showing through a phase dims what comes later, and the flow labels and a selected pipe say what it carries by then, from the land its built pipes serve. That land is worked out with everything built, so an area a later lateral would take isn't given to an earlier one, which errs low. The estimate splits by phase.
A pipe going in before what it drains into is a problem, since its water has nowhere to go until then, unless it has another way on that's built in time.
Elevations
Ground comes from the original surface only, at the DEM's own cells or every 2 m if those are finer. The types keep the conditioned surface out, and it's refused at run time too. Where a pipe has no data, there's no cover there, and it says so.
Inverts run from upstream to down, on one straight grade per pipe:
- A pipe starts at its preferred depth, or lower if its cover needs that, or if a pipe coming in is lower. Water can't climb, so a pipe never starts above what feeds it.
- It ends at its preferred depth, where that gives enough grade.
- Over a dip in the ground, it goes under, keeping its cover.
- Among the straight lines that do all that, it takes the one that digs least, and the flattest of any that dig the same. That can mean starting lower than preferred. Pivoting on the upstream end instead would send a pipe steeply down to clear a dip near its start, which is what the first version did, and what a profile showed up at once.
- A person's grade breaks are taken as given, and a fixed invert downstream that water can't reach is reported rather than changed.
- A run doesn't step down at a junction. Where a lateral arrives lower than the main, or a fixed invert is lower, the pipe on starts there, and the pipe bringing the run in steepens to end there too. That only takes it deeper, so it keeps its cover and grade, and nothing below it moves. Left as a step, it would take a drop structure to build. Until PR 22 the main stepped down instead, which a plan set built in the app showed at 29 junctions on one main.
The pipe bringing a run in is the main or submain with the longest way in, which is the way a profile goes back along it, or whatever pipe is the only one coming in. Laterals are branches: they come in above the main, as tile does at a tee, and two laterals meeting aren't a run. A run can drop at an inlet, control structure, lift station or tie-in, where a structure is built in anyway.
So on flat ground, a line of pipes gets deeper as it goes, which is the real cost of a flat field. Item 70 turns that into a check against how deep a trench can go.
Depths: minimum cover is from the ground to the outside top of the pipe, and preferred depth is from the ground to the invert (inside bottom). Each comes from the pipe if it's set there, then the project's criteria, then the standard's value for the soil.
Outside top for cover (plan v3 item 427): for a concentric pipe with inside diameter ID and outside diameter OD, one wall thickness is (OD − ID) / 2, so the outside top stands ID + (OD − ID) / 2 = (ID + OD) / 2 above the invert. For example, a pipe with ID = 0.60 m and OD = 0.70 m whose invert sits 1.20 m below the ground has 1.20 − 0.65 = 0.55 m of cover. The elevation solver uses the same height when placing pipes against the minimum-cover limit, so a large main is set to keep the limit over its outside top rather than its bore. When a pipe has no outside diameter (such as the generic NRCS corrugated plastic line, or a hand-entered bore with no outside diameter), cover falls back to the inside top (ID above the invert — 0.60 m in the example above) and records coverBasis = "inside", which is disclosed in the inspector, pipe table, checks, assumptions, profile violations, and plan schedule. Water levels (hydraulic gradeline), Manning capacity, velocity, and grade still use only the inside diameter.
The least grade is the steeper of two things. One is whatever keeps the standard's slowest allowed velocity flowing full, 0.5 ft/s in the standards so far, from Manning's equation. The other is NRCS's own floor: "Grades as low as 0.1 foot per 100 feet are permissible where silt is not a problem or where a filter is used" (650.1411 F(2)). Large pipes keep that velocity on far less, but nobody can lay a pipe at 0.01%, so this is what holds them on flat ground. Before a pipe has a size, it uses the smallest size the standard allows and NRCS's n for small plastic drains: 3 in at 0.015 comes to about 0.10%. Sizing then replaces that with the real pipe's.
Sizing
"Calculate sizing" gives each pipe the smallest size in a chosen product line that carries its flow, plus any margin asked for. It goes from upstream to down, a pipe is never smaller than one feeding it, and it's one step of undo.
That holds below pipes sizing leaves alone, too. A locked pipe, tile already in the ground, and a pipe with a size but no flow to size for all keep the size they have, and whatever they feed is at least that size. The size such a pipe counts as is its catalog product's nominal size. Without a product it's the size in the line being sized that its inside diameter is within 5% of, and failing that the next size up in that line. Until PR 27 only pipes sized in the same pass counted, so a reach on a steep grade below a locked 10 in main came out 8 in, which is exactly where new work ties into old tile. The record for a pipe held up this way gives the size feeding it.
A size is good enough if it carries the flow on the grade it would have. That grade can steepen to carry the flow, as far as a trench may go, which is NRCS's limit for that size in a wide trench with standard tubing, 5.2 or 6.2 ft. A pipe already past that on its flattest grade doesn't go deeper still. Depth is shared along a run, so a pipe can only use its share of what's left, by its length against what's still to run below it. Otherwise the small pipes at the top would take all the fall they could to stay small, and on flat ground the biggest pipes at the bottom would have none left to carry their flow. A run ends at an outlet or a lift station. So a small pipe is chosen where the ground gives it grade, or where a little more depth does, and a bigger one where neither does. Where no size keeps to its share, as where a pipe has to dive to keep its cover under a ditch, a bigger pipe would only go deeper, so it's the smallest that carries the flow, and the depth checks say how deep that is. Until PR 19 it took the largest instead, which gave a real Red River lateral carrying 0.0008 m³/s a 60 in pipe, and the pipe below it the same. That's a judgment about how to trade depth against size, and an engineer may want to weigh it differently.
The same rule runs live. As a design changes, a pipe with a size keeps the grade it needs to carry its flow, within that same depth. Past that, it stays on its flattest grade and comes up short, which the checks report, rather than quietly going deeper.
A single line of drain also has to stay within the criteria's length limit for its size (plan v3 item 435). Where the chosen standard limits how long one unbranched line of a size may run—Minnesota and North Dakota at 1,000 ft for 3 in and 1,320 ft for 4 in, and Iowa at 1,500 ft for 4 in corrugated plastic on grades flatter than 0.4%—sizing rejects any candidate size whose limit is shorter than the line's whole length, and gives the line the smallest size that carries its flow and covers its length. A line is the same run the too_long check walks: pipe with nothing joining it, from its head down to where something joins, it splits, a force main begins, or a held pipe sits on another size tier. A size the criteria set no limit for may run any length; where no size in the chosen product line covers the length, the largest size in that line is chosen and the too_long check keeps it flagged as a problem. Where the criteria set no limit (six of the nine standards), sizing changes nothing.
- What is the standard's and what is judgment: Staying within the limit for a drain's size is the standard's own wording; sizing the whole unbranched line up to the larger size (rather than stepping up partway down with a reducer, or adding a submain to shorten laterals) is a judgment recorded under question 9 of
docs/engineering/plan-v3-signoffs.md, pending engineer review. - Grade-dependent limits (Iowa): Iowa's 0.4% grade condition is evaluated on each candidate size's own grade along the whole unbranched line as computed by
edgeLevelsbeforenetworkElevations's junction-continuity steepening pass. Because that pass only ever steepens a pipe (never flattens it), evaluating the limit before it is conservative: any size accepted bysizeNetworkis guaranteed not to triggertoo_longincheckDesign. Each candidate is tested directly on the grade that candidate would actually take, avoiding circularity between grade and size; if a candidate size only clears 0.4% by steepening for capacity within its depth share, it stays on that steeper designed grade, and if it cannot steepen within depth it fails the limit and moves up a size.
The margin is yours to set, and starts at none, since nothing cited here gives one. It's kept with the project, since a pipe's grade has to keep giving that capacity as the design changes. Each pipe also shows the spare capacity it ended up with.
It says when it relied on a nominal diameter. Published catalog sizes are nominal, as pipe-products.md explains. A pipe measuring 2% smaller carries about 5% less, so a thin margin on a nominal size may not be a margin at all.
These checks use NRCS's own fixed grades, which is how its examples take them, from a plotted profile:
| Check | Published | Here |
|---|---|---|
| 0.17 ft³/s at 0.08%, NRCS 650.1411(I)(3) | 8 in | 8 in |
| 0.574 ft³/s at 0.30%, NRCS 650.1411(I)(4) | 8 in, read from a chart | 10 in, since 8 in carries 0.5735 ft³/s, which is 0.1% short |
The second check is the one place this differs from a published answer. That flow sits right on the line for 8 in, closer than a chart can show. Worked exactly it's just over, and this errs towards the bigger pipe. An engineer may well accept the 8 in.
A locked pipe keeps its size, and it's reported if that can't carry the flow. A pipe past a split or loop has no flow to size for, one outside the elevation data has no grade, and one serving no land is left as it is. Each says which.
Recalculating
Every edit recalculates, in a Web Worker, so the map stays smooth. Edits that arrive while it's busy replace each other, since nobody wants an answer about a design that's already gone.
The panel says when the numbers on screen aren't for the design as it stands. It reads "Updating" from the moment of an edit until the answer for that design arrives, and sizing won't run from numbers that are out of date. If a calculation fails, it says that too. Spec section 3.5 asks for exactly this.
The same inputs always give the same results, down to the byte, and there's a test for that. Timings are in network-performance.md.
Grades set by hand
Dragging or typing on a profile sets a pipe's grade by hand, as grade points from one end of it to the other. They replace the worked-out grade for that pipe, and it can go back to being worked out.
A pipe with grade points is only as good as its flattest stretch, so that's the grade its capacity and velocity use, rather than the average. The plan set marks that slope and lists every grade point, so the pipe can be built as set.
Grade points follow the pipe. When a pipe stretches, they keep their share of its length. When it's split, the split gets a point worked out from the line on either side, so each part still has both ends, and joining puts it back. A graded pipe won't join one that isn't, since that would lose one's grade.
A design imported from a file sets grade points from its heights. Each line becomes a pipe, joined to another where their ends are within a meter, and the heights on its points are read as inverts, in NAVD88 in the unit a person picks. With an invert at both ends, they become the pipe's grade points, and water runs downhill along them, so a line drawn uphill is turned round. A line without them runs the way it's drawn and gets the worked-out grade. Heights of zero all along count as none, since that's what KML writes when it has none. GeoJSON and KML heights are tested. A zipped shapefile's heights come through only if its reader passes them on, which hasn't been checked with a real file.
Water still can't climb. A pipe downstream of one set by hand starts no higher than where that one ends. A pipe set by hand keeps what it was given, even if that's wrong, and the checks in item 71 say so.
Nor is a pipe set by hand steepened to meet its run. Where one ends above where the run goes on, the step stays, and it's a caution, as it is where the pipe bringing a run in is tile already in the ground.
Checks
Each pipe is held to the standard chosen in the design criteria. A problem is against a stated limit. A caution is for someone to look at, and may be fine.
| Check | Limit | Kind | Source |
|---|---|---|---|
| Carries its flow | Flowing full, on its grade | Problem | Manning's equation |
| Has fall | Above zero | Problem | |
| Least grade | 0.1 ft per 100 ft | Problem | NRCS 650.1411 F(2) |
| Slowest velocity | 0.5 ft/s, flowing full | Problem | The standard's Minimum velocity and grade |
| Sediment | 1.4 ft/s, where sedimentation could happen | Caution | The same section |
| Fastest velocity | 12 ft/s in perforated corrugated plastic, where the standard gives one | Problem | The standard's Maximum velocity |
| Cover | From the pipe, then the project, then the standard for the soil | Problem | The standard's Location, Depth, and Spacing |
| Trench depth | 5.2 ft for 4 to 8 in nominal, 6.2 ft for 10 to 15 in | Caution | NRCS 650.1411 Figure 14-41 |
| Run continuity | Starts no lower than where its run comes in, to 0.01 ft | Caution | |
| Line length | One line of drain with nothing joining it, by nominal size | Problem | The standard's Size |
| Lateral depth | No more than half a foot shallower than the drain depth | Caution | A judgment |
| Carries water | Some land drains to it, or something comes in above it | Caution | |
| Has elevations | Ground data reaches it, so it has inverts | Problem | |
| Ground all along | No gaps in the ground data along it | Caution | |
| Fixed invert | Ends no lower than an invert fixed at the node it runs to | Problem | |
| Has a roughness | A pipe with a size has a Manning's n | Problem | |
| In the fields | No more than 5 m of a proposed pipe farther than 5 m from every field | Caution | A judgment |
Limits set by size go by nominal size. NRCS's trench table and the standards' limits on a single line of drain both list the sizes pipe is sold as. A pipe with a catalog product is looked up by that product's nominal size, whatever its inside diameter. A pipe without one is looked up by the listed size its inside diameter is within 5% of, so 4 in tile entered with a measured 4.1 in bore is still 4 in. A size between the listed ones takes the next one up, as before. The 5% is a judgment, not a standard's number: a measured bore sits a few percent off the size the pipe is sold as, and the closest two sizes tile comes in, 5 and 6 in, are 20% apart, so it can't take one size for another. Each of these checks records which row it read and whether the size came from a product or the inside diameter, and says so in words when it was the inside diameter. Until PR 27 the inside diameter was compared as if it were the nominal size, so 4 in tile entered at its measured 0.1041 m matched no length limit at all, and an 8 in pipe at 0.206 m read the 10 in row of the trench table and was allowed another foot. Two things still go by inside diameter alone, with the same 5%: layouts worked out on the worker, and the shading for depth on the profile, neither of which is given the catalog.
A pipe that can't be worked out is a problem, not a pass. A pipe with no ground data under it gets no inverts, and one with a size but no Manning's n gets no capacity, so none of the checks above has anything to hold it to. An audit on 2026-11-09 found a design with a lateral off the terrain coming back survey-verified with nothing against it. Each is now a problem of its own, and so is a pipe that ends below an invert fixed at the node it runs to, since water can't get there by gravity. A pipe with gaps in its ground is a caution: it's worked out from the ground it has, and its cover and depth aren't checked across the gap. A pipe with no size at all is still only unfinished. A loop leaves every pipe without elevations, and it stays one entry under "Needs more analysis" rather than a problem on each pipe.
A proposed pipe outside every field is a caution, since land there isn't counted as draining to it and may not be the project's to tile. Within 5 m of a field counts as in it, and up to 5 m of a pipe can lie farther out than that, so a main along a boundary that was traced a little off, or a lateral that overshoots it, isn't flagged. The length given is what lies past that 5 m. Both numbers are a judgment rather than a standard's, set so that a boundary traced a little off doesn't flag the main laid along it. A hole in a field is outside it. Three things aren't held to this: tile already in the ground, a project with no fields, and each outlet's own run to its outfall, which is the pipes into the outlet and on up for as long as nothing joins or leaves. An outlet is usually at a ditch past the field's edge, so that run is meant to leave. A main above where anything joins it is held to the fields like any other pipe.
Sediment is only a caution because nothing here knows whether the soil has fine sand or silt to carry. The standard asks for 1.4 ft/s where it does, and 0.5 ft/s where it doesn't.
The trench limits are the strictest column of NRCS's table: standard tubing, in a trench 2.6 ft or wider at the top of the pipe. A narrower trench or heavy-duty tubing allows more, and any depth is allowed at 0.67 ft wide, which the design doesn't know about yet. NRCS says the table rests on limited research and should be used with caution, so it's a caution here. It stops at 15 in, so bigger pipes aren't checked against it.
A lateral shallower than the drain depth drains less than its spacing assumes, since spacing is worked out from the drain depth, and a shallower drain has less head between it and the water table it's holding down. A lateral on one straight grade across rolling ground can come up to its minimum cover over a rise and still meet the drain depth at both ends, so nothing else would catch it. A plan set built in the app had laterals 2,590 ft long coming up to 2.3 ft against a 4 ft drain depth. It's a caution where a lateral's shallowest point is more than half a foot above the drain depth. Half a foot is a judgment rather than a standard's number: well past how closely tile is laid, and on a 4 ft drain holding the water table 1 ft down, a sixth of the head. Mains and submains collect more than they drain, so they aren't held to it, and nor is tile already in the ground.
South Dakota limits velocity by soil texture rather than giving one number. That's noted in its criteria, and isn't checked here.
Outlets
NRCS 650.1402, Drainage Outlet: "The depth of outlet should be such that any planned subsurface drains may be discharged above normal low waterflow. Pumping may be considered as a last alternative." And: "The capacity of the outlet should be such that the design flow can be discharged at an elevation at or below the design hydraulic gradeline."
Each outlet is held against what's been recorded for it. These are problems wherever the number came from, estimates included.
| Check | Limit |
|---|---|
| Low water | The lowest pipe arriving has to come out above it |
| Tailwater | At or below the design gradeline |
| Receiving capacity | Everything arriving has to fit |
| Surveyed invert | The design has to be within a tenth of a foot of it |
The design gradeline is the crown of the lowest pipe arriving, since a pipe sized to flow full has its gradeline there. Item 93 works out a real one.
NRCS allows submerged outlets "in some cases", with spacing and depth adjusted for it. There's no way to say so here yet, so one still shows as a problem for someone to look at.
The tenth of a foot is our choice, as fine as elevations are shown, rather than from a standard.
An outlet is verified when its invert and normal low water are surveyed, tailwater and receiving capacity have numbers from anywhere, and all four checks pass with a size and elevations to check them against. Tailwater and capacity can be estimates because they're usually worked out from a stage-discharge relationship or a drainage authority's number, not read off a rod.
Surveyed elevations have to be in the terrain's vertical datum. Nothing here converts them yet. Item 115 brings survey import with datum mapping.
If an outlet is past the edge of the terrain, the worker takes the outlets of the scenario in use into the area it finds and builds elevation data for. Only outlets outside the field's 100 m buffer change that area, so placing one on the field doesn't throw away a built terrain.
Constraints
What a design has to work around: no-tile zones, utilities, roads, easements and waterways. They're drawn or imported from GeoJSON, KML or a zipped Shapefile, and kept per project, since they're about the place rather than one design.
| Check | Limit | Kind |
|---|---|---|
| In a no-tile zone | No pipe anywhere inside it | Problem |
| Crosses something | Anything else it meets, for someone to arrange | Caution |
| Cover at a crossing | At least what's entered, ground to the outside top of the pipe (inside top if no outside diameter, labeled) | Problem |
| Depth at a crossing | At most what's entered, ground to the bottom of the pipe | Problem |
The limits are entered, not assumed. They depend on the owner and the utility, so nothing here supplies a default, and "Review conflicts" counts crossings with no limit. Across a wide road or easement, a limit holds at each ground sample as well as both edges.
Crossing limits aren't surveyed. A utility's real depth has to be located in the field, and nothing yet holds a design back for that. Item 110 adds field-verification tasks.
Across pipes
Some problems only show up looking at more than one pipe. These all count as problems, and "Review conflicts" lists them with the checks above, each with a way to go to it on the map.
| Check | Limit |
|---|---|
| Has an outlet | At least one, once there are pipes |
| Reaches an outlet | Every pipe's water gets to one |
| Junction levels | A pipe can't start above the lowest pipe feeding it |
| Network shape | What validateNetwork calls an error, such as a pipe leaving an outlet |
Strength and loads
The trench depth check above is the only strength limit worked out here. NRCS's words on the rest (650.1411): "The design load on the conduit should be based on a combination of equipment loads and trench loads", and "Equipment loads on the conduit may be neglected if the depth of cover exceeds 6 feet."
So nothing here calculates a load. Instead:
- A pipe over 15 in gets a caution on every design, because Figure 14-41 stops there and nothing else here says how deep it can go. That's for the manufacturer's data.
- "Review conflicts" says how many pipes have 6 ft of cover or less, which is nearly all of them, so equipment loads are still someone's to consider.
What's still assumed
"Review conflicts" also lists what the design rests on that nobody has checked: elevations that came from the terrain model, pipes sized on a nominal diameter, soils taken from NRCS's estimates, soils with an assumed barrier, the loads above and the outlet. These aren't faults. They're the list of what a field visit or a reviewer should look at.
Design status
A design is one of three things, as the spec asks: preliminary, survey-verified or reviewed.
Preliminary until all of these hold: flows and elevations are worked out, every pipe has a size, there are no problems, and every outlet is verified. Cautions don't hold it back, since they're for someone to look at and may be fine.
Survey-verified then follows by itself, and goes back as soon as any of that stops being true. Nothing about it is stored, because a stored status could outlast what earned it. It's narrower than it sounds so far: outlets are verified, while elevations along the pipes still come from the terrain model, and the status says so. Item 116 brings surveyed elevations along the pipes.
Reviewed is a person's confirmation, stored with their name, a saved version of what they saw, and a fingerprint of the design. It only counts while the design matches that fingerprint. Nothing here checks anyone's qualifications, or whether this was the review the design needs.
The fingerprint has to change whenever a check could come out differently, since a match is all that stands between a review and a design it never saw. It is worked out in designFingerprint (packages/hydraulics/src/fingerprint.ts), the same way in the browser that records an approval and on the server that checks one for a shared or printed view.
What the fingerprint covers
As of network-6 (plan v3 item 405), exactly these:
- The engine's version, as its first 8 characters.
- The network, whole: every node and pipe with all their fields, sizes, products, fixed inverts, grade points, phases, blocks and structure settings.
- The drainage coefficient the design was worked out with.
- The requirements pipes are held to: drain depth, minimum cover, smallest size, slowest and fastest velocity, the velocity where sediment could settle, and the capacity margin. With them, from the project's design criteria:
- what was chosen: the standard, soil, crop, inlets, target water table, and any coefficient or cover a person entered. An approval lapses when any of these changes, whether or not a check reads it today. Saving the criteria again unchanged keeps it.
- where entered values fall short of the standard for that soil, crop and inlets, as the design criteria panel lists them. Left out when there are none.
- The standard's limits on a single line of drain.
- The fields.
- What's been measured at outlets: each measurement's node, kind, value and source, not who took it or when.
- What's on the ground to work around, and the pumps the project has entered.
- The nominal sizes of the catalog products the design uses, not the rest of the catalog.
- The ground along each pipe: every sample of the original surface, after any adopted survey, as a short hash a pipe. So a new terrain, an adopted or dropped survey, or anything else that moves the ground under a pipe lapses an approval, even between the pipe's least cover and its most depth. Left out with no terrain.
- What it came to: flows, each pipe's inverts, length, grade, least cover and what it was measured to, most depth, where the cover is least, and whether grade points set the grade, what the engine couldn't work out, capacities, and the water level at each node with which have none and why.
- Everything found: every check on a pipe, a connection, an outlet, something on the ground, the water surface, a lift station and a control structure.
Not in it directly, because they reach it only through what they come to: the soils and spacing zones (through service areas and flows), the service areas themselves, crossings, lift station and control structure figures other than their checks, and the water surface along a pipe between nodes. Nothing checks the spacing laid against the spacing the soil calls for, so a change to the spacing the soil calls for that moves no flow leaves an approval standing.
Through network-5 the ground was in it only through those extremes, and the chosen criteria not at all. An audit on 2026-11-30 found ground raised 0.15 m under the middle of a pipe, and soil changed from mineral to organic under an entered 2 ft cover, each left a design "Approved for construction".
Checks are sorted before they're hashed, since they come out in whatever order the pipes were added, and numbers are rounded to six decimals so a machine's floating-point noise can't lapse a review. It's 36 hexadecimal characters: 8 that say which engine version worked it out, then a plain 106-bit hash of all the above, which is enough to notice a change but wouldn't stop someone deliberately forging one, which Row Level Security leaves to listed users anyway.
Until PR 27 it left out the limits on a single line of drain, the fields and the engine's version, and held none of the checks' findings. An audit on 2026-11-09 found that a design reviewed under a standard with no such limit, then switched to Minnesota's or North Dakota's, gained a "too long" problem while its fingerprint, and so its Reviewed status, stayed the same.
A review or construction approval made before an engine update stops counting, including every review from before PR 27 (whose fingerprints had no version in them), every review or approval recorded on network-4 before network-5 moved cover to the outside top of the pipe, and every one recorded on network-5 before network-6 put the ground along each pipe and the chosen criteria in the fingerprint. The stored record is never deleted or rewritten. Because the design itself may be unchanged, the status says who reviewed or approved it and when, that how designs are calculated and checked has been updated since so that review or approval no longer counts, and to look over the results as they are now and record a new one. Sign-offs of analyses and "this design" on past exports and simulations go by the same fingerprint, so they lapse with it too, and a past export or simulation from an earlier engine says the calculations were updated rather than that the design changed.
A shared or printed view says "Approved for construction" only when the server, working the saved design out itself, finds it matches a current approval and passes the construction gate. A printed map also has to be of that saved design: the browser sends which saved draft and scenario it drew, and anything drawn over the design. Unsaved changes, a draft or scenario saved again since, an earlier version or a generated layout on the map each print preliminary, with a sentence saying which. A map shown through one phase still draws the whole design, later phases faintly, so it keeps the whole design's status and says which phase it shows.
A check of the ground counts for the ground it covered. Soil borings, having utilities marked and looking for tile already in the ground are done on a place for a design, not on particular pipes, so until PR 29 they had nothing to tie them to, and one sign-off held for every later design and scenario in the project. Each sign-off of these now keeps the scenario, the project's fields and the box around every pipe at the time, and it stops counting when the scenario is another one, a field has been added, or a pipe reaches more than 5 m past that box. The 5 m is a judgment: enough for a node to be nudged or a line trimmed, and short of another run of pipe. Taking a field away or pulling pipes back leaves it standing. A task that opens again says who signed it off, when, and which of those happened, and signing it off again covers the design as it now is. Sign-offs of these three recorded before PR 29 kept none of this, so they open again once, saying so.
Water surface in a pipe
Capacity assumes a pipe running full on its own grade. Where water stands in it really depends on what's below it, so this works that out for one pipe at a steady flow. The geometry of part-full round pipe is closed-form. The rest is standard open-channel hydraulics, as in the HEC-RAS Hydraulic Reference Manual.
- Normal depth is where gravity and friction balance, by Manning's equation at that depth. A round pipe carries the most at 0.938 of its diameter, about 7.6% more than when full, so a flow can have no normal depth at all, and then it runs under pressure.
- Critical depth is where the Froude number is one,
Q²T / (gA³) = 1. - On a mild grade the surface is set from downstream, starting at the higher of what's below and critical depth, then working back up by
dy/dx = (S - Sf) / (1 - Fr²). It only ever heads for normal depth. - On a steep grade it's set from upstream, at normal depth, unless the tailwater drowns that. Then it falls back to critical depth and jumps down to normal depth.
- Under pressure, it climbs at the friction slope of a full pipe, going up by what friction costs over what the grade gives (
dy/dx = Sf - S). That holds across the 1.00 to ~1.076 × full-flow band as well: although an open-channel normal depth still exists below 0.938 D, a pipe already flowing full climbs atSf - Srather than being clamped by the open-channel normal depth.
| Check | Expected | Basis |
|---|---|---|
| Half full | Exactly half of full flow | The geometry: the hydraulic radius is the same as full, and the area is half |
| Most flow | 0.938 of the diameter, 1.0757 times full flow | Brute force over the geometry in the test itself |
| Pressurized at 1.04× full flow | Climbs (1.04² - 1) × S × L = 0.03264 m |
Full-pipe Manning friction slope on 12 in, n = 0.012, S = 0.002, L = 200 m (to 1e-4 m) |
| Critical depth at half full | Q² = gA³/T |
The geometry |
| Against Straub's approximation (1978) | Within 9% | Published, as cited here |
| A surface with few steps | Within 5% of one with many | A check on the numerical method |
| A surface against 20,000 small direct steps | To 3 decimals | A different integration of the same equation |
None of these checks the model itself against something else. That's item 96, against SWMM.
Water through the network
Each pipe's surface starts from wherever water stands at its downstream node, and where it ends is what the next one up has to work with. So it works from each outlet back up. At an outlet that's the design tailwater if one's been recorded, and otherwise a free outfall, where the surface draws down to critical depth. Where pipes come together, the node takes the highest of them.
This shows what checking pipes one at a time can't: a high tailwater, or a short stretch that can't carry its flow, backing up into everything above it. It's the dashed "Water" line on the profile.
- Water above the ground is a problem, since it would come up out of the ground at the design flow.
- A pipe under pressure is a caution. It isn't necessarily wrong, and it isn't what a pipe sized to run full on its grade should do, so someone should look.
Above a pipe that can't be worked out, nothing is. A pipe with no elevations, no flow, no size or no Manning's n has no water surface, and neither does any pipe that drains through it, since nothing says where the water they run into stands. Each of those pipes is listed with the reason, the profile says its water line is missing because the level isn't known, and each pipe that could otherwise be worked out gets a caution naming what the pipe below it lacks. The pipe at the bottom of it has its own check for that. Until PR 27 the pipe above started again as a free outfall, so with a high tailwater and an unsized last main, the main above it reported no backing up at all. A pump is where this stops: gravity pipes above a lift station only ever see its wet well.
This is steady flow in a tree, with no losses at junctions, so it reads a little low wherever a junction matters. Pipes past a split or a loop have no flow to work from and get nothing here, which is what the dynamic model in items 94 and 95 is for. A pipe with grade points is taken at its average grade.
A surveyed outlet is still held to the crown as its design gradeline, as NRCS has it, under "Outlets" above. This is what happens if it isn't met.
Roughness
pipe-products.md has the catalog's values and their sources. Figure 14-45 of the NRCS chapter restates its corrugated plastic values, and adds ranges for other materials.