1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
//! Reference cases for scientific validation
//!
//! Each [`ReferenceCase`] encodes a set of physical parameters and the
//! analytical predictions derived from the literature against which chrom-rs
//! results are compared.
//!
//! # Bibliographic basis
//!
//! - **Lapidus & Amundson (1952)** — analytical solution for linear
//! advection-dispersion in a chromatographic column; provides exact
//! expressions for the retention time and peak variance.
//! - **Felinger & Guiochon, §7.1** — dissimilarity criterion $R_{sf}$
//! and its thresholds for model equivalence (Figures 7.1–7.3).
//!
//! # Validation strategy
//!
//! Three complementary cases are defined:
//!
//! | Case | Regime | Criterion | Reference |
//! |------|--------|-----------|-----------|
//! | [`linear_tfa`] | Linear ($C_0 \to 0$) | $t_R$ ±1 %, $\sigma$ ±10 %, mass ≥ 90 % | Lapidus-Amundson analytical |
//! | [`nonlinear_tfa`] | Non-linear ($C_0 = 0.1$) | $t_R < t_R^{lin}$, mass ≥ 85 % | Langmuir qualitative properties |
//! | Euler vs RK4 | Internal | $R_{sf} < 0.05$ | §7.1, Figure 7.1 |
//!
//! The Euler-vs-RK4 comparison lives in the test module of `main.rs`
//! rather than in a `ReferenceCase`, because it requires running two
//! simulations rather than comparing against precomputed values.
// =================================================================================================
// Physical parameters — shared by all TFA cases
// =================================================================================================
/// Column length $L$ \[m\]
pub const COLUMN_LENGTH: f64 = 0.3;
/// Interstitial porosity $\varepsilon$
pub const POROSITY: f64 = 0.4;
/// Superficial velocity $u = \varepsilon \cdot u_e$ \[m/s\]
///
/// Passed to [`LangmuirSingle::new`] which internally computes
/// $u_e = u / \varepsilon = 2.5 \times 10^{-3}$ m/s.
pub const VELOCITY: f64 = 1.0e-3;
/// Linear retention term $\lambda$
pub const LAMBDA: f64 = 1.0;
/// Langmuir equilibrium constant $\tilde{K}$ \[L/mol\]
pub const KI: f64 = 0.5;
/// Adsorption capacity $N$ (number of sites)
pub const PORT_NUMBER: f64 = 6.0;
// =================================================================================================
// Simulation parameters — shared discretisation
// =================================================================================================
/// Number of spatial discretisation points $N_z$
pub const N_POINTS: usize = 100;
/// Total simulation time \[s\] — covers $t_R + 4\sigma \approx 870$ s
pub const T_TOTAL: f64 = 900.0;
/// Number of time steps $N_t$
pub const N_STEPS: usize = 4500;
/// Injection duration for the inlet pulse \[s\]
///
/// Set to two solver time steps ($2 \Delta t$) so that all four RK4 stage
/// evaluations within step 0 and step 1 fall inside the injection window.
/// This guarantees that the injected area is exactly $C_0 \cdot T_{inj}$
/// regardless of the solver.
///
/// A Dirac delta ($t_{inj} \to 0$) is not suitable for RK4 because the
/// intermediate stage evaluations at $t + \Delta t/2$ and $t + \Delta t$
/// fall outside the single time point and return zero.
pub const T_INJ: f64 = 2.0 * T_TOTAL / N_STEPS as f64;
// =================================================================================================
// ReferenceCase
// =================================================================================================
/// Physical parameters and analytical predictions for one validation case.
// =================================================================================================
// Tests
// =================================================================================================