Add files via upload

This commit is contained in:
Nils Berglund
2025-01-11 19:25:51 +01:00
committed by GitHub
parent ac6280f770
commit 8a20ab883a
18 changed files with 2539 additions and 289 deletions

View File

@@ -44,7 +44,7 @@
#include <time.h>
#define MOVIE 0 /* set to 1 to generate movie */
#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */
#define DOUBLE_MOVIE 0 /* set to 1 to produce movies for wave height and energy simultaneously */
#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */
#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */
@@ -55,29 +55,34 @@
/* General geometrical parameters */
#define WINWIDTH 1920 /* window width */
// #define WINWIDTH 1920 /* window width */
#define WINWIDTH 1150 /* window width */
#define WINHEIGHT 1150 /* window height */
#define NX 3840 /* number of grid points on x axis */
// #define NX 3840 /* number of grid points on x axis */
#define NX 2300 /* number of grid points on x axis */
#define NY 2300 /* number of grid points on y axis */
#define XMIN -2.0
#define XMAX 2.0 /* x interval */
#define YMIN -0.997916667
#define YMAX 1.397916667 /* y interval for 9/16 aspect ratio */
// #define XMIN -2.0
// #define XMAX 2.0 /* x interval */
#define XMIN -1.197916667
#define XMAX 1.197916667 /* x interval */
#define YMIN -1.197916667
#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */
#define HIGHRES 1 /* set to 1 if resolution of grid is double that of displayed image */
#define HRES 1 /* dummy, only used by rde.c */
#define JULIA_SCALE 1.0 /* scaling for Julia sets */
#define JULIA_SCALE 0.8 /* scaling for Julia sets and some other domains */
/* Choice of the billiard table */
#define B_DOMAIN 792 /* choice of domain shape, see list in global_pdes.c */
#define B_DOMAIN 92 /* choice of domain shape, see list in global_pdes.c */
#define CIRCLE_PATTERN 202 /* pattern of circles or polygons, see list in global_pdes.c */
#define IMAGE_FILE 5 /* for option D_IMAGE */
#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */
#define B_DOMAIN_B 20 /* second domain shape, for comparisons */
#define B_DOMAIN_B 20 /* second domain shape, for comparisons */
#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */
#define P_PERCOL 0.15 /* probability of having a circle in C_RAND_PERCOL arrangement */
@@ -85,11 +90,11 @@
#define PDISC_FACTOR 3.5 /* controls density of Poisson disc process (default: 3.25) */
#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */
#define LAMBDA 0.85 /* parameter controlling the dimensions of domain */
#define MU 0.18 /* parameter controlling the dimensions of domain */
#define LAMBDA 0.8 /* parameter controlling the dimensions of domain */
#define MU 0.75 /* parameter controlling the dimensions of domain */
#define MU_B 1.0 /* parameter controlling the dimensions of domain */
#define NPOLY 3 /* number of sides of polygon */
#define APOLY -0.17 /* angle by which to turn polygon, in units of Pi/2 */
#define NPOLY 7 /* number of sides of polygon */
#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */
#define MDEPTH 6 /* depth of computation of Menger gasket */
#define MRATIO 3 /* ratio defining Menger gasket */
#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */
@@ -113,7 +118,6 @@
/* You can add more billiard tables by adapting the functions */
/* xy_in_billiard and draw_billiard below */
/* Physical parameters of wave equation */
#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */
@@ -128,10 +132,8 @@
#define AMPLITUDE 0.5 /* amplitude of periodic excitation */
#define ACHIRP 0.25 /* acceleration coefficient in chirp */
#define DAMPING 0.0 /* damping of periodic excitation */
#define COURANT 0.12 /* Courant number */
// #define COURANT 0.07 /* Courant number */
#define COURANTB 0.08 /* Courant number in medium B */
// #define GAMMA 1.0e-7 /* damping factor in wave equation */
#define COURANT 0.08 /* Courant number */
#define COURANTB 0.025 /* Courant number in medium B */
#define GAMMA 0.0 /* damping factor in wave equation */
#define GAMMAB 0.0 /* damping factor in wave equation */
#define GAMMA_SIDES 1.0e-4 /* damping factor on boundary */
@@ -146,10 +148,11 @@
/* For similar wave forms, COURANT^2*GAMMA should be kept constant */
#define ADD_OSCILLATING_SOURCE 1 /* set to 1 to add an oscillating wave source */
#define OSCILLATING_SOURCE_PERIOD 16 /* period of oscillating source */
#define OSCILLATING_SOURCE_PERIOD 49 /* period of oscillating source */
#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */
#define N_SOURCES 3 /* number of sources, for option draw_sources */
#define N_SOURCES 7 /* number of sources, for option draw_sources */
#define ALTERNATE_SOURCE_PHASES 0 /* set to 1 to alternate initial phases of sources */
#define MAX_PULSING_TIME 100 /* max time for adding pulses */
#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */
#define WAVE_PACKET_SOURCE_TYPE 3 /* type of wave packet sources */
@@ -164,7 +167,7 @@
/* Parameters for length and speed of simulation */
#define NSTEPS 2300 /* number of frames of movie */
#define NSTEPS 1350 /* number of frames of movie */
#define NVID 8 /* number of iterations between images displayed on screen */
#define NSEG 1000 /* number of segments of boundary */
#define INITIAL_TIME 0 /* time after which to start saving frames */
@@ -182,20 +185,20 @@
/* Parameters of initial condition */
#define INITIAL_AMP 1.5 /* amplitude of initial condition */
#define INITIAL_VARIANCE 0.00001 /* variance of initial condition */
#define INITIAL_AMP 1.4 /* amplitude of initial condition */
#define INITIAL_VARIANCE 0.00005 /* variance of initial condition */
#define INITIAL_WAVELENGTH 0.025 /* wavelength of initial condition */
/* Plot type, see list in global_pdes.c */
#define PLOT 0
#define PLOT 8
#define PLOT_B 8 /* plot type for second movie */
#define PLOT_B 0 /* plot type for second movie */
/* Color schemes */
#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */
#define COLOR_PALETTE_B 17 /* Color palette, see list in global_pdes.c */
#define COLOR_PALETTE 12 /* Color palette, see list in global_pdes.c */
#define COLOR_PALETTE_B 11 /* Color palette, see list in global_pdes.c */
#define BLACK 1 /* background */
@@ -206,17 +209,17 @@
#define PHASE_FACTOR 1.0 /* factor in computation of phase in color scheme P_3D_PHASE */
#define PHASE_SHIFT 0.0 /* shift of phase in color scheme P_3D_PHASE */
#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */
#define VSHIFT_AMPLITUDE 0.0 /* additional shift for wave amplitude */
#define VSCALE_AMPLITUDE 0.5 /* additional scaling factor for wave amplitude */
#define E_SCALE 10.0 /* scaling factor for energy representation */
#define VSHIFT_AMPLITUDE -0.5 /* additional shift for wave amplitude */
#define VSCALE_AMPLITUDE 0.2 /* additional scaling factor for wave amplitude */
#define E_SCALE 13.5 /* scaling factor for energy representation */
#define LOG_SCALE 0.75 /* scaling factor for energy log representation */
#define LOG_SHIFT 0.75 /* shift of colors on log scale */
#define FLUX_SCALE 250.0 /* scaling factor for energy flux represtnation */
#define AVRG_E_FACTOR 0.8 /* controls time window size in P_AVERAGE_ENERGY scheme */
#define AVRG_E_FACTOR 0.9 /* controls time window size in P_AVERAGE_ENERGY scheme */
#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */
#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */
#define SHADE_2D 0 /* set to 1 to add pseudo-3d shading effect */
#define SHADE_SCALE_2D 0.25 /* lower value increases sensitivity of shading */
#define SHADE_2D 1 /* set to 1 to add pseudo-3d shading effect */
#define SHADE_SCALE_2D 0.05 /* lower value increases sensitivity of shading */
#define COLORHUE 260 /* initial hue of water color for scheme C_LUM */
#define COLORDRIFT 0.0 /* how much the color hue drifts during the whole simulation */
@@ -225,10 +228,10 @@
#define HUEMEAN 180.0 /* mean value of hue for color scheme C_HUE */
#define HUEAMP -180.0 /* amplitude of variation of hue for color scheme C_HUE */
#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */
#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */
#define COLORBAR_RANGE_B 0.2 /* scale of color scheme bar for 2nd part */
#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */
#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */
#define COLORBAR_RANGE 1.5 /* scale of color scheme bar */
#define COLORBAR_RANGE_B 0.3 /* scale of color scheme bar for 2nd part */
#define ROTATE_COLOR_SCHEME 1 /* set to 1 to draw color scheme horizontally */
#define CIRC_COLORBAR 0 /* set to 1 to draw circular color scheme */
#define CIRC_COLORBAR_B 0 /* set to 1 to draw circular color scheme */
@@ -594,7 +597,7 @@ void draw_color_bar_palette(int plot, double range, int palette, int circular, i
void animation()
{
double time, scale, ratio, startleft[2], startright[2], sign[N_SOURCES], r2, xy[2], fade_value, yshift, speed = 0.0, a, b, c, x, y, angle = 0.0, x1, ior_angle = 0.0, omega, phase_shift, vshift, dsource, finv, source_amp;
double time, scale, ratio, startleft[2], startright[2], sign[N_SOURCES], r2, xy[2], fade_value, yshift, speed = 0.0, a, b, c, x, y, angle = 0.0, x1, ior_angle = 0.0, omega, phase_shift, vshift, dsource, finv, source_amp, nx, ny, r;
double *phi[NX], *psi[NX], *tmp[NX], *total_energy[NX], *average_energy[NX], *color_scale[NX], *total_flux, *tcc_table[NX], *tgamma_table[NX], *fade_table;
short int *xy_in[NX];
int i, j, k, s, sample_left[2], sample_right[2], period = 0, fade, source_counter = 0, p, q, first_source = 1, imin, imax, ij[2], source, source_period, source_shift[N_SOURCES];
@@ -829,17 +832,17 @@ void animation()
/* add oscillating waves */
for (source = 0; source < N_SOURCES; source++)
{
angle = APOLY*PID + (double)source*DPI/(double)NPOLY;
wave_source_x[source] = LAMBDA*cos(angle) + 2.0*MU*cos(angle - 0.5*PID);
wave_source_y[source] = LAMBDA*sin(angle) + 2.0*MU*sin(angle - 0.5*PID);
source_shift[source] = source*OSCILLATING_SOURCE_PERIOD/N_SOURCES;
if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == source_shift[source]))
angle = ((double)source)*DPI/(double)NPOLY + APOLY*PID - PID;
wave_source_x[source] = 1.0*LAMBDA*cos(angle);
wave_source_y[source] = 1.0*LAMBDA*sin(angle);
source_shift[source] = 0;
// source_shift[source] = OSCILLATING_SOURCE_PERIOD*source/N_SOURCES;
if ((ADD_OSCILLATING_SOURCE)&&(i%(OSCILLATING_SOURCE_PERIOD) == source_shift[source])&&(i<MAX_PULSING_TIME))
{
if (ALTERNATE_OSCILLATING_SOURCE) sign[source] = -sign[source];
add_circular_wave(-sign[source]*INITIAL_AMP, wave_source_x[source], wave_source_y[source], phi, psi, xy_in);
}
}
if (ADD_WAVE_PACKET_SOURCES) add_wave_packets(phi, psi, xy_in, packet, i, WAVE_PACKET_RADIUS, 1, 4, 1);
if (PRINT_SPEED) print_speed(speed, 0, 1.0);