# SPIRAL_DATA Velocity Vector Field Satisfying Continuity Equation

SPIRAL_DATA is a C++ program which samples a velocity vector field that satisfies the continuity equation, and writes the nodes and velocities to a file, suitable for display using GNUPLOT.

The continuous velocity field (U,V)(X,Y) that is discretely sampled here satisfies the homogeneous continuity equation, that is, it has zero divergence. In other words:

```
dU/dX + dV/dY = 0.
```
This is by construction, since we have
```
U(X,Y) =  10 * d/dY ( PHI(X) * PHI(Y) )
V(X,Y) = -10 * d/dX ( PHI(X) * PHI(Y) )
```
which guarantees zero divergence.

The underlying function PHI is defined by

```
PHI(Z) = ( 1 - cos ( C * pi * Z ) ) * ( 1 - Z )^2
```
where C is a parameter.

The velocity data satisifes the (continuous) continuity equation; this in no way implies that it satisfies the momentum equations associated with Stokes or Navier-Stokes flow! Moreover, a flow solution for those equations would normally also require specifying a value for the scalar pressure field P(X,Y).

### Languages:

SPIRAL_DATA is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version..

### Related Data and Programs:

GNUPLOT, C++ programs which illustrate the use of the gnuplot graphics program.

NAVIER_STOKES_2D_EXACT, a C++ library which evaluates an exact solution to the incompressible time-dependent Navier-Stokes equations over an arbitrary domain in 2D.

STOKES_2D_EXACT, a C++ library which evaluates exact solutions to the incompressible steady Stokes equations over the unit square in 2D.

### Examples and Tests:

Sample data was generated with N = 20 and C = 0.45 and plotted with GNUPLOT:

### List of Routines:

• GRID_2D returns a regular 2D grid.
• R8VEC_AMAX returns the maximum absolute value in an R8VEC.
• R8VEC_AMIN returns the minimum absolute value in an R8VEC.
• R8VEC_MAX returns the value of the maximum element in an R8VEC.
• R8VEC_MIN returns the value of the minimum element in an R8VEC.
• R8VEC_UNIFORM_AB_NEW returns a scaled pseudorandom R8VEC.
• RESID_SPIRAL computes the residual for a spiral velocity vector field.
• SPIRAL_GNUPLOT writes the spiral vector field to files for GNUPLOT.
• TIMESTAMP prints the current YMDHMS date as a time stamp.
• UV_SPIRAL computes a spiral velocity vector field.

You can go up one level to the C++ source codes.

Last revised on 20 January 2015.