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.
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
12% Copyright (c) 2012-2026, Imperial College London
23j = find(tg <= tt, 1, 'last');
24wj = (tt - tg(j)) / (tg(j+1) - tg(j));
25b = (1-wj)*B(:,j) + wj*B(:,j+1);