The ABC-flow is defined by the 3d-vector field:
$$V(x,y,z)=(A sin(z) + C cos(y), B sin(x) + A cos(z), C sin(y) + B cos(x)),$$where $A, B, C$ are real parameters.
The vector field $V$ represents a three-dimensional incompressible velocity field, which is an exact solution of Euler's equation for inviscid Newtonian fluids with periodic boundary conditions. It is a Beltrami vector field, i.e. it coincides with its vorticity, $\omega=\nabla \times V$.
We evaluate the ABC vector field at the points of a grid defined on the volume $[0, 2\pi]^3$
using PlotlyJS
include("src/plotlyju.jl");
include("src/PlotlyColorSchemes.jl");
function VF(x, y, z; A= 1, B= sqrt(2/3), C=sqrt(1/3))
return A*sin(z) + C*cos(y), B*sin(x) + A*cos(z), C*sin(y) + B*cos(x)
end
function cone_trace(x::AbstractVector, y::AbstractVector, z::AbstractVector,
uvw::AbstractMatrix; sizeref=2)
return cone(
x=x,
y=y,
z=z,
u=uvw[:, 1],
v=uvw[:, 2],
w=uvw[:, 3],
sizemode="scaled",
sizeref=sizeref,
colorscale=pl_curl,
colorbar_len=0.7,
anchor="tail")
end
xl = yl = zl = 0:π/10:2π
x = vec([xi for xi in xl, yi in yl, zi in zl])
y = vec([yi for xi in xl, yi in yl, zi in zl])
z = vec([zi for xi in xl, yi in yl, zi in zl]);
Evaluate the vector field at x, y, z, and convert the Vector of 3-tuples to a matrix of size (length(x), 3)
vfc = VF.(x, y, z) #typeof(vfc) is Vector{Tuple{Float64, Float64, Float64}}
UVW = reshape(reinterpret(Float64, vfc), (3, length(vfc)))';
trace = cone_trace(x, y, z, UVW)
pl1 = Plot(trace,
Layout(width=600, height=600,
scene_camera_eye=attr(x=1.55, y=1.55, z=0.6)),
style=plotlyju)
To illustrate how the ABC-vector field changes its direction and magnitude we display the cones in a few slices in the volume $[0, 2\pi]^3$.
z0 = 6*pi/5
X = vec([xi for yi in yl, xi in xl])
Y = vec([ yi for yi in yl, xi in xl])
Z = z0*ones(size(X))
vfs = VF.(X,Y, Z);
UVWs = reshape(reinterpret(Float64, vfs), (3, length(vfs)))';
slicez = cone_trace(X, Y, Z, UVWs; sizeref=7)
pl2 = Plot(slicez,
Layout(width=600, height=600,
scene_camera_eye=attr(x=1.55, y=1.55, z=0.75),
scene_zaxis_range=[0, 2π]),
style=plotlyju)
xs = vec([xi for xi in xl, zi in zl])
ys = 2π .- xs
zs = vec([zi for xi in xl, zi in zl])
vf = VF.(xs, ys, zs)
uvw = reshape(reinterpret(Float64, vf), (3, length(vf)))';
slice_xpy = cone_trace(xs, ys, zs, uvw; sizeref=1.5)
pl3 = Plot(slice_xpy,
Layout(width=600, height=600,
scene_camera_eye=attr(x=1.55, y=1.55, z=0.8)),
style=plotlyju)