continuity_exact, a C++ code which returns a 2D velocity vector field (u,v)(x,y) which is an exact solution of the partial differential equation (PDE) sometimes called the continuity equation of fluid mechanics, which has the form ux + vy = 0.
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).
The information on this web page is distributed under the MIT license.
continuity_exact is available in a C version and a C++ version and a Fortran77 version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.
cpp_exact, a C++ code which evaluates exact solutions to a few selected examples of ordinary differential equations (ODE) and partial differential equations (PDE).