src/test/uf.c
Stability of the embedded face velocity interpolation
If a “naive” face interpolation is used (by the face_value() macro) to compute face velocities in the centered Navier–Stokes solver, an instability can appear, due to the amplifications of velocity perturbations by the third-order Dirichlet interpolation used to compute viscous fluxes.
This problem is avoided by using an embedded-fraction-weighted interpolation of the face velocities (see /src/embed.h).
#include "embed.h"
#include "navier-stokes/centered.h"
int main()
{
(-0.5, -0.5);
origin periodic (right);
periodic (top);
= true;
stokes = 2e-5;
DT = HUGE [*];
TOLERANCE = 10;
NITERMIN = 32;
N
run();
}
event init (t = 0)
{
double eps = L0/(1 << 7)/1000.;
solid (cs, fs, union (y - L0/4. + eps, - L0/4 + eps - y));
= fm; mu
The boundary condition is zero velocity on the embedded boundary.
.n[embed] = dirichlet(0);
u.t[embed] = dirichlet(0);
u
foreach()
.y[] = 1.;
u}
event logfile (i++; i <= 100)
{
fprintf (stderr, "%d %d %d %d %d %d %d %.3g %.3g %.3g %.3g\n",
,
i.i, mgp.nrelax, mgp.minlevel,
mgp.i, mgu.nrelax, mgu.minlevel,
mgu.resa*dt, mgu.resa, normf(u.y).max, normf(p).max);
mgp
foreach()
if (x < -L0/2. + L0/N)
printf ("%g %g %g %g %g\n", y, u.y[], p[], g.y[], cs[]);
printf ("\n");
}
event profile (t = end)
{
.nodump = false;
pdump();
assert (normf(u.y).max < 1e-3);
}