swirl.h
📄 View in API Reference (Doxygen) · View on basilisk.fr
Azimuthal velocity for axisymmetric flows
The centered Navier--Stokes solver can be combined with the axisymmetric metric but assumes zero azimuthal velocity ("swirl"). This file adds this azimuthal velocity component: the $w$ field.
Assuming that $x$ is the axial direction and $y$ the radial direction, as in axi.h, the incompressible, variable-density and viscosity, axisymmetric Navier--Stokes equations (with swirl) can be written
where the terms in blue are the missing "swirl" terms. We will thus need to solve an advection-diffusion equation for $w$.
#include "tracer.h" [api]
#include "diffusion.h" [api]
scalar w[], * tracers = {w};
The azimuthal velocity is zero on the axis of symmetry ($y=0$).
w[bottom] = dirichlet(0);
We will need to add the acceleration term $w^2/y$ in the evolution equation for $u_y$. If the acceleration field is not allocated yet, we do so.
event defaults (i = 0)
{
if (is_constant(a.x)) {
a = new face vector;
foreach_face()
a.x[] = 0.;
}
}
The equation for $u_y$ is solved by the centered Navier--Stokes solver combined with the axisymmetric metric, but the acceleration term $w^2/y$ is missing. We add it here, taking care of the division by zero on the axis, and averaging $w$ from cell center to cell face.
event acceleration (i++)
{
face vector av = a;
foreach_face (y)
av.y[] += y > 0. ? sq(w[] + w[0,-1])/(4.*y) : 0.;
}
The advection of $w$ is done by the tracer solver, but we need to add diffusion. Using the diffusion solver, we solve
Identifying with the diffusion part of the equation for $w$ above, we have
Note that the *rho* and *mu* fields (defined by the Navier--Stokes solver) already include the metric (i.e. are $\rho y$ and $\mu y$), which explains the divisions by $y$ in the code below.
event tracer_diffusion (i++)
{
scalar beta[], theta[];
foreach() {
theta[] = rho[];
double muc = (mu.x[] + mu.x[1] + mu.y[] + mu.y[0,1])/4.;
double dymu = (mu.y[0,1]/fm.y[0,1] - mu.y[]/fm.y[])/Delta;
beta[] = - (rho[]*u.y[] + muc/y)/y - dymu;
}
diffusion (w, dt, mu, theta = theta, beta = beta);
}