From a Biological Question to a Testable Spatial Prediction
A spatial model is useful only if its output answers a defined question. “Simulate signal spread” is not yet a prediction: it does not say which signal, over what domain or time, or what feature of the distribution matters. A prediction might instead be “the signal concentration at the tissue boundary after 6 hours,” “the distance from a source at which concentration falls below a specified threshold,” or “the total signal in the domain over time.” These are different outputs, and they need not respond in the same way to the same mechanism.
Before choosing equations or simulation rules, specify the modeled domain, the quantities that vary in space and time, the biological processes represented, the boundary and initial conditions, and the output used to answer the question. State units for each quantity. This makes assumptions visible and provides checks for both the model and its implementation.
The spatial representation should follow the prediction and the mechanisms needed to produce it. A continuum model describes fields such as concentration or cell density at locations in a domain. An agent-based model represents discrete entities and their rules, such as cell movement, division, or interactions. A hybrid model may use both. Earlier material on choosing between continuum and agent-based models provides the basic selection principles; in a workflow, the practical test is whether the chosen representation can express the relevant mechanism and produce the specified output without adding unneeded detail.
For example, a question about a smooth signal gradient may be addressed by a continuum field, while a prediction about the distribution of individual cell-to-cell distances may require explicit cells. Neither representation is automatically more realistic. The representation must also be consistent with the available observations: an output that cannot be measured or meaningfully compared with data may not constrain the model in the intended way.
Check Units and Limiting Cases Before Simulation
A model’s units should agree term by term. Consider a one-dimensional signal concentration \(c(x,t)\), with diffusion coefficient \(D\), first-order loss rate constant \(k\), and source rate per unit volume \(s(x,t)\):
If \(c\) is measured in \(\mu\mathrm{mol}/\mathrm{mm}^3\), \(x\) in mm, and \(t\) in h, then \(D\) must have units \(\mathrm{mm}^2/\mathrm{h}\), \(k\) must have units \(\mathrm{h}^{-1}\), and \(s\) must have units \(\mu\mathrm{mol}/(\mathrm{mm}^3\mathrm{h})\). Each right-hand term then has units of concentration per time, matching \(\partial c/\partial t\). A mismatch often reveals a missing length scale, an incorrectly converted time unit, or a source term that represents amount rather than rate.
Limiting cases provide a second check. Setting \(D=0\) should remove spatial redistribution, leaving local reaction dynamics. Setting \(k=0\) removes loss. Setting the source to zero removes production. These checks do not establish that the model is biologically complete; they test whether its equations and implementation behave consistently with their stated structure.
Worked Example: A Unit Check for Signal Spread
Suppose a hypothetical model uses \(c\) in \(\mu\mathrm{mol}/\mathrm{mm}^3\), \(x\) in mm, and time in hours. Let \(D=0.0200\ \mathrm{mm}^2/\mathrm{h}\), \(k=0.300\ \mathrm{h}^{-1}\), and a uniform source \(s=0.0100\ \mu\mathrm{mol}/(\mathrm{mm}^3\mathrm{h})\). Check the units and interpret the no-diffusion limit.
The diffusion term has units \( (\mathrm{mm}^2/\mathrm{h})(\mu\mathrm{mol}/\mathrm{mm}^5) =\mu\mathrm{mol}/(\mathrm{mm}^3\mathrm{h})\), because the second spatial derivative contributes \(\mathrm{mm}^{-2}\) relative to concentration. The loss term \(kc\) has units \((\mathrm{h}^{-1})(\mu\mathrm{mol}/\mathrm{mm}^3)\), and the source has the same units. The equation is dimensionally consistent.
When \(D=0\), the equation at each location becomes \(dc/dt=-0.300c+0.0100\). Its steady concentration is \(s/k=0.0100/0.300=0.0333\ \mu\mathrm{mol}/\mathrm{mm}^3\). This is a local reaction balance, not a spatial gradient: with no diffusion, one location does not affect another through this equation.
Use Conservation and Limiting Behavior as Tests
For a spatial model, the quantity integrated over the domain can behave differently from the value at one location. This distinction is central to interpreting simulations. Consider the diffusion-loss equation on \(0\leq x\leq L\), with no source and zero-flux boundaries, so \(\partial c/\partial x=0\) at \(x=0,L\). Define the total signal \(M(t)=\int_0^L c(x,t)\,dx\). Differentiating and substituting the equation gives:
Thus \(M(t)=M(0)e^{-kt}\): the total signal decays when \(k>0\). This result does not imply that concentration must decrease at every point. Diffusion redistributes signal; it can raise concentration locally even while the total amount declines. The result also depends on the zero-flux boundary condition. With nonzero boundary flux, signal may enter or leave the domain, so that term must be included in the balance.
This derivation gives an implementation test. In a source-free, zero-flux simulation, the integrated signal should follow the expected loss balance as numerical resolution is refined. If it instead increases substantially or changes at the wrong rate, check boundary implementation, units, reaction terms, and numerical error. Do not impose the same test on a local concentration, which can rise through redistribution.
Worked Example: Total Signal Can Fall While Local Concentration Rises
Consider a hypothetical signal on \(0\leq x\leq L\) with \(D=0.0200\ \mathrm{mm}^2/\mathrm{h}\), \(k=0.400\ \mathrm{h}^{-1}\), no source, and zero-flux boundaries. Let the initial profile be \(c(x,0)=1+\cos(\pi x/L)\), where concentration is in arbitrary consistent units. Find the initial rate of change at \(x=L\), and the total signal after 2 hours if \(M(0)=L\) in concentration-length units.
At \(x=L\), the initial concentration is \(1+\cos(\pi)=0\). The second derivative is \(\partial^2c/\partial x^2=-(\pi/L)^2\cos(\pi x/L)\), so at \(x=L\) it equals \(\pi^2/L^2\). Therefore,
The concentration at the boundary initially increases: diffusion carries signal into that initially low-concentration location. Yet the total follows \(M(2)=Le^{-0.400(2)}=0.4493L\). The domain-wide total has fallen by about \(55.1\%\), while concentration at the boundary initially rises. The two statements concern different outputs and are compatible.
Check the Spatial and Temporal Resolution
A simulated result may depend on the grid spacing, time step, or agent update schedule, even when the biological model is unchanged. Numerical convergence asks whether the output of interest approaches a stable value as numerical resolution is refined. It is distinct from stochastic variability: a stochastic model may produce different outputs across random realizations even at fixed resolution. Both effects should be assessed rather than mistaken for biological uncertainty.
For a simple explicit finite-difference scheme for one-dimensional diffusion, a common stability condition is \(D\Delta t/\Delta x^2\leq 1/2\), where \(\Delta x\) is the spatial step and \(\Delta t\) is the time step. This condition applies to that scheme and the diffusion equation; reaction terms or different schemes can impose different constraints. Passing a stability condition is not proof of accuracy. Outputs still need a refinement check.
Worked Example: Refining a Spatial Simulation
A hypothetical continuum model with diffusion coefficient \(D=0.0200\ \mathrm{mm}^2/\mathrm{h}\) is run at three resolutions. The prediction of interest is penetration distance at 4 hours, defined as the distance from the source where concentration reaches a fixed threshold. The table also reports total signal and concentration at the far boundary.
| Grid step \(\Delta x\) (mm) | Time step \(\Delta t\) (h) | Penetration distance (mm) | Total signal (units) | Boundary concentration (units) |
|---|---|---|---|---|
| 0.0400 | 0.00400 | 0.420 | 9.82 | 0.31 |
| 0.0200 | 0.00100 | 0.405 | 9.79 | 0.28 |
| 0.0100 | 0.000250 | 0.401 | 9.78 | 0.27 |
For the finest run, the diffusion stability ratio is \(D\Delta t/\Delta x^2=0.0200(0.000250)/(0.0100)^2=0.0500\), below \(1/2\). The corresponding ratios at the middle and coarse resolutions are also 0.0500. Stability is therefore plausible for this diffusion scheme, though it does not by itself establish accuracy.
From the middle to finest run, penetration distance changes by \(|0.401-0.405|/0.405=0.00988\), or \(0.988\%\). Total signal changes by \(|9.78-9.79|/9.79=0.102\%\), while boundary concentration changes by \(|0.27-0.28|/0.28=3.57\%\). If a 1% numerical tolerance had been specified for the penetration distance and total signal, those two outputs meet it in this comparison, but boundary concentration does not. The conclusion is specific to the chosen outputs and tolerance; one cannot claim that the entire spatial solution has converged from these comparisons alone.
Evaluate Outputs and Diagnose Failure Modes
Spatial diagnostics should be selected to match the prediction. If the question concerns a threshold-defined penetration distance, inspect the profile near the threshold and check whether the estimate changes with resolution. If the question concerns total signal, calculate the spatial integral and compare it with the model’s mass balance. If the question concerns cell organization, summaries such as local density, neighborhood counts, or distance distributions may be more informative than a domain-wide average.
Useful checks include plotting profiles at several times, examining boundary behavior, checking whether concentrations or cell counts become physically impossible, and comparing integrated quantities with expected production and loss. For agent models, repeat runs with different random seeds to characterize stochastic variability; keep numerical settings fixed while doing so. To assess resolution effects, change spatial or temporal resolution while holding model assumptions and parameters fixed. Otherwise the source of a change in output is ambiguous.
Several failure patterns are especially informative. A sharp change in the predicted output under modest grid refinement suggests inadequate resolution or a poorly resolved threshold. A systematic drift in a conserved quantity may indicate a boundary or implementation error. Negative concentrations can signal a numerical scheme or time step that is unsuitable for the problem. A spatial average that appears stable while a boundary or hotspot output changes substantially can conceal a failure for the actual prediction. These are prompts to investigate, not universal proof that a model is invalid.
The main alternatives are not competing “correct” answers but different ways to represent the system. A continuum model is often efficient for smooth fields and allows direct calculation of gradients and integrals, but can obscure discrete cell variability. An agent-based model represents individual entities and event rules, but can be computationally expensive and stochastic. A hybrid model can combine fields and cells, at the cost of additional coupling assumptions and implementation checks. The simplest model that represents the mechanism and output of interest is often the most interpretable choice.
Spatial outputs also have limitations. They depend on domain geometry, boundary conditions, spatial resolution, and the way model quantities correspond to measurements. A prediction can be numerically stable yet biologically misspecified, and a visually plausible spatial pattern is not by itself evidence of predictive accuracy. Report the output definition, units, resolution checks, and relevant limitations together so that the result can be interpreted in context.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- A source-free signal model has zero-flux boundaries and first-order loss. Which quantity has a simple exponential decay law, and why does that not require every local concentration to decrease?
- A one-dimensional diffusion model uses \(D=0.0100\ \mathrm{mm}^2/\mathrm{h}\), \(\Delta x=0.0200\ \mathrm{mm}\), and \(\Delta t=0.0100\ \mathrm{h}\). Does it meet the explicit diffusion condition stated in this tutorial?
- A model’s total signal changes by only 0.2% after grid refinement, but its threshold-defined distance changes by 5%. Which output has stronger evidence of convergence?
- What should be varied to assess stochastic variability, and what should be varied to assess numerical convergence?
Solutions. (1) The spatial integral \(M(t)=\int c\,dx\) follows \(dM/dt=-kM\), so \(M(t)=M(0)e^{-kt}\). Diffusion can move signal into a location with low initial concentration, raising the local value while loss reduces the total. (2) The ratio is \(D\Delta t/\Delta x^2=0.0100(0.0100)/(0.0200)^2=0.250\), which is at most \(1/2\), so the stated condition is met. This is a stability check, not a guarantee of accuracy. (3) The total signal has stronger evidence of convergence in the reported comparison; the threshold distance has not met a 1% tolerance, for example. (4) Change random seeds while holding numerical settings fixed to examine stochastic variability. Change spatial or temporal resolution while holding the model and parameters fixed to examine numerical convergence.