Here are some basic examples that can help get you started. For each one we give you the lines of code to use at the top of the code to define the singularities and the seeds for the streamlines. That way you can just copy-paste them in.
Flow Over an Ovoid
These all called Rankine bodies or Rankine ovals after Macquorn Rankine. The flow is comprised of freestream plus a source and sink pair.
#--| User Config |----------------------------------------- SINGULARITIES = ( # type location strength ('freestream', None, (1, 0)), ('source', (26, 16), 3), ('source', (38, 16), -3), ) SEEDS = ( # (x, y) starting location (0, 0), (0, 3), (0, 6), (0, 9), (0, 12), (0, 15), (0, 17), (0, 20), (0, 23), (0, 26), (0, 29), ) MATRIX_WIDTH = 64 MATRIX_HEIGHT = 32 BACK_COLOR = 0x000000 # background fill SING_COLOR = 0xADAF00 # singularities HEAD_COLOR = 0x00FFFF # leading particles TAIL_COLOR = 0x000A0A # trailing particles TAIL_LENGTH = 10 # length in pixels DELAY = 0.01 # smaller = faster #----------------------------------------------------------
The result should look like this:
Lifting Flow Over a Cylinder
This is called a cylinder instead of a sphere since the flow is two dimensional. We use a doublet to generate the main cylinder flow. To simulate lift we use a vortex. The two are located at the same location. And of course we still need our good 'ole friend the freestream.
#--| User Config |----------------------------------------- SINGULARITIES = ( # type location strength ('freestream', None, (1, 0)), ('doublet', (32, 16), 3), ('vortex', (32, 16), 4), ) SEEDS = ( # (x, y) starting location (0, 0), (0, 3), (0, 6), (0, 9), (0, 12), (0, 15), (0, 17), (0, 20), (0, 23), (0, 26), (0, 29), ) MATRIX_WIDTH = 64 MATRIX_HEIGHT = 32 BACK_COLOR = 0x000000 # background fill SING_COLOR = 0xADAF00 # singularities HEAD_COLOR = 0x00FFFF # leading particles TAIL_COLOR = 0x000A0A # trailing particles TAIL_LENGTH = 10 # length in pixels DELAY = 0.01 # smaller = faster #----------------------------------------------------------
What does this one look like? Well...run it and see :)
Page last edited March 08, 2024
Text editor powered by tinymce.