One way to use potential flow is to create a set of basic flow elements. Each of these basic flow elements, often called "singularities", is a specific solution to the governing Laplace's equation. The idea is to use them as building blocks to create and describe various flow fields.
This idea works because if A and B are each a solution to Laplace's equation, then so is A+B. And you can keep adding as many as you want, A+B+C, etc.
So they are sort of like aerodynamic legos. Click them together to create different flow fields.
Coordinate System
We will work in the native display coordinate system as shown below. This is a little different than the typical coordinate system used in engineering. But these are just conventions. As long as the coordinate system being used is known and accounted for, the results are the same.
We will also stick with just a cartesian notation for everything, even though polar coordinates are cleaner for some of the singularities. Cartesian coordinates will be used in the code as well. So by sticking with cartesian notation, it also makes it easier to understand the code (hopefully).
Singularities
Each singularity has a location (SX, SY) and a strength S. The velocity (vx, vy) induced at some point (x, y) is then described by functions fx(), fy() specific to the singularity type.

So let's define our basic flow elements. There are four of them.
Freestream flow is just flow everywhere moving in the same direction. It's unique in that it doesn't have a location. Instead, you just define the two components sx and sy. For "straight" flow, left to right, you'd set sy=0, for example. 

A source shoots out in all directions from its origin location. A sink is just a source with negative strength, and then all the lines go in instead of out.


A vortex is like a whirlpool. Flow spins in a circle around the origin location. The sign of the strength sets the direction of rotation. 

A doublet is a source/sink pair brought together so they sit on top of each other. It's a bit of an oddball, but has its use. 
And that's our set of aerodynamic legos. Now let's play with them.