Physical models¶
Summary¶
Package: dynamodels.physical (re-exported as romda.models.physical). All use IVPIntegrator (scipy.integrate.solve_ivp) except KS, which uses a discrete ETDRK4 map.
| Class | Dim | Key parameters | Integrator |
|---|---|---|---|
VdP |
2 | beta, zeta, kappa, law, omega |
IVP |
Lorenz63 |
3 | rho, sigma, beta |
IVP |
Lorenz96 |
Nx | F, Nx |
IVP |
KS |
Nx | nu, L, Nx |
Discrete (ETDRK4) |
Rijke |
2Nm+Nc | beta, tau, C1, C2, kappa |
IVP |
Annular |
4 | omega, nu, c2beta, kappa, epsilon |
IVP |
dynamodels.physical.van_der_pol.VdP(**model_dict)
¶
Bases: Model
Van der Pol oscillator — low-order model of a longitudinal thermoacoustic mode.
The acoustic pressure mode \(\eta\) evolves as
with a cubic (\(g = \eta^2\), law='cubic') or arctangent-saturated
(\(g = \eta^2 / (1 + \kappa \eta^2 / \beta)\), law='tan') heat-release law.
The estimable parameters are the linear growth rate \(\beta\), the damping
\(\zeta\) and the nonlinear saturation \(\kappa\).
References
Nóvoa & Magri (2022). Real-time thermoacoustic data assimilation. J. Fluid Mech., 948, A35. DOI: 10.1017/jfm.2022.653.
Source code in dynamodels/physical/van_der_pol.py
47 48 49 50 51 52 53 54 55 56 | |
dynamodels.physical.lorenz63.Lorenz63(**model_dict)
¶
Bases: Model
Lorenz (1963) system — chaotic benchmark with three state variables.
With the classical parameters (\(\sigma = 10\), \(\rho = 28\), \(\beta = 8/3\)) the system is chaotic with leading Lyapunov exponent \(\lambda_1 \approx 0.906\).
References
Lorenz (1963). Deterministic nonperiodic flow. J. Atmos. Sci., 20, 130–141.
Source code in dynamodels/physical/lorenz63.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
time_derivative(t, psi, sigma, rho, beta)
staticmethod
¶
Calculates the time derivative of the Lorenz 63 system. Note: This derivative must handle the augmented state vector (psi). The augmented parameters are stored after the core state (x, y, z).
Source code in dynamodels/physical/lorenz63.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
visualize_attractor(psi_cases=None, **kwargs)
¶
Visualizes the Lorenz attractor for given state trajectories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
psi_cases
|
list
|
State trajectories to plot, each of shape |
None
|
**kwargs
|
Plotting options forwarded to the helper ( |
{}
|
Source code in dynamodels/physical/lorenz63.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
dynamodels.physical.lorenz96.Lorenz96(**model_dict)
¶
Bases: Model
Lorenz (1996) system — chaotic model of \(N_x\) variables on a periodic lattice.
with indices taken cyclically modulo \(N_x\) (i.e. \(x_{-1} = x_{N_x - 1}\), \(x_{-2} = x_{N_x - 2}\) and \(x_{N_x} = x_0\)). Each variable is coupled quadratically to its two upstream neighbours, damped linearly (\(-x_i\)) and driven by a constant forcing \(F\). With the classical parameters (\(N_x = 40\), \(F = 8\)) the system is chaotic.
References
Lorenz (1996). Predictability: a problem partly solved. Proc. Seminar on Predictability, Vol. 1, ECMWF, Reading, UK, 1-18.
Source code in dynamodels/physical/lorenz96.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
time_derivative(t, psi, Nx, F)
staticmethod
¶
Calculates the time derivative of the Lorenz 96 system (see class docstring).
Source code in dynamodels/physical/lorenz96.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
dynamodels.physical.kuramoto_sivashinsky.KS(**model_dict)
¶
Bases: Model
Kuramoto-Sivashinsky equation.
with periodic boundary conditions \(u(t, 0) = u(t, L)\), \(u_x(t, 0) = u_x(t, L)\). Solved with the ETDRK4 scheme in Fourier space, where the Fourier transform pair is
On the \(N_x\)-point grid the wavenumbers are \(\alpha_j = 2\pi j / L\), so the (diagonal) linear operator is \(\alpha_j^2 - \nu\,\alpha_j^4\) and the nonlinear term \(u\,u_x\) is computed in physical space and transformed back to Fourier space at every stage.
Parametrization (\(\nu\), \(L\)). The pair is independent: whichever of the two is given fixes that side of the operator.
nuonly (the default): the domain follows the standard nondimensionalization \(L = 2\pi/\sqrt{\nu}\), and the equation is then integrated in its \(\nu = 1\) form on that domain -- soself.nuis 1 afterwards and the stored \((N_x, \nu, L)\) always describes the operator that was actually integrated (this is what makesntsa.respawn, which rebuilds fromfixed_params, bit-faithful).Lonly: \(\nu = 1\) on the given domain.- both: both are honoured as given, i.e. the genuine two-parameter system \(u_t + u_{xx} + \nu u_{xxxx} + u u_x = 0\) on \((0, L]\).
The one- and two-parameter forms are related by \(v(x', t') = \sqrt{\nu}\,u(x, t)\)
with \(x = \sqrt{\nu}\,x'\) and \(t = \nu\,t'\): KS(Nx, L=Lx, nu=visc, dt=dt) and
KS(Nx, L=Lx/sqrt(visc), dt=dt/visc) describe the same physical system.
Initialize the KS model.
Sets up the spatial grid, wavenumbers, sensor locations, and initial state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**model_dict
|
Model parameters; supported keys are:
|
{}
|
Source code in dynamodels/physical/kuramoto_sivashinsky.py
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 | |
get_observables(Nt=1, loc=None, **kwargs)
¶
Get the observable state in physical space at specified sensor locations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Nt
|
int
|
Number of time steps to retrieve. Default is 1. |
1
|
loc
|
array - like or str
|
Sensor locations to retrieve observables from. If 'all', returns observables at all spatial points. If None, returns observables at the predefined sensor locations. |
None
|
Source code in dynamodels/physical/kuramoto_sivashinsky.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
ETDRK4_step(u_hat, nonlinear_operator, E, E2, Q, f1, f2, f3)
staticmethod
¶
Standard Kassam-Trefethen ETDRK4 step:
a_n = exp(L h / 2) u_n + Q N(u_n) b_n = exp(L h / 2) u_n + Q N(a_n) c_n = exp(L h / 2) a_n + Q (2 N(b_n) - N(u_n))
u_{n+1} = exp(L h) u_n + f1 N(u_n) + 2 f2 (N(a_n) + N(b_n)) + f3 N(c_n)
where h is the timestep, L the (diagonal) linear operator, N the nonlinear operator, and Q, f1, f2, f3 the contour-integrated phi-function coefficients (see ETDRK4_f_terms). The linear part is integrated exactly; the nonlinear terms with fourth-order accuracy.
Source code in dynamodels/physical/kuramoto_sivashinsky.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
time_step(Nt=10, averaged=False, alpha=None)
¶
Integrator for the KS model that supports ensembles and averaged ensemble propagation. Matches interface conventions of other models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Nt
|
int
|
Number of time steps to integrate. |
10
|
averaged
|
bool
|
If True, integrates the mean state and broadcasts ensemble deviations. |
False
|
alpha
|
optional
|
Additional model parameters. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
psi |
ndarray
|
Forecasted state array of shape (Nt, Nphi, m). |
t |
ndarray
|
Time vector corresponding to each forecasted state. |
Source code in dynamodels/physical/kuramoto_sivashinsky.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | |
get_energy(Nt=0, u=None)
¶
Compute the L2 energy of the solution: E = (1/L) * integral(u^2)dx
Returns:
float L2 energy
Source code in dynamodels/physical/kuramoto_sivashinsky.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
get_enstrophy(Nt=0, u_hat=None)
¶
Compute the enstrophy (integral of (u_x)^2).
Returns:
float Enstrophy
Source code in dynamodels/physical/kuramoto_sivashinsky.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
visualize_spatiotemporal_hist(y_hist=None, t=None, nrows=None, averaged=False, **kwargs)
¶
Visualize the spatiotemporal evolution of the KS model in the physical space.
Source code in dynamodels/physical/kuramoto_sivashinsky.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | |
dynamodels.physical.rijke.Rijke(**model_dict)
¶
Bases: Model
Rijke tube — longitudinal thermoacoustic low-order model.
The acoustic velocity and pressure perturbations are expanded on \(N_m\) Galerkin modes with wavenumbers \(k_j = j\pi/L\),
giving the modal ODEs
where \(\bar\rho\), \(\bar{c}\) (and \(\bar{u}\), \(\bar{p}\), \(\bar\gamma\) below) are fixed mean-flow properties, weight-averaged across the temperature jump at the flame location \(x_f\), and \(\zeta_j\) is the modal damping. The heat release is projected onto the modes as
with a gain–delay law relating \(\dot{q}'\) to the (time-delayed) acoustic
velocity at the flame, \(u_f(t) \equiv u'(x_f, t - \tau)\): a square-root law
(law='sqrt')
or a saturating arctangent law (law='tan')
The delay \(\tau\) is realized by advecting \(u'(x_f, t)\) along an auxiliary field discretized with \(N_c\) Chebyshev collocation points, and interpolating it at the point corresponding to the elapsed delay to obtain \(u_f(t)\).
The estimable parameters are \(\beta\), \(\tau\), the damping coefficients \(C_1\),
\(C_2\), and \(\kappa\) (only active for law='tan'). The observables are the
pressure at Nq microphone locations.
References
Nóvoa & Magri (2022). Real-time thermoacoustic data assimilation. J. Fluid Mech., 948, A35. DOI: 10.1017/jfm.2022.653.
Source code in dynamodels/physical/rijke.py
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 | |
time_derivative(t, psi, C1, C2, beta, kappa, tau, cosomjxf, Dc, gc, jpiL, L, law, meanFlow, Nc, Nm, tau_adv, sinomjxf)
staticmethod
¶
Time derivative of the Rijke tube governing equations (see class docstring).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
Current time. |
required |
psi
|
ndarray
|
Augmented state vector; the first |
required |
C1
|
float
|
Modal damping coefficients, \(\zeta_j = C_1 j^2 + C_2 \sqrt{j}\). |
required |
C2
|
float
|
Modal damping coefficients, \(\zeta_j = C_1 j^2 + C_2 \sqrt{j}\). |
required |
beta
|
float
|
Heat-release intensity. |
required |
kappa
|
float
|
Saturation parameter used by the |
required |
tau
|
float
|
Time delay of the flame response. |
required |
cosomjxf
|
ndarray
|
Precomputed \(\cos(k_j x_f)\), \(\sin(k_j x_f)\) for each mode \(j\), used respectively to evaluate \(u'(x_f, t)\) and to project the heat release onto the \(\mu\) modes. |
required |
sinomjxf
|
ndarray
|
Precomputed \(\cos(k_j x_f)\), \(\sin(k_j x_f)\) for each mode \(j\), used respectively to evaluate \(u'(x_f, t)\) and to project the heat release onto the \(\mu\) modes. |
required |
Dc
|
ndarray
|
Chebyshev differentiation matrix and collocation points used to advect the delay line. |
required |
gc
|
ndarray
|
Chebyshev differentiation matrix and collocation points used to advect the delay line. |
required |
jpiL
|
ndarray
|
Modal wavenumbers \(k_j = j\pi/L\). |
required |
L
|
float
|
Tube length. |
required |
law
|
str
|
Heat-release law, |
required |
meanFlow
|
dict
|
Mean-flow properties at the flame (\(\bar\rho\), \(\bar u\), \(\bar p\), \(\bar c\), \(\bar\gamma\), \(\bar T\)). |
required |
Nc
|
int
|
Number of Chebyshev modes discretizing the delay line. |
required |
Nm
|
int
|
Number of Galerkin modes. |
required |
tau_adv
|
float
|
Reference advection time spanned by the delay line. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Concatenated time derivative of the augmented state vector. |
Source code in dynamodels/physical/rijke.py
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 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
visualize_spatiotemporal_hist(y_hist=None, t=None, nrows=None, averaged=False, reference_y=1.0, reference_t=1.0, **kwargs)
¶
Visualize the spatiotemporal evolution of the Rijke tube model in the physical space.
Source code in dynamodels/physical/rijke.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |
dynamodels.physical.annular.Annular(**model_dict)
¶
Bases: Model
Annular combustor — two coupled oscillators for the first azimuthal modes.
The acoustic pressure in the annulus obeys the wave equation with heat-release source and resistive/reactive asymmetries,
Decomposing the pressure field onto the first azimuthal mode pair (\(n = 1\)),
yields four coupled first-order ODEs for \((\eta_a, \dot{\eta}_a, \eta_b, \dot{\eta}_b)\):
The estimable parameters are the growth rate \(\nu\), the resistive-asymmetry intensity \(c_2\beta\), the saturation \(\kappa\), the reactive-asymmetry amplitude \(\epsilon\) and phase \(\Theta_\epsilon\), the frequency \(\omega\) and the direction of maximum r.m.s. pressure \(\Theta_\beta\).
Example dynamical regimes:
- purely spinning mode: \((\nu, c_2\beta) = (30, 5)\);
- purely standing mode: \((\nu, c_2\beta) = (0, 50)\);
- mixed mode: \((\nu, c_2\beta) = (20, 18)\).
References
Nóvoa, Noiray, Dawson & Magri (2024). A real-time digital twin of azimuthal thermoacoustic instabilities. J. Fluid Mech., 1001, A49. DOI: 10.1017/jfm.2024.1052.
Source code in dynamodels/physical/annular.py
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 | |
get_observables(Nt=1, loc=None, measure_modes=False, **kwargs)
¶
pressure measurements at theta = [0º, 60º, 120º, 240º]
Source code in dynamodels/physical/annular.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
time_derivative(t, psi, nu, kappa, c2beta, theta_b, omega, epsilon, theta_e)
staticmethod
¶
Time derivative of the two coupled azimuthal oscillators (see class docstring).
Source code in dynamodels/physical/annular.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |