# include # include # include # include # include int main ( ); void timestamp ( ); /******************************************************************************/ int main ( ) /******************************************************************************/ /* Purpose: vortex_subplots() creates a color contour plot of orbital data. Licensing: This code is distributed under the MIT license. Modified: 22 August 2026 Author: John Burkardt */ { FILE *command_unit; timestamp ( ); printf ( "\n" ); printf ( "vortex_subplots():\n" ); printf ( " C version\n" ); printf ( " Plot a pair of subplots together using gnuplot().\n" ); command_unit = fopen ( "vortex_subplots_commands.txt", "wt" ); fprintf ( command_unit, "# vortex_subplots_commands.txt\n" ); fprintf ( command_unit, "#\n" ); fprintf ( command_unit, "# Usage:\n" ); fprintf ( command_unit, "# gnuplot < vortex_subplots_commands.txt\n" ); fprintf ( command_unit, "#\n" ); fprintf ( command_unit, "set term png\n" ); fprintf ( command_unit, "set output 'vortex_subplots.png'\n" ); fprintf ( command_unit, "set multiplot layout 1,2 title \"Vortex pressure and velocity\"\n" ); fprintf ( command_unit, "#\n" ); fprintf ( command_unit, "set xlabel '<--- X --->'\n" ); fprintf ( command_unit, "set ylabel '<--- Y --->'\n" ); fprintf ( command_unit, "set title 'Pressure'\n" ); fprintf ( command_unit, "set grid\n" ); fprintf ( command_unit, "unset key\n" ); fprintf ( command_unit, "unset surface\n" ); fprintf ( command_unit, "set contour base\n" ); fprintf ( command_unit, "set view map\n" ); fprintf ( command_unit, "set pm3d\n" ); fprintf ( command_unit, "set size ratio -1\n" ); fprintf ( command_unit, "unset tics\n" ); fprintf ( command_unit, "set view map scale 0.90\n" ); fprintf ( command_unit, "splot 'vortex_pressure_data.txt' with pm3d\n" ); fprintf ( command_unit, "#\n" ); fprintf ( command_unit, "set xlabel \"<--- X --->\"\n" ); fprintf ( command_unit, "set ylabel \"<--- Y --->\"\n" ); fprintf ( command_unit, "set title \"Velocity\"\n" ); fprintf ( command_unit, "unset key\n" ); fprintf ( command_unit, "set grid\n" ); fprintf ( command_unit, "set size ratio -1\n" ); fprintf ( command_unit, "plot \"vortex_velocity_data.txt\" using 1:2:5:6 with vectors \\\n" ); fprintf ( command_unit, " head filled lt 2 linecolor rgb \"blue\"\n" ); fprintf ( command_unit, "#\n" ); fprintf ( command_unit, "unset multiplot\n" ); fprintf ( command_unit, "quit\n" ); fclose ( command_unit ); printf ( " Created command file 'vortex_subplots_commands.txt'\n" ); /* Terminate. */ printf ( "\n" ); printf ( "vortex_subplots():\n" ); printf ( " Normal end of execution.\n" ); timestamp ( ); return 0; } /******************************************************************************/ void timestamp ( ) /******************************************************************************/ /* Purpose: timestamp() prints the current YMDHMS date as a time stamp. Example: 17 June 2014 09:45:54 AM Licensing: This code is distributed under the MIT license. Modified: 01 May 2021 Author: John Burkardt */ { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct tm *tm; time_t now; now = time ( NULL ); tm = localtime ( &now ); strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm ); printf ( "%s\n", time_buffer ); return; # undef TIME_SIZE }