sandbox/Antoonvh/ek.c
Ekman flow in 2D
We test the force_geo.h
header file in 2D
#include "navier-stokes/centered.h"
#define U_GEO 1.
#include "force_geo.h"
scalar * tracers; //We need to declare the tracers
[bottom] = dirichlet (0.);
uz.t[bottom] = dirichlet (0.);
u
FILE * fp;
int main() {
= fopen ("vy", "w");
fp periodic (left);
= 1.;
f_cor = unityf;
mu = 25.;
L0 for (TOLERANCE = 1e-2; TOLERANCE >= 1e-6; TOLERANCE /= 10.)
run();
}
event init (t = 0) {
foreach()
.x[] = U_GEO;
u}
event adapt (i++)
({u.x, uz}, (double[]){0.005, 0.005}, 8);
adapt_wavelet
#include "profile5c.h"
scalar u_test[];
event end (t < HUGE; i += 10) {
if (change (u.x, u_test) < 2e-3) {
fprintf (fp, "%g %g\n", TOLERANCE, normf(u.y).avg);
if (fabs (TOLERANCE - 1e-3) < 1e-4)
profile ({u.x, uz}, fname = "prof");
return 1;
}
}
Results
The approximate solution (slowly) converges towards the analytical Ekman spiral over time.
set xr [0 : 25]
set xlabel 'y'
set ylabel 'velocities'
plot 'prof' u 1:2 t 'u.x', 'prof' u 1:3 t 'uz',\
- exp(-0.707*x)*cos(0.707*x), exp(-0.707*x)*sin(0.707*x) 1
The effect of the TOLERANCE
on the average absolute
vertical velocity
reset
set xr [0.0000001:0.1]
set xlabel 'TOLERANCE'
set ylabel 'average abs(u.y)'
set key off
set logscale xy
plot 'vy' u 1:2