Subcritical Swift-Hohenberg equation (SH23)
Overview
The Swift-Hohenberg equation is the canonical model of pattern formation near a finite-wavenumber instability, introduced by Swift and Hohenberg in 1977 for Rayleigh-Bénard convection. Its quadratic-cubic (subcritical) variant, commonly called SH23, reads
\[u_t = r u - \left(1 + \partial_x^2\right)^2 u + b u^2 - u^3,\]
- $u(x,t)$: scalar field (e.g. the deviation of the temperature from the conducting state)
- $r$: bifurcation parameter (distance from the onset of the instability)
- $b$: strength of the quadratic nonlinearity, which breaks the $u \mapsto -u$ symmetry
Some properties
Linear stability: a Fourier mode $e^{ikx}$ grows at the rate $\sigma(k) = r - (1-k^2)^2$. The trivial state $u \equiv 0$ is linearly stable for $r < 0$ and loses stability at $r = 0$ to the critical wavenumber $k_c = 1$. Modes away from $k_c$ are strongly damped ($\sigma \sim -k^4$).
Subcriticality and bistability: for $b^2 > 27/38$ the bifurcation at $r=0$ is subcritical. A finite-amplitude periodic pattern then coexists with the stable trivial state for $r_{\mathrm{sn}} < r < 0$, where $r_{\mathrm{sn}}$ is the saddle-node of the periodic branch ($r_{\mathrm{sn}} \approx -0.37$ for $b = 1.8$ and wavenumber $k=1$). In this window the basin of attraction of $u \equiv 0$ is bounded by the stable manifolds of unstable (lower-branch) states, which makes the model a test case for methods that estimate regions of attraction.
Localized states: inside the bistable window, spatially localized patches of pattern exist and organize in the snaking bifurcation diagram described by Burke and Knobloch (2006). On domains of only a few wavelengths these states have little room and the dynamics is dominated by the periodic pattern.
Gradient flow: SH23 is the $L_2$-gradient flow of the Lyapunov functional
\[E(u) = \int \left( -\frac{r}{2}u^2 + \frac{1}{2}\left[(1+\partial_x^2)u\right]^2 - \frac{b}{3}u^3 + \frac{1}{4}u^4 \right) dx,\]
so every bounded trajectory converges to a steady state.
Model
Expanding the linear operator as $(r-1) - 2\partial_x^2 - \partial_x^4$, the semi-discrete SH23 equation is a linear-quadratic-cubic model:
\[\dot{\mathbf{u}}(t) = \mathbf{Au}(t) + \mathbf{F}(\mathbf{u}(t) \oslash \mathbf{u}(t)) + \mathbf{E}(\mathbf{u}(t) \oslash \mathbf{u}(t) \oslash \mathbf{u}(t)) + \mathbf{Bw}(t)\]
where
- $\mathbf{u}\in\mathbb{R}^N$: the state vector
- $\mathbf{w}\in\mathbb{R}^m$: the input vector (Dirichlet boundary values)
- $\mathbf{A}\in\mathbb{R}^{N\times N}$: the linear state matrix, a symmetric pentadiagonal matrix from second-order central differences
- $\mathbf{F}\in\mathbb{R}^{N\times N(N+1)/2}$: the quadratic state matrix without redundancy (the $bu^2$ term)
- $\mathbf{E}\in\mathbb{R}^{N\times N(N+1)(N+2)/6}$: the cubic state matrix without redundancy (the $-u^3$ term)
- $\mathbf{B}\in\mathbb{R}^{N\times m}$: the control input matrix
The model parameters are passed as params=Dict(:r => ..., :b => ...).
Boundary conditions
:periodic: $\mathbf{A}$ is a circulant matrix. UseΔx = (Ω[2]-Ω[1])/Nxso that the discrete period equals the domain length; since the dynamics selects the wavenumber $k_c = 1$, a domain of length $2\pi m$ holds exactly $m$ critical wavelengths.:dirichlet: hinged (simply supported) conditions $u = g$ and $u_{xx} = 0$. As in the other Dirichlet models of this package, the boundary values $g_L, g_R$ sit at ghost nodes one grid spacing outsidexspan; the condition $u_{xx} = 0$ fixes the second ghost node by reflection, $u_{-1} = 2g_L - u_1$. With $g_L = g_R = 0$ the operator $\mathbf{A}$ is symmetric and diagonalized by the discrete sine transform. The two columns of $\mathbf{B}$ carry $g_L$ and $g_R$.
Numerical Integration
For the numerical integration we consider two methods:
- Semi-Implicit Crank-Nicolson (SICN)
- Crank-Nicolson Adams-Bashforth (CNAB)
Both treat the stiff linear operator $\mathbf{A}$ with Crank-Nicolson and the reaction term $\mathbf{N}(\mathbf{u}) = \mathbf{F}\mathbf{u}^{\langle 2\rangle} + \mathbf{E}\mathbf{u}^{\langle 3\rangle}$ explicitly.
SICN:
\[\mathbf{u}(t_{k+1}) = \left(\mathbf{I}-\frac{\Delta t}{2}\mathbf{A}\right)^{-1} \left\{ \left( \mathbf{I} + \frac{\Delta t}{2}\mathbf{A} \right)\mathbf{u}(t_k) + \Delta t\,\mathbf{N}(\mathbf{u}(t_k)) + \frac{\Delta t}{2} \mathbf{B}\left[ \mathbf{w}(t_{k+1}) + \mathbf{w}(t_k) \right]\right\}\]
CNAB:
If $k=1$ the SICN step is used. If $k\geq 2$
\[\mathbf{u}(t_{k+1}) = \left(\mathbf{I}-\frac{\Delta t}{2}\mathbf{A}\right)^{-1} \left\{ \left( \mathbf{I} + \frac{\Delta t}{2}\mathbf{A} \right)\mathbf{u}(t_k) + \frac{3\Delta t}{2}\mathbf{N}(\mathbf{u}(t_k)) - \frac{\Delta t}{2}\mathbf{N}(\mathbf{u}(t_{k-1})) + \frac{\Delta t}{2} \mathbf{B}\left[ \mathbf{w}(t_{k+1}) + \mathbf{w}(t_k) \right]\right\}\]
where $\mathbf{u}^{\langle 2 \rangle}=\mathbf{u} \oslash \mathbf{u}$ and $\mathbf{u}^{\langle 3 \rangle}=\mathbf{u} \oslash \mathbf{u} \oslash \mathbf{u}$.
The fast integrator integrate_model_fast uses the same schemes with a pre-built solver from build_fast_solver. Because $\mathbf{A}$ is pentadiagonal, the tridiagonal solver does not apply: periodic boundaries use the FFT-based FastCirculant1DSolver, and Dirichlet boundaries use FastDenseSolver, which eigendecomposes the symmetric operator once and caches $(\mathbf{I}-\frac{\Delta t}{2}\mathbf{A})^{-1}$.
!!! Note Please go over the derivations in 1D heat equation and Kuramoto-Sivashinsky equation for details on how to construct the second- and fourth-order difference operators.
Example
using CairoMakie
using LinearAlgebra
using PolynomialModelReductionDataset
const pomoreda = PolynomialModelReductionDataset
# Setup: four critical wavelengths on a periodic domain, inside the bistable window
Ω = (0.0, 8π)
T = (0.0, 50.0)
Nx = 2^7
dt = 1e-2
sh = pomoreda.SwiftHohenbergModel(
spatial_domain=Ω, time_domain=T, Δx=(Ω[2]-Ω[1])/Nx, Δt=dt,
params=Dict(:r => -0.2, :b => 1.8), BC=:periodic
)
DS = 10
x = sh.xspan
# Operators and fast solver
A, F, E = sh.finite_diff_model(sh, sh.params)
solver = pomoreda.build_fast_solver(sh, sh.params; scheme=:CN)
# Two perturbations of the critical mode on either side of the threshold
sh.IC = 0.2 * cos.(x)
U_small = pomoreda.integrate_model_fast(sh, solver, sh.tspan, sh.IC;
quadratic_matrix=F, cubic_matrix=E, integrator_type=:CNAB)
sh.IC = 1.0 * cos.(x)
U_large = pomoreda.integrate_model_fast(sh, solver, sh.tspan, sh.IC;
quadratic_matrix=F, cubic_matrix=E, integrator_type=:CNAB)
fig = Figure(size=(900, 400))
crange = (-1.5, 1.5)
ax1 = Axis(fig[1, 1], xlabel=L"x", ylabel=L"t", title="Small perturbation: decays to 0")
heatmap!(ax1, x, sh.tspan[1:DS:end], U_small[:, 1:DS:end], colorrange=crange, colormap=:balance)
ax2 = Axis(fig[1, 2], xlabel=L"x", ylabel=L"t", title="Large perturbation: saturates on the pattern")
hm = heatmap!(ax2, x, sh.tspan[1:DS:end], U_large[:, 1:DS:end], colorrange=crange, colormap=:balance)
Colorbar(fig[1, 3], hm)
fig
API
PolynomialModelReductionDataset.SwiftHohenberg.SwiftHohenbergModel — Type
mutable struct SwiftHohenbergModel <: AbstractModelSubcritical (quadratic-cubic) Swift-Hohenberg equation model, commonly called SH23:
\[\frac{\partial u}{\partial t} = r u - \left(1 + \frac{\partial^2}{\partial x^2}\right)^2 u + b u^2 - u^3\]
where $u$ is the state variable, $r$ is the bifurcation (control) parameter, and $b$ is the quadratic coefficient. Expanding the linear operator,
\[\frac{\partial u}{\partial t} = (r-1) u - 2\frac{\partial^2 u}{\partial x^2} - \frac{\partial^4 u}{\partial x^4} + b u^2 - u^3,\]
so the semi-discrete model is linear-quadratic-cubic in the state. The linear growth rate of a Fourier mode $e^{ikx}$ is $r - (1-k^2)^2$, so the trivial state is linearly stable for $r<0$. For $b^2 > 27/38$ the pattern-forming bifurcation at $r=0$ is subcritical: a finite-amplitude periodic pattern coexists with the stable trivial state for $r_{\mathrm{sn}} < r < 0$, and the basin of $u \equiv 0$ is bounded by the stable manifolds of the unstable (lower-branch) states. For $b=1.8$ the saddle-node of the $k=1$ periodic branch is at $r_{\mathrm{sn}} \approx -0.37$.
Fields
spatial_domain::Tuple{Real,Real}: spatial domaintime_domain::Tuple{Real,Real}: temporal domainparam_domain::Dict{Symbol,Tuple{Real,Real}}: parameter domainΔx::Real: spatial grid sizeΔt::Real: temporal step sizexspan::Vector{<:Real}: spatial grid pointstspan::Vector{<:Real}: temporal pointsparams::Dict{Symbol,Union{Real,AbstractArray{<:Real}}}: parameters (:rbifurcation parameter,:bquadratic coefficient)spatial_dim::Int: spatial dimensiontime_dim::Int: temporal dimensionparam_dim::Dict{Symbol,Int}: parameter dimensionIC::AbstractArray{<:Real}: initial conditionBC::Symbol: boundary condition (:periodicor:dirichlet)finite_diff_model::Function: model using Finite Differenceintegrate_model::Function: integrator using Crank-Nicolson (linear) Explicit (nonlinear) method
PolynomialModelReductionDataset.SwiftHohenberg — Module
Subcritical Swift-Hohenberg (SH23) equation PDE ModelPolynomialModelReductionDataset.FastSolvers.build_fast_solver — Method
build_fast_solver(model, params; scheme, Δt)
Build a fast Crank-Nicolson-flavoured solver for the Swift-Hohenberg model (bakes α = Δt/2). Periodic BCs use the FFT-based circulant solver; hinged Dirichlet BCs give a symmetric pentadiagonal operator, which is eigendecomposed once (FastDenseSolver).
PolynomialModelReductionDataset.FastSolvers.integrate_model_fast — Function
integrate_model_fast(model, solver, tdata, u0; ...)
integrate_model_fast(
model,
solver,
tdata,
u0,
input;
quadratic_matrix,
cubic_matrix,
control_matrix,
integrator_type,
nl_jm1
)
Fast SICN or CNAB integrator for the 1D Swift-Hohenberg model.
Arguments
model::SwiftHohenbergModelsolver::AbstractFastSolver: frombuild_fast_solverwithscheme=:CNtdata::AbstractVector: time grid (uniform spacing assumed)u0::AbstractVector: initial conditioninput::AbstractArray=Float64[]: boundary input matrix (Dirichlet only)
Keyword Arguments
quadratic_matrix: F fromfinite_diff_modelcubic_matrix: E fromfinite_diff_modelcontrol_matrix=nothing: B fromfinite_diff_modelintegrator_type::Symbol=:CNAB::SICNor:CNABnl_jm1=nothing: reaction term at the previous step, seed for AB-2 (CNAB only)
PolynomialModelReductionDataset.SwiftHohenberg.finite_diff_dirichlet_model — Method
finite_diff_dirichlet_model(N, Δx, params)
Create the matrices A (linear operator), F (quadratic operator), E (cubic operator), and B (input operator) for the Swift-Hohenberg model with hinged Dirichlet boundary conditions $u = g$ and $u_{xx} = 0$ at both ends.
The boundary values $g_L, g_R$ sit at the ghost nodes one grid spacing outside xspan (the same convention as the other Dirichlet models in this package), and the condition $u_{xx}=0$ determines the second ghost node by reflection, $u_{-1} = 2 g_L - u_1$. For homogeneous boundary values the operator A is symmetric and diagonalized by the discrete sine transform.
Arguments
N::Real: spatial dimensionΔx::Real: spatial grid sizeparams::Dict: parameters
Returns
A::SparseMatrixCSC{Float64,Int}: linear operatorF::SparseMatrixCSC{Float64,Int}: quadratic operatorE::SparseMatrixCSC{Float64,Int}: cubic operatorB::SparseMatrixCSC{Float64,Int}: input operator (columns: left and right boundary values)
PolynomialModelReductionDataset.SwiftHohenberg.finite_diff_model — Method
finite_diff_model(model, params)
Create the matrices A (linear operator), F (quadratic operator), E (cubic operator), and, for Dirichlet boundary conditions, B (input operator) for the Swift-Hohenberg model.
Arguments
model::SwiftHohenbergModel: Swift-Hohenberg modelparams::Dict: parameters dictionary
Returns
- periodic:
A, F, E - Dirichlet:
A, F, E, B
PolynomialModelReductionDataset.SwiftHohenberg.finite_diff_periodic_model — Method
finite_diff_periodic_model(N, Δx, params)
Create the matrices A (linear operator), F (quadratic operator), and E (cubic operator) for the Swift-Hohenberg model with periodic boundary condition. The linear operator is a symmetric pentadiagonal circulant matrix.
Arguments
N::Real: spatial dimensionΔx::Real: spatial grid sizeparams::Dict: parameters
Returns
A::SparseMatrixCSC{Float64,Int}: linear operatorF::SparseMatrixCSC{Float64,Int}: quadratic operatorE::SparseMatrixCSC{Float64,Int}: cubic operator
PolynomialModelReductionDataset.SwiftHohenberg.integrate_model — Method
integrate_model(tdata, u0; ...)
integrate_model(tdata, u0, input; kwargs...)
Integrate the Swift-Hohenberg model using the Crank-Nicolson Adams-Bashforth (CNAB) or the Semi-Implicit Crank-Nicolson (SICN) method.
Arguments
tdata::AbstractArray{T}: time datau0::AbstractArray{T}: initial conditioninput::AbstractArray{T}=[]: input data (Dirichlet boundary values)
Keyword Arguments
linear_matrix::AbstractArray{T,2}: linear matrix Aquadratic_matrix::AbstractArray{T,2}: quadratic matrix Fcubic_matrix::AbstractArray{T,2}: cubic matrix Econtrol_matrix::AbstractArray{T,2}: control matrix Bsystem_input::Bool=false: system input flagconst_stepsize::Bool=false: constant step size flagnl_jm1::AbstractArray{T}=nothing: reaction term at the previous time step (CNAB only)integrator_type::Symbol=:CNAB::SICNor:CNAB
Returns
u::Array{T,2}: integrated model states
Notes
- If
system_inputis true, thencontrol_matrixmust be provided. - If
const_stepsizeis true, then the time step size is assumed to be constant. - If
nl_jm1is provided, then the reaction term at the previous time step is used to start AB-2.
PolynomialModelReductionDataset.SwiftHohenberg.integrate_model_with_control_CNAB — Method
integrate_model_with_control_CNAB(
tdata,
u0,
input;
linear_matrix,
quadratic_matrix,
cubic_matrix,
control_matrix,
const_stepsize,
nl_jm1
)
Integrate the Swift-Hohenberg model using the Crank-Nicolson (linear) Adams-Bashforth (nonlinear) method (CNAB) with control.
PolynomialModelReductionDataset.SwiftHohenberg.integrate_model_with_control_SICN — Method
integrate_model_with_control_SICN(
tdata,
u0,
input;
linear_matrix,
quadratic_matrix,
cubic_matrix,
control_matrix,
const_stepsize
)
Integrate the Swift-Hohenberg model using the Semi-Implicit Crank-Nicolson (SICN) method with control input.
PolynomialModelReductionDataset.SwiftHohenberg.integrate_model_without_control_CNAB — Method
integrate_model_without_control_CNAB(
tdata,
u0;
linear_matrix,
quadratic_matrix,
cubic_matrix,
const_stepsize,
nl_jm1
)
Integrate the Swift-Hohenberg model using the Crank-Nicolson (linear) Adams-Bashforth (nonlinear) method (CNAB) without control.
PolynomialModelReductionDataset.SwiftHohenberg.integrate_model_without_control_SICN — Method
integrate_model_without_control_SICN(
tdata,
u0;
linear_matrix,
quadratic_matrix,
cubic_matrix,
const_stepsize
)
Integrate the Swift-Hohenberg model using the Crank-Nicolson (linear) Explicit (nonlinear) method, or, in other words, the Semi-Implicit Crank-Nicolson (SICN) method without control.
PolynomialModelReductionDataset.SwiftHohenberg.linear_stencil — Method
linear_stencil(Δx, r)
Stencil coefficients of the linear operator $(r-1) - 2\partial_x^2 - \partial_x^4$ discretized with second-order central differences. Returns the diagonal, first off-diagonal, and second off-diagonal values.
PolynomialModelReductionDataset.SwiftHohenberg.reaction_operators — Method
reaction_operators(N, b)
Quadratic operator F (N × N(N+1)/2) and cubic operator E (N × N(N+1)(N+2)/6) of the reaction term $b u^2 - u^3$ in the non-redundant (unique Kronecker) coordinates. Only the $u_i^2$ and $u_i^3$ columns are nonzero.
PolynomialModelReductionDataset.SwiftHohenberg.reaction_term — Method
reaction_term(u, F, E)
Evaluate the polynomial reaction term $F u^{⟨2⟩} + E u^{⟨3⟩}$ at a state vector u.