diff --git a/global_3d.c b/global_3d.c index 44c265b..60ec2b8 100644 --- a/global_3d.c +++ b/global_3d.c @@ -27,6 +27,9 @@ /* Choice of potential */ #define POT_HARMONIC 1 /* harmonic oscillator */ +#define POT_COULOMB 2 /* Coulomb (1/r) potential */ +#define POT_PERIODIC 3 /* periodic potential */ +#define POT_DOUBLE_COULOMB 4 /* sum of Coulomb potentials located at focal points of ellipse */ /* plot types used by rde */ @@ -39,10 +42,12 @@ #define Z_ANGLE_GRADIENTX 231 /* direction of gradient of u */ #define Z_NORM_GRADIENT_INTENSITY 24 /* gradient and intensity of polar angle */ #define Z_VORTICITY 25 /* curl of polar angle */ +#define Z_VORTICITY_ABS 251 /* absolute value of curl of polar angle */ /* for Schrodinger equation */ #define Z_MODULE 30 /* module squared of first two fields */ #define Z_ARGUMENT 31 /* argument of first two fields, with luminosity depending on module */ +#define Z_REALPART 32 /* first field, with luminosity depending on module */ /* for RPSLZ equation */ #define Z_MAXTYPE_RPSLZ 40 /* color of type with maximal density */ @@ -51,8 +56,8 @@ /* macros to avoid unnecessary computations in 3D plots */ -#define COMPUTE_THETA ((cplot == Z_POLAR)||(cplot == Z_NORM_GRADIENT)||(cplot == Z_ANGLE_GRADIENT)||(cplot == Z_NORM_GRADIENT_INTENSITY)||(cplot == Z_VORTICITY)) -#define COMPUTE_THETAZ ((zplot == Z_POLAR)||(zplot == Z_NORM_GRADIENT)||(zplot == Z_ANGLE_GRADIENT)||(zplot == Z_NORM_GRADIENT_INTENSITY)||(zplot == Z_VORTICITY)) +#define COMPUTE_THETA ((cplot == Z_POLAR)||(cplot == Z_NORM_GRADIENT)||(cplot == Z_ANGLE_GRADIENT)||(cplot == Z_NORM_GRADIENT_INTENSITY)||(cplot == Z_VORTICITY)||(cplot == Z_VORTICITY_ABS)) +#define COMPUTE_THETAZ ((zplot == Z_POLAR)||(zplot == Z_NORM_GRADIENT)||(zplot == Z_ANGLE_GRADIENT)||(zplot == Z_NORM_GRADIENT_INTENSITY)||(zplot == Z_VORTICITY)||(zplot == Z_VORTICITY_ABS)) #define COMPUTE_ENERGY ((zplot == P_3D_ENERGY)||(cplot == P_3D_ENERGY)||(zplot == P_3D_LOG_ENERGY)||(cplot == P_3D_LOG_ENERGY)||(zplot == P_3D_TOTAL_ENERGY)||(cplot == P_3D_TOTAL_ENERGY)||(zplot == P_3D_LOG_TOTAL_ENERGY)||(cplot == P_3D_LOG_TOTAL_ENERGY)||(zplot == P_3D_MEAN_ENERGY)||(cplot == P_3D_MEAN_ENERGY)||(zplot == P_3D_LOG_MEAN_ENERGY)||(cplot == P_3D_LOG_MEAN_ENERGY)) diff --git a/global_ljones.c b/global_ljones.c index 42d3027..4b7747e 100644 --- a/global_ljones.c +++ b/global_ljones.c @@ -52,6 +52,9 @@ #define S_POOL_TABLE 6 /* pool table with pockets */ #define S_CENTRIFUGE_RND 7 /* segments forming centrifuge with more rounded bins */ #define S_CENTRIFUGE_LEAKY 8 /* segments forming centrifuge with rounded bins and holes */ +#define S_CIRCLE_EXT 9 /* segments forming a repelling cicle */ +#define S_ROCKET_NOZZLE 10 /* segments forming a rocket bell-shpaed nozzle */ +#define S_TWO_CIRCLES_EXT 11 /* segments forming two repelling cicle */ /* particle interaction */ @@ -86,6 +89,12 @@ #define TH_VERTICAL 0 /* only particles at the right of x = PARTIAL_THERMO_SHIFT are coupled */ #define TH_INSEGMENT 1 /* only particles in region defined by segments are coupled */ +#define TH_INBOX 2 /* only particles in a given box are coupled */ + +/* Gravity schedules */ + +#define G_INCREASE_RELEASE 1 /* slow increase and instant release */ +#define G_INCREASE_DECREASE 2 /* slow increase an decrease */ /* Plot types */ @@ -196,6 +205,7 @@ typedef struct double length; /* length of segment */ short int concave; /* corner is concave, to add extra repelling force */ short int cycle; /* set to 1 if (x2, y2) is equal to (x1, y1) of next segment */ + short int group; /* group to which segment belongs (for several obstacles) */ double angle1, angle2; /* angles in which concave corners repel */ short int active; /* segment is active */ double x01, x02, y01, y02; /* initial values of extremities, in case of rotation/translation */ diff --git a/global_particles.c b/global_particles.c index 5f67491..3e011ca 100644 --- a/global_particles.c +++ b/global_particles.c @@ -77,6 +77,7 @@ double x_shooter = -0.2, y_shooter = -0.6, x_target = 0.4, y_target = 0.7; #define P_POLYGON 5 /* regular polygon, alternative for D_POLYGON */ #define P_TOKA_PRIME 6 /* Tokarsky room made of 86 triangles */ #define P_TREE 7 /* pine tree */ +#define P_TOKA_NONSELF 8 /* Tokarsky non-self-unilluminable room */ /* Color palettes */ diff --git a/global_pdes.c b/global_pdes.c index 07738bd..916bd06 100644 --- a/global_pdes.c +++ b/global_pdes.c @@ -53,9 +53,12 @@ #define D_STAR 42 /* star shape */ #define D_FRESNEL 43 /* Fresnel lens */ #define D_NOISEPANEL 44 /* zigzag noise insulating panel */ +#define D_NOISEPANEL_RECT 441 /* comparison between zigzag noise insulating panel and flat walls */ #define D_DOUBLE_FRESNEL 45 /* two facing Fresnel lenses */ #define D_QRD 46 /* quadratic resonance diffuser */ +#define D_QRD_ASYM 461 /* asymmetric quadratic resonance diffuser */ #define D_CIRCLE_SEGMENT 47 /* lens-shaped circular segment */ +#define D_GROOVE 48 /* groove array supposed to induce polaritons */ #define NMAXCIRCLES 10000 /* total number of circles/polygons (must be at least NCX*NCY for square grid) */ #define NMAXPOLY 50000 /* maximal number of vertices of polygonal lines (for von Koch et al) */ @@ -96,7 +99,8 @@ #define D_VONKOCH_HEATED 27 /* von Koch snowflake in larger circle */ /* Variable index of refraction */ -#define IOR_MANDELBROT 1 /* index of refraction depends on escape time in Mandelbrot set */ +#define IOR_MANDELBROT 1 /* index of refraction depends on escape time in Mandelbrot set (log) */ +#define IOR_MANDELBROT_LIN 100 /* index of refraction depends on escape time in Mandelbrot set (linear) */ /* Boundary conditions */ @@ -154,6 +158,8 @@ #define COL_TURBO_CYCLIC 101 /* TURBO color palette (by Anton Mikhailov) corrected to be cyclic, beta */ +#define NPWIDTH 0.02 /* width of noise panel separation */ + typedef struct { diff --git a/heat.c b/heat.c index 816d119..298544c 100644 --- a/heat.c +++ b/heat.c @@ -35,7 +35,7 @@ #include /* Sam Leffler's libtiff library. */ #include -#define MOVIE 0 /* set to 1 to generate movie */ +#define MOVIE 1 /* set to 1 to generate movie */ /* General geometrical parameters */ @@ -671,7 +671,7 @@ void animation() glutSwapBuffers(); draw_wave(phi, xy_in, 1.0, 0); - if (DRAW_BILLIARD) draw_billiard(); + if (DRAW_BILLIARD) draw_billiard(0, 1.0); // print_Julia_parameters(i); // print_level(MDEPTH); @@ -698,7 +698,7 @@ void animation() for (j=0; j NSTEPS + INITIAL_TIME - GRAVITY_RESTORE_TIME)) return(GRAVITY); - else - { - time = ((double)(i - INITIAL_TIME - GRAVITY_INITIAL_TIME) - + (double)j/(double)NVID)/(double)(NSTEPS - GRAVITY_RESTORE_TIME - GRAVITY_INITIAL_TIME); - gravity = GRAVITY*(1.0 + time*(GRAVITY_FACTOR - 1.0)); -// printf("i = %i, time = %.3lg, Gravity = %.3lg\n", i, time, gravity); - return(gravity); + switch (GRAVITY_SCHEDULE){ + + case (G_INCREASE_RELEASE): + { + if ((i < INITIAL_TIME + GRAVITY_INITIAL_TIME)||(i > NSTEPS + INITIAL_TIME - GRAVITY_RESTORE_TIME)) return(GRAVITY); + else + { + time = ((double)(i - INITIAL_TIME - GRAVITY_INITIAL_TIME) + + (double)j/(double)NVID)/(double)(NSTEPS - GRAVITY_RESTORE_TIME - GRAVITY_INITIAL_TIME); + gravity = GRAVITY*(1.0 + time*(GRAVITY_FACTOR - 1.0)); + return(gravity); + } + break; + } + + case (G_INCREASE_DECREASE): + { + if ((i < INITIAL_TIME + GRAVITY_INITIAL_TIME)||(i > NSTEPS + INITIAL_TIME - GRAVITY_RESTORE_TIME)) return(GRAVITY); + else + { + time = ((double)(i - INITIAL_TIME - GRAVITY_INITIAL_TIME) + + (double)j/(double)NVID)/(double)(NSTEPS - GRAVITY_RESTORE_TIME - GRAVITY_INITIAL_TIME); + x = 2.0 - cos(DPI*time); + y = 0.5*((GRAVITY_FACTOR - 1.0)*x + 3.0 - GRAVITY_FACTOR); + gravity = GRAVITY*y; + return(gravity); + } + break; + } } } double rotation_angle(double phase) { - double omegamax = 15.0; - /* case of rotating hourglass */ - while (phase > DPI) phase -= DPI; - return(phase - 0.5*sin(2.0*phase)); +// while (phase > DPI) phase -= DPI; +// return(phase - 0.5*sin(2.0*phase)); /* case of centrifuge */ -// while (phase > DPI) phase -= DPI; -// angular_speed = 0.5*omegamax*(1.0 - cos(phase)); -// return(0.5*omegamax*(phase - sin(phase))); +// while (phase > 1.0) phase -= 1.0; +// phase *= DPI; +// angular_speed = 0.5*OMEGAMAX*(1.0 - cos(phase)); +// return(0.5*OMEGAMAX*(phase - sin(phase))); + + /* case of centrifuge remaining at constant speed for a while */ + if (phase < ROTATE_CHANGE_TIME) + { +// angular_speed = 0.5*OMEGAMAX*(1.0 - cos(phase*PI/ROTATE_CHANGE_TIME)); + return(0.5*OMEGAMAX*(phase - (ROTATE_CHANGE_TIME/PI)*sin(phase*PI/ROTATE_CHANGE_TIME))); + } + else if (phase < 1.0 - ROTATE_CHANGE_TIME) + { +// angular_speed = OMEGAMAX; + return(0.5*OMEGAMAX*(2.0*phase - ROTATE_CHANGE_TIME)); + } + else + { +// angular_speed = 0.5*OMEGAMAX*(1.0 + cos((phase - 1.0 + ROTATE_CHANGE_TIME)*PI/ROTATE_CHANGE_TIME)); + return(0.5*OMEGAMAX*(2.0 - 2.0*ROTATE_CHANGE_TIME + phase - 1.0 + (ROTATE_CHANGE_TIME/PI)*sin((1.0-phase)*PI/ROTATE_CHANGE_TIME))); + } } double rotation_schedule(int i) @@ -487,7 +536,7 @@ double rotation_schedule(int i) double rotation_schedule_smooth(int i, int j) { - double phase; + double phase, angle, phase1, angle1; static int imin = INITIAL_TIME + ROTATE_INITIAL_TIME, imax = INITIAL_TIME + NSTEPS - ROTATE_FINAL_TIME; if (i < imin) @@ -497,9 +546,22 @@ double rotation_schedule_smooth(int i, int j) } else { - if (i > imax) i = imax; - phase = (DPI/(double)PERIOD_ROTATE_BOUNDARY)*((double)(i - imin) + (double)j/(double)NVID); - return(rotation_angle(phase)); + if (i > imax) + { + angle = rotation_angle(1.0); + angular_speed = 0.0; + } + else + { + phase = (1.0/(double)(imax - imin))*((double)(i - imin) + (double)j/(double)NVID); + angle = rotation_angle(phase); + + phase1 = (1.0/(double)(imax - imin))*((double)(i + 1 - imin) + (double)j/(double)NVID); + angle1 = rotation_angle(phase1); + angular_speed = 25.0*(angle1 - angle); + } + + return(angle); } } @@ -660,37 +722,68 @@ void evolve_wall(double fboundary) void evolve_segments(t_segment segment[NMAXSEGMENTS]) { - int i, nactive = 0; - double fx = 0.0, fy = 0.0; + int i, nactive = 0, group; + double fx[2] = {0.0, 0.0}, fy[2] = {0.0, 0.0}, x, y, padding = 3.0*MU, mass2 = SEGMENTS_MASS*TWO_CIRCLES_RADIUS_RATIO; + for (group=0; group<2; group++) + { + fx[group] = 0.0; + fy[group] = 0.0; + } for (i=0; i XMAX - padding) fx[group] -= KSPRING_BOUNDARY*(x - XMAX + padding); + if (y < YMIN + padding) fy[group] += KSPRING_BOUNDARY*(YMIN + padding - y); + else if (y > YMAX - padding) fy[group] -= KSPRING_BOUNDARY*(y - YMAX + padding); + } + if (group == 0) fy[group] -= GRAVITY*SEGMENTS_MASS; + else fy[group] -= GRAVITY*mass2; } - if (nactive > 0) + if (nactive > 0) for (group=0; group<2; group++) { - fx = fx/(double)nactive; - fy = fy/(double)nactive; + fx[group] = fx[group]/(double)nactive; + fy[group] = fy[group]/(double)nactive; } - if (FLOOR_FORCE) + if (FLOOR_FORCE) { - if (fx > FMAX) fx = FMAX; - else if (fx < -FMAX) fx = -FMAX; - if (fy > FMAX) fy = FMAX; - else if (fy < -FMAX) fy = -FMAX; + if (fx[0] > FMAX) fx[0] = FMAX; + else if (fx[0] < -FMAX) fx[0] = -FMAX; + if (fy[0] > FMAX) fy[0] = FMAX; + else if (fy[0] < -FMAX) fy[0] = -FMAX; + } + vxsegments[0] += fx[0]*DT_PARTICLE/SEGMENTS_MASS; + vysegments[0] += fy[0]*DT_PARTICLE/SEGMENTS_MASS; + xsegments[0] += vxsegments[0]*DT_PARTICLE; + ysegments[0] += vysegments[0]*DT_PARTICLE; + if (TWO_OBSTACLES) + { + if (FLOOR_FORCE) + { + if (fx[1] > FMAX) fx[1] = FMAX; + else if (fx[1] < -FMAX) fx[1] = -FMAX; + if (fy[1] > FMAX) fy[1] = FMAX; + else if (fy[1] < -FMAX) fy[1] = -FMAX; + } + vxsegments[1] += fx[1]*DT_PARTICLE/mass2; + vysegments[1] += fy[1]*DT_PARTICLE/mass2; + xsegments[1] += vxsegments[1]*DT_PARTICLE; + ysegments[1] += vysegments[1]*DT_PARTICLE; } - vxsegments += fx*DT_PARTICLE/(SEGMENTS_MASS); - vysegments += fy*DT_PARTICLE/(SEGMENTS_MASS); - xsegments += vxsegments*DT_PARTICLE; - ysegments += vysegments*DT_PARTICLE; /* to avoid numerical instabilities */ - if (xsegments + 1.0 > BCXMAX) + for (group=0; group<2; group++) if (xsegments[group] + 1.0 > BCXMAX) { - xsegments = BCXMAX - 1.0; - vxsegments = 0.0; + xsegments[group] = BCXMAX - 1.0; + vxsegments[group] = 0.0; } translate_segments(segment, xsegments, ysegments); @@ -783,7 +876,7 @@ void animation() thermostat_on = thermostat_schedule(i); printf("Termostat: %i\n", thermostat_on); } - if ((DEACTIVATE_SEGMENT)&&(i > INITIAL_TIME + SEGMENT_DEACTIVATION_TIME)) + if ((ADD_FIXED_SEGMENTS)&&(DEACTIVATE_SEGMENT)&&(i > INITIAL_TIME + SEGMENT_DEACTIVATION_TIME)) segment[nsegments-1].active = 0; blank(); @@ -793,6 +886,7 @@ void animation() pright = 0.0; if (RECORD_PRESSURES) for (j=0; j OBSTACLE_INITIAL_TIME)) evolve_segments(segment); } /* end of for (n=0; nN_T_AVERAGE)) @@ -918,11 +1015,11 @@ void animation() // printf("Max number of neighbours: %i\n", max_nb); if (TRACER_PARTICLE) draw_trajectory(trajectory, traj_position, traj_length); - draw_particles(particle, PLOT); + draw_particles(particle, PLOT, beta); draw_container(xmincontainer, xmaxcontainer, obstacle, segment, wall); /* add a particle */ - if ((ADD_PARTICLES)&&(i > ADD_TIME)&&((i - INITIAL_TIME - ADD_TIME + 1)%ADD_PERIOD == 0)&&(i < NSTEPS - FINAL_NOADD_PERIOD)) + if ((ADD_PARTICLES)&&(i > ADD_TIME)&&((i - INITIAL_TIME - ADD_TIME)%ADD_PERIOD == 1)&&(i < NSTEPS - FINAL_NOADD_PERIOD)) nadd_particle = add_particles(particle, px, py, nadd_particle); /* case of reaction-diffusion equation */ @@ -945,7 +1042,8 @@ void animation() if (PRINT_OMEGA) print_omega(angular_speed); else if (PRINT_PARTICLE_SPEEDS) print_particles_speeds(particle); - + else if (PRINT_SEGMENTS_SPEEDS) print_segments_speeds(vxsegments, vysegments); + glutSwapBuffers(); @@ -965,7 +1063,7 @@ void animation() if ((i >= INITIAL_TIME)&&(DOUBLE_MOVIE)) { if (TRACER_PARTICLE) draw_trajectory(trajectory, traj_position, traj_length); - draw_particles(particle, PLOT_B); + draw_particles(particle, PLOT_B, beta); draw_container(xmincontainer, xmaxcontainer, obstacle, segment, wall); print_parameters(beta, mean_energy, krepel, xmaxcontainer - xmincontainer, fboundary/(double)(ncircles*NVID), PRINT_LEFT, pressure, gravity); @@ -973,6 +1071,7 @@ void animation() else if (PRINT_PARTICLE_NUMBER) print_particle_number(ncircles); if (PRINT_OMEGA) print_omega(angular_speed); else if (PRINT_PARTICLE_SPEEDS) print_particles_speeds(particle); + else if (PRINT_SEGMENTS_SPEEDS) print_segments_speeds(vxsegments, vysegments); glutSwapBuffers(); save_frame_lj_counter(NSTEPS + MID_FRAMES + 1 + counter); counter++; @@ -995,7 +1094,7 @@ void animation() if (DOUBLE_MOVIE) { if (TRACER_PARTICLE) draw_trajectory(trajectory, traj_position, traj_length); - draw_particles(particle, PLOT); + draw_particles(particle, PLOT, beta); draw_container(xmincontainer, xmaxcontainer, obstacle, segment, wall); print_parameters(beta, mean_energy, krepel, xmaxcontainer - xmincontainer, fboundary/(double)(ncircles*NVID), PRINT_LEFT, pressure, gravity); @@ -1003,13 +1102,14 @@ void animation() else if (PRINT_PARTICLE_NUMBER) print_particle_number(ncircles); if (PRINT_OMEGA) print_omega(angular_speed); else if (PRINT_PARTICLE_SPEEDS) print_particles_speeds(particle); + else if (PRINT_SEGMENTS_SPEEDS) print_segments_speeds(vxsegments, vysegments); glutSwapBuffers(); } for (i=0; i #include #include /* Sam Leffler's libtiff library. */ +#include #define MOVIE 0 /* set to 1 to generate movie */ -#define WINWIDTH 1280 /* window width */ +#define WINWIDTH 720 /* window width */ #define WINHEIGHT 720 /* window height */ -#define XMIN -2.0 -#define XMAX 2.0 /* x interval */ +#define XMIN -1.125 +#define XMAX 1.125 /* x interval */ #define YMIN -1.125 #define YMAX 1.125 /* y interval for 9/16 aspect ratio */ @@ -47,22 +48,20 @@ #define B_DOMAIN 30 /* choice of domain shape */ #define CIRCLE_PATTERN 1 /* pattern of circles */ -#define POLYLINE_PATTERN 6 /* pattern of polyline */ +#define POLYLINE_PATTERN 8 /* pattern of polyline */ #define ABSORBING_CIRCLES 1 /* set to 1 for circular scatterers to be absorbing */ #define NMAXCIRCLES 100000 /* total number of circles (must be at least NCX*NCY for square grid) */ #define NMAXPOLY 100000 /* total number of sides of polygonal line */ -// #define NCX 10 /* number of circles in x direction */ -// #define NCY 10 /* number of circles in y direction */ #define NCX 30 /* number of circles in x direction */ #define NCY 20 /* number of circles in y direction */ #define NPOISSON 500 /* number of points for Poisson C_RAND_POISSON arrangement */ #define NGOLDENSPIRAL 2000 /* max number of points for C_GOLDEN_SPIRAL arrandement */ #define SDEPTH 1 /* Sierpinski gastket depth */ -#define LAMBDA 0.8 /* parameter controlling shape of domain */ -#define MU 0.015 /* second parameter controlling shape of billiard */ +#define LAMBDA 1.5 /* parameter controlling shape of domain */ +#define MU 0.01 /* second parameter controlling shape of billiard */ #define FOCI 1 /* set to 1 to draw focal points of ellipse */ #define NPOLY 6 /* number of sides of polygon */ #define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ @@ -80,16 +79,17 @@ #define LMAX 0.01 /* minimal segment length triggering resampling */ #define DMIN 0.02 /* minimal distance to boundary for triggering resampling */ #define CYCLE 1 /* set to 1 for closed curve (start in all directions) */ -#define SHOWTRAILS 1 /* set to 1 to keep trails of the particles */ +#define SHOWTRAILS 0 /* set to 1 to keep trails of the particles */ #define SHOWZOOM 1 /* set to 1 to show zoom on specific area */ #define PRINT_PARTICLE_NUMBER 1 /* set to 1 to print number of particles */ #define PRINT_COLLISION_NUMBER 0 /* set to 1 to print number of collisions */ #define TEST_ACTIVE 1 /* set to 1 to test whether particle is in billiard */ -#define NSTEPS 5000 /* number of frames of movie */ -#define TIME 1500 /* time between movie frames, for fluidity of real-time simulation */ -#define DPHI 0.00001 /* integration step */ -#define NVID 150 /* number of iterations between images displayed on screen */ +#define NSTEPS 1000 /* number of frames of movie */ +#define TIME 2500 /* time between movie frames, for fluidity of real-time simulation */ +#define DPHI 0.00001 /* integration step */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define END_FRAMES 25 /* number of still frames at the end of the movie */ /* Decreasing TIME accelerates the animation and the movie */ /* For constant speed of movie, TIME*DPHI should be kept constant */ @@ -99,14 +99,14 @@ /* Colors and other graphical parameters */ -#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ -#define NCOLORS 32 /* number of colors */ +#define NCOLORS 64 /* number of colors */ #define COLORSHIFT 0 /* hue of initial color */ #define RAINBOW_COLOR 1 /* set to 1 to use different colors for all particles */ #define FLOWER_COLOR 0 /* set to 1 to adapt initial colors to flower billiard (tracks vs core) */ #define NSEG 100 /* number of segments of boundary */ -#define LENGTH 0.05 /* length of velocity vectors */ +#define LENGTH 0.03 /* length of velocity vectors */ #define BILLIARD_WIDTH 2 /* width of billiard */ #define PARTICLE_WIDTH 3 /* width of particles */ #define FRONT_WIDTH 3 /* width of wave front */ @@ -120,7 +120,7 @@ #define PAUSE 200 /* number of frames after which to pause */ #define PSLEEP 2 /* sleep time during pause */ #define SLEEP1 1 /* initial sleeping time */ -#define SLEEP2 1000 /* final sleeping time */ +#define SLEEP2 1 /* final sleeping time */ #include "global_particles.c" @@ -437,10 +437,18 @@ void draw_config_showtrails(int color[NPARTMAX], double *configs[NPARTMAX], int } if (DRAW_BILLIARD) draw_billiard(); - if (SHOWZOOM) - { - draw_zoom(color, configs, active, x_target, y_target, 0.1, 1.65, 0.75, 0.3, 0); - draw_zoom(color, configs, active, x_shooter, y_shooter, 0.1, -1.65, 0.75, 0.3, 1); + if (SHOWZOOM) switch (POLYLINE_PATTERN) { + case (P_TOKA_PRIME): + { + draw_zoom(color, configs, active, x_target, y_target, 0.1, 1.65, 0.75, 0.3, 0); + draw_zoom(color, configs, active, x_shooter, y_shooter, 0.1, -1.65, 0.75, 0.3, 1); + break; + } + case (P_TOKA_NONSELF): + { + draw_zoom(color, configs, active, 0.0, 0.0, 0.1, 1.65, 0.75, 0.3, 0); + break; + } } // if (SHOWZOOM) draw_zoom(color, configs, active, 0.95, 0.0, 0.1); } @@ -547,10 +555,18 @@ void draw_config(int color[NPARTMAX], double *configs[NPARTMAX], int active[NPAR } if (DRAW_BILLIARD) draw_billiard(); - if (SHOWZOOM) - { - draw_zoom(color, configs, active, x_target, y_target, 0.1, 1.65, 0.75, 0.3, 0); - draw_zoom(color, configs, active, x_shooter, y_shooter, 0.1, -1.65, 0.75, 0.3, 1); + if (SHOWZOOM) switch (POLYLINE_PATTERN) { + case (P_TOKA_PRIME): + { + draw_zoom(color, configs, active, x_target, y_target, 0.1, 1.65, 0.75, 0.3, 0); + draw_zoom(color, configs, active, x_shooter, y_shooter, 0.1, -1.65, 0.75, 0.3, 1); + break; + } + case (P_TOKA_NONSELF): + { + draw_zoom(color, configs, active, 0.0, 0.0, 0.1, 0.82, 0.82, 0.25, 0); + break; + } } // if (SHOWZOOM) draw_zoom(color, configs, active, 0.95, 0.0, 0.1); } @@ -668,7 +684,7 @@ void animation() // init_drop_config(-1.0 + 0.3*sqrt(2.0), -1.0 + 0.5*sqrt(2.0), 0.0, DPI, configs); - init_line_config(0.0, 0.3, 0.0, 0.9, 0.0, configs); +// init_line_config(0.0, 0.0, 0.0, 0.9, 0.0, configs); // init_drop_config(-0.95, 0.0, -0.103 + DPI/15.0, -0.1 + DPI/15.0, configs); /* find long trajectory */ @@ -697,7 +713,9 @@ void animation() // init_drop_config(x_shooter, y_shooter, alphamax, alphamax + DPI, configs); -// init_drop_config(-0.95, 0.0, 1.0, 1.0 + DPI, configs); +// init_drop_config(-0.5, 0.0, 0.2, 0.4, configs); + init_drop_config(0.0, 0.0, 0.0, DPI, configs); + // init_drop_config(-1.3, -0.1, 0.0, DPI, configs); // init_drop_config(1.4, 0.1, 0.0, DPI, configs); // init_drop_config(0.5, 0.5, -1.0, 1.0, configs); @@ -759,8 +777,8 @@ void animation() /* initialize drops in different colors */ // init_partial_drop_config(0.0, 0.0, 0.0, DPI, 0, 2*NPART/5, 0, configs, color, newcolor); -// init_partial_drop_config(0.0, 0.8, 0.0, DPI, 2*NPART/5, 4*NPART/5, 10, configs, color, newcolor); -// init_partial_drop_config(1.2, 0.1, 0.0, DPI, 4*NPART/5, NPART, 36, configs, color, newcolor); +// init_partial_drop_config(0.0, 0.8, 0.0, DPI, 2*NPART/5, 4*NPART/5, 30, configs, color, newcolor); +// init_partial_drop_config(LAMBDA - 0.05, 0.1, 0.0, DPI, 4*NPART/5, NPART, 60, configs, color, newcolor); for (i=0; i<=NSTEPS; i++) { @@ -798,7 +816,7 @@ void animation() if (MOVIE) { - for (i=0; i<20; i++) save_frame(); + for (i=0; i= INITIAL_TIME)&&(DOUBLE_MOVIE)) { - draw_wave_rde(1, phi, xy_in, rde, ZPLOT_B, CPLOT_B, COLOR_PALETTE_B, 0, 1.0, REFRESH_B); + draw_wave_rde(1, phi, xy_in, rde, potential_field, ZPLOT_B, CPLOT_B, COLOR_PALETTE_B, 0, 1.0, REFRESH_B); // draw_billiard(); - if ((PRINT_TIME)||(PRINT_VISCOSITY)||(PRINT_RPSLZB)) print_parameters(time, 0, viscosity_printed); + if (PRINT_PARAMETERS) print_parameters(rde, xy_in, time, 0, viscosity_printed, noise); if (DRAW_COLOR_SCHEME) draw_color_bar_palette(CPLOT_B, COLORBAR_RANGE_B, COLOR_PALETTE_B, 0, 1.0); glutSwapBuffers(); save_frame_counter(NSTEPS + MID_FRAMES + 1 + counter); @@ -719,9 +832,9 @@ void animation() { if (DOUBLE_MOVIE) { - draw_wave_rde(0, phi, xy_in, rde, ZPLOT, CPLOT, COLOR_PALETTE, 0, 1.0, 1); + draw_wave_rde(0, phi, xy_in, rde, potential_field, ZPLOT, CPLOT, COLOR_PALETTE, 0, 1.0, 1); // draw_billiard(); - if ((PRINT_TIME)||(PRINT_VISCOSITY)||(PRINT_RPSLZB)) print_parameters(time, 0, viscosity_printed); + if (PRINT_PARAMETERS) print_parameters(rde, xy_in, time, 0, viscosity_printed, noise); if (DRAW_COLOR_SCHEME) draw_color_bar_palette(CPLOT, COLORBAR_RANGE, COLOR_PALETTE, 0, 1.0); glutSwapBuffers(); @@ -729,14 +842,14 @@ void animation() else for (i=0; i= 0.0) return(width); + else return(sqrt(width*width - 0.5*x)); +} void init_segment_config(t_segment segment[NMAXSEGMENTS]) /* initialise linear obstacle configuration */ { - int i, cycle = 0, iminus, iplus; - double angle, angle2, dx, width, height, a, b, length; + int i, j, cycle = 0, iminus, iplus, nsides, n; + double angle, angle2, dx, width, height, a, b, length, xmid = 0.5*(BCXMIN + BCXMAX), lpocket, r, x, x1, y1, x2, y2, nozx, nozy; switch (SEGMENT_PATTERN) { case (S_RECTANGLE): @@ -922,7 +1063,11 @@ void init_segment_config(t_segment segment[NMAXSEGMENTS]) cycle = 1; nsegments = 4; - for (i=0; i NMAXSEGMENTS) + { + printf("Error: NMAXSEGMENTS is too small\n"); + exit(1); + } + + for (i=0; i NMAXSEGMENTS) + { + printf("Error: NMAXSEGMENTS is too small\n"); + exit(1); + } + + for (i=0; i= BCXMAX) return(0); if (x <= BCXMIN) return(0); @@ -1194,6 +1583,51 @@ int in_segment_region(double x, double y) if (x*x + y*y/(LAMBDA*LAMBDA) < 0.95) return(1); else return(0); } + case (S_CENTRIFUGE_RND): + { + if (module2(x,y) > 0.75) return(0); + angle = argument(x,y); + theta = DPI/(double)NPOLY; + while (angle > theta) angle -= theta; + while (angle < 0.0) angle += theta; + if (angle < 0.1) return(0); + if (angle > 0.9) return(0); + return(1); + } + case (S_CENTRIFUGE_LEAKY): + { + if (module2(x,y) > 0.75) return(0); + angle = argument(x,y); + theta = DPI/(double)NPOLY; + while (angle > theta) angle -= theta; + while (angle < 0.0) angle += theta; + if (angle < 0.1) return(0); + if (angle > 0.9) return(0); + return(1); + } + case (S_CIRCLE_EXT): + { + if (module2(x - SEGMENTS_X0, y - SEGMENTS_Y0) > LAMBDA + 2.0*MU) return(1); + else return(0); + } + case (S_TWO_CIRCLES_EXT): + { + if ((module2(x - SEGMENTS_X0, y - SEGMENTS_Y0) > LAMBDA + 2.0*MU)&&(module2(x + SEGMENTS_X0, y - SEGMENTS_Y0) > TWO_CIRCLES_RADIUS_RATIO*LAMBDA + 2.0*MU)) return(1); + else return(0); + } + case (S_ROCKET_NOZZLE): + { + if (x < 0.0) return(0); + else if (x > 1.4*LAMBDA) return(0); + else + { + lx = 0.7*LAMBDA; + ly = 0.5*LAMBDA; + x -= lx; + if (x*x/(lx*lx) + y*y/(ly*ly) < 0.95) return(1); + } + return(0); + } default: return(1); } } @@ -1231,17 +1665,27 @@ void rotate_segments(t_segment segment[NMAXSEGMENTS], double angle) } -void translate_segments(t_segment segment[NMAXSEGMENTS], double deltax, double deltay) +void translate_segments(t_segment segment[NMAXSEGMENTS], double deltax[2], double deltay[2]) /* rotates the repelling segments by given angle */ { - int i; + int i, group; for (i=0; i 1) + { + if (t0 <= 1) hue = HUE_TYPE0; + else if (t0 == 2) hue = HUE_TYPE1; + else if (t0 == 3) hue = HUE_TYPE2; + else hue = HUE_TYPE3; + + hsl_to_rgb(hue, 0.9, 0.3, rgb); + glColor3f(rgb[0], rgb[1], rgb[2]); + for (p=-1; p<2; p++) for (q=-1; q<2; q++) + { + x = particle[i].xc + (double)p*(BCXMAX - BCXMIN); + y = particle[i].yc + (double)q*(BCYMAX - BCYMIN); + + glBegin(GL_TRIANGLE_FAN); + glVertex2d(x, y); +// printf("%i | ", particle[i].hash_nneighb); + for (k=0; k 1.0) logratio = 1.0; + else if (logratio < 0.0) logratio = 0.0; + if (BETA_FACTOR > 1.0) hue = PARTICLE_HUE_MAX - (PARTICLE_HUE_MAX - PARTICLE_HUE_MIN)*logratio; + else hue = PARTICLE_HUE_MIN - (PARTICLE_HUE_MIN - PARTICLE_HUE_MAX)*logratio; + } + else hue = 0.25*PARTICLE_HUE_MIN + 0.75*PARTICLE_HUE_MAX; + erase_area_hsl_turbo(0.0, YMIN, 2.0*PARTIAL_THERMO_WIDTH, PARTIAL_THERMO_HEIGHT*(YMAX - YMIN), hue, 0.9, 0.15); + + } + /* draw the bonds first */ - if (plot == P_BONDS) + if ((DRAW_BONDS)||(plot == P_BONDS)) { glLineWidth(LINK_WIDTH); for (j=0; j 1.0) logratio = 1.0; + else if (logratio < 0.0) logratio = 0.0; if (BETA_FACTOR > 1.0) hue = PARTICLE_HUE_MAX - (PARTICLE_HUE_MAX - PARTICLE_HUE_MIN)*logratio; else hue = PARTICLE_HUE_MIN - (PARTICLE_HUE_MIN - PARTICLE_HUE_MAX)*logratio; erase_area_hsl_turbo(xbox, y + 0.025, 0.37, 0.05, hue, 0.9, 0.5); @@ -3105,8 +3632,6 @@ void print_omega(double angular_speed) if (first) { -// xleftbox = XMIN + 0.4; -// xlefttext = xleftbox - 0.55; xrightbox = XMAX - 0.39; xrighttext = xrightbox - 0.55; first = 0; @@ -3115,11 +3640,55 @@ void print_omega(double angular_speed) erase_area_hsl(xrightbox, y + 0.025, 0.35, 0.05, 0.0, 0.9, 0.0); glColor3f(1.0, 1.0, 1.0); - sprintf(message, "Angular speed = %.4f", DPI*angular_speed*25.0/(double)(PERIOD_ROTATE_BOUNDARY)); + sprintf(message, "Angular speed = %.4f", angular_speed); +// sprintf(message, "Angular speed = %.4f", DPI*angular_speed*25.0/(double)(PERIOD_ROTATE_BOUNDARY)); write_text(xrighttext + 0.1, y, message); } +void print_segments_speeds(double vx[2], double vy[2]) +{ + char message[100]; + double rgb[3], y = YMAX - 0.1; + static double xleftbox, xlefttext, xrightbox, xrighttext, ymin = YMIN + 0.05; + static int first = 1; + + if (first) + { + xleftbox = XMIN + 0.4; + xlefttext = xleftbox - 0.3; + xrightbox = XMAX - 0.39; + xrighttext = xrightbox - 0.3; + first = 0; + } + + erase_area_hsl(xrightbox, y + 0.025, 0.25, 0.05, 0.0, 0.9, 0.0); + glColor3f(1.0, 1.0, 1.0); + sprintf(message, "Vx = %.2f", vx[0]); + write_text(xrighttext + 0.1, y, message); + + y -= 0.1; + erase_area_hsl(xrightbox, y + 0.025, 0.25, 0.05, 0.0, 0.9, 0.0); + glColor3f(1.0, 1.0, 1.0); + sprintf(message, "Vy = %.2f", vy[0]); + write_text(xrighttext + 0.1, y, message); + + if (TWO_OBSTACLES) + { + y = YMAX - 0.1; + erase_area_hsl(xleftbox, y + 0.025, 0.25, 0.05, 0.0, 0.9, 0.0); + glColor3f(1.0, 1.0, 1.0); + sprintf(message, "Vx = %.2f", vx[1]); + write_text(xlefttext + 0.1, y, message); + + y -= 0.1; + erase_area_hsl(xleftbox, y + 0.025, 0.25, 0.05, 0.0, 0.9, 0.0); + glColor3f(1.0, 1.0, 1.0); + sprintf(message, "Vy = %.2f", vy[1]); + write_text(xlefttext + 0.1, y, message); + } +} + void print_particles_speeds(t_particle particle[NMAXCIRCLES]) { char message[100]; @@ -3606,6 +4175,34 @@ double compute_boundary_force(int j, t_particle particle[NMAXCIRCLES], t_obstacl } return(fperp); } + case (BC_ABSORBING): + { + /* add harmonic force outside screen */ + padding = 0.1; + x = particle[j].xc; + y = particle[j].yc; + + if ((x > XMAX + padding)||(x < XMIN - padding)||(y > YMAX + padding)||(y < YMIN - padding)) + { + particle[j].active = 0; + particle[j].vx = 0.0; + particle[j].vy = 0.0; + particle[j].xc = XMAX + 2.0*padding; + particle[j].yc = YMAX + 2.0*padding; + } + +// if ((x > XMAX)&&(x < XMAX + 0.5*padding)) particle[j].fx += KSPRING_BOUNDARY*(XMAX + 0.5*padding - x); +// else if (x < XMIN) particle[j].fx -= KSPRING_BOUNDARY; +// if (y > YMAX) particle[j].fy += KSPRING_BOUNDARY; +// else if (y < YMIN) particle[j].fy -= KSPRING_BOUNDARY; + +// if (x > XMAX + padding) particle[j].fx -= KSPRING_BOUNDARY*(x - XMAX - padding); +// else if (x < XMIN - padding) particle[j].fx += KSPRING_BOUNDARY*(XMIN - padding - x); +// if (y > YMAX + padding) particle[j].fy -= KSPRING_BOUNDARY*(y - YMAX - padding); +// else if (y < YMIN - padding) particle[j].fy += KSPRING_BOUNDARY*(YMIN - padding - y); + + return(fperp); + } } } @@ -3907,13 +4504,15 @@ int add_particles(t_particle particle[NMAXCIRCLES], double px[NMAXCIRCLES], doub // px[ncircles - 1] = particle[ncircles - 1].vx; // py[ncircles - 1] = particle[ncircles - 1].vy; // add_particle(MU*(2.0*rand()/RAND_MAX - 1.0), YMAX + 2.0*MU, 0.0, 0.0, PARTICLE_MASS, 0, particle); - + +// add_particle(XMIN - 0.5*MU, 0.0, 50.0 + 5.0*(double)i, 0.0, 2.0*PARTICLE_MASS, 0, particle); + printf("Adding a particle\n\n"); - add_particle(XMIN - 0.5*MU, 0.0, 50.0 + 5.0*(double)i, 0.0, 2.0*PARTICLE_MASS, 0, particle); - i++; + add_particle(BCXMIN + 0.1, 0.5*(BCYMIN + BCYMAX), 200.0, 0.0, PARTICLE_MASS, 0, particle); +// i++; - particle[ncircles - 1].radius = 0.5*MU; + particle[ncircles - 1].radius = MU; particle[ncircles - 1].eq_dist = EQUILIBRIUM_DIST; particle[ncircles - 1].thermostat = 0; px[ncircles - 1] = particle[ncircles - 1].vx; @@ -3959,6 +4558,7 @@ int partial_thermostat_coupling(t_particle particle[NMAXCIRCLES], double xmin) /* only couple particles with x > xmin to thermostat */ { int condition, i, nthermo = 0; + double x, y; for (i=0; i= DPI) arg -= DPI; + while (arg < 0.0) arg += DPI; + while (arg >= DPI) arg -= DPI; rde[i*NY+j].field_arg = arg; } } - +void compute_probabilities(t_rde rde[NX*NY], short int xy_in[NX*NY], double probas[2]) +/* compute probabilities for Ehrenfest urns */ +{ + int i, j; + double pleft = 0.0, pright = 0.0, sum; + + #pragma omp parallel for private(j) + for (j=0; j 0) + { + z_mid = compute_interpolated_colors_rde(i, j, rde, potential, palette, cplot, + rgb_e, rgb_w, rgb_n, rgb_s, &z_sw, &z_se, &z_nw, &z_ne, + fade, fade_value, movie); + ij_to_xy(i, j, xy_sw); + ij_to_xy(i+1, j, xy_se); + ij_to_xy(i, j+1, xy_nw); + ij_to_xy(i+1, j+1, xy_ne); + + for (k=0; k<2; k++) xy_mid[k] = 0.25*(xy_sw[k] + xy_se[k] + xy_nw[k] + xy_ne[k]); + + if (AMPLITUDE_HIGH_RES == 1) + { + glBegin(GL_TRIANGLE_FAN); + glColor3f(rgb_w[0], rgb_w[1], rgb_w[2]); + draw_vertex_xyz(xy_mid, z_mid); + draw_vertex_xyz(xy_nw, z_nw); + draw_vertex_xyz(xy_sw, z_sw); + + glColor3f(rgb_s[0], rgb_s[1], rgb_s[2]); + draw_vertex_xyz(xy_se, z_se); + + glColor3f(rgb_e[0], rgb_e[1], rgb_e[2]); + draw_vertex_xyz(xy_ne, z_ne); + + glColor3f(rgb_n[0], rgb_n[1], rgb_n[2]); + draw_vertex_xyz(xy_nw, z_nw); + glEnd (); + } + } + else + { + glColor3f(rde[i*NY+j].rgb[0], rde[i*NY+j].rgb[1], rde[i*NY+j].rgb[2]); + + glBegin(GL_TRIANGLE_FAN); + ij_to_xy(i, j, xy); + draw_vertex_xyz(xy, adjust_field(*rde[i*NY+j].p_zfield[movie], potential[i*NY+j])); + ij_to_xy(i+1, j, xy); + draw_vertex_xyz(xy, adjust_field(*rde[(i+1)*NY+j].p_zfield[movie], potential[(i+1)*NY+j])); + ij_to_xy(i+1, j+1, xy); + draw_vertex_xyz(xy, adjust_field(*rde[(i+1)*NY+j+1].p_zfield[movie], potential[(i+1)*NY+j+1])); + ij_to_xy(i, j+1, xy); + draw_vertex_xyz(xy, adjust_field(*rde[i*NY+j+1].p_zfield[movie], potential[i*NY+j+1])); + glEnd (); + } + } } -void draw_wave_3d_rde(int movie, double *phi[NFIELDS], short int xy_in[NX*NY], t_rde rde[NX*NY], +void draw_wave_3d_rde(int movie, double *phi[NFIELDS], short int xy_in[NX*NY], t_rde rde[NX*NY], double potential[NX*NY], int zplot, int cplot, int palette, int fade, double fade_value) { - int i, j, k, l, draw = 1; - double xy[2], xy_screen[2], rgb[3], pos[2], ca, rgb_e[3], rgb_w[3], rgb_n[3], rgb_s[3]; - double z_sw, z_se, z_nw, z_ne, z_mid, zw, ze, zn, zs, min = 1000.0, max = 0.0; - double xy_sw[2], xy_se[2], xy_nw[2], xy_ne[2], xy_mid[2]; - double energy; + int i, j; + double observer_angle; blank(); if (DRAW_BILLIARD) draw_billiard_3d(fade, fade_value); - - for (i=0; i 0) - { - z_mid = compute_interpolated_colors_rde(i, j, rde, palette, cplot, - rgb_e, rgb_w, rgb_n, rgb_s, fade, fade_value, movie); - - ij_to_xy(i, j, xy_sw); - ij_to_xy(i+1, j, xy_se); - ij_to_xy(i, j+1, xy_nw); - ij_to_xy(i+1, j+1, xy_ne); - - for (k=0; k<2; k++) xy_mid[k] = 0.25*(xy_sw[k] + xy_se[k] + xy_nw[k] + xy_ne[k]); - - if (AMPLITUDE_HIGH_RES == 1) - { - glBegin(GL_TRIANGLE_FAN); - glColor3f(rgb_w[0], rgb_w[1], rgb_w[2]); - draw_vertex_xyz(xy_mid, z_mid); - draw_vertex_xyz(xy_nw, *rde[i*NY+j+1].p_zfield[movie]); - draw_vertex_xyz(xy_sw, *rde[i*NY+j].p_zfield[movie]); - - glColor3f(rgb_s[0], rgb_s[1], rgb_s[2]); - draw_vertex_xyz(xy_se, *rde[(i+1)*NY+j].p_zfield[movie]); - - glColor3f(rgb_e[0], rgb_e[1], rgb_e[2]); - draw_vertex_xyz(xy_ne, *rde[(i+1)*NY+j+1].p_zfield[movie]); - - glColor3f(rgb_n[0], rgb_n[1], rgb_n[2]); - draw_vertex_xyz(xy_nw, *rde[i*NY+j+1].p_zfield[movie]); - glEnd (); - } - } - else - { - glColor3f(rde[i*NY+j].rgb[0], rde[i*NY+j].rgb[1], rde[i*NY+j].rgb[2]); - glBegin(GL_TRIANGLE_FAN); - ij_to_xy(i, j, xy); - draw_vertex_xyz(xy, *rde[i*NY+j].p_zfield[movie]); - ij_to_xy(i+1, j, xy); - draw_vertex_xyz(xy, *rde[(i+1)*NY+j].p_zfield[movie]); - ij_to_xy(i+1, j+1, xy); - draw_vertex_xyz(xy, *rde[(i+1)*NY+j+1].p_zfield[movie]); - ij_to_xy(i, j+1, xy); - draw_vertex_xyz(xy, *rde[i*NY+j+1].p_zfield[movie]); - glEnd (); - } - } - } + if (!ROTATE_VIEW) + { + for (i=0; i 0.0)&&(observer_angle < PID)) + { + for (j=0; j0; i--) + for (j=0; j0; j--) + for (i=0; i XMIN) + { + x -= LAMBDA; + n++; + } + if (n%2 == 0) even = 1; + else even = 0; + + i = 0; + while (x <= 0.0) + { + if (even) y = YMIN + 0.1; + else y = YMIN + 0.1 + MU; + + x1 = x; + if (x1 > XMAX) x1 = XMAX; + else if (x1 < XMIN) x1 = XMIN; + + polyline[i].x = x1; + polyline[i].y = y; + + xy_to_pos(x1, y, pos); + polyline[i].posi = pos[0]; + polyline[i].posj = pos[1]; + + x += LAMBDA; + even = 1 - even; + i++; + } + n = i; + for (i=0; i YMIN + y1)&&(y < YMAX - y1)); } + case (D_NOISEPANEL_RECT): + { + x1 = -x; + if (x1 > NPWIDTH) + { + while (x1 > 2.0*LAMBDA) x1 -= 2.0*LAMBDA; + if (x1 <= LAMBDA) y1 = 0.1 + MU*x1/LAMBDA; + else y1 = 0.1 + 2.0*MU - MU*x1/LAMBDA; + return((y > YMIN + y1)&&(y < YMAX - y1)&&(x > XMIN + 0.1)); + } + else if (x > NPWIDTH) + { + return((vabs(y) < YMAX - 0.1)&&(x < XMAX - 0.1)); + } + else return(0); + } case (D_QRD): { x1 = vabs(x)/LAMBDA; @@ -2055,6 +2125,25 @@ int xy_in_billiard(double x, double y) y1 = (MU/13.0)*(14.0 - (double)k1); return ((y > YMIN + y1)&&(y < YMAX - y1)); } + case (D_QRD_ASYM): + { + if (y > 0.0) + { + x1 = vabs(x)/LAMBDA; + k = (int)(x1 + 0.5); + k1 = (k*k) % 13; + y1 = (MU/13.0)*(14.0 - (double)k1); + return (y < YMAX - y1); + } + else + { + x1 = vabs(x + 1.0)/LAMBDA; + k = (int)(x1 + 0.5); + k1 = (k*k) % 17; + y1 = (MU/17.0)*(18.0 - (double)k1); + return (y > YMIN + y1); + } + } case (D_CIRCLE_SEGMENT): { if (vabs(y) > 0.9*vabs(LAMBDA)) return(1); @@ -2076,6 +2165,14 @@ int xy_in_billiard(double x, double y) else return(1); } } + case (D_GROOVE): + { + s = 0.85*LAMBDA; + a = 0.5*LAMBDA; + x1 = x - XMIN - (double)((int)((x - XMIN)/LAMBDA))*LAMBDA; + if (x1 < a) return (y > YMIN + LAMBDA); + else return (y > YMIN + LAMBDA + s); + } case (D_MENGER): { x1 = 0.5*(x+1.0); @@ -2255,14 +2352,22 @@ void tvertex_lineto(t_vertex z) } -void draw_billiard() /* draws the billiard boundary */ +void draw_billiard(int fade, double fade_value) /* draws the billiard boundary */ { double x0, x, y, x1, y1, dx, dy, phi, r = 0.01, pos[2], pos1[2], alpha, dphi, omega, z, l, width, a, b, c, ymax; int i, j, k, k1, k2, mr2; static int first = 1, nsides; - if (BLACK) glColor3f(1.0, 1.0, 1.0); - else glColor3f(0.0, 0.0, 0.0); + if (fade) + { + if (BLACK) glColor3f(fade_value, fade_value, fade_value); + else glColor3f(1.0 - fade_value, 1.0 - fade_value, 1.0 - fade_value); + } + else + { + if (BLACK) glColor3f(1.0, 1.0, 1.0); + else glColor3f(0.0, 0.0, 0.0); + } glLineWidth(BOUNDARY_WIDTH); glEnable(GL_LINE_SMOOTH); @@ -2298,7 +2403,8 @@ void draw_billiard() /* draws the billiard boundary */ /* draw foci */ if (FOCI) { - glColor3f(0.3, 0.3, 0.3); + if (fade) glColor3f(0.3*fade_value, 0.3*fade_value, 0.3*fade_value); + else glColor3f(0.3, 0.3, 0.3); x0 = sqrt(LAMBDA*LAMBDA-1.0); glLineWidth(2); @@ -3041,6 +3147,14 @@ void draw_billiard() /* draws the billiard boundary */ glEnd(); break; } + case (D_NOISEPANEL_RECT): + { + glLineWidth(BOUNDARY_WIDTH); + glBegin(GL_LINE_STRIP); + for (i=0; i= COL_TURBO) color_scheme_asym_palette(COLOR_SCHEME, palette, value, 1.0, 1, rgb); + else color_scheme_palette(COLOR_SCHEME, palette, value, 1.0, 1, rgb); + break; + } + case (P_MEAN_ENERGY): + { + value = dy_e*(double)(j - jmin)*100.0/E_SCALE; + if (COLOR_PALETTE >= COL_TURBO) color_scheme_asym_palette(COLOR_SCHEME, palette, value, 1.0, 1, rgb); + else color_scheme_palette(COLOR_SCHEME, palette, value, 1.0, 1, rgb); + break; + } + case (P_LOG_ENERGY): + { + value = LOG_SHIFT + LOG_SCALE*log(dy_e*(double)(j - jmin)*100.0/E_SCALE); +// if (value <= 0.0) value = 0.0; + color_scheme_palette(COLOR_SCHEME, palette, value, 1.0, 1, rgb); + break; + } + case (P_LOG_MEAN_ENERGY): + { + value = LOG_SHIFT + LOG_SCALE*log(dy_e*(double)(j - jmin)*100.0/E_SCALE); +// if (value <= 0.0) value = 0.0; + color_scheme_palette(COLOR_SCHEME, palette, value, 1.0, 1, rgb); + break; + } + case (P_PHASE): + { + value = min + 1.0*dy*(double)(j - jmin); +// lum = (color_amplitude(value, 1.0, 1))*0.5; +// if (lum < 0.0) lum = 0.0; +// hsl_to_rgb(value*360.0, 0.9, 0.5, rgb); +// color_scheme(COLOR_SCHEME, value, 1.0, 1, rgb); +// amp = color_amplitude_linear(value, 1.0, 1); + amp = 0.5*color_amplitude_linear(value, 1.0, 1); + while (amp > 1.0) amp -= 2.0; + while (amp < -1.0) amp += 2.0; + amp_to_rgb(0.5*(1.0 + amp), rgb); + break; + } + } + if (fade) for (k=0; k<3; k++) rgb[k] *= fade_value; + glColor3f(rgb[0], rgb[1], rgb[2]); + if (ROTATE_COLOR_SCHEME) + { + glVertex2i(j, imin); + glVertex2i(j, imax); + glVertex2i(j+1, imax); + glVertex2i(j+1, imin); + } + else + { + glVertex2i(imin, j); + glVertex2i(imax, j); + glVertex2i(imax, j+1); + glVertex2i(imin, j+1); + } + } + glEnd (); + + if (fade) glColor3f(fade_value, fade_value, fade_value); + else glColor3f(1.0, 1.0, 1.0); + glLineWidth(BOUNDARY_WIDTH); + draw_rectangle(x1, y1, x2, y2); +} diff --git a/sub_wave_3d.c b/sub_wave_3d.c index 7ce5d68..00aac62 100644 --- a/sub_wave_3d.c +++ b/sub_wave_3d.c @@ -21,7 +21,7 @@ void xyz_to_xy(double x, double y, double z, double xy_out[2]) static double n2, m2, d, sm2, sn2, v[3], h[2], plane_ratio = 0.5; static int first = 1; - if ((first)&&(REPRESENTATION_3D == REP_PROJ_3D)) + if (((first)&&(REPRESENTATION_3D == REP_PROJ_3D))||(reset_view)) { m2 = observer[0]*observer[0] + observer[1]*observer[1]; n2 = m2 + observer[2]*observer[2]; @@ -34,8 +34,9 @@ void xyz_to_xy(double x, double y, double z, double xy_out[2]) v[1] = -observer[1]*observer[2]/(sn2*sm2); v[2] = m2/(sn2*sm2); first = 0; - printf("h = (%.3lg, %.3lg)\n", h[0], h[1]); - printf("v = (%.3lg, %.3lg, %.3lg)\n", v[0], v[1], v[2]); + reset_view = 0; +// printf("h = (%.3lg, %.3lg)\n", h[0], h[1]); +// printf("v = (%.3lg, %.3lg, %.3lg)\n", v[0], v[1], v[2]); } switch (REPRESENTATION_3D) { @@ -170,6 +171,16 @@ void draw_billiard_3d(int fade, double fade_value) /* draws the billiard bo glEnable(GL_LINE_SMOOTH); switch (B_DOMAIN) { + case (D_RECTANGLE): + { + glBegin(GL_LINE_LOOP); + draw_vertex_x_y_z(LAMBDA, -1.0, 0.0); + draw_vertex_x_y_z(LAMBDA, 1.0, 0.0); + draw_vertex_x_y_z(-LAMBDA, 1.0, 0.0); + draw_vertex_x_y_z(-LAMBDA, -1.0, 0.0); + glEnd(); + break; + } case (D_ELLIPSE): { glBegin(GL_LINE_LOOP); @@ -714,6 +725,10 @@ void draw_billiard_3d(int fade, double fade_value) /* draws the billiard bo if (polygons[i].active) draw_tpolygon_3d(polygons[i]); break; } + case (D_NOTHING): + { + break; + } default: { break; @@ -781,6 +796,15 @@ void draw_billiard_3d_front(int fade, double fade_value) glEnable(GL_LINE_SMOOTH); switch (B_DOMAIN) { + case (D_RECTANGLE): + { + glBegin(GL_LINE_STRIP); + draw_vertex_x_y_z(LAMBDA, -1.0, 0.0); + draw_vertex_x_y_z(LAMBDA, 1.0, 0.0); + draw_vertex_x_y_z(-LAMBDA, 1.0, 0.0); + glEnd(); + break; + } case (D_YOUNG): { glBegin(GL_LINE_STRIP); @@ -1150,6 +1174,43 @@ void init_speed_dissipation(short int xy_in[NX*NY], double tc[NX*NY], double tcc } break; } + case (IOR_MANDELBROT_LIN): + { + #pragma omp parallel for private(i,j) + for (i=0; i= MANDELLEVEL) + { + tc[i*NY+j] = COURANT; + tcc[i*NY+j] = courant2; + tgamma[i*NY+j] = GAMMA; + } + else + { + speed = (double)k/(double)MANDELLEVEL; + if (speed < 1.0e-10) speed = 1.0e-10; + else if (speed > 10.0) speed = 10.0; + tcc[i*NY+j] = courant2*speed; + tc[i*NY+j] = COURANT*sqrt(speed); + tgamma[i*NY+j] = GAMMA; + } + } + } + break; + } default: { for (i=0; i zfloor)&&(*wave[(i+1)*NY+j].p_zfield[movie] > zfloor)&&(*wave[i*NY+j+1].p_zfield[movie] > zfloor)&&(*wave[(i+1)*NY+j+1].p_zfield[movie] > zfloor); + + if (draw) + { + if (AMPLITUDE_HIGH_RES > 0) + { + z_mid = compute_interpolated_colors_wave(i, j, xy_in, wave, palette, cplot, + rgb_e, rgb_w, rgb_n, rgb_s, fade, fade_value, movie); + ij_to_xy(i, j, xy_sw); + ij_to_xy(i+1, j, xy_se); + ij_to_xy(i, j+1, xy_nw); + ij_to_xy(i+1, j+1, xy_ne); + + for (k=0; k<2; k++) xy_mid[k] = 0.25*(xy_sw[k] + xy_se[k] + xy_nw[k] + xy_ne[k]); + + if (AMPLITUDE_HIGH_RES == 1) + { + glBegin(GL_TRIANGLE_FAN); + glColor3f(rgb_w[0], rgb_w[1], rgb_w[2]); + draw_vertex_xyz(xy_mid, z_mid); + draw_vertex_xyz(xy_nw, *wave[i*NY+j+1].p_zfield[movie]); + draw_vertex_xyz(xy_sw, *wave[i*NY+j].p_zfield[movie]); + + glColor3f(rgb_s[0], rgb_s[1], rgb_s[2]); + draw_vertex_xyz(xy_se, *wave[(i+1)*NY+j].p_zfield[movie]); + + glColor3f(rgb_e[0], rgb_e[1], rgb_e[2]); + draw_vertex_xyz(xy_ne, *wave[(i+1)*NY+j+1].p_zfield[movie]); + + glColor3f(rgb_n[0], rgb_n[1], rgb_n[2]); + draw_vertex_xyz(xy_nw, *wave[i*NY+j+1].p_zfield[movie]); + glEnd (); + } + else /* experimental */ + { + glColor3f(rgb_w[0], rgb_w[1], rgb_w[2]); + glBegin(GL_TRIANGLE_STRIP); + draw_vertex_xyz(xy_mid, z_mid); + draw_vertex_xyz(xy_nw, *wave[i*NY+j+1].p_zfield[movie]); + draw_vertex_xyz(xy_sw, *wave[i*NY+j].p_zfield[movie]); + glEnd (); + + glColor3f(rgb_s[0], rgb_s[1], rgb_s[2]); + glBegin(GL_TRIANGLE_STRIP); + draw_vertex_xyz(xy_mid, z_mid); + draw_vertex_xyz(xy_sw, *wave[i*NY+j].p_zfield[movie]); + draw_vertex_xyz(xy_se, *wave[(i+1)*NY+j].p_zfield[movie]); + glEnd (); + + glColor3f(rgb_e[0], rgb_e[1], rgb_e[2]); + glBegin(GL_TRIANGLE_STRIP); + draw_vertex_xyz(xy_mid, z_mid); + draw_vertex_xyz(xy_se, *wave[(i+1)*NY+j].p_zfield[movie]); + draw_vertex_xyz(xy_ne, *wave[(i+1)*NY+j+1].p_zfield[movie]); + glEnd (); + + glColor3f(rgb_n[0], rgb_n[1], rgb_n[2]); + glBegin(GL_TRIANGLE_STRIP); + draw_vertex_xyz(xy_mid, z_mid); + draw_vertex_xyz(xy_nw, *wave[i*NY+j+1].p_zfield[movie]); + draw_vertex_xyz(xy_ne, *wave[(i+1)*NY+j+1].p_zfield[movie]); + glEnd (); + } + } + else + { + glColor3f(wave[i*NY+j].rgb[0], wave[i*NY+j].rgb[1], wave[i*NY+j].rgb[2]); + glBegin(GL_TRIANGLE_FAN); + ij_to_xy(i, j, xy); + draw_vertex_xyz(xy, *wave[i*NY+j].p_zfield[movie]); + ij_to_xy(i+1, j, xy); + draw_vertex_xyz(xy, *wave[(i+1)*NY+j].p_zfield[movie]); + ij_to_xy(i+1, j+1, xy); + draw_vertex_xyz(xy, *wave[(i+1)*NY+j+1].p_zfield[movie]); + ij_to_xy(i, j+1, xy); + draw_vertex_xyz(xy, *wave[i*NY+j+1].p_zfield[movie]); + glEnd (); + } + } + + if ((DRAW_OUTSIDE_GRAY)&&((!xy_in[i*NY+j]))) + { + glColor3f(0.5, 0.5, 0.5); + glBegin(GL_TRIANGLE_FAN); + ij_to_xy(i, j, xy); + draw_vertex_xyz(xy, 0.0); + ij_to_xy(i+1, j, xy); + draw_vertex_xyz(xy, 0.0); + ij_to_xy(i+1, j+1, xy); + draw_vertex_xyz(xy, 0.0); + ij_to_xy(i, j+1, xy); + draw_vertex_xyz(xy, 0.0); + glEnd (); + } +} + + +void draw_wave_3d(int movie, double phi[NX*NY], double psi[NX*NY], short int xy_in[NX*NY], t_wave wave[NX*NY], + int zplot, int cplot, int palette, int fade, double fade_value, int refresh) +{ + int i, j; + double observer_angle; + blank(); if (DRAW_BILLIARD) draw_billiard_3d(fade, fade_value); @@ -1343,111 +1513,44 @@ void draw_wave_3d(int movie, double phi[NX*NY], double psi[NX*NY], short int xy_ compute_cfield(xy_in, cplot, palette, wave, fade, fade_value, movie); } - for (i=0; i 0.0)&&(observer_angle < PID)) { - if (NON_DIRICHLET_BC) - draw = (xy_in[i*NY+j])&&(xy_in[(i+1)*NY+j])&&(xy_in[i*NY+j+1])&&(xy_in[(i+1)*NY+j+1]); - else draw = (TWOSPEEDS)||(xy_in[i*NY+j]); - - if (FLOOR_ZCOORD) - draw = (draw)&&(*wave[i*NY+j].p_zfield[movie] > zfloor)&&(*wave[(i+1)*NY+j].p_zfield[movie] > zfloor)&&(*wave[i*NY+j+1].p_zfield[movie] > zfloor)&&(*wave[(i+1)*NY+j+1].p_zfield[movie] > zfloor); - - if (draw) - { - if (AMPLITUDE_HIGH_RES > 0) - { - z_mid = compute_interpolated_colors_wave(i, j, xy_in, wave, palette, cplot, - rgb_e, rgb_w, rgb_n, rgb_s, fade, fade_value, movie); - - ij_to_xy(i, j, xy_sw); - ij_to_xy(i+1, j, xy_se); - ij_to_xy(i, j+1, xy_nw); - ij_to_xy(i+1, j+1, xy_ne); - - for (k=0; k<2; k++) xy_mid[k] = 0.25*(xy_sw[k] + xy_se[k] + xy_nw[k] + xy_ne[k]); - - if (AMPLITUDE_HIGH_RES == 1) - { - glBegin(GL_TRIANGLE_FAN); - glColor3f(rgb_w[0], rgb_w[1], rgb_w[2]); - draw_vertex_xyz(xy_mid, z_mid); - draw_vertex_xyz(xy_nw, *wave[i*NY+j+1].p_zfield[movie]); - draw_vertex_xyz(xy_sw, *wave[i*NY+j].p_zfield[movie]); - - glColor3f(rgb_s[0], rgb_s[1], rgb_s[2]); - draw_vertex_xyz(xy_se, *wave[(i+1)*NY+j].p_zfield[movie]); - - glColor3f(rgb_e[0], rgb_e[1], rgb_e[2]); - draw_vertex_xyz(xy_ne, *wave[(i+1)*NY+j+1].p_zfield[movie]); - - glColor3f(rgb_n[0], rgb_n[1], rgb_n[2]); - draw_vertex_xyz(xy_nw, *wave[i*NY+j+1].p_zfield[movie]); - glEnd (); - } - else /* experimental */ - { - glColor3f(rgb_w[0], rgb_w[1], rgb_w[2]); - glBegin(GL_TRIANGLE_STRIP); - draw_vertex_xyz(xy_mid, z_mid); - draw_vertex_xyz(xy_nw, *wave[i*NY+j+1].p_zfield[movie]); - draw_vertex_xyz(xy_sw, *wave[i*NY+j].p_zfield[movie]); - glEnd (); - - glColor3f(rgb_s[0], rgb_s[1], rgb_s[2]); - glBegin(GL_TRIANGLE_STRIP); - draw_vertex_xyz(xy_mid, z_mid); - draw_vertex_xyz(xy_sw, *wave[i*NY+j].p_zfield[movie]); - draw_vertex_xyz(xy_se, *wave[(i+1)*NY+j].p_zfield[movie]); - glEnd (); - - glColor3f(rgb_e[0], rgb_e[1], rgb_e[2]); - glBegin(GL_TRIANGLE_STRIP); - draw_vertex_xyz(xy_mid, z_mid); - draw_vertex_xyz(xy_se, *wave[(i+1)*NY+j].p_zfield[movie]); - draw_vertex_xyz(xy_ne, *wave[(i+1)*NY+j+1].p_zfield[movie]); - glEnd (); - - glColor3f(rgb_n[0], rgb_n[1], rgb_n[2]); - glBegin(GL_TRIANGLE_STRIP); - draw_vertex_xyz(xy_mid, z_mid); - draw_vertex_xyz(xy_nw, *wave[i*NY+j+1].p_zfield[movie]); - draw_vertex_xyz(xy_ne, *wave[(i+1)*NY+j+1].p_zfield[movie]); - glEnd (); - } - } - else - { - glColor3f(wave[i*NY+j].rgb[0], wave[i*NY+j].rgb[1], wave[i*NY+j].rgb[2]); - - glBegin(GL_TRIANGLE_FAN); - ij_to_xy(i, j, xy); - draw_vertex_xyz(xy, *wave[i*NY+j].p_zfield[movie]); - ij_to_xy(i+1, j, xy); - draw_vertex_xyz(xy, *wave[(i+1)*NY+j].p_zfield[movie]); - ij_to_xy(i+1, j+1, xy); - draw_vertex_xyz(xy, *wave[(i+1)*NY+j+1].p_zfield[movie]); - ij_to_xy(i, j+1, xy); - draw_vertex_xyz(xy, *wave[i*NY+j+1].p_zfield[movie]); - glEnd (); - } - } - - if ((DRAW_OUTSIDE_GRAY)&&((!xy_in[i*NY+j]))) - { - glColor3f(0.5, 0.5, 0.5); - glBegin(GL_TRIANGLE_FAN); - ij_to_xy(i, j, xy); - draw_vertex_xyz(xy, 0.0); - ij_to_xy(i+1, j, xy); - draw_vertex_xyz(xy, 0.0); - ij_to_xy(i+1, j+1, xy); - draw_vertex_xyz(xy, 0.0); - ij_to_xy(i, j+1, xy); - draw_vertex_xyz(xy, 0.0); - glEnd (); - } + for (j=0; j0; i--) + for (j=0; j0; j--) + for (i=0; i #include /* Sam Leffler's libtiff library. */ #include +#include #define MOVIE 0 /* set to 1 to generate movie */ #define DOUBLE_MOVIE 0 /* set to 1 to produce movies for wave height and energy simultaneously */ @@ -49,17 +50,17 @@ #define WINWIDTH 1920 /* window width */ #define WINHEIGHT 1000 /* window height */ -// #define NX 1920 /* number of grid points on x axis */ -// #define NY 1000 /* number of grid points on y axis */ -#define NX 3840 /* number of grid points on x axis */ -#define NY 2000 /* number of grid points on y axis */ +#define NX 1920 /* number of grid points on x axis */ +#define NY 1000 /* number of grid points on y axis */ +// #define NX 3840 /* number of grid points on x axis */ +// #define NY 2000 /* number of grid points on y axis */ -#define XMIN -1.25 -#define XMAX 2.75 /* x interval */ +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ #define YMIN -1.041666667 #define YMAX 1.041666667 /* y interval for 9/16 aspect ratio */ -#define HIGHRES 1 /* set to 1 if resolution of grid is double that of displayed image */ +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ // #define WINWIDTH 1280 /* window width */ // #define WINHEIGHT 720 /* window height */ @@ -69,8 +70,8 @@ // #define NX 2560 /* number of grid points on x axis */ // #define NY 1440 /* number of grid points on y axis */ // -// #define XMIN -1.25 -// #define XMAX 2.75 /* x interval */ +// #define XMIN -2.0 +// #define XMAX 2.0 /* x interval */ // #define YMIN -1.125 // #define YMAX 1.125 /* y interval for 9/16 aspect ratio */ @@ -159,6 +160,7 @@ #define SLEEP2 1 /* final sleeping time */ #define MID_FRAMES 20 /* number of still frames between parts of two-part movie */ #define END_FRAMES 100 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ /* Parameters of initial condition */ @@ -169,7 +171,7 @@ /* Plot type, see list in global_pdes.c */ #define PLOT 0 -// #define PLOT 3 +// #define PLOT 0 // #define PLOT 1 #define PLOT_B 3 /* plot type for second movie */ @@ -491,18 +493,30 @@ void draw_color_bar(int plot, double range) // else draw_color_scheme(1.7, YMIN + 0.25, 1.9, YMAX - 0.25, plot, -range, range); } -void draw_color_bar_palette(int plot, double range, int palette) +// void draw_color_bar_palette(int plot, double range, int palette) +// { +// if (ROTATE_COLOR_SCHEME) draw_color_scheme_palette(-1.0, -0.8, XMAX - 0.1, -1.0, plot, -range, range, palette); +// else draw_color_scheme_palette(XMAX - 0.3, YMIN + 0.1, XMAX - 0.1, YMAX - 0.1, plot, -range, range, palette); +// } + +void draw_color_bar_palette(int plot, double range, int palette, int fade, double fade_value) { - if (ROTATE_COLOR_SCHEME) draw_color_scheme_palette(-1.0, -0.8, XMAX - 0.1, -1.0, plot, -range, range, palette); - else draw_color_scheme_palette(XMAX - 0.3, YMIN + 0.1, XMAX - 0.1, YMAX - 0.1, plot, -range, range, palette); + double width = 0.14; +// double width = 0.2; + + if (ROTATE_COLOR_SCHEME) + draw_color_scheme_palette_fade(-1.0, -0.8, XMAX - 0.1, -1.0, plot, -range, range, palette, fade, fade_value); + else + draw_color_scheme_palette_fade(XMAX - 1.5*width, YMIN + 0.1, XMAX - 0.5*width, YMAX - 0.1, plot, -range, range, palette, fade, fade_value); } + void animation() { - double time, scale, ratio, startleft[2], startright[2], sign, r2, xy[2]; + double time, scale, ratio, startleft[2], startright[2], sign, r2, xy[2], fade_value; double *phi[NX], *psi[NX], *phi_tmp[NX], *psi_tmp[NX], *total_energy[NX], *color_scale[NX]; short int *xy_in[NX]; - int i, j, s, sample_left[2], sample_right[2], period = 0; + int i, j, s, sample_left[2], sample_right[2], period = 0, fade; static int counter = 0; long int wave_value; @@ -569,6 +583,9 @@ void animation() // printf("xleft = (%.3f, %.3f) xright = (%.3f, %.3f)\n", xin_left, yin_left, xin_right, yin_right); init_wave_flat(phi, psi, xy_in); + +// init_circular_wave(sqrt(LAMBDA*LAMBDA - 1.0), 0.0, phi, psi, xy_in); +// init_circular_wave(0.0, 0.0, phi, psi, xy_in); // init_wave_plus(LAMBDA - 0.3*MU, 0.5*MU, phi, psi, xy_in); // init_wave(LAMBDA - 0.3*MU, 0.5*MU, phi, psi, xy_in); @@ -607,12 +624,12 @@ void animation() glColor3f(0.0, 0.0, 0.0); // draw_wave(phi, psi, xy_in, 1.0, 0, PLOT); if (HIGHRES) draw_wave_highres_palette(2, phi, psi, total_energy, xy_in, 1.0, 0, PLOT, COLOR_PALETTE); - else draw_wave_epalette(phi, psi, total_energy, color_scale, xy_in, 1.0, 0, PLOT, COLOR_PALETTE); + else draw_wave_epalette(phi, psi, total_energy, color_scale, xy_in, 1.0, 0, PLOT, COLOR_PALETTE, 0, 1.0); - draw_billiard(); + draw_billiard(0, 1.0); - if (DRAW_COLOR_SCHEME) draw_color_bar_palette(PLOT, COLORBAR_RANGE, COLOR_PALETTE); + if (DRAW_COLOR_SCHEME) draw_color_bar_palette(PLOT, COLORBAR_RANGE, COLOR_PALETTE, fade, fade_value); glutSwapBuffers(); @@ -634,7 +651,7 @@ void animation() // draw_wave(phi, psi, xy_in, scale, i, PLOT); if (HIGHRES) draw_wave_highres_palette(2, phi, psi, total_energy, xy_in, scale, i, PLOT, COLOR_PALETTE); - else draw_wave_epalette(phi, psi, total_energy, color_scale, xy_in, scale, i, PLOT, COLOR_PALETTE); + else draw_wave_epalette(phi, psi, total_energy, color_scale, xy_in, scale, i, PLOT, COLOR_PALETTE, 0, 1.0); for (j=0; j