LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
fluid_interpcols.m
1function b = fluid_interpcols(tg, B, tt)
2% B = FLUID_INTERPCOLS(TG, B, TT)
3% Clamped piecewise-linear interpolation of the columns of B at scalar time tt.
4%
5% B is (nrows x ngrid) with column j sampled at time tg(j); tg is a strictly
6% increasing grid. The result b is (nrows x 1). Times outside [tg(1),tg(end)]
7% are clamped to the boundary columns (zero-order hold outside the grid). This
8% is the shared time-varying-input evaluator used both by the TBI transient
9% (cross-cell inflow drift) and by the time-varying rate-multiplier closure in
10% solver_fluid_odes.
11%
12% Copyright (c) 2012-2026, Imperial College London
13% All rights reserved.
14
15if tt <= tg(1)
16 b = B(:,1);
17 return
18end
19if tt >= tg(end)
20 b = B(:,end);
21 return
22end
23j = find(tg <= tt, 1, 'last');
24wj = (tt - tg(j)) / (tg(j+1) - tg(j));
25b = (1-wj)*B(:,j) + wj*B(:,j+1);
26end
Definition Station.m:245