sandbox/Antoonvh/strat4.c
Interal waves and the dispersion relation
Internal waves can exist in a stratified fluid. An interesting feature of these waves is the so-called dispersion relation between the angle of wave propagation (\theta), stratification strength (N^2) and the freqency of the wave (\omega), according to,
\omega = N^2 \cos(\theta).
The Navier-Stokes equations under the Boussinesq approximation are solved. In the centre of the domain an oscillating force exites the internal waves with a freqency corresponding to \theta = 45^o.
A pass for the 4th order solver

‘dirichlet_vert_bottom’ undeclared (first use in this function)
[bottom] = dirichlet_vert_bottom;
b[top] = dirichlet_vert_top (L0);
bvector av;
double omega;
int main() {
= sqrt(2)/2.;
omega periodic (left);
.x = zeros;
av.y = b;
av= 30;
L0 = av;
a = 1e-5;
TOLERANCE = 0.2;
DT = 128;
N run();
}
event init (t = 0) {
() foreach_vert
[] = y;
bboundary ({b});
}

invalid storage class for function ‘accel_expr0’
invalid storage class for function ‘accel’
invalid storage class for function ‘accel’
event accel (i++) {
foreach()
if (sq(x - L0/2) + sq(y - L0/2) < 1)
.y[] += 0.1*dt*sin(omega*t); // Not accurate, but flexible...
u}

invalid storage class for function ‘output_expr0’
invalid storage class for function ‘output’
invalid storage class for function ‘output’
event output (t += 0.5) {
scalar grb[];
foreach() {
[] = 0;
grbforeach_dimension()
[] += sq((b[1] - b[-1])/(2*Delta));
grb[] = sqrt(grb[]);
grb}
output_ppm (grb, file = "grb.mp4", min = 0.8, max = 1.2, n = 300);
}

invalid storage class for function ‘stop_expr0’
invalid storage class for function ‘stop’
invalid storage class for function ‘stop’
event stop (t = 75);