Friday, November 18, 2016

Bezier, data points approximated by a polynomial made in VB6 (B-Spline, C spline, T-Spline)

Automated translation from Italian

The coordinates of the points to be interpolated or approximated may be changed to:
1) selecting, with the mouse cursor, the point to move and dragging it to the desired position.
2) Selecting, in the table, the coordinate to edit and write the new value in the Text box. Clicking an 'other box or by pressing the' Enter to confirm the new value; the Escape key restores the previous value.
3) Import a data file, generated by an 'other application with the menu command "Curve / Read to be interpolated" File of points.

The data must be organized as:
Xi (0), Yi (0)
Xi (1), Yi (1)
...., ....
Xi (NPI-1), Yi (NPI-1)
Coordinates, calculated, of the points of the spline curve can be saved to file with the menu command "Curve / Save the curve to File"; the data format will be ':
Xc (0), Yc (0)
Xc (1), Yc (1)
...., ....
Xc (NPC-1), YC (NPC-1)

NPI and NPCs are, respectively, the number of points to be interpolated and the number of points on which the spline is calculated. The default values ​​can be changed by writing in the "Curve Parameters" boxes.
The points, calculated, the spline curve can be highlighted by ticking the 'appropriate
box at the top, to the right on the graph.
The graph can 'scale be changed by changing the values ​​in the "Graph Scale" boxes.
When you import points to be interpolated from a file, the values ​​of NPI and the "Scale the graph will be updated automatically."

The data points are approximated with a polynomial of Bernstein.

The NK value determines the number of nodes of the approximating curve:
NK = 2 -> line segments.
NK = 3 -> quadratic curves.
... ..................
NK = NPI -> Bezier splines.

C spline:
The data points are interpolated by a cubic spline.

The data points are interpolated by a spline at an exponential voltage.
VZ parameter allows you to choose the tension of the curve: larger values ​​of VZ flatten the curve.

Wednesday, November 2, 2016

Advanced Cell Flow in VB6

The main features of CellFlow are:
-Freeware open source (Download VB6 source code)
-It can do any number of dimensions: 1, 2 and 3 dimensions, but also (just for fun) 4 and higher.
-It does an animation as it calculates.
-It works as a dynamical direct numerical simulation: With compressible flow, in explicit time dependence.
-Input files generated by a spreadsheet.
-Models pressures, flows, temperatures, and chemical species.
-Also suitable for acoustic simulation, and for simulation of aero acoustics (eg whistles)

To be fair, I can think of a few drawbacks:
-Only (topologically) rectangular grids. But cells need not be equal in size.
-No implicit turbulence model is implemented. But if you use a fine enough grid, you get turbulence explicitly.

Both of these drawbacks can of course be addressed. Maybe I will work on it if I have time.

Here are some pictures I generated for a ball in a channel, in 2D, 3D, and 4D.

2D, 3D and 4D velocity plots for an n-dimensional ball in a channel.
For 2D, this gives the well known "von Karman vortex street".
The 3D and 4D pictures are of course cross sections.