The complex Ginzburg–Landau equation

The complex Ginzburg–Landau equation tA=A+(1+iα)2A(1+iβ)A2A with A a complex number, is a classical model for phenomena exhibiting Hopf bifurcations such as Rayleigh-Bénard convection or superconductivity.

Posing Ar=Re(A) and Ai=Im(A) one gets the coupled reaction–diffusion equations. tAr=2Ar+Ar(1A2)α2Ai+A2βAi tAi=2Ai+Ai(1A2)+α2ArA2βAr

This system can be solved with the reaction–diffusion solver.

#include "grid/multigrid.h"
#include "run.h"
#include "diffusion.h"

scalar Ar[], Ai[], A2[];

In this example, we only consider the case when α=0.

double β;

The generic time loop needs a timestep. We will store the statistics on the diffusion solvers in mgd1 and mgd2.

double dt;
mgstats mgd1, mgd2;


We change the size of the domain L0.

int main() {
  β = 1.5;
  size (100);
  init_grid (256);

Initial conditions

We use a white noise in [104:104] for both components.

event init (i = 0) {
  foreach() {
    Ar[] = 1e-4*noise();
    Ai[] = 1e-4*noise();
  boundary ({Ar,Ai});

Time integration

event integration (i++) {

We first set the timestep according to the timing of upcoming events. We choose a maximum timestep of 0.05 which ensures the stability of the reactive terms for this example.

  dt = dtnext (0.05);

We compute A2.

    A2[] = sq(Ar[]) + sq(Ai[]);
  boundary ({A2});

We use the diffusion solver (twice) to advance the system from t to t+dt.

  scalar r[], λ[];
  foreach() {
    r[] = A2[]*β*Ai[];
    λ[] = 1. - A2[];
  mgd1 = diffusion (Ar, dt, r = r, β = λ);
  foreach() {
    r[] = - A2[]*β*Ar[];
    λ[] = 1. - A2[];
  mgd1 = diffusion (Ai, dt, r = r, β = λ);


Here we create MP4 animations for both components. The spread parameter sets the color scale to ± twice the standard deviation.

event movies (i += 3; t <= 150) {
  fprintf (ferr, "%g %g\n", t, sqrt(normf(A2).max));

  output_ppm (Ai, spread = 2, linear = true, file = "Ai.mp4");
  output_ppm (A2, spread = 2, linear = true, file = "A2.mp4");

For the value of β we chose, we get a typical “frozen state” composed of “cellular structures” for A2 and stationary spirals for Ai.

A2 Ai
Evolution of the norm and imaginary part

See also