Documentation
The Model Builder
How to model anything that changes over time with stocks and flows, run it on SepalSolver, fit it to measurements and share it. Start with the three pages below, then use the rest as you need it.
- 1Read what the builder isFive minutes on stocks, flows and what runs them.
- 2Find your way round the editorWhere everything is, with a labelled picture.
- 3Build your first modelA cooling cup of coffee, checked against the exact answer.
Tutorials
Build something whole, one step at a time.
- A cup of coffee coolingYour first model: one stock, one flow and two constants, checked against the exact answer.
- Fitting an outbreak to case dataImport daily case counts, let Fit to Data find the contact rate, and judge how far to trust it.
- Two towns, one outbreakPut a model inside another twice, connect the copies with a flow, and watch the second outbreak follow the first.
- An oil field from pressure historyBuild a material balance from objects, match it to twelve pressure surveys, and forecast with wells.
How-to guides
One job, done quickly.
- Import measurements from a CSVGet a column of measurements into the model, drawn as dots against the line it should follow.
- Fit constants to measurementsChoose what to fit, run the fit, and read the ± and R² that come back.
- Compare scenariosRun the same model under different futures and see them on one chart.
- Find which constants matterSweep one constant across its range and see how far the answer moves.
- Use a curve from data in a formulaDraw or paste a relationship you know from data, and call it like a function.
- Write a rule in C#When a formula can't say it: ifs, loops and local variables in a block of your own C#.
- Make a model reusable as a moduleMark inputs and outputs, then drop the model into others as a single block.
- Choose a solverWhich of the nine solvers to use, and how to tell when a model is stiff.
- Save, share and embed a modelWhere models are kept, and how to send one, put it in a page, or post it.
- Read and run the C# behind a modelThe program SepalSolver runs, and how to take it to the terminal and change it.
Concepts
The thinking behind the tool.
- Stocks and flowsWhy a system is easier to model as what accumulates and what moves it.
- Feedback loopsWhere behaviour comes from: loops that reinforce and loops that balance.
- DelaysWhat a delay does to a system, and why one stage and four stages behave so differently.
- Units as a checkWhy giving everything a unit catches mistakes long before a number looks wrong.
- Stiff modelsWhen something fast and something slow share a model, and what that does to a solver.
- Calibration, uncertainty and validationWhat a fit can and can't tell you, and how to test a model on data it hasn't seen.
Reference: components
Every component, every setting.
- StockAn amount that builds up or runs down, changed only by its flows.
- FlowA rate that fills or drains a stock, per unit of time.
- VariableA value worked out from others by a formula, at every step.
- ConstantA fixed number with a slider, a unit and a range.
- LinkThe arrow that shows one value is used in another's formula.
- DelayA first-order delay: a stock, two flows and a delay time.
- Logistic growthGrowth that slows as it nears a limit.
- Lookup tableA curve from points, called like a function.
- C# blockA variable worked out by C# you write.
- ArrayA stock repeated n times, as a chain or side by side.
- Spatial stockA stock spread along a line: a one-dimensional PDE.
- SubmodelA whole model inside this one, in its own box.
- Module and boxesA model with inputs and outputs, used as one block; and folding any box.
- Nonlinear function (Fzero)The x between two bounds that makes an expression zero, at every step.
- IntegralA function of x added up between two bounds, at every step.
- Data seriesMeasurements over time, compared with a stock or variable.
- Fit to DataLsqcurvefit: the constants that make the model match the measurements best.
- Oil and gas kitPVT, tank, aquifer, history, diagnostics and wells for material balance.
Reference: language and settings
Formulas, units, solvers and limits.
- FormulasWhat a formula can contain: names, t, operators and functions.
- UnitsHow units are written, and the rules the checker applies.
- SolversThe nine ODE solvers, what each is for, and the accuracy they hold.
- Simulation settingsStart, end, time unit and solver, and how results are reported.
- Keyboard and mouseEvery shortcut in the editor.
- LimitsHow long a run may take, how often you may run, and other bounds.
- Messages and what they meanEvery problem the builder reports, and what to do about it.