From b809ce9e5507d736a8f5a351f4795f20862c1829 Mon Sep 17 00:00:00 2001 From: Nils Berglund <83530463+nilsberglund-orleans@users.noreply.github.com> Date: Sun, 30 Apr 2023 17:01:39 +0200 Subject: [PATCH] Add files via upload --- Parameters.md | 12146 ++++++++++++++++++++++++---------------- Parameters_April23.md | 8756 +++++++++++++++++++++++++++++ Parameters_May23.md | 6249 +++++++++++++++++++++ global_ljones.c | 7 + global_pdes.c | 25 +- lennardjones.c | 148 +- rde.c | 218 +- sub_hashgrid.c | 2 + sub_lj.c | 228 +- sub_rde.c | 292 +- sub_wave.c | 21 + sub_wave_3d.c | 75 +- wave_3d.c | 175 +- wave_billiard.c | 124 +- 14 files changed, 23373 insertions(+), 5093 deletions(-) create mode 100644 Parameters_April23.md create mode 100644 Parameters_May23.md diff --git a/Parameters.md b/Parameters.md index 9551456..449b89a 100644 --- a/Parameters.md +++ b/Parameters.md @@ -9,697 +9,11 @@ function animation. Some simulations use variants of the published code. The lis updated gradually. -### 25 March 23 - A rotating beam in a maze with octagonal and square cells ### - -**Program:** `particle_trajectory.c` - -**Initial condition in function `animation()`:** -``` - x = MAZE_XSHIFT - 0.025; - y = 0.0; - alpha = angle_schedule(time); - - period = compute_trajectories_xy(x, y, alpha, alpha + DPI, configs, trajectory, traj_length, &xmax); -``` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ - -#define WINWIDTH 1280 /* window width */ -#define WINHEIGHT 720 /* window height */ -#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 */ - -#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 */ - -#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ - -/* Choice of the billiard table, see global_particles.c */ - -#define B_DOMAIN 30 /* choice of domain shape */ - -#define CIRCLE_PATTERN 1 /* pattern of circles */ -#define POLYLINE_PATTERN 16 /* pattern of polyline */ - -#define ABSORBING_CIRCLES 0 /* set to 1 for circular scatterers to be absorbing */ - -#define NMAXCIRCLES 50000 /* total number of circles (must be at least NCX*NCY for square grid) */ -#define NMAXPOLY 50000 /* total number of sides of polygonal line */ -#define NCX 9 /* 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 2 /* Sierpinski gastket depth */ - -#define LAMBDA -1.1 /* parameter controlling shape of domain */ -#define MU 0.1 /* second parameter controlling shape of billiard */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NPOLY 3 /* number of sides of polygon */ -#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ -#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ -#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ -#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ -#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ - -#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ -#define DEBUG 0 /* draw trajectories, for debugging purposes */ - -/* Simulation parameters */ - -#define NPART 1 /* number of particles */ -#define NPARTMAX 100000 /* maximal number of particles after resampling */ -#define TRAJ_LENGTH 10000 /* length of trajectory */ -#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 0 /* set to 1 to keep trails of the particles */ -#define HEATMAP 0 /* set to 1 to show heat map of particles */ -#define PLOT_HEATMAP_AVERAGE 0 /* set to 1 to plot average number of particles in heat map */ -#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ -#define TEST_ACTIVE 1 /* set to 1 to test whether particle is in billiard */ -#define PRINT_TRAJECTORY_LENGTH 1 /* set to 1 to print length of trajectory 0 */ -#define PRINT_TRAJECTORY_ANGLE 1 /* set to 1 to print angle of trajectory 0 */ -#define PRINT_TRAJECTORY_PERIOD 0 /* set to 1 to print period of trajectory 0 */ -#define DRAW_LENGTHS_PLOT 1 /* set to 1 to plot trajectory lengths */ -#define LENGTHS_LOG_SCALE 1 /* set to 1 to use log scale for plot of lengths */ -#define LENGTH_PLOT_POLAR 1 /* set to 1 to plot lengths in polar coordinates */ -#define MIN_ANGLE 0.0 /* range of angles of trajectory */ -#define MAX_ANGLE 360.0 /* range of angles of trajectory */ -#define TEST_INITIAL_COND 1 /* set to 1 to allow only initial conditions that pass a test */ - -#define SLOW_AT_LONG_TRAJ 0 /* set to 1 to slow down movie for long trajectories */ -#define ADD_SUCCESS_GALLERY 1 /* set to 1 to add gallery of successful trajectories at end of movie */ -#define SUCCESS_GALLERY_FRAMES 25 /* number of frames per success */ -#define EXIT_BOTH_WAYS 1 /* set to 1 to add exits to he left to succesful trajectories */ - -#define NSTEPS 7000 /* 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 150 /* number of iterations between images displayed on screen */ - -/* Decreasing TIME accelerates the animation and the movie */ -/* For constant speed of movie, TIME*DPHI should be kept constant */ -/* However, increasing DPHI too much deterioriates quality of simulation */ -/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ -/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ - -/* Colors and other graphical parameters */ - -#define COLOR_PALETTE 12 /* Color palette, see list in global_pdes.c */ - -#define NCOLORS 10000 /* number of colors */ -#define COLORSHIFT 0 /* hue of initial color */ -#define COLOR_HUEMIN 0 /* minimal color hue */ -#define COLOR_HUEMAX 240 /* maximal color hue */ -#define RAINBOW_COLOR 0 /* 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.03 /* length of velocity vectors */ -#define BILLIARD_WIDTH 2 /* width of billiard */ -#define PARTICLE_WIDTH 2 /* width of particles */ -#define FRONT_WIDTH 3 /* width of wave front */ -#define GRAPH_HUE 90.0 /* color hue of graph */ -#define SUCCESS_HUE 180.0 /* color hue of success */ - -#define BLACK 1 /* set to 1 for black background */ -#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ -#define OUTER_COLOR 270.0 /* color outside billiard */ -#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ -#define PAINT_EXT 1 /* set to 1 to paint exterior */ - -#define PAUSE 250 /* number of frames after which to pause */ -#define PSLEEP 2 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#define SLEEP2 1 /* final sleeping time */ -#define END_FRAMES 100 /* number of frames at end of movie */ - -#define NXMAZE 25 /* width of maze */ -#define NYMAZE 25 /* height of maze */ -#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 10 /* seed of random number generator */ -#define MAZE_XSHIFT -0.7 /* horizontal shift of maze */ -#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ -#define MAZE_CORNER_RADIUS 0.4 /* radius of tounded corners in maze */ - -``` - - -### 24 March 23 - A heterogeneous reversible reaction with two oxydation states ### - -**Program:** `lennardjones.c` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#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 while saving frames */ -#define NO_EXTRA_BUFFER_SWAP 0 /* some OS require one less buffer swap when recording images */ - -#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ - /* so far incompatible with double movie */ -#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ -#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ - -#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ - -/* General geometrical parameters */ - -#define WINWIDTH 1280 /* window width */ -#define WINHEIGHT 720 /* window height */ - -#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 */ - -#define INITXMIN -1.97 -#define INITXMAX 1.97 /* x interval for initial condition */ -#define INITYMIN -1.1 -#define INITYMAX 1.1 /* y interval for initial condition */ - -#define BCXMIN -2.0 -#define BCXMAX 2.0 /* x interval for boundary condition */ -#define BCYMIN -1.125 -#define BCYMAX 1.125 /* y interval for boundary condition */ - -#define OBSXMIN -2.0 -#define OBSXMAX 2.0 /* x interval for motion of obstacle */ - -#define CIRCLE_PATTERN 1 /* pattern of circles, see list in global_ljones.c */ - -#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ -#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ - -#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ -#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ -#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ -#define ROCKET_SHAPE_B 2 /* shape of second rocket */ -#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ -#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ - -#define TWO_TYPES 0 /* set to 1 to have two types of particles */ -#define TYPE_PROPORTION 0.66 /* proportion of particles of first type */ -#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ -#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ -#define CENTER_PY 0 /* set to 1 to center vertical momentum */ -#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ - -#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ -#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ -#define SPIN_INTER_FREQUENCY 5.0 /* angular frequency of spin-spin interaction */ -#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ - -#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define PDISC_DISTANCE 4.5 /* minimal distance in Poisson disc process, controls density of particles */ -#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ -#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ -#define MU 0.008 /* parameter controlling radius of particles */ -#define MU_B 0.01 /* parameter controlling radius of particles of second type */ -#define NPOLY 25 /* number of sides of polygon */ -#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ -#define MDEPTH 4 /* depth of computation of Menger gasket */ -#define MRATIO 3 /* ratio defining Menger gasket */ -#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 120 /* number of grid point for grid of disks */ -#define NGRIDY 51 /* number of grid point for grid of disks */ -#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ -#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ -#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ -#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 4800 /* number of frames of movie */ -#define NVID 75 /* number of iterations between images displayed on screen */ -#define NSEG 250 /* number of segments of boundary */ -#define INITIAL_TIME 40 /* time after which to start saving frames */ -#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ -#define BOUNDARY_WIDTH 1 /* width of particle boundary */ -#define LINK_WIDTH 2 /* width of links between particles */ -#define CONTAINER_WIDTH 4 /* width of container boundary */ - -#define PAUSE 1000 /* number of frames after which to pause */ -#define PSLEEP 1 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#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 */ - -/* Boundary conditions, see list in global_ljones.c */ - -#define BOUNDARY_COND 0 - -/* Plot type, see list in global_ljones.c */ - -#define PLOT 5 -#define PLOT_B 0 /* plot type for second movie */ - -#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ -#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ -#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ -#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ -#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ - -/* Color schemes */ - -#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ - -#define BLACK 1 /* background */ - -#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ -#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ -#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ - -#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ -#define PRINT_TEMPERATURE 1 /* set to 1 to print current temperature */ - -/* particle properties */ - -#define ENERGY_HUE_MIN 330.0 /* color of original particle */ -#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ -#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ -#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ -#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ -#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ -#define HUE_TYPE1 290.0 /* hue of particles of type 1 */ -#define HUE_TYPE2 210.0 /* hue of particles of type 2 */ -#define HUE_TYPE3 140.0 /* hue of particles of type 3 */ - -#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ -#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ -#define KREPEL 12.0 /* constant in repelling force between particles */ -#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ -#define EQUILIBRIUM_DIST_B 1.5 /* Lennard-Jones equilibrium distance for second type of particle */ -#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ -#define DAMPING 200.0 /* damping coefficient of particles */ -#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */ -#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ -#define PARTICLE_MASS_B 3.0 /* mass of particle of radius MU */ -#define PARTICLE_INERTIA_MOMENT 0.02 /* moment of inertia of particle */ -#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ -#define V_INITIAL 0.0 /* initial velocity range */ -#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ - -#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ -#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ -#define SIGMA 5.0 /* noise intensity in thermostat */ -#define BETA 0.002 /* initial inverse temperature */ -#define MU_XI 0.01 /* friction constant in thermostat */ -#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ -#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ -#define NBH_DIST_FACTOR 10.0 /* radius in which to count neighbours */ -#define GRAVITY 0.0 /* gravity acting on all particles */ -#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ -#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ -#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ -#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ -#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ -#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ - -#define ROTATION 1 /* set to 1 to include rotation of particles */ -#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ -#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ -#define KTORQUE 100.0 /* force constant in angular dynamics */ -#define KTORQUE_B 10.0 /* force constant in angular dynamics */ -#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ -#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ -#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ -#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ -#define SPIN_RANGE 7.0 /* range of spin-spin interaction */ -#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ -#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ - -#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ -#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ -#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ -#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ -#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ -#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ -#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ - -#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ -#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ -#define COMPRESSION_RATIO 0.3 /* final size of container */ -#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ -#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ - -#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ -#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ -#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ -#define NTRIALS 2000 /* number of trials when resampling */ -#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ -#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ -#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ -#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ -#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ -#define N_PRESSURES 100 /* number of intervals to record pressure */ -#define N_P_AVERAGE 100 /* size of pressure averaging window */ -#define N_T_AVERAGE 1 /* size of temperature averaging window */ -#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ -#define PARTIAL_THERMO_COUPLING 1 /* set to 1 to couple only some particles to thermostat */ -#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ -#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ -#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ -#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ - -#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ -#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ - -#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ -#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ -#define NPART_BOTTOM 100 /* number of particles at the bottom */ - -#define ADD_PARTICLES 0 /* set to 1 to add particles */ -#define ADD_TIME 0 /* time at which to add first particle */ -#define ADD_PERIOD 10000 /* time interval between adding further particles */ -#define N_ADD_PARTICLES 20 /* number of particles to add */ -#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ -#define SAFETY_FACTOR 1.5 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ - -#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ -#define N_TRACER_PARTICLES 3 /* number of tracer particles */ -#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ -#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ -#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ - -#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ -#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ -#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ -#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ -#define ROTATE_FINAL_TIME 100 /* final time without rotation */ -#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ -#define OMEGAMAX 100.0 /* maximal rotation speed */ -#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ -#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ -#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ - -#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ -#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ -#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ -#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ -#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ -#define SEGMENTS_X0 1.5 /* initial position of segments */ -#define SEGMENTS_Y0 0.0 /* initial position of segments */ -#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ -#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ -#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ - -#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ -#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ -#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ -#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ -#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ -#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ -#define GROUP_WIDTH 0.05 /* interaction width of groups */ -#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ -#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ -#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ -#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ - -#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ -#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ -#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ - -#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ -#define RD_REACTION 13 /* type of reaction, see list in global_ljones.c */ -#define RD_TYPES 4 /* number of types in reaction-diffusion equation */ -#define RD_INITIAL_COND 5 /* initial condition of particles */ -#define REACTION_DIST 2.0 /* maximal distance for reaction to occur */ -#define REACTION_PROB 0.5 /* probability controlling reaction term */ -#define DISSOCIATION_PROB 0.005 /* probability controlling dissociation reaction */ -#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ -#define EXOTHERMIC 1 /* set to 1 to make reaction exo/endothermic */ -#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ -#define COLLISION_TIME 25 /* time during which collisions are shown */ - -#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ -#define PLOT_PARTICLE_NUMBER 1 /* set to 1 to make of plot of particle number over time */ -#define PARTICLE_NB_PLOT_FACTOR 1.0 /* expected final number of particles over initial number */ -#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ -#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ -#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ -#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ - -#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ - -#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ -#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ -#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_VMAX 100.0 /* max speed of wall */ -#define WALL_TIME 0 /* time during which to keep wall */ - -#define NXMAZE 10 /* width of maze */ -#define NYMAZE 10 /* height of maze */ -#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 200 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ - -#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ -#define FMAX 1.0e10 /* maximal force */ -#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ -#define PMAX 1000.0 /* maximal force */ - -#define HASHX 100 /* size of hashgrid in x direction */ -#define HASHY 50 /* size of hashgrid in y direction */ -#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ -#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ - -#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ -#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ - -``` - -### 23 March 23 - Waves in a rotating medium ### - -**Program:** `wave_billiard.c` - -**Initial condition in function `animation()`:** -``` - init_wave_flat(phi, psi, xy_in); - - if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign; - add_circular_wave(sign, 0.0, 0.0, phi, psi, xy_in); -``` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#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 */ - -#define VARIABLE_IOR 1 /* set to 1 for a variable index of refraction */ -#define IOR 6 /* choice of index of refraction, see list in global_pdes.c */ -#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ -#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ - - -/* General geometrical parameters */ - -#define WINWIDTH 1150 /* window width */ -#define WINHEIGHT 1150 /* window height */ -// #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 -1.2 -#define XMAX 1.2 /* x interval */ -#define YMIN -1.2 -#define YMAX 1.2 /* y interval for 9/16 aspect ratio */ - -#define HIGHRES 1 /* set to 1 if resolution of grid is double that of displayed image */ - -#define JULIA_SCALE 1.0 /* scaling for Julia sets */ - -/* Choice of the billiard table */ - -#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ - -#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ - -#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ -#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ -#define MU 0.5 /* parameter controlling the dimensions of domain */ -#define NPOLY 6 /* 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 */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 8 /* number of grid point for grid of disks */ -#define NGRIDY 8 /* number of grid point for grid of disks */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -#define ISO_XSHIFT_LEFT -2.9 -#define ISO_XSHIFT_RIGHT 1.4 -#define ISO_YSHIFT_LEFT -0.15 -#define ISO_YSHIFT_RIGHT -0.15 -#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ - -/* 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 */ -#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ -#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ -#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ - -#define OMEGA 0.0005 /* frequency of periodic excitation */ -#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ -#define ACHIRP 0.25 /* acceleration coefficient in chirp */ -#define DAMPING 0.0 /* damping of periodic excitation */ -#define COURANT 0.04 /* Courant number */ -#define COURANTB 0.0 /* 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 */ -#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ -#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ -#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ -#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ -/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ -/* The physical damping coefficient is given by GAMMA/(DT)^2 */ -/* Increasing COURANT speeds up the simulation, but decreases accuracy */ -/* 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 50 /* period of oscillating source */ -#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ - -#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ -#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ -#define N_WAVE_PACKETS 15 /* number of wave packets */ -#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ - -/* Boundary conditions, see list in global_pdes.c */ - -#define B_COND 2 - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 1200 /* number of frames of movie */ -#define NVID 10 /* 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 */ -#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ -#define PRINT_SPEED 0 /* print speed of moving source */ - -#define PAUSE 200 /* number of frames after which to pause */ -#define PSLEEP 1 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#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 */ - -#define INITIAL_AMP 0.5 /* amplitude of initial condition */ -#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ -#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ - -/* Plot type, see list in global_pdes.c */ - -#define PLOT 5 - -#define PLOT_B 5 /* plot type for second movie */ - -/* Color schemes */ - -#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ -#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ - -#define BLACK 1 /* background */ - -#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 0.75 /* sensitivity of color on wave amplitude */ -#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 E_SCALE 60.0 /* scaling factor for energy representation */ -#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ -#define LOG_SHIFT 3.5 /* shift of colors on log scale */ -#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ -#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#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 0 /* set to 1 to plot the color scheme */ -#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ - -#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ - -#define NXMAZE 8 /* width of maze */ -#define NYMAZE 32 /* height of maze */ -#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 0 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ -#define MAZE_WIDTH 0.02 /* half width of maze walls */ - -/* for compatibility with sub_wave and sub_maze */ -#define ADD_POTENTIAL 0 -#define POT_MAZE 7 -#define POTENTIAL 0 -/* end of constants only used by sub_wave and sub_maze */ - -/* For debugging purposes only */ -#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ -#define VMAX 10.0 /* max value of wave amplitude */ - -``` - -### 22 March 23 - Solving a slightly larger maze with an Euler flow ### +### 30 April 23 - Solving a maze with a pressure gradient ### **Program:** `rde.c` -**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` +**Initial condition in function `animation()`:** `init_pressure_gradient_flow(flow_speed_schedule(0), 1.0 + PRESSURE_GRADIENT, 1.0 - PRESSURE_GRADIENT, phi, xy_in, bc_field);` ``` #define MOVIE 1 /* set to 1 to generate movie */ @@ -727,14 +41,14 @@ updated gradually. #define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ #define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ -#define ADD_FORCE_FIELD 0 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ #define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ -#define FORCE_FIELD 4 /* type of force field, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ #define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ #define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ -#define OBSTACLE_GEOMETRY 541 /* geometry of obstacles, as in B_DOMAIN */ -#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ +#define OBSTACLE_GEOMETRY 541 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 100.0 /* controls region of boundary condition control */ #define JULIA_SCALE 0.5 /* scaling for Julia sets */ @@ -759,6 +73,7 @@ updated gradually. #define FOCI 1 /* set to 1 to draw focal points of ellipse */ #define NGRIDX 15 /* number of grid point for grid of disks */ #define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ #define X_SHOOTER -0.2 #define Y_SHOOTER -0.6 @@ -793,7 +108,7 @@ updated gradually. #define BZQ 0.0008 /* parameter in BZ equation */ #define BZF 1.2 /* parameter in BZ equation */ #define B_FIELD 10.0 /* magnetic field */ -#define G_FIELD 1.0e-7 /* gravity/constant in repulsive field from obstacles */ +#define G_FIELD 1.0e-4 /* gravity/constant in repulsive field from obstacles */ #define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ #define K_EULER 50.0 /* constant in stream function integration of Euler equation */ #define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ @@ -829,13 +144,16 @@ updated gradually. #define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ #define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ -#define CHANGE_FLOW_SPEED 1 /* set to 1 to change speed of laminar flow */ -#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation, 0 for no b.c. */ +#define IN_OUT_BC_FACTOR 0.001 /* factor of convex combination between old and new flow */ + /* see list in global_pdes.c */ -#define IN_OUT_FLOW_MIN_AMP 0.1 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ -#define IN_OUT_FLOW_AMP 0.3 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ -#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ +#define IN_OUT_FLOW_MIN_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ #define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ +#define PRESSURE_GRADIENT 0.3 /* amplitude of pressure gradient for Euler equation */ #define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ @@ -845,7 +163,7 @@ updated gradually. /* Parameters for length and speed of simulation */ -#define NSTEPS 2000 /* number of frames of movie */ +#define NSTEPS 2500 /* number of frames of movie */ #define NVID 100 /* number of iterations between images displayed on screen */ #define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ #define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ @@ -874,12 +192,12 @@ updated gradually. /* Plot type - color scheme */ #define CPLOT 61 -#define CPLOT_B 62 +#define CPLOT_B 60 /* Plot type - height of 3D plot */ -#define ZPLOT 62 /* z coordinate in 3D plot */ -#define ZPLOT_B 61 /* z coordinate in second 3D plot */ +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ #define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ #define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ @@ -897,7 +215,9 @@ updated gradually. #define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ #define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ #define PRINT_NOISE 0 /* set to 1 to print noise intensity */ -#define PRINT_FLOW_SPEED 1 /* set to 1 to print speed of flow */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 0 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ #define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ #define FIELD_LINE_WIDTH 1 /* width of field lines */ @@ -917,7 +237,7 @@ updated gradually. /* Color schemes, see list in global_pdes.c */ #define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ -#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 11 /* Color palette, see list in global_pdes.c */ #define BLACK 1 /* black background */ @@ -933,7 +253,7 @@ updated gradually. #define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ #define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ #define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ -#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define VSCALE_PRESSURE 0.25 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ #define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ #define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ @@ -954,23 +274,25 @@ updated gradually. #define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ #define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ #define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ -#define NXMAZE 9 /* width of maze */ -#define NYMAZE 9 /* height of maze */ +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ #define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 0 /* seed of random number generator */ +#define RAND_SHIFT 3 /* seed of random number generator */ #define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ -#define MAZE_WIDTH 0.05 /* half width of maze walls */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ -#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ -#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 2.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 1 /* set to 1 to draw color scheme horizontally */ +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ /* only for compatibility with wave_common.c */ #define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ #define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ #define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ #define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ #define OMEGA 0.005 /* frequency of periodic excitation */ #define COURANT 0.08 /* Courant number */ @@ -999,15 +321,15 @@ updated gradually. double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ double v_3d[2] = {-0.75, -0.45}; double w_3d[2] = {0.0, 0.015}; -double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ -double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ -#define Z_SCALING_FACTOR 2.4 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ #define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ #define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ -#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ -#define YSHIFT_3D 0.0 /* overall y shift for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ #define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ /* For debugging purposes only */ @@ -1017,143 +339,20 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO ``` -### 21 March 23 - Starting off center in a circular maze ### - -**Program:** `particle_billiard.c` - -**Initial condition in function `animation()`:** `init_drop_config(-0.75, 0.0, 0.0, DPI, configs);` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ - -#define WINWIDTH 1280 /* window width */ -#define WINHEIGHT 720 /* window height */ - -#define XMIN -1.5 -#define XMAX 2.5 /* x interval */ -#define YMIN -1.125 -#define YMAX 1.125 /* y interval for 9/16 aspect ratio */ - -#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ - -/* Choice of the billiard table, see global_particles.c */ - -#define B_DOMAIN 31 /* choice of domain shape */ - -#define CIRCLE_PATTERN 1 /* pattern of circles */ -#define POLYLINE_PATTERN 13 /* pattern of polyline */ - -#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ -#define MU 0.005 /* 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 */ -#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ - -#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ -#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ -#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ - -#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ -#define DEBUG 0 /* draw trajectories, for debugging purposes */ - -/* Simulation parameters */ - -#define NPART 50000 /* number of particles */ -#define NPARTMAX 100000 /* maximal number of particles after resampling */ -#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 0 /* set to 1 to keep trails of the particles */ -#define HEATMAP 1 /* set to 1 to show heat map of particles */ -#define DRAW_HEATMAP_HISTOGRAM 1 /* set to 1 to draw a histogram of particle distribution in heat map */ -#define NBIN_FACTOR 6.0 /* constant controlling number of bins in histogram */ -#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ -#define HEATMAP_MAX_PART_BY_CELL 0 /* set to positive value to draw only limited number of particles in cell */ -#define PLOT_HEATMAP_AVERAGE 0 /* set to 1 to plot average number of particles in heat map */ -#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ -#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ -#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles on left and right side */ -#define PRINT_CIRCLE_PARTICLE_NUMBER 1 /* set to 1 to print number of particles outside circular maze */ -#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ - -#define NSTEPS 12000 /* number of frames of movie */ -#define TIME 3000 /* time between movie frames, for fluidity of real-time simulation */ -#define DPHI 0.00002 /* integration step */ -#define NVID 25 /* number of iterations between images displayed on screen */ -#define END_FRAMES 50 /* 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 */ -/* However, increasing DPHI too much deterioriates quality of simulation */ -/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ -/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ - -/* Colors and other graphical parameters */ - -#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ - -#define NCOLORS 500 /* number of colors */ -#define COLORSHIFT 0 /* hue of initial color */ -#define COLOR_HUEMIN 0 /* minimal color hue */ -#define COLOR_HUEMAX 300 /* maximal color hue */ -#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.025 /* length of velocity vectors */ -#define BILLIARD_WIDTH 2 /* width of billiard */ -#define PARTICLE_WIDTH 2 /* width of particles */ -#define FRONT_WIDTH 3 /* width of wave front */ - -#define BLACK 1 /* set to 1 for black background */ -#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ -#define OUTER_COLOR 270.0 /* color outside billiard */ -#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ -#define PAINT_EXT 1 /* set to 1 to paint exterior */ - -#define PAUSE 1000 /* number of frames after which to pause */ -#define PSLEEP 2 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#define SLEEP2 1 /* final sleeping time */ - -#define NXMAZE 16 /* width of maze */ -#define NYMAZE 96 /* height of maze */ -#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 10 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ -#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ -#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ - -``` - -### 20 March 23 - Bloopers 8: When reversibility breaks down due to coding issues ### +### 29 April 23 - A school of fish exploring a maze ### **Program:** `lennardjones.c` ``` #define MOVIE 1 /* set to 1 to generate movie */ -#define DOUBLE_MOVIE 0 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ #define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ -#define NO_EXTRA_BUFFER_SWAP 0 /* some OS require one less buffer swap when recording images */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ -#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ /* so far incompatible with double movie */ #define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ -#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ #define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ @@ -1180,41 +379,41 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define OBSXMIN -2.0 #define OBSXMAX 2.0 /* x interval for motion of obstacle */ -#define CIRCLE_PATTERN 1 /* pattern of circles, see list in global_ljones.c */ +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ #define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ #define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ -#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ -#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 15 /* pattern of repelling segments, see list in global_ljones.c */ #define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ #define ROCKET_SHAPE_B 2 /* shape of second rocket */ #define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ #define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ #define TWO_TYPES 0 /* set to 1 to have two types of particles */ -#define TYPE_PROPORTION 0.66 /* proportion of particles of first type */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ #define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ #define CENTER_PX 0 /* set to 1 to center horizontal momentum */ #define CENTER_PY 0 /* set to 1 to center vertical momentum */ #define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ -#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION 9 /* particle interaction, see list in global_ljones.c */ #define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ -#define SPIN_INTER_FREQUENCY 5.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ #define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ #define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ #define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define PDISC_DISTANCE 4.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ #define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ #define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ #define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ -#define MU 0.008 /* parameter controlling radius of particles */ -#define MU_B 0.01 /* parameter controlling radius of particles of second type */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ #define NPOLY 25 /* number of sides of polygon */ -#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ #define MDEPTH 4 /* depth of computation of Menger gasket */ #define MRATIO 3 /* ratio defining Menger gasket */ #define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ @@ -1235,9 +434,9 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO /* Parameters for length and speed of simulation */ #define NSTEPS 3600 /* number of frames of movie */ -#define NVID 75 /* number of iterations between images displayed on screen */ +#define NVID 50 /* number of iterations between images displayed on screen */ #define NSEG 250 /* number of segments of boundary */ -#define INITIAL_TIME 40 /* time after which to start saving frames */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ #define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ #define BOUNDARY_WIDTH 1 /* width of particle boundary */ #define LINK_WIDTH 2 /* width of links between particles */ @@ -1252,22 +451,22 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO /* Boundary conditions, see list in global_ljones.c */ -#define BOUNDARY_COND 0 +#define BOUNDARY_COND 3 /* Plot type, see list in global_ljones.c */ -#define PLOT 5 -#define PLOT_B 0 /* plot type for second movie */ +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ #define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ #define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ -#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ #define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ #define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ /* Color schemes */ -#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ #define BLACK 1 /* background */ @@ -1285,7 +484,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ #define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ -#define PRINT_TEMPERATURE 1 /* set to 1 to print current temperature */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ /* particle properties */ @@ -1294,34 +493,37 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define PARTICLE_HUE_MIN 359.0 /* color of original particle */ #define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ #define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ -#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ -#define HUE_TYPE1 270.0 /* hue of particles of type 1 */ -#define HUE_TYPE2 210.0 /* hue of particles of type 2 */ -#define HUE_TYPE3 140.0 /* hue of particles of type 3 */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ #define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ #define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ -#define KREPEL 12.0 /* constant in repelling force between particles */ -#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ -#define EQUILIBRIUM_DIST_B 1.5 /* Lennard-Jones equilibrium distance for second type of particle */ +#define KREPEL 0.5 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 1.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ #define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ -#define DAMPING 160.0 /* damping coefficient of particles */ -#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */ -#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ -#define PARTICLE_MASS_B 3.0 /* mass of particle of radius MU */ -#define PARTICLE_INERTIA_MOMENT 0.02 /* moment of inertia of particle */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ #define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ -#define V_INITIAL 0.0 /* initial velocity range */ -#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ -#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ #define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ #define SIGMA 5.0 /* noise intensity in thermostat */ #define BETA 0.002 /* initial inverse temperature */ #define MU_XI 0.01 /* friction constant in thermostat */ -#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ -#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ -#define NBH_DIST_FACTOR 10.0 /* radius in which to count neighbours */ +#define KSPRING_BOUNDARY 1.0e10 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e10 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ #define GRAVITY 0.0 /* gravity acting on all particles */ #define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ #define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ @@ -1329,17 +531,19 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ #define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ #define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ #define ROTATION 1 /* set to 1 to include rotation of particles */ -#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ #define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ -#define KTORQUE 100.0 /* force constant in angular dynamics */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ #define KTORQUE_B 10.0 /* force constant in angular dynamics */ #define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ #define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ #define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ #define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ -#define SPIN_RANGE 7.0 /* range of spin-spin interaction */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ #define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ #define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ @@ -1370,7 +574,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define N_P_AVERAGE 100 /* size of pressure averaging window */ #define N_T_AVERAGE 1 /* size of temperature averaging window */ #define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ -#define PARTIAL_THERMO_COUPLING 1 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ #define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ #define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ #define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ @@ -1434,21 +638,2234 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ #define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ -#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ -#define RD_REACTION 13 /* type of reaction, see list in global_ljones.c */ -#define RD_TYPES 4 /* number of types in reaction-diffusion equation */ -#define RD_INITIAL_COND 5 /* initial condition of particles */ -#define REACTION_DIST 2.2 /* maximal distance for reaction to occur */ +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ #define REACTION_PROB 0.5 /* probability controlling reaction term */ -#define DISSOCIATION_PROB 0.02 /* probability controlling dissociation reaction */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ #define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ -#define EXOTHERMIC 1 /* set to 1 to make reaction exo/endothermic */ -#define DELTA_EKIN 1500.0 /* change of kinetic energy in reaction */ -#define COLLISION_TIME 25 /* time during which collisions are shown */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ #define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ -#define PLOT_PARTICLE_NUMBER 1 /* set to 1 to make of plot of particle number over time */ -#define PARTICLE_NB_PLOT_FACTOR 1.0 /* expected final number of particles over initial number */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 6 /* width of maze */ +#define NYMAZE 6 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 1 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 80 /* size of hashgrid in x direction */ +#define HASHY 40 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 28 April 23 - Waves spilling from the Mandelbrot set ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** +``` + init_circular_wave_mod(0.0, 0.0, phi, psi, xy_in); + + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign; + add_circular_wave_mod(sign, 0.0, 0.0, phi, psi, xy_in); + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 2500 /* number of grid points on x axis */ +#define NY 1250 /* number of grid points on y axis */ + +#define XMIN -2.2 +#define XMAX 1.8 /* x interval */ +#define YMIN -1.041666667 +#define YMAX 1.041666667 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 1 /* set to 1 for a variable index of refraction */ +#define IOR 101 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 2000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 20.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 8 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.06 /* Courant number */ +#define COURANTB 0.06 /* Courant number in medium B */ +#define GAMMA 0.0 /* damping factor in wave equation */ +#define GAMMAB 1.0e-6 /* damping factor in wave equation */ +#define GAMMA_SIDES 1.0e-4 /* damping factor on boundary */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 50 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2300 /* number of frames of movie */ +#define NVID 6 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.15 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 108 +#define CPLOT_B 108 /* plot type for second movie */ + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 0.4 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.5 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 18 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 14 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 0.5 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 15.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 240.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 20.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 500.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 5.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define ADD_POTENTIAL 1 /* set to 1 to add potential to z coordinate */ +#define POTENTIAL 10 +#define POT_FACT 400.0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +/* Parameters controlling 3D projection */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 6.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 0.05 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.8 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.2 /* overall y shift for REP_PROJ_3D representation */ + +``` + +### 27 April 23 - Tesla valves under a pressure gradient ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_pressure_gradient_flow(flow_speed_schedule(0), 1.0 + PRESSURE_GRADIENT, 1.0 - PRESSURE_GRADIENT, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 72 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 1.0e-4 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 6 /* type of in-flow/out-flow boundary conditions for Euler equation, 0 for no b.c. */ +#define IN_OUT_BC_FACTOR 0.001 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ +#define PRESSURE_GRADIENT 0.3 /* amplitude of pressure gradient for Euler equation */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3000 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 60 +#define CPLOT_B 61 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 1 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.25 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 26 April 23 - Video #800: A rocket fueled by a chemical reaction ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#define XMIN -3.3 +#define XMAX 4.7 /* x interval */ +#define YMIN -2.25 +#define YMAX 2.25 /* y interval for 9/16 aspect ratio */ + +#define INITXMIN -0.7 +#define INITXMAX 0.7 /* x interval for initial condition */ +#define INITYMIN -1.7 +#define INITYMAX 1.7 /* y interval for initial condition */ + +#define BCXMIN -5.1 +#define BCXMAX 6.1 /* x interval for boundary condition */ +#define BCYMIN -6.5 +#define BCYMAX 44.0 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 101 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 1 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.5 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 2.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.8 /* parameter controlling the dimensions of domain */ +#define MU 0.009 /* parameter controlling radius of particles */ +#define MU_B 0.009 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 5200 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 50 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 150 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 20 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 5 +#define PLOT_B 8 /* plot type for second movie */ + +#define DRAW_BONDS 0 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 1 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 1 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 1 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 2.0e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 280.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 180.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 210.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 4.5 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 3.5 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 5.0 /* damping coefficient of particles */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define INITIAL_DAMPING 5.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 1.0 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.2 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 0.0 /* initial velocity range */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.02 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 7.5 /* radius in which to count neighbours */ +#define GRAVITY 15.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 0 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.02 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 1 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 20 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 0 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 0.0 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 0 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 5.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 0 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 2 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 3 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.1 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.4 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 1 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 224.49 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 0 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 1 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 1 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.2 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 6 /* width of maze */ +#define NYMAZE 6 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 1 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 120 /* size of hashgrid in x direction */ +#define HASHY 450 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +**Part 2:** + +``` +#define REACTION_DIST 3.1245 /* maximal distance for reaction to occur */ +#define VMAX_PLOT_SPEEDS 0.25 /* vertical scale of plot of obstacle speeds + +``` + + +### 25 April 23 - Bloopers 9: Solving a maze with fish is not so easy ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 15 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 9 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3600 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 0.5 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 1.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e10 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e10 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_BOUNDARY 1.0e4 /* constant in torque from the boundary */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 6 /* width of maze */ +#define NYMAZE 6 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 120 /* size of hashgrid in x direction */ +#define HASHY 60 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 24 April 23 - 3D render of waves in a periodic medium, shown in their index of refraction landscape ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** +``` + init_circular_wave_mod(0.0, 0.0, phi, psi, xy_in); + + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign; + add_circular_wave_mod(sign, 0.0, 0.0, phi, psi, xy_in); + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 2500 /* number of grid points on x axis */ +#define NY 2500 /* number of grid points on y axis */ + +#define XMIN -1.5 +#define XMAX 1.5 /* x interval */ +#define YMIN -1.5 +#define YMAX 1.5 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 1 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 8 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.05 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 50 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2100 /* number of frames of movie */ +#define NVID 4 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.7 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 108 +#define CPLOT_B 108 /* plot type for second movie */ + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 0.1 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.5 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 3.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 15.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 20.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 500.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define ADD_POTENTIAL 1 /* set to 1 to add potential to z coordinate */ +#define POTENTIAL 10 +#define POT_FACT 30.0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + +### 23 April 23 - 3D view of an Euler flow solving a maze ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 700 /* number of grid points on x axis */ +#define NY 600 /* number of grid points on y axis */ + +#define XMIN -1.4 +#define XMAX 1.4 /* x interval */ +#define YMIN -1.2 +#define YMAX 1.2 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 541 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 150.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.3 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.3 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2400 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 1 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 62 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 62 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 0 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 5.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 4.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.05 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 22 April 23 - Your aquarium simulator: A Vicsek-type model with speed alignment ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 10 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 4200 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 0.1 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ #define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ #define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ #define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ @@ -1475,8 +2892,8 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ #define PMAX 1000.0 /* maximal force */ -#define HASHX 100 /* size of hashgrid in x direction */ -#define HASHY 50 /* size of hashgrid in y direction */ +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ #define HASHMAX 100 /* maximal number of particles per hashgrid cell */ #define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ @@ -1487,7 +2904,966 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO ``` -### 19 March 23 - Changing the beam direction in a phased array with 25 emitters ### +**Part 2:** +``` +#define KSPRING_VICSEK 0.5 /* spring constant for I_VICSEK_SPEED interaction */ +``` + + +### 21 April 23 - 3D render of a circular phased array ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat_mod(phi, psi, xy_in); + + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + if (first_source) for (k=0; k<25; k++) + { + omega = DPI/25.0; + wave_source[k].xc = 0.15*cos((double)k*omega);; + wave_source[k].yc = 0.15*sin((double)k*omega); + wave_source[k].phase = 1.0 - (double)(k+1)*10.0/25.0; + wave_source[k].sign = 1; + first_source = 0; + } + + for (k=0; k<25; k++) + { + wave_source[k].phase += 1.0/25.0; + if (wave_source[k].phase > 1.0) + { + add_circular_wave_mod((double)wave_source[k].sign, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } + } + +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 1500 /* number of grid points on x axis */ +#define NY 1500 /* number of grid points on y axis */ + +#define XMIN -1.5 +#define XMAX 1.5 /* x interval */ +#define YMIN -1.5 +#define YMAX 1.5 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 5 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 14 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.04 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 1900 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.015 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 108 +#define CPLOT_B 108 /* plot type for second movie */ + + + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 1.0 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.5 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 3.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 15.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 360.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 20.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 500.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 5.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define ADD_POTENTIAL 1 /* set to 1 to add potential to z coordinate */ +#define POTENTIAL 10 +#define POT_FACT 30.0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +/* Parameters controlling 3D projection */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 0.2 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.8 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.1 /* overall y shift for REP_PROJ_3D representation */ + +``` + +### 20 April 23 - Several Tesla valves in series - Pressure and vorticity ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 72 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 0 /* type of in-flow/out-flow boundary conditions for Euler equation, 0 for no b.c. */ +#define IN_OUT_BC_FACTOR 0.001 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2300 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 60 +#define CPLOT_B 62 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 1 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 4.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 19 April 23 - A Vicsek-type swarming model with weak repulsion ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 9 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3200 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 50 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 0.1 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 18 April 23 - A circular phased array with slower rotation ### **Program:** `wave_billiard.c` @@ -1495,27 +3871,25 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO ``` init_wave_flat(phi, psi, xy_in); - p = phased_array_schedule(i); - y = -1.0; - sign1 = sign; - printf("p = %i\n", p); - for (k=-8; k<9; k++) + if (first_source) for (k=0; k<25; k++) { - x1 = 0.05*((double)source_counter/(double)p + (double)k); - if ((x1 > 0.083333333*XMIN)&&(x1 < 0.083333333*XMAX)) - { - add_circular_wave(sign1, x1, y, phi, psi, xy_in); - printf("Adding wave at (%.2lg, %.2lg)\n", x1, y); - } - sign1 = -sign1; + omega = DPI/25.0; + wave_source[k].xc = 0.15*cos((double)k*omega);; + wave_source[k].yc = 0.15*sin((double)k*omega); + wave_source[k].phase = 1.1 - (double)(k+1)*10.0/25.0; + wave_source[k].sign = 1; + first_source = 0; } - source_counter++; - if (p > 0) q = p; - else q = -p; - if (source_counter >= q) + for (k=0; k<25; k++) { - source_counter = 0; - sign = -sign; + wave_source[k].phase += 1.0/50.0; + if (wave_source[k].phase > 1.0) + { + add_circular_wave((double)wave_source[k].sign, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } } ``` @@ -1526,7 +3900,8 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ #define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ -#define IOR 5 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ #define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ @@ -1569,8 +3944,8 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ #define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ #define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 14 /* number of grid point for grid of disks */ -#define NGRIDY 8 /* number of grid point for grid of disks */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ #define X_SHOOTER -0.2 #define Y_SHOOTER -0.6 @@ -1597,7 +3972,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define AMPLITUDE 0.8 /* amplitude of periodic excitation */ #define ACHIRP 0.25 /* acceleration coefficient in chirp */ #define DAMPING 0.0 /* damping of periodic excitation */ -#define COURANT 0.08 /* Courant number */ +#define COURANT 0.04 /* Courant number */ #define COURANTB 0.0 /* Courant number in medium B */ #define GAMMA 0.0 /* damping factor in wave equation */ #define GAMMAB 0.0 /* damping factor in wave equation */ @@ -1612,8 +3987,8 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO /* 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 3 /* period of oscillating source */ -#define ALTERNATE_OSCILLATING_SOURCE 0 /* set to 1 to alternate sign of oscillating source */ +#define OSCILLATING_SOURCE_PERIOD 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ #define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ #define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ @@ -1626,8 +4001,8 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO /* Parameters for length and speed of simulation */ -#define NSTEPS 2800 /* number of frames of movie */ -#define NVID 12 /* number of iterations between images displayed on screen */ +#define NSTEPS 3000 /* number of frames of movie */ +#define NVID 10 /* 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 */ #define BOUNDARY_WIDTH 2 /* width of billiard boundary */ @@ -1643,34 +4018,34 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO /* Parameters of initial condition */ -#define INITIAL_AMP 0.1 /* amplitude of initial condition */ -#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ -#define INITIAL_WAVELENGTH 0.01 /* wavelength of initial condition */ +#define INITIAL_AMP 0.015 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ /* Plot type, see list in global_pdes.c */ #define PLOT 0 -#define PLOT_B 6 /* plot type for second movie */ +#define PLOT_B 5 /* plot type for second movie */ /* Color schemes */ #define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ -#define COLOR_PALETTE_B 14 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ #define BLACK 1 /* background */ #define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ #define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define SLOPE 0.75 /* sensitivity of color on wave amplitude */ #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 E_SCALE 500.0 /* scaling factor for energy representation */ -#define LOG_SCALE 0.8 /* scaling factor for energy log representation */ +#define E_SCALE 120.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ #define LOG_SHIFT 3.5 /* shift of colors on log scale */ -#define FLUX_SCALE 2.5e2 /* scaling factor for enegy flux represtnation */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ #define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ #define COLORHUE 260 /* initial hue of water color for scheme C_LUM */ @@ -1680,9 +4055,9 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #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 1.5 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ #define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ #define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ @@ -1692,6 +4067,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ #define RAND_SHIFT 0 /* seed of random number generator */ #define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ /* for compatibility with sub_wave and sub_maze */ #define ADD_POTENTIAL 0 @@ -1705,7 +4081,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO ``` -### 18 March 23 - A Tesla valve ### +### 17 April 23 - Several Tesla valves in series ### **Program:** `rde.c` @@ -1737,9 +4113,1030 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ #define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ -#define ADD_FORCE_FIELD 0 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ #define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ -#define FORCE_FIELD 4 /* type of force field, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 72 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 0 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2300 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 64 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 1 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#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 BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#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 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 16 April 23 - A Vicsek-type model with weaker coupling ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 8 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2500 /* number of frames of movie */ +#define NVID 175 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 0.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 20.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 1.0 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 0.04 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5000.0 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 15 April 23 - A circular phased array ### + +**Program:** `wave_billiard.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat(phi, psi, xy_in); + + if (first_source) for (k=0; k<25; k++) + { + omega = DPI/25.0; + wave_source[k].xc = 0.15*cos((double)k*omega);; + wave_source[k].yc = 0.15*sin((double)k*omega); + wave_source[k].phase = 1.0 - (double)(k+1)*10.0/25.0; + wave_source[k].sign = 1; + first_source = 0; + } + for (k=0; k<25; k++) + { + wave_source[k].phase += 1.0/25.0; + if (wave_source[k].phase > 1.0) + { + add_circular_wave((double)wave_source[k].sign, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* 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 */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.0005 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.25 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.04 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2700 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* print speed of moving source */ + +#define PAUSE 200 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +#define INITIAL_AMP 0.01 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define PLOT 0 + +#define PLOT_B 5 /* plot type for second movie */ + +/* Color schemes */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.75 /* sensitivity of color on wave amplitude */ +#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 E_SCALE 120.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ +#define LOG_SHIFT 3.5 /* shift of colors on log scale */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#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 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POT_MAZE 7 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + +/* For debugging purposes only */ +#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + +### 14 April 23 - Everything is illuminable (well, almost, in a closed maze with right angles) ### + +**Program:** `particle_billiard.c` + +**Initial condition in function `animation()`:** `init_drop_config(0.05, 0.05, 0.0, DPI, configs);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ +#define INVERT_COUNTER 0 /* set to 1 to save frames in inverse order */ + +#define WINWIDTH 720 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ + +/* Choice of the billiard table, see global_particles.c */ + +#define B_DOMAIN 30 /* choice of domain shape */ + +#define CIRCLE_PATTERN 1 /* pattern of circles */ +#define POLYLINE_PATTERN 10 /* pattern of polyline */ + +#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ +#define MU 0.005 /* 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 */ +#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ + +#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ +#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ + +#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ +#define DEBUG 0 /* draw trajectories, for debugging purposes */ + +/* Simulation parameters */ + +#define NPART 50000 /* number of particles */ +#define NPARTMAX 100000 /* maximal number of particles after resampling */ +#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 0 /* set to 1 to keep trails of the particles */ +#define HEATMAP 1 /* set to 1 to show heat map of particles */ +#define DRAW_FINAL_HEATMAP 1 /* set to 1 to show final heat map of particles */ +#define DRAW_HEATMAP_HISTOGRAM 0 /* set to 1 to draw a histogram of particle distribution in heat map */ +#define NBIN_FACTOR 6.0 /* constant controlling number of bins in histogram */ +#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ +#define HEATMAP_MAX_PART_BY_CELL 50 /* set to positive value to draw only limited number of particles in cell */ +#define PLOT_HEATMAP_AVERAGE 1 /* set to 1 to plot average number of particles in heat map */ +#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ +#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles on left and right side */ +#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ +#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ + +#define NSTEPS 1300 /* number of frames of movie */ +#define TIME 3000 /* time between movie frames, for fluidity of real-time simulation */ +#define DPHI 0.00002 /* integration step */ +#define NVID 25 /* number of iterations between images displayed on screen */ +#define END_FRAMES 50 /* 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 */ +/* However, increasing DPHI too much deterioriates quality of simulation */ +/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ +/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ + +/* Colors and other graphical parameters */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ + +#define NCOLORS 500 /* number of colors */ +#define COLORSHIFT 0 /* hue of initial color */ +#define COLOR_HUEMIN 0 /* minimal color hue */ +#define COLOR_HUEMAX 300 /* maximal color hue */ +#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.025 /* length of velocity vectors */ +#define BILLIARD_WIDTH 2 /* width of billiard */ +#define PARTICLE_WIDTH 2 /* width of particles */ +#define FRONT_WIDTH 3 /* width of wave front */ + +#define BLACK 1 /* set to 1 for black background */ +#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ +#define OUTER_COLOR 270.0 /* color outside billiard */ +#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ +#define PAINT_EXT 1 /* set to 1 to paint exterior */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ + +#define NXMAZE 18 /* width of maze */ +#define NYMAZE 18 /* height of maze */ +#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 15 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ +#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ +#define CLOSE_MAZE 1 /* set to 1 to close maze exits */ + +``` + +### 13 April 23 - 3D render of a Tesla valve ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ #define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ #define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ @@ -1804,7 +5201,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define BZQ 0.0008 /* parameter in BZ equation */ #define BZF 1.2 /* parameter in BZ equation */ #define B_FIELD 10.0 /* magnetic field */ -#define G_FIELD 1.0e-7 /* gravity/constant in repulsive field from obstacles */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ #define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ #define K_EULER 50.0 /* constant in stream function integration of Euler equation */ #define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ @@ -1842,9 +5239,11 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ #define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + /* see list in global_pdes.c */ -#define IN_OUT_FLOW_MIN_AMP 0.35 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ -#define IN_OUT_FLOW_AMP 0.35 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ #define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ #define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ @@ -1856,7 +5255,3007 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO /* Parameters for length and speed of simulation */ -#define NSTEPS 1500 /* number of frames of movie */ +#define NSTEPS 2000 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 1 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 62 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 62 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#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 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +**Part 2:** +``` +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ +``` + +### 12 April 23 - A Vicsek-type model for swarming ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 8 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.6 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3500 /* number of frames of movie */ +#define NVID 175 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 0.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 20.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 1.0 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 0.04 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 10000.0 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 11 April 23 - A continuous sweep in a phased array ### + +**Program:** `wave_billiard.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat(phi, psi, xy_in); + + if (first_source) for (k=0; k<25; k++) + { + wave_source[k].xc = -0.1*XMAX + 0.1*(XMAX-XMIN)*(double)k/25.0; + wave_source[k].yc = -1.0; + wave_source[k].phase = 0.9 - (double)k*0.2; + wave_source[k].sign = 1; + first_source = 0; + } + for (k=0; k<25; k++) + { + wave_source[k].phase += 0.08*(1.0 + 0.05*((double)(i*k)/(double)NSTEPS)); + if (wave_source[k].phase > 1.0) + { + add_circular_wave((double)wave_source[k].sign, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* 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 */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.0005 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.25 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.04 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2800 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* print speed of moving source */ + +#define PAUSE 200 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +#define INITIAL_AMP 0.02 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define PLOT 0 + +#define PLOT_B 6 /* plot type for second movie */ + +/* Color schemes */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.75 /* sensitivity of color on wave amplitude */ +#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 E_SCALE 60.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ +#define LOG_SHIFT 3.5 /* shift of colors on log scale */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#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 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POT_MAZE 7 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + +/* For debugging purposes only */ +#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + +### 10 April 23 - An Euler flow in a larger maze with repelling walls ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 541 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 150.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 0 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2400 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 62 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 62 /* z coordinate in 3D plot */ +#define ZPLOT_B 61 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 1 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 2.4 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.0 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 9 April 23 - Approach to equilibrium of particle distribution in a maze with rounded corners ### + +**Program:** `particle_billiard.c` + +**Initial condition in function `animation()`:** `init_drop_config(0.05, 0.05, 0.0, DPI, configs);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ +#define INVERT_COUNTER 0 /* set to 1 to save frames in inverse order */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#define XMIN -1.5 +#define XMAX 2.5 /* x interval */ +#define YMIN -1.125 +#define YMAX 1.125 /* y interval for 9/16 aspect ratio */ + +#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ + +/* Choice of the billiard table, see global_particles.c */ + +#define B_DOMAIN 31 /* choice of domain shape */ + +#define CIRCLE_PATTERN 1 /* pattern of circles */ +#define POLYLINE_PATTERN 10 /* pattern of polyline */ + +#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ +#define MU 0.005 /* 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 */ +#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ + +#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ +#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ + +#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ +#define DEBUG 0 /* draw trajectories, for debugging purposes */ + +/* Simulation parameters */ + +#define NPART 50000 /* number of particles */ +#define NPARTMAX 100000 /* maximal number of particles after resampling */ +#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 0 /* set to 1 to keep trails of the particles */ +#define HEATMAP 1 /* set to 1 to show heat map of particles */ +#define DRAW_FINAL_HEATMAP 0 /* set to 1 to show final heat map of particles */ +#define DRAW_HEATMAP_HISTOGRAM 1 /* set to 1 to draw a histogram of particle distribution in heat map */ +#define NBIN_FACTOR 8.0 /* constant controlling number of bins in histogram */ +#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ +#define HEATMAP_MAX_PART_BY_CELL 0 /* set to positive value to draw only limited number of particles in cell */ +#define PLOT_HEATMAP_AVERAGE 0 /* set to 1 to plot average number of particles in heat map */ +#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ +#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles on left and right side */ +#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ +#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ + +#define NSTEPS 22000 /* number of frames of movie */ +#define TIME 2000 /* time between movie frames, for fluidity of real-time simulation */ +#define DPHI 0.00002 /* integration step */ +#define NVID 25 /* number of iterations between images displayed on screen */ +#define END_FRAMES 50 /* 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 */ +/* However, increasing DPHI too much deterioriates quality of simulation */ +/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ +/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ + +/* Colors and other graphical parameters */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ + +#define NCOLORS 500 /* number of colors */ +#define COLORSHIFT 0 /* hue of initial color */ +#define COLOR_HUEMIN 0 /* minimal color hue */ +#define COLOR_HUEMAX 160 /* maximal color hue */ +#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.025 /* length of velocity vectors */ +#define BILLIARD_WIDTH 2 /* width of billiard */ +#define PARTICLE_WIDTH 2 /* width of particles */ +#define FRONT_WIDTH 3 /* width of wave front */ + +#define BLACK 1 /* set to 1 for black background */ +#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ +#define OUTER_COLOR 270.0 /* color outside billiard */ +#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ +#define PAINT_EXT 1 /* set to 1 to paint exterior */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ + +#define NXMAZE 36 /* width of maze */ +#define NYMAZE 36 /* height of maze */ +#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 15 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ +#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ +#define CLOSE_MAZE 1 /* set to 1 to close maze exits */ + +``` + +**Part 2:** + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ +#define INVERT_COUNTER 0 /* set to 1 to save frames in inverse order */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#define XMIN -1.5 +#define XMAX 2.5 /* x interval */ +#define YMIN -1.125 +#define YMAX 1.125 /* y interval for 9/16 aspect ratio */ + +#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ + +/* Choice of the billiard table, see global_particles.c */ + +#define B_DOMAIN 31 /* choice of domain shape */ + +#define CIRCLE_PATTERN 1 /* pattern of circles */ +#define POLYLINE_PATTERN 10 /* pattern of polyline */ + +#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ +#define MU 0.005 /* 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 */ +#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ + +#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ +#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ + +#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ +#define DEBUG 0 /* draw trajectories, for debugging purposes */ + +/* Simulation parameters */ + +#define NPART 50000 /* number of particles */ +#define NPARTMAX 100000 /* maximal number of particles after resampling */ +#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 0 /* set to 1 to keep trails of the particles */ +#define HEATMAP 1 /* set to 1 to show heat map of particles */ +#define DRAW_FINAL_HEATMAP 1 /* set to 1 to show final heat map of particles */ +#define DRAW_HEATMAP_HISTOGRAM 1 /* set to 1 to draw a histogram of particle distribution in heat map */ +#define NBIN_FACTOR 8.0 /* constant controlling number of bins in histogram */ +#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ +#define HEATMAP_MAX_PART_BY_CELL 5 /* set to positive value to draw only limited number of particles in cell */ +#define PLOT_HEATMAP_AVERAGE 1 /* set to 1 to plot average number of particles in heat map */ +#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ +#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles on left and right side */ +#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ +#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ + +#define NSTEPS 22000 /* number of frames of movie */ +#define TIME 2000 /* time between movie frames, for fluidity of real-time simulation */ +#define DPHI 0.00002 /* integration step */ +#define NVID 25 /* number of iterations between images displayed on screen */ +#define END_FRAMES 50 /* 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 */ +/* However, increasing DPHI too much deterioriates quality of simulation */ +/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ +/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ + +/* Colors and other graphical parameters */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ + +#define NCOLORS 500 /* number of colors */ +#define COLORSHIFT 0 /* hue of initial color */ +#define COLOR_HUEMIN 0 /* minimal color hue */ +#define COLOR_HUEMAX 160 /* maximal color hue */ +#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.025 /* length of velocity vectors */ +#define BILLIARD_WIDTH 2 /* width of billiard */ +#define PARTICLE_WIDTH 2 /* width of particles */ +#define FRONT_WIDTH 3 /* width of wave front */ + +#define BLACK 1 /* set to 1 for black background */ +#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ +#define OUTER_COLOR 270.0 /* color outside billiard */ +#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ +#define PAINT_EXT 1 /* set to 1 to paint exterior */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ + +#define NXMAZE 36 /* width of maze */ +#define NYMAZE 36 /* height of maze */ +#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 15 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ +#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ +#define CLOSE_MAZE 1 /* set to 1 to close maze exits */ + +``` + +### 8 April 23 - 3D render of waves in a random medium, shown in their index of refraction landscape ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat_mod(phi, psi, xy_in); + + if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign; + add_circular_wave_mod(sign, 0.0, 0.0, phi, psi, xy_in); +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 2840 /* 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 -1.041666667 +#define YMAX 1.041666667 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 1 /* set to 1 for a variable index of refraction */ +#define IOR 5 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 14 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.05 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 75 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2200 /* number of frames of movie */ +#define NVID 4 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.25 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.00015 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.0075 /* wavelength of initial condition */ + + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 108 +#define CPLOT_B 108 /* plot type for second movie */ + + + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 0.1 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.2 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 14 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 3.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 25.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 240.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 20.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 500.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 5.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define ADD_POTENTIAL 1 /* set to 1 to add potential to z coordinate */ +#define POTENTIAL 10 +#define POT_FACT 30.0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +/* Parameters controlling 3D projection */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 7.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 0.15 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.8 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.1 /* overall y shift for REP_PROJ_3D representation */ + +``` + +### 7 April 23 - More periodic oscillations in a modified Brusselator ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 0 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 5.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 4.2 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.008 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 5000 /* number of frames of movie */ +#define NVID 175 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 20 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 0 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 5 +#define PLOT_B 0 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 200.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.02 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 0.0 /* initial velocity range */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 10.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 100.0 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 7.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 1 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 100 /* size of hashgrid in x direction */ +#define HASHY 50 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 6 April 23 - A Tesla valve with improved boundary conditions ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 71 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 0 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 1600 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 64 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 62 /* z coordinate in 3D plot */ +#define ZPLOT_B 61 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#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 BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 1 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 2.4 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.0 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +**Part 2:** +``` +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ +``` + +### 5 April 23 - 3D rendering of waves in a medium with random index of refraction ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat_mod(phi, psi, xy_in); + + if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign; + add_circular_wave_mod(sign, 0.0, 0.0, phi, psi, xy_in); +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 2840 /* 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 -1.041666667 +#define YMAX 1.041666667 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 1 /* set to 1 for a variable index of refraction */ +#define IOR 5 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 14 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.05 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 75 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2200 /* number of frames of movie */ +#define NVID 4 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.25 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.00015 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.0075 /* wavelength of initial condition */ + + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 108 +#define CPLOT_B 108 /* plot type for second movie */ + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 0.1 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.2 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 3.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 25.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 240.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 20.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 500.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 5.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +/* Parameters controlling 3D projection */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 7.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 0.15 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.8 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.1 /* overall y shift for REP_PROJ_3D representation */ + +``` + +### 4 April 23 - A second attempt at simulating the Belousov-Zhabotinsky/oregonator reaction ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 0 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.66 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 5.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 4.2 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.01 /* parameter controlling radius of particles */ +#define MU_B 0.008 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 5000 /* number of frames of movie */ +#define NVID 175 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 40 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 0 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 5 +#define PLOT_B 0 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 110.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 140.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 170.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 200.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.02 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 0.0 /* initial velocity range */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 10.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 100.0 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 7.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 14 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 8 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 6 /* initial condition of particles */ +#define REACTION_DIST 1.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.005 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 25 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 1 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 1.0 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 100 /* size of hashgrid in x direction */ +#define HASHY 50 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 3 April 23 - An Euler flow in a maze with repelling walls ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 541 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 100.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 0 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2200 /* number of frames of movie */ #define NVID 100 /* number of iterations between images displayed on screen */ #define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ #define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ @@ -2029,493 +8428,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO ``` -**Part 2:** -``` -#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ -``` - - -### 17 March 23 - Particle density in a maze with octagonal and square cells ### - -**Program:** `particle_billiard.c` - -**Initial condition in function `animation()`:** `init_drop_config(0.0, 0.0, 0.0, DPI, configs);` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ - -#define WINWIDTH 1280 /* window width */ -#define WINHEIGHT 720 /* window height */ - -#define XMIN -1.5 -#define XMAX 2.5 /* x interval */ -#define YMIN -1.125 -#define YMAX 1.125 /* y interval for 9/16 aspect ratio */ - -#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ - -/* Choice of the billiard table, see global_particles.c */ - -#define B_DOMAIN 30 /* choice of domain shape */ - -#define CIRCLE_PATTERN 1 /* pattern of circles */ -#define POLYLINE_PATTERN 16 /* pattern of polyline */ - -#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ -#define MU 0.005 /* 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 */ -#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ - -#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ -#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ -#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ - -#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ -#define DEBUG 0 /* draw trajectories, for debugging purposes */ - -/* Simulation parameters */ - -// #define NPART 10 /* number of particles */ -#define NPART 20000 /* number of particles */ -#define NPARTMAX 100000 /* maximal number of particles after resampling */ -#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 0 /* set to 1 to keep trails of the particles */ -#define HEATMAP 1 /* set to 1 to show heat map of particles */ -#define DRAW_HEATMAP_HISTOGRAM 1 /* set to 1 to draw a histogram of particle distribution in heat map */ -#define NBIN_FACTOR 6.0 /* constant controlling number of bins in histogram */ -#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ -#define HEATMAP_MAX_PART_BY_CELL 0 /* set to positive value to draw only limited number of particles in cell */ -#define PLOT_HEATMAP_AVERAGE 0 /* set to 1 to plot average number of particles in heat map */ -#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ -#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ -#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 1 /* set to 1 to print number of particles on left and right side */ -#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ -#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ - -#define NSTEPS 10000 /* number of frames of movie */ -#define TIME 1500 /* time between movie frames, for fluidity of real-time simulation */ -// #define DPHI 0.000002 /* integration step */ -#define DPHI 0.00002 /* integration step */ -#define NVID 25 /* number of iterations between images displayed on screen */ -#define END_FRAMES 50 /* 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 */ -/* However, increasing DPHI too much deterioriates quality of simulation */ -/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ -/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ - -/* Colors and other graphical parameters */ - -#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ - -#define NCOLORS 500 /* number of colors */ -#define COLORSHIFT 0 /* hue of initial color */ -#define COLOR_HUEMIN 10 /* minimal color hue */ -#define COLOR_HUEMAX 350 /* maximal color hue */ -#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.025 /* length of velocity vectors */ -#define BILLIARD_WIDTH 2 /* width of billiard */ -#define PARTICLE_WIDTH 2 /* width of particles */ -#define FRONT_WIDTH 3 /* width of wave front */ - -#define BLACK 1 /* set to 1 for black background */ -#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ -#define OUTER_COLOR 270.0 /* color outside billiard */ -#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ -#define PAINT_EXT 1 /* set to 1 to paint exterior */ - -#define PAUSE 1000 /* number of frames after which to pause */ -#define PSLEEP 2 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#define SLEEP2 1 /* final sleeping time */ - -#define NXMAZE 33 /* width of maze */ -#define NYMAZE 33 /* height of maze */ -#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 10 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ -#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ -#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ - -``` - -**Part 2:** - -``` -#define PLOT_HEATMAP_AVERAGE 1 /* set to 1 to plot average number of particles in heat map */ -#define NSTEPS 5000 /* number of frames of movie */ -#define TIME 3000 /* time between movie frames, for fluidity of real-time simulation */ - -``` -### 16 March 23 - A heterogeneous reversible exothermic chemical reaction ### - -**Program:** `lennardjones.c` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#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 while saving frames */ -#define NO_EXTRA_BUFFER_SWAP 0 /* some OS require one less buffer swap when recording images */ - -#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ - /* so far incompatible with double movie */ -#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ -#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ - -#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ - -/* General geometrical parameters */ - -#define WINWIDTH 1280 /* window width */ -#define WINHEIGHT 720 /* window height */ - -#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 */ - -#define INITXMIN -1.97 -#define INITXMAX 1.97 /* x interval for initial condition */ -#define INITYMIN -1.1 -#define INITYMAX 1.1 /* y interval for initial condition */ - -#define BCXMIN -2.0 -#define BCXMAX 2.0 /* x interval for boundary condition */ -#define BCYMIN -1.125 -#define BCYMAX 1.125 /* y interval for boundary condition */ - -#define OBSXMIN -2.0 -#define OBSXMAX 2.0 /* x interval for motion of obstacle */ - -#define CIRCLE_PATTERN 1 /* pattern of circles, see list in global_ljones.c */ - -#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ -#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ - -#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ -#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ -#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ -#define ROCKET_SHAPE_B 2 /* shape of second rocket */ -#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ -#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ - -#define TWO_TYPES 0 /* set to 1 to have two types of particles */ -#define TYPE_PROPORTION 0.66 /* proportion of particles of first type */ -#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ -#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ -#define CENTER_PY 0 /* set to 1 to center vertical momentum */ -#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ - -#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ -#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ -#define SPIN_INTER_FREQUENCY 5.0 /* angular frequency of spin-spin interaction */ -#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ - -#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define PDISC_DISTANCE 4.5 /* minimal distance in Poisson disc process, controls density of particles */ -#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ -#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ -#define MU 0.008 /* parameter controlling radius of particles */ -#define MU_B 0.01 /* parameter controlling radius of particles of second type */ -#define NPOLY 25 /* number of sides of polygon */ -#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ -#define MDEPTH 4 /* depth of computation of Menger gasket */ -#define MRATIO 3 /* ratio defining Menger gasket */ -#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 120 /* number of grid point for grid of disks */ -#define NGRIDY 51 /* number of grid point for grid of disks */ -#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ -#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ -#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ -#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 2700 /* number of frames of movie */ -#define NVID 75 /* number of iterations between images displayed on screen */ -#define NSEG 250 /* number of segments of boundary */ -#define INITIAL_TIME 10 /* time after which to start saving frames */ -#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ -#define BOUNDARY_WIDTH 1 /* width of particle boundary */ -#define LINK_WIDTH 2 /* width of links between particles */ -#define CONTAINER_WIDTH 4 /* width of container boundary */ - -#define PAUSE 1000 /* number of frames after which to pause */ -#define PSLEEP 1 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#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 */ - -/* Boundary conditions, see list in global_ljones.c */ - -#define BOUNDARY_COND 0 - -/* Plot type, see list in global_ljones.c */ - -#define PLOT 5 -#define PLOT_B 0 /* plot type for second movie */ - -#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ -#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ -#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ -#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ -#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ - -/* Color schemes */ - -#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ - -#define BLACK 1 /* background */ - -#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ -#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ -#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ - -#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ -#define PRINT_TEMPERATURE 1 /* set to 1 to print current temperature */ - -/* particle properties */ - -#define ENERGY_HUE_MIN 330.0 /* color of original particle */ -#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ -#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ -#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ -#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ -#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ -#define HUE_TYPE1 270.0 /* hue of particles of type 1 */ -#define HUE_TYPE2 190.0 /* hue of particles of type 2 */ -#define HUE_TYPE3 150.0 /* hue of particles of type 3 */ - -#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ -#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ -#define KREPEL 12.0 /* constant in repelling force between particles */ -#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ -#define EQUILIBRIUM_DIST_B 1.5 /* Lennard-Jones equilibrium distance for second type of particle */ -#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ -#define DAMPING 160.0 /* damping coefficient of particles */ -#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */ -#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ -#define PARTICLE_MASS_B 3.0 /* mass of particle of radius MU */ -#define PARTICLE_INERTIA_MOMENT 0.02 /* moment of inertia of particle */ -#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ -#define V_INITIAL 0.0 /* initial velocity range */ -#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ - -#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ -#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ -#define SIGMA 5.0 /* noise intensity in thermostat */ -#define BETA 0.002 /* initial inverse temperature */ -#define MU_XI 0.01 /* friction constant in thermostat */ -#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ -#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ -#define NBH_DIST_FACTOR 10.0 /* radius in which to count neighbours */ -#define GRAVITY 0.0 /* gravity acting on all particles */ -#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ -#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ -#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ -#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ -#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ -#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ - -#define ROTATION 1 /* set to 1 to include rotation of particles */ -#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ -#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ -#define KTORQUE 100.0 /* force constant in angular dynamics */ -#define KTORQUE_B 10.0 /* force constant in angular dynamics */ -#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ -#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ -#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ -#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ -#define SPIN_RANGE 7.0 /* range of spin-spin interaction */ -#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ -#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ - -#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ -#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ -#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ -#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ -#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ -#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ -#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ - -#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ -#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ -#define COMPRESSION_RATIO 0.3 /* final size of container */ -#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ -#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ - -#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ -#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ -#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ -#define NTRIALS 2000 /* number of trials when resampling */ -#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ -#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ -#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ -#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ -#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ -#define N_PRESSURES 100 /* number of intervals to record pressure */ -#define N_P_AVERAGE 100 /* size of pressure averaging window */ -#define N_T_AVERAGE 1 /* size of temperature averaging window */ -#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ -#define PARTIAL_THERMO_COUPLING 1 /* set to 1 to couple only some particles to thermostat */ -#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ -#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ -#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ -#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ - -#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ -#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ - -#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ -#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ -#define NPART_BOTTOM 100 /* number of particles at the bottom */ - -#define ADD_PARTICLES 0 /* set to 1 to add particles */ -#define ADD_TIME 0 /* time at which to add first particle */ -#define ADD_PERIOD 10000 /* time interval between adding further particles */ -#define N_ADD_PARTICLES 20 /* number of particles to add */ -#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ -#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ - -#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ -#define N_TRACER_PARTICLES 3 /* number of tracer particles */ -#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ -#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ -#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ - -#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ -#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ -#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ -#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ -#define ROTATE_FINAL_TIME 100 /* final time without rotation */ -#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ -#define OMEGAMAX 100.0 /* maximal rotation speed */ -#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ -#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ -#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ - -#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ -#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ -#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ -#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ -#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ -#define SEGMENTS_X0 1.5 /* initial position of segments */ -#define SEGMENTS_Y0 0.0 /* initial position of segments */ -#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ -#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ -#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ - -#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ -#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ -#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ -#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ -#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ -#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ -#define GROUP_WIDTH 0.05 /* interaction width of groups */ -#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ -#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ -#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ -#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ - -#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ -#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ -#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ - -#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ -#define RD_REACTION 12 /* type of reaction, see list in global_ljones.c */ -#define RD_TYPES 3 /* number of types in reaction-diffusion equation */ -#define RD_INITIAL_COND 5 /* initial condition of particles */ -#define REACTION_DIST 2.2 /* maximal distance for reaction to occur */ -#define REACTION_PROB 0.5 /* probability controlling reaction term */ -#define DISSOCIATION_PROB 0.02 /* probability controlling dissociation reaction */ -#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ -#define EXOTHERMIC 1 /* set to 1 to make reaction exo/endothermic */ -#define DELTA_EKIN 1500.0 /* change of kinetic energy in reaction */ -#define COLLISION_TIME 25 /* time during which collisions are shown */ - -#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ -#define PLOT_PARTICLE_NUMBER 1 /* set to 1 to make of plot of particle number over time */ -#define PARTICLE_NB_PLOT_FACTOR 1.0 /* expected final number of particles over initial number */ -#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ -#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ -#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ -#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ - -#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ - -#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ -#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ -#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_VMAX 100.0 /* max speed of wall */ -#define WALL_TIME 0 /* time during which to keep wall */ - -#define NXMAZE 10 /* width of maze */ -#define NYMAZE 10 /* height of maze */ -#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 200 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ - -#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ -#define FMAX 1.0e10 /* maximal force */ -#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ -#define PMAX 1000.0 /* maximal force */ - -#define HASHX 100 /* size of hashgrid in x direction */ -#define HASHY 50 /* size of hashgrid in y direction */ -#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ -#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ - -#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ -#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ - -``` - -### 15 March 23 - Waves in a rotating medium with periodic index of refraction ### +### 2 April 23 - Waves in a rotating medium, with fewer boundary effects ### **Program:** `wave_billiard.c` @@ -2524,7 +8437,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO init_wave_flat(phi, psi, xy_in); if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign; - add_circular_wave(sign, 0.0, 0.0, phi, psi, xy_in); + add_circular_wave(sign, 0.0, 0.0, phi, psi, xy_in); ``` ``` @@ -2534,7 +8447,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ #define VARIABLE_IOR 1 /* set to 1 for a variable index of refraction */ -#define IOR 6 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ #define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ #define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ @@ -2578,8 +8491,8 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ #define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ #define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 14 /* number of grid point for grid of disks */ -#define NGRIDY 8 /* number of grid point for grid of disks */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ #define X_SHOOTER -0.2 #define Y_SHOOTER -0.6 @@ -2635,7 +8548,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO /* Parameters for length and speed of simulation */ -#define NSTEPS 2300 /* number of frames of movie */ +#define NSTEPS 1800 /* number of frames of movie */ #define NVID 10 /* 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 */ @@ -2689,7 +8602,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #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 DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ #define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ #define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ #define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ @@ -2715,2329 +8628,16 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO ``` -### 14 March 23 - Solving a (tiny) maze with an Euler flow ### - -**Program:** `rde.c` - -**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define DOUBLE_MOVIE 1 /* 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 */ - -/* General geometrical parameters */ - -#define WINWIDTH 1920 /* window width */ -#define WINHEIGHT 1150 /* window height */ -#define NX 960 /* number of grid points on x axis */ -#define NY 575 /* number of grid points on y axis */ - -#define XMIN -2.0 -#define XMAX 2.0 /* x interval */ -#define YMIN -1.197916667 -#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ - -/* Choice of simulated equation */ - -#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ -#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ -#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ - -#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ -#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ -#define ADD_FORCE_FIELD 0 /* set to 1 to add a foce field (for compressible Euler equation) */ -#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ -#define FORCE_FIELD 4 /* type of force field, see list in global_3d.c */ - -#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ -#define ADAPT_STATE_TO_BC 1 /* set to 1 to smoothly adapt initial state to obstacles */ -#define OBSTACLE_GEOMETRY 53 /* geometry of obstacles, as in B_DOMAIN */ -#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ - -#define JULIA_SCALE 0.5 /* scaling for Julia sets */ - -/* Choice of the billiard table */ - -#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ - -#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ - -#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ -#define MU 0.08 /* parameter controlling the dimensions of domain */ -#define NPOLY 5 /* number of sides of polygon */ -#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ -#define MDEPTH 7 /* depth of computation of Menger gasket */ -#define MRATIO 5 /* ratio defining Menger gasket */ -#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 15 /* number of grid point for grid of disks */ -#define NGRIDY 20 /* number of grid point for grid of disks */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -#define ISO_XSHIFT_LEFT -1.65 -#define ISO_XSHIFT_RIGHT 0.4 -#define ISO_YSHIFT_LEFT -0.05 -#define ISO_YSHIFT_RIGHT -0.05 -#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ - -/* You can add more billiard tables by adapting the functions */ -/* xy_in_billiard and draw_billiard in sub_wave.c */ - -/* Physical patameters of wave equation */ - -#define DT 0.00000025 - -#define VISCOSITY 2.0 - -#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ -#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ - -#define EPSILON 0.8 /* time scale separation */ -#define DELTA 0.1 /* time scale separation */ -#define FHNA 1.0 /* parameter in FHN equation */ -#define FHNC -0.01 /* parameter in FHN equation */ -#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ -#define K_COULOMB 0.5 /* constant in Coulomb potential */ -#define V_MAZE 0.4 /* potential in walls of maze */ -#define BZQ 0.0008 /* parameter in BZ equation */ -#define BZF 1.2 /* parameter in BZ equation */ -#define B_FIELD 10.0 /* magnetic field */ -#define G_FIELD 1.0e-7 /* gravity/constant in repulsive field from obstacles */ -#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ -#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ -#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ - -#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ -#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ -#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ -#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ - -#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ -#define N_TRACERS 1000 /* number of tracer particles */ -#define TRACERS_STEP 0.005 /* step size in tracer evolution */ - -#define T_OUT 2.0 /* outside temperature */ -#define T_IN 0.0 /* inside temperature */ -#define SPEED 0.0 /* speed of drift to the right */ - -#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ -#define NOISE_INTENSITY 0.005 /* noise intensity */ -#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ -#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ -#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ - -#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ -#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ -#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ -#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ -#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, - for numerical stability */ - -#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ -#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ -#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ -#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ - -#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ -#define IN_OUT_FLOW_BC 0 /* type of in-flow/out-flow boundary conditions for Euler equation */ - /* see list in global_pdes.c */ -#define IN_OUT_FLOW_MIN_AMP 0.1 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ -#define IN_OUT_FLOW_AMP 0.1 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ -#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ -#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ - -#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ - -/* Boundary conditions, see list in global_pdes.c */ - -#define B_COND 1 - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 1500 /* number of frames of movie */ -#define NVID 100 /* number of iterations between images displayed on screen */ -#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ -#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ -#define MAX_DT 0.024 /* maximal value of integration step */ -#define NSEG 100 /* number of segments of boundary */ -#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ - -#define PAUSE 100 /* number of frames after which to pause */ -#define PSLEEP 2 /* sleep time during pause */ -#define SLEEP1 2 /* initial sleeping time */ -#define SLEEP2 1 /* final sleeping time */ -#define INITIAL_TIME 0 /* initial still time */ -#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ -#define END_FRAMES 50 /* number of still frames at end of movie */ -#define FADE 1 /* set to 1 to fade at end of movie */ - -/* Visualisation */ - -#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ - -#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ -#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ - -#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ - -/* Plot type - color scheme */ - -#define CPLOT 61 -#define CPLOT_B 62 - -/* Plot type - height of 3D plot */ - -#define ZPLOT 62 /* z coordinate in 3D plot */ -#define ZPLOT_B 61 /* z coordinate in second 3D plot */ - -#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ -#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ -#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ -#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ -#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ -#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ -#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ -#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ - -#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ - -#define PRINT_TIME 0 /* set to 1 to print running time */ -#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ -#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ -#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ -#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ -#define PRINT_FLOW_SPEED 1 /* set to 1 to print speed of flow */ - -#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ -#define FIELD_LINE_WIDTH 1 /* width of field lines */ -#define N_FIELD_LINES 120 /* number of field lines */ -#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ -#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ -#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ -#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ - -/* 3D representation */ - -#define REPRESENTATION_3D 1 /* choice of 3D representation */ - -#define REP_AXO_3D 0 /* linear projection (axonometry) */ -#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ - -/* Color schemes, see list in global_pdes.c */ - -#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ -#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ - -#define BLACK 1 /* black background */ - -#define COLOR_SCHEME 3 /* choice of color scheme */ - -#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ -#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ -#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ -#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ -#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ -#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ -#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ -#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ -#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ -#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ -#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ -#define E_SCALE 100.0 /* scaling factor for energy representation */ -#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ -#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ -#define LOG_SHIFT 1.0 -#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ -#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ -#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ -#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ -#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ -#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ -#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ - -#define NXMAZE 4 /* width of maze */ -#define NYMAZE 4 /* height of maze */ -#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 0 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ -#define MAZE_WIDTH 0.05 /* half width of maze walls */ - -#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ -#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 2.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 1 /* set to 1 to draw color scheme horizontally */ - -/* only for compatibility with wave_common.c */ -#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ -#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ -#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ -#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ -#define OMEGA 0.005 /* frequency of periodic excitation */ -#define COURANT 0.08 /* Courant number */ -#define COURANTB 0.03 /* Courant number in medium B */ -#define INITIAL_AMP 0.5 /* amplitude of initial condition */ -#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ -#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ -#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ -#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ -#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ -#define ACHIRP 0.2 /* acceleration coefficient in chirp */ -#define DAMPING 0.0 /* damping of periodic excitation */ -#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ -#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ -#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ -#define FLUX_WINDOW 20 /* averaging window for energy flux */ -#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ -#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ -#define N_WAVE_PACKETS 15 /* number of wave packets */ -#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ -/* end of constants added only for compatibility with wave_common.c */ - - -double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ -double v_3d[2] = {-0.75, -0.45}; -double w_3d[2] = {0.0, 0.015}; -double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ -double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ -int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ - -#define Z_SCALING_FACTOR 2.4 /* overall scaling factor of z axis for REP_PROJ_3D representation */ -#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ -#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ -#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ -#define YSHIFT_3D 0.0 /* overall y shift for REP_PROJ_3D representation */ -#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ - -/* For debugging purposes only */ -#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ -#define VMAX 1000.0 /* max value of wave amplitude */ -#define TEST_GRADIENT 0 /* print norm squared of gradient */ - -``` - -### 13 March 23 - Laser beams in a large maze with octagonal and square cells ### +### 1 April 23 - Cleaning up a maze using artificial intelligence ### **Program:** `particle_billiard.c` -**Initial condition in function `animation()`:** `init_drop_config(0.025, 0.025, 0.0, DPI, configs);` +**Initial condition in function `animation()`:** `init_drop_config(0.05, 0.05, 0.0, DPI, configs);` ``` #define MOVIE 1 /* set to 1 to generate movie */ -#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ - -#define WINWIDTH 1280 /* window width */ -#define WINHEIGHT 720 /* window height */ - -#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 */ - -#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ - -/* Choice of the billiard table, see global_particles.c */ - -#define B_DOMAIN 30 /* choice of domain shape */ - -#define CIRCLE_PATTERN 1 /* pattern of circles */ -#define POLYLINE_PATTERN 16 /* pattern of polyline */ - -#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ -#define MU 0.005 /* 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 */ -#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ - -#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ -#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ -#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ - -#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ -#define DEBUG 0 /* draw trajectories, for debugging purposes */ - -/* Simulation parameters */ - -#define NPART 15000 /* number of particles */ -#define NPARTMAX 100000 /* maximal number of particles after resampling */ -#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 HEATMAP 0 /* set to 1 to show heat map of particles */ -#define DRAW_HEATMAP_HISTOGRAM 0 /* set to 1 to draw a histogram of particle distribution in heat map */ -#define NBIN_FACTOR 6.0 /* constant controlling number of bins in histogram */ -#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ -#define HEATMAP_MAX_PART_BY_CELL 0 /* to draw only limited number of particles in cell */ -#define PLOT_HEATMAP_AVERAGE 0 /* set to 1 to plot average number of particles in heat map */ -#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ -#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ -#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 1 /* set to 1 to print number of particles on left and right side */ -#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ -#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ - -#define NSTEPS 7900 /* number of frames of movie */ -#define TIME 1500 /* time between movie frames, for fluidity of real-time simulation */ -#define DPHI 0.00002 /* integration step */ -#define NVID 25 /* number of iterations between images displayed on screen */ -#define END_FRAMES 50 /* 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 */ -/* However, increasing DPHI too much deterioriates quality of simulation */ -/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ -/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ - -/* Colors and other graphical parameters */ - -#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ - -#define NCOLORS 500 /* number of colors */ -#define COLORSHIFT 0 /* hue of initial color */ -#define COLOR_HUEMIN 10 /* minimal color hue */ -#define COLOR_HUEMAX 350 /* maximal color hue */ -#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.025 /* length of velocity vectors */ -#define BILLIARD_WIDTH 2 /* width of billiard */ -#define PARTICLE_WIDTH 2 /* width of particles */ -#define FRONT_WIDTH 3 /* width of wave front */ - -#define BLACK 1 /* set to 1 for black background */ -#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ -#define OUTER_COLOR 270.0 /* color outside billiard */ -#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ -#define PAINT_EXT 1 /* set to 1 to paint exterior */ - -#define PAUSE 1000 /* number of frames after which to pause */ -#define PSLEEP 2 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#define SLEEP2 1 /* final sleeping time */ - -#define NXMAZE 64 /* width of maze */ -#define NYMAZE 64 /* height of maze */ -#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 10 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ -#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ -#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ - -``` - -### 12 March 23 - A reversible exothermic chemical reaction ### - -**Program:** `lennardjones.c` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#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 while saving frames */ -#define NO_EXTRA_BUFFER_SWAP 0 /* some OS require one less buffer swap when recording images */ - -#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ - /* so far incompatible with double movie */ -#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ -#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ - -#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ - -/* General geometrical parameters */ - -#define WINWIDTH 1280 /* window width */ -#define WINHEIGHT 720 /* window height */ - -#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 */ - -#define INITXMIN -1.97 -#define INITXMAX 1.97 /* x interval for initial condition */ -#define INITYMIN -1.1 -#define INITYMAX 1.1 /* y interval for initial condition */ - -#define BCXMIN -2.0 -#define BCXMAX 2.0 /* x interval for boundary condition */ -#define BCYMIN -1.125 -#define BCYMAX 1.125 /* y interval for boundary condition */ - -#define OBSXMIN -2.0 -#define OBSXMAX 2.0 /* x interval for motion of obstacle */ - -#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ - -#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ -#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ - -#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ -#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ -#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ -#define ROCKET_SHAPE_B 2 /* shape of second rocket */ -#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ -#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ - -#define TWO_TYPES 0 /* set to 1 to have two types of particles */ -#define TYPE_PROPORTION 0.6 /* proportion of particles of first type */ -#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ -#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ -#define CENTER_PY 0 /* set to 1 to center vertical momentum */ -#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ - -#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ -#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ -#define SPIN_INTER_FREQUENCY 5.0 /* angular frequency of spin-spin interaction */ -#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ - -#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define PDISC_DISTANCE 4.5 /* minimal distance in Poisson disc process, controls density of particles */ -#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ -#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ -#define MU 0.008 /* parameter controlling radius of particles */ -#define MU_B 0.012 /* parameter controlling radius of particles of second type */ -#define NPOLY 25 /* number of sides of polygon */ -#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ -#define MDEPTH 4 /* depth of computation of Menger gasket */ -#define MRATIO 3 /* ratio defining Menger gasket */ -#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 120 /* number of grid point for grid of disks */ -#define NGRIDY 51 /* number of grid point for grid of disks */ -#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ -#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ -#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ -#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 2800 /* number of frames of movie */ -#define NVID 100 /* number of iterations between images displayed on screen */ -#define NSEG 250 /* number of segments of boundary */ -#define INITIAL_TIME 10 /* time after which to start saving frames */ -#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ -#define BOUNDARY_WIDTH 1 /* width of particle boundary */ -#define LINK_WIDTH 2 /* width of links between particles */ -#define CONTAINER_WIDTH 4 /* width of container boundary */ - -#define PAUSE 1000 /* number of frames after which to pause */ -#define PSLEEP 1 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#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 */ - -/* Boundary conditions, see list in global_ljones.c */ - -#define BOUNDARY_COND 3 - -/* Plot type, see list in global_ljones.c */ - -#define PLOT 5 -#define PLOT_B 0 /* plot type for second movie */ - -#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ -#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ -#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ -#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ -#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ - -/* Color schemes */ - -#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ - -#define BLACK 1 /* background */ - -#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ -#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ -#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ - -#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ -#define PRINT_TEMPERATURE 1 /* set to 1 to print current temperature */ - -/* particle properties */ - -#define ENERGY_HUE_MIN 330.0 /* color of original particle */ -#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ -#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ -#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ -#define PARTICLE_EMAX 3.0e2 /* energy of particle with hottest color */ -#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ -#define HUE_TYPE1 270.0 /* hue of particles of type 1 */ -#define HUE_TYPE2 190.0 /* hue of particles of type 2 */ -#define HUE_TYPE3 120.0 /* hue of particles of type 3 */ - -#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ -#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ -#define KREPEL 12.0 /* constant in repelling force between particles */ -#define EQUILIBRIUM_DIST 3.5 /* Lennard-Jones equilibrium distance */ -#define EQUILIBRIUM_DIST_B 3.5 /* Lennard-Jones equilibrium distance for second type of particle */ -#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ -#define DAMPING 180.0 /* damping coefficient of particles */ -#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */ -#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ -#define PARTICLE_MASS_B 2.0 /* mass of particle of radius MU_B */ -#define PARTICLE_INERTIA_MOMENT 0.02 /* moment of inertia of particle */ -#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ -#define V_INITIAL 0.0 /* initial velocity range */ -#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ - -#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ -#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ -#define SIGMA 5.0 /* noise intensity in thermostat */ -#define BETA 0.002 /* initial inverse temperature */ -#define MU_XI 0.01 /* friction constant in thermostat */ -#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ -#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ -#define NBH_DIST_FACTOR 10.0 /* radius in which to count neighbours */ -#define GRAVITY 0.0 /* gravity acting on all particles */ -#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ -#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ -#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ -#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ -#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ -#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ - -#define ROTATION 1 /* set to 1 to include rotation of particles */ -#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ -#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ -#define KTORQUE 100.0 /* force constant in angular dynamics */ -#define KTORQUE_B 10.0 /* force constant in angular dynamics */ -#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ -#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ -#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ -#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ -#define SPIN_RANGE 7.0 /* range of spin-spin interaction */ -#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ -#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ - -#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ -#define BETA_FACTOR 0.45 /* factor by which to change BETA during simulation */ -#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ -#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ -#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ -#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ -#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ - -#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ -#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ -#define COMPRESSION_RATIO 0.3 /* final size of container */ -#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ -#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ - -#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ -#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ -#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ -#define NTRIALS 2000 /* number of trials when resampling */ -#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ -#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ -#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ -#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ -#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ -#define N_PRESSURES 100 /* number of intervals to record pressure */ -#define N_P_AVERAGE 100 /* size of pressure averaging window */ -#define N_T_AVERAGE 50 /* size of temperature averaging window */ -#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ -#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ -#define PARTIAL_THERMO_REGION 3 /* region for partial thermostat coupling (see list in global_ljones.c) */ -#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ -#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ -#define PARTIAL_THERMO_HEIGHT -0.48 /* vertical size of partial thermostat coupling */ - -#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ -#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ - -#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ -#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ -#define NPART_BOTTOM 100 /* number of particles at the bottom */ - -#define ADD_PARTICLES 0 /* set to 1 to add particles */ -#define ADD_TIME 0 /* time at which to add first particle */ -#define ADD_PERIOD 10000 /* time interval between adding further particles */ -#define N_ADD_PARTICLES 20 /* number of particles to add */ -#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ -#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ - -#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ -#define N_TRACER_PARTICLES 3 /* number of tracer particles */ -#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ -#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ -#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ - -#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ -#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ -#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ -#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ -#define ROTATE_FINAL_TIME 100 /* final time without rotation */ -#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ -#define OMEGAMAX 100.0 /* maximal rotation speed */ -#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ -#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ -#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ - -#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ -#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ -#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ -#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ -#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ -#define SEGMENTS_X0 1.5 /* initial position of segments */ -#define SEGMENTS_Y0 0.0 /* initial position of segments */ -#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ -#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ -#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ - -#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ -#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ -#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ -#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ -#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ -#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ -#define GROUP_WIDTH 0.05 /* interaction width of groups */ -#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ -#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ -#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ -#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ - -#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ -#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ -#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ - -#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ -#define RD_REACTION 6 /* type of reaction, see list in global_ljones.c */ -#define RD_TYPES 2 /* number of types in reaction-diffusion equation */ -#define RD_INITIAL_COND 0 /* initial condition of particles */ -#define REACTION_DIST 2.15 /* maximal distance for reaction to occur */ -#define REACTION_PROB 0.5 /* probability controlling reaction term */ -#define DISSOCIATION_PROB 0.0022 /* probability controlling dissociation reaction */ -#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ -#define EXOTHERMIC 1 /* set to 1 to make reaction exo/endothermic */ -#define DELTA_EKIN 1500.0 /* change of kinetic energy in reaction */ -#define COLLISION_TIME 25 /* time during which collisions are shown */ - -#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ -#define PLOT_PARTICLE_NUMBER 1 /* set to 1 to make of plot of particle number over time */ -#define PARTICLE_NB_PLOT_FACTOR 1.0 /* expected final number of particles over initial number */ -#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ -#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ -#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ -#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ - -#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ - -#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ -#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ -#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_VMAX 100.0 /* max speed of wall */ -#define WALL_TIME 0 /* time during which to keep wall */ - -#define NXMAZE 10 /* width of maze */ -#define NYMAZE 10 /* height of maze */ -#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 200 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ - -#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ -#define FMAX 1.0e10 /* maximal force */ -#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ -#define PMAX 1000.0 /* maximal force */ - -#define HASHX 90 /* size of hashgrid in x direction */ -#define HASHY 45 /* size of hashgrid in y direction */ -#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ -#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ - -#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ -#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ - -``` - -### 11 March 23 - A phased array with more emitters ### - -**Program:** `wave_billiard.c` - -**Initial condition in function `animation()`:** -``` - init_wave_flat(phi, psi, xy_in); - - p = 3; - y = -1.0; - sign1 = sign; - printf("p = %i\n", p); - for (k=-8; k<9; k++) - { - x1 = 0.05*((double)source_counter/(double)p + (double)k); - if ((x1 > 0.083333333*XMIN)&&(x1 < 0.083333333*XMAX)) - { - add_circular_wave(sign1, x1, y, phi, psi, xy_in); - printf("Adding wave at (%.2lg, %.2lg)\n", x1, y); - } - sign1 = -sign1; - } - source_counter++; - if (p > 0) q = p; - else q = -p; - if (source_counter >= q) - { - source_counter = 0; - sign = -sign; - } -``` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define DOUBLE_MOVIE 1 /* 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 */ - -#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ -#define IOR 5 /* choice of index of refraction, see list in global_pdes.c */ -#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ - - -/* General geometrical parameters */ - -#define WINWIDTH 1920 /* window width */ -#define WINHEIGHT 1150 /* window height */ -#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ - -/* Choice of the billiard table */ - -#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ - -#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ - -#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ -#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ -#define MU 0.5 /* parameter controlling the dimensions of domain */ -#define NPOLY 6 /* 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 */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 14 /* number of grid point for grid of disks */ -#define NGRIDY 8 /* number of grid point for grid of disks */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -#define ISO_XSHIFT_LEFT -2.9 -#define ISO_XSHIFT_RIGHT 1.4 -#define ISO_YSHIFT_LEFT -0.15 -#define ISO_YSHIFT_RIGHT -0.15 -#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ - -/* 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 */ -#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ -#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ -#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ - -#define OMEGA 0.0005 /* frequency of periodic excitation */ -#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ -#define ACHIRP 0.25 /* acceleration coefficient in chirp */ -#define DAMPING 0.0 /* damping of periodic excitation */ -#define COURANT 0.08 /* Courant number */ -#define COURANTB 0.0 /* 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 */ -#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ -#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ -#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ -#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ -/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ -/* The physical damping coefficient is given by GAMMA/(DT)^2 */ -/* Increasing COURANT speeds up the simulation, but decreases accuracy */ -/* 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 3 /* period of oscillating source */ -#define ALTERNATE_OSCILLATING_SOURCE 0 /* set to 1 to alternate sign of oscillating source */ - -#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ -#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ -#define N_WAVE_PACKETS 15 /* number of wave packets */ -#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ - -/* Boundary conditions, see list in global_pdes.c */ - -#define B_COND 2 - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 2500 /* number of frames of movie */ -#define NVID 12 /* 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 */ -#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ -#define PRINT_SPEED 0 /* print speed of moving source */ - -#define PAUSE 200 /* number of frames after which to pause */ -#define PSLEEP 1 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#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 */ - -#define INITIAL_AMP 0.1 /* amplitude of initial condition */ -#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ -#define INITIAL_WAVELENGTH 0.01 /* wavelength of initial condition */ - -/* Plot type, see list in global_pdes.c */ - -#define PLOT 0 - -#define PLOT_B 5 /* plot type for second movie */ - -/* Color schemes */ - -#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ -#define COLOR_PALETTE_B 12 /* Color palette, see list in global_pdes.c */ - -#define BLACK 1 /* background */ - -#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ -#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 E_SCALE 500.0 /* scaling factor for energy representation */ -#define LOG_SCALE 0.2 /* scaling factor for energy log representation */ -#define LOG_SHIFT 0.0 /* shift of colors on log scale */ -#define FLUX_SCALE 1.0e1 /* scaling factor for enegy flux represtnation */ -#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#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 1.5 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 150.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ - -#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ - -#define NXMAZE 8 /* width of maze */ -#define NYMAZE 32 /* height of maze */ -#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 0 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ - -/* for compatibility with sub_wave and sub_maze */ -#define ADD_POTENTIAL 0 -#define POT_MAZE 7 -#define POTENTIAL 0 -/* end of constants only used by sub_wave and sub_maze */ - -/* For debugging purposes only */ -#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ -#define VMAX 10.0 /* max value of wave amplitude */ - -``` - -### 10 March 23 - Vorticity and flow direction of Von Kármán vortices behind an airplane wing ### - -**Program:** `rde.c` - -**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define DOUBLE_MOVIE 1 /* 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 */ - -/* General geometrical parameters */ - -#define WINWIDTH 1920 /* window width */ -#define WINHEIGHT 1150 /* window height */ -#define NX 960 /* number of grid points on x axis */ -#define NY 575 /* number of grid points on y axis */ - -#define XMIN -1.0 -#define XMAX 3.0 /* x interval */ -#define YMIN -1.197916667 -#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ - -/* Choice of simulated equation */ - -#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ -#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ -#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ - -#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ -#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ -#define ADD_FORCE_FIELD 0 /* set to 1 to add a foce field (for compressible Euler equation) */ -#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ -#define FORCE_FIELD 4 /* type of force field, see list in global_3d.c */ - -#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ -#define ADAPT_STATE_TO_BC 1 /* set to 1 to smoothly adapt initial state to obstacles */ -#define OBSTACLE_GEOMETRY 70 /* geometry of obstacles, as in B_DOMAIN */ -#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ - -#define JULIA_SCALE 0.5 /* scaling for Julia sets */ - -/* Choice of the billiard table */ - -#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ - -#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ - -#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ -#define MU 0.08 /* parameter controlling the dimensions of domain */ -#define NPOLY 5 /* number of sides of polygon */ -#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ -#define MDEPTH 7 /* depth of computation of Menger gasket */ -#define MRATIO 5 /* ratio defining Menger gasket */ -#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 15 /* number of grid point for grid of disks */ -#define NGRIDY 20 /* number of grid point for grid of disks */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -#define ISO_XSHIFT_LEFT -1.65 -#define ISO_XSHIFT_RIGHT 0.4 -#define ISO_YSHIFT_LEFT -0.05 -#define ISO_YSHIFT_RIGHT -0.05 -#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ - -/* You can add more billiard tables by adapting the functions */ -/* xy_in_billiard and draw_billiard in sub_wave.c */ - -/* Physical patameters of wave equation */ - -#define DT 0.00000025 - -#define VISCOSITY 2.0 - -#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ -#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ - -#define EPSILON 0.8 /* time scale separation */ -#define DELTA 0.1 /* time scale separation */ -#define FHNA 1.0 /* parameter in FHN equation */ -#define FHNC -0.01 /* parameter in FHN equation */ -#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ -#define K_COULOMB 0.5 /* constant in Coulomb potential */ -#define V_MAZE 0.4 /* potential in walls of maze */ -#define BZQ 0.0008 /* parameter in BZ equation */ -#define BZF 1.2 /* parameter in BZ equation */ -#define B_FIELD 10.0 /* magnetic field */ -#define G_FIELD 1.0e-7 /* gravity/constant in repulsive field from obstacles */ -#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ -#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ -#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ - -#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ -#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ -#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ -#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ - -#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ -#define N_TRACERS 1000 /* number of tracer particles */ -#define TRACERS_STEP 0.005 /* step size in tracer evolution */ - -#define T_OUT 2.0 /* outside temperature */ -#define T_IN 0.0 /* inside temperature */ -#define SPEED 0.0 /* speed of drift to the right */ - -#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ -#define NOISE_INTENSITY 0.005 /* noise intensity */ -#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ -#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ -#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ - -#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ -#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ -#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ -#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ -#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, - for numerical stability */ - -#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ -#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ -#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ -#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ - -#define CHANGE_FLOW_SPEED 1 /* set to 1 to change speed of laminar flow */ -#define IN_OUT_FLOW_BC 5 /* type of in-flow/out-flow boundary conditions for Euler equation */ - /* see list in global_pdes.c */ -#define IN_OUT_FLOW_MIN_AMP 0.1 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ -#define IN_OUT_FLOW_AMP 0.35 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ -#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ -#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ - -#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ - -/* Boundary conditions, see list in global_pdes.c */ - -#define B_COND 1 - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 2600 /* number of frames of movie */ -#define NVID 100 /* number of iterations between images displayed on screen */ -#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ -#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ -#define MAX_DT 0.024 /* maximal value of integration step */ -#define NSEG 100 /* number of segments of boundary */ -#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ - -#define PAUSE 100 /* number of frames after which to pause */ -#define PSLEEP 2 /* sleep time during pause */ -#define SLEEP1 2 /* initial sleeping time */ -#define SLEEP2 1 /* final sleeping time */ -#define INITIAL_TIME 0 /* initial still time */ -#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ -#define END_FRAMES 50 /* number of still frames at end of movie */ -#define FADE 1 /* set to 1 to fade at end of movie */ - -/* Visualisation */ - -#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ - -#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ -#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ - -#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ - -/* Plot type - color scheme */ - -#define CPLOT 62 -#define CPLOT_B 63 - -/* Plot type - height of 3D plot */ - -#define ZPLOT 62 /* z coordinate in 3D plot */ -#define ZPLOT_B 61 /* z coordinate in second 3D plot */ - -#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ -#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ -#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ -#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ -#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ -#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ -#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ -#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ - -#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ - -#define PRINT_TIME 0 /* set to 1 to print running time */ -#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ -#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ -#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ -#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ -#define PRINT_FLOW_SPEED 1 /* set to 1 to print speed of flow */ - -#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ -#define FIELD_LINE_WIDTH 1 /* width of field lines */ -#define N_FIELD_LINES 120 /* number of field lines */ -#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ -#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ -#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ -#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ - -/* 3D representation */ - -#define REPRESENTATION_3D 1 /* choice of 3D representation */ - -#define REP_AXO_3D 0 /* linear projection (axonometry) */ -#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ - -/* Color schemes, see list in global_pdes.c */ - -#define COLOR_PALETTE 10 /* Color palette, see list in global_pdes.c */ -#define COLOR_PALETTE_B 17 /* Color palette, see list in global_pdes.c */ - -#define BLACK 1 /* black background */ - -#define COLOR_SCHEME 3 /* choice of color scheme */ - -#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ -#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ -#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ -#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ -#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ -#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ -#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ -#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ -#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ -#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ -#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ -#define E_SCALE 100.0 /* scaling factor for energy representation */ -#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ -#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ -#define LOG_SHIFT 1.0 -#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ -#define VSCALE_SPEED 1.5 /* additional scaling factor for color scheme Z_EULER_SPEED */ -#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ -#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ -#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ -#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ -#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ - -#define NXMAZE 7 /* width of maze */ -#define NYMAZE 7 /* height of maze */ -#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 0 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ - -#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 2.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 1 /* set to 1 to draw color scheme horizontally */ - -/* only for compatibility with wave_common.c */ -#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ -#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ -#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ -#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ -#define OMEGA 0.005 /* frequency of periodic excitation */ -#define COURANT 0.08 /* Courant number */ -#define COURANTB 0.03 /* Courant number in medium B */ -#define INITIAL_AMP 0.5 /* amplitude of initial condition */ -#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ -#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ -#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ -#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ -#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ -#define ACHIRP 0.2 /* acceleration coefficient in chirp */ -#define DAMPING 0.0 /* damping of periodic excitation */ -#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ -#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ -#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ -#define FLUX_WINDOW 20 /* averaging window for energy flux */ -#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ -#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ -#define N_WAVE_PACKETS 15 /* number of wave packets */ -#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ -/* end of constants added only for compatibility with wave_common.c */ - - -double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ -double v_3d[2] = {-0.75, -0.45}; -double w_3d[2] = {0.0, 0.015}; -double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ -double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ -int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ - -#define Z_SCALING_FACTOR 2.4 /* overall scaling factor of z axis for REP_PROJ_3D representation */ -#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ -#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ -#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ -#define YSHIFT_3D 0.0 /* overall y shift for REP_PROJ_3D representation */ -#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ - -/* For debugging purposes only */ -#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ -#define VMAX 1000.0 /* max value of wave amplitude */ -#define TEST_GRADIENT 0 /* print norm squared of gradient */ - -``` - -### 9 March 23 - Laser beams in a maze with octagonal and square cells ### - -**Program:** `particle_billiard.c` - -**Initial condition in function `animation()`:** `init_drop_config(0.025, 0.025, 0.0, DPI, configs);` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ - -#define WINWIDTH 1280 /* window width */ -#define WINHEIGHT 720 /* window height */ - -#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 */ - -#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ - -/* Choice of the billiard table, see global_particles.c */ - -#define B_DOMAIN 30 /* choice of domain shape */ - -#define CIRCLE_PATTERN 1 /* pattern of circles */ -#define POLYLINE_PATTERN 16 /* pattern of polyline */ - -#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ -#define MU 0.005 /* 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 */ -#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ - -#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ -#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ -#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ - -#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ -#define DEBUG 0 /* draw trajectories, for debugging purposes */ - -/* Simulation parameters */ - -#define NPART 15000 /* number of particles */ -#define NPARTMAX 100000 /* maximal number of particles after resampling */ -#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 HEATMAP 0 /* set to 1 to show heat map of particles */ -#define DRAW_HEATMAP_HISTOGRAM 0 /* set to 1 to draw a histogram of particle distribution in heat map */ -#define NBIN_FACTOR 6.0 /* constant controlling number of bins in histogram */ -#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ -#define HEATMAP_MAX_PART_BY_CELL 0 /* to draw only limited number of particles in cell */ -#define PLOT_HEATMAP_AVERAGE 0 /* set to 1 to plot average number of particles in heat map */ -#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ -#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ -#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 1 /* set to 1 to print number of particles on left and right side */ -#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ -#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ - -#define NSTEPS 8400 /* number of frames of movie */ -#define TIME 1500 /* time between movie frames, for fluidity of real-time simulation */ -#define DPHI 0.00002 /* integration step */ -#define NVID 25 /* number of iterations between images displayed on screen */ -#define END_FRAMES 50 /* 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 */ -/* However, increasing DPHI too much deterioriates quality of simulation */ -/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ -/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ - -/* Colors and other graphical parameters */ - -#define COLOR_PALETTE 10 /* Color palette, see list in global_pdes.c */ - -#define NCOLORS 500 /* number of colors */ -#define COLORSHIFT 0 /* hue of initial color */ -#define COLOR_HUEMIN 10 /* minimal color hue */ -#define COLOR_HUEMAX 350 /* maximal color hue */ -#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.025 /* length of velocity vectors */ -#define BILLIARD_WIDTH 2 /* width of billiard */ -#define PARTICLE_WIDTH 2 /* width of particles */ -#define FRONT_WIDTH 3 /* width of wave front */ - -#define BLACK 1 /* set to 1 for black background */ -#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ -#define OUTER_COLOR 270.0 /* color outside billiard */ -#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ -#define PAINT_EXT 1 /* set to 1 to paint exterior */ - -#define PAUSE 1000 /* number of frames after which to pause */ -#define PSLEEP 2 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#define SLEEP2 1 /* final sleeping time */ - -#define NXMAZE 32 /* width of maze */ -#define NYMAZE 32 /* height of maze */ -#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 10 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ -#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ -#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ - -``` - -### 8 March 23 - The two step catalytic chemical reaction A + B → C, A + C → B + D ### - -**Program:** `lennardjones.c` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#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 while saving frames */ -#define NO_EXTRA_BUFFER_SWAP 0 /* some OS require one less buffer swap when recording images */ - -#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ - /* so far incompatible with double movie */ -#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ -#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ - -#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ - -/* General geometrical parameters */ - -#define WINWIDTH 1536 /* window width */ -#define WINHEIGHT 864 /* window height */ - -#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 */ - -#define INITXMIN -1.97 -#define INITXMAX 1.97 /* x interval for initial condition */ -#define INITYMIN -1.1 -#define INITYMAX 1.1 /* y interval for initial condition */ - -#define BCXMIN -2.0 -#define BCXMAX 2.0 /* x interval for boundary condition */ -#define BCYMIN -1.125 -#define BCYMAX 1.125 /* y interval for boundary condition */ - -#define OBSXMIN -2.0 -#define OBSXMAX 2.0 /* x interval for motion of obstacle */ - -#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ - -#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ -#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ - -#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ -#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ -#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ -#define ROCKET_SHAPE_B 2 /* shape of second rocket */ -#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ -#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ - -#define TWO_TYPES 0 /* set to 1 to have two types of particles */ -#define TYPE_PROPORTION 0.6 /* proportion of particles of first type */ -#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ -#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ -#define CENTER_PY 0 /* set to 1 to center vertical momentum */ -#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ - -#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ -#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ -#define SPIN_INTER_FREQUENCY 5.0 /* angular frequency of spin-spin interaction */ -#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ - -#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define PDISC_DISTANCE 4.5 /* minimal distance in Poisson disc process, controls density of particles */ -#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ -#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ -#define MU 0.008 /* parameter controlling radius of particles */ -#define MU_B 0.012 /* parameter controlling radius of particles of second type */ -#define NPOLY 25 /* number of sides of polygon */ -#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ -#define MDEPTH 4 /* depth of computation of Menger gasket */ -#define MRATIO 3 /* ratio defining Menger gasket */ -#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 120 /* number of grid point for grid of disks */ -#define NGRIDY 51 /* number of grid point for grid of disks */ -#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ -#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ -#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ -#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 4000 /* number of frames of movie */ -#define NVID 100 /* number of iterations between images displayed on screen */ -#define NSEG 250 /* number of segments of boundary */ -#define INITIAL_TIME 10 /* time after which to start saving frames */ -#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ -#define BOUNDARY_WIDTH 1 /* width of particle boundary */ -#define LINK_WIDTH 2 /* width of links between particles */ -#define CONTAINER_WIDTH 4 /* width of container boundary */ - -#define PAUSE 1000 /* number of frames after which to pause */ -#define PSLEEP 1 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#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 */ - -/* Boundary conditions, see list in global_ljones.c */ - -#define BOUNDARY_COND 3 - -/* Plot type, see list in global_ljones.c */ - -#define PLOT 5 -#define PLOT_B 0 /* plot type for second movie */ - -#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ -#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ -#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ -#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ -#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ - -/* Color schemes */ - -#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ - -#define BLACK 1 /* background */ - -#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ -#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ -#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ - -#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ -#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ - -/* particle properties */ - -#define ENERGY_HUE_MIN 330.0 /* color of original particle */ -#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ -#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ -#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ -#define PARTICLE_EMAX 5.0e2 /* energy of particle with hottest color */ -#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ -#define HUE_TYPE1 270.0 /* hue of particles of type 1 */ -#define HUE_TYPE2 190.0 /* hue of particles of type 2 */ -#define HUE_TYPE3 120.0 /* hue of particles of type 3 */ - -#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ -#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ -#define KREPEL 12.0 /* constant in repelling force between particles */ -#define EQUILIBRIUM_DIST 3.5 /* Lennard-Jones equilibrium distance */ -#define EQUILIBRIUM_DIST_B 3.5 /* Lennard-Jones equilibrium distance for second type of particle */ -#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ -#define DAMPING 180.0 /* damping coefficient of particles */ -#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */ -#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ -#define PARTICLE_MASS_B 2.0 /* mass of particle of radius MU_B */ -#define PARTICLE_INERTIA_MOMENT 0.02 /* moment of inertia of particle */ -#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ -#define V_INITIAL 0.0 /* initial velocity range */ -#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ - -#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ -#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ -#define SIGMA 5.0 /* noise intensity in thermostat */ -#define BETA 0.002 /* initial inverse temperature */ -#define MU_XI 0.01 /* friction constant in thermostat */ -#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ -#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ -#define NBH_DIST_FACTOR 10.0 /* radius in which to count neighbours */ -#define GRAVITY 0.0 /* gravity acting on all particles */ -#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ -#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ -#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ -#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ -#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ -#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ - -#define ROTATION 1 /* set to 1 to include rotation of particles */ -#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ -#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ -#define KTORQUE 100.0 /* force constant in angular dynamics */ -#define KTORQUE_B 10.0 /* force constant in angular dynamics */ -#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ -#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ -#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ -#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ -#define SPIN_RANGE 7.0 /* range of spin-spin interaction */ -#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ -#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ - -#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ -#define BETA_FACTOR 0.025 /* factor by which to change BETA during simulation */ -#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ -#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ -#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ -#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ -#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ - -#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ -#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ -#define COMPRESSION_RATIO 0.3 /* final size of container */ -#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ -#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ - -#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ -#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ -#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ -#define NTRIALS 2000 /* number of trials when resampling */ -#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ -#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ -#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ -#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ -#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ -#define N_PRESSURES 100 /* number of intervals to record pressure */ -#define N_P_AVERAGE 100 /* size of pressure averaging window */ -#define N_T_AVERAGE 50 /* size of temperature averaging window */ -#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ -#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ -#define PARTIAL_THERMO_REGION 3 /* region for partial thermostat coupling (see list in global_ljones.c) */ -#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ -#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ -#define PARTIAL_THERMO_HEIGHT -0.48 /* vertical size of partial thermostat coupling */ - -#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ -#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ - -#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ -#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ -#define NPART_BOTTOM 100 /* number of particles at the bottom */ - -#define ADD_PARTICLES 0 /* set to 1 to add particles */ -#define ADD_TIME 0 /* time at which to add first particle */ -#define ADD_PERIOD 10000 /* time interval between adding further particles */ -#define N_ADD_PARTICLES 20 /* number of particles to add */ -#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ -#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ - -#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ -#define N_TRACER_PARTICLES 3 /* number of tracer particles */ -#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ -#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ -#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ - -#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ -#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ -#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ -#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ -#define ROTATE_FINAL_TIME 100 /* final time without rotation */ -#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ -#define OMEGAMAX 100.0 /* maximal rotation speed */ -#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ -#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ -#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ - -#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ -#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ -#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ -#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ -#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ -#define SEGMENTS_X0 1.5 /* initial position of segments */ -#define SEGMENTS_Y0 0.0 /* initial position of segments */ -#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ -#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ -#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ - -#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ -#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ -#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ -#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ -#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ -#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ -#define GROUP_WIDTH 0.05 /* interaction width of groups */ -#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ -#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ -#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ -#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ - -#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ -#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ -#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ - -#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ -#define RD_REACTION 11 /* type of reaction, see list in global_ljones.c */ -#define RD_TYPES 4 /* number of types in reaction-diffusion equation */ -#define RD_INITIAL_COND 2 /* initial condition of particles */ -#define REACTION_DIST 3.05 /* maximal distance for reaction to occur */ -#define REACTION_PROB 0.5 /* probability controlling reaction term */ -#define DISSOCIATION_PROB 0.005 /* probability controlling dissociation reaction */ -#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ -#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ -#define DELTA_EKIN -1500.0 /* change of kinetic energy in reaction */ -#define COLLISION_TIME 25 /* time during which collisions are shown */ - -#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ -#define PLOT_PARTICLE_NUMBER 1 /* set to 1 to make of plot of particle number over time */ -#define PARTICLE_NB_PLOT_FACTOR 1.0 /* expected final number of particles over initial number */ -#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ -#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ -#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ -#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ - -#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ - -#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ -#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ -#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_VMAX 100.0 /* max speed of wall */ -#define WALL_TIME 0 /* time during which to keep wall */ - -#define NXMAZE 10 /* width of maze */ -#define NYMAZE 10 /* height of maze */ -#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 200 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ - -#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ -#define FMAX 1.0e10 /* maximal force */ -#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ -#define PMAX 1000.0 /* maximal force */ - -#define HASHX 90 /* size of hashgrid in x direction */ -#define HASHY 45 /* size of hashgrid in y direction */ -#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ -#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ - -#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ -#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ - -``` - -### 7 March 23 - Bloopers 7: Boundary value issues with coherent waves ### - -**Program:** `wave_billiard.c` - -**Initial condition in function `animation()`:** `init_wave_flat(phi, psi, xy_in);` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define DOUBLE_MOVIE 1 /* 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 */ - -#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ -#define IOR 5 /* choice of index of refraction, see list in global_pdes.c */ -#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ - - -/* General geometrical parameters */ - -#define WINWIDTH 1920 /* window width */ -#define WINHEIGHT 1150 /* window height */ -#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ - -/* Choice of the billiard table */ - -#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ - -#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ - -#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ -#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ -#define MU 0.5 /* parameter controlling the dimensions of domain */ -#define NPOLY 6 /* 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 */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 14 /* number of grid point for grid of disks */ -#define NGRIDY 8 /* number of grid point for grid of disks */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -#define ISO_XSHIFT_LEFT -2.9 -#define ISO_XSHIFT_RIGHT 1.4 -#define ISO_YSHIFT_LEFT -0.15 -#define ISO_YSHIFT_RIGHT -0.15 -#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ - -/* 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 */ -#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ -#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ -#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ - -#define OMEGA 0.0005 /* frequency of periodic excitation */ -#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ -#define ACHIRP 0.25 /* acceleration coefficient in chirp */ -#define DAMPING 0.0 /* damping of periodic excitation */ -#define COURANT 0.08 /* Courant number */ -#define COURANTB 0.0 /* 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 */ -#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ -#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ -#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ -#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ -/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ -/* The physical damping coefficient is given by GAMMA/(DT)^2 */ -/* Increasing COURANT speeds up the simulation, but decreases accuracy */ -/* For similar wave forms, COURANT^2*GAMMA should be kept constant */ - -#define ADD_OSCILLATING_SOURCE 0 /* set to 1 to add an oscillating wave source */ -#define OSCILLATING_SOURCE_PERIOD 3 /* period of oscillating source */ -#define ALTERNATE_OSCILLATING_SOURCE 0 /* set to 1 to alternate sign of oscillating source */ - -#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ -#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ -#define N_WAVE_PACKETS 25 /* number of wave packets */ -#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ - -/* Boundary conditions, see list in global_pdes.c */ - -#define B_COND 2 - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 2500 /* number of frames of movie */ -#define NVID 12 /* 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 */ -#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ -#define PRINT_SPEED 0 /* print speed of moving source */ - -#define PAUSE 200 /* number of frames after which to pause */ -#define PSLEEP 1 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#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 */ - -#define INITIAL_AMP 0.5 /* amplitude of initial condition */ -#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ -#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ - -/* Plot type, see list in global_pdes.c */ - -#define PLOT 0 - -#define PLOT_B 4 /* plot type for second movie */ - -/* Color schemes */ - -#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ -#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ - -#define BLACK 1 /* background */ - -#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ -#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 E_SCALE 75.0 /* scaling factor for energy representation */ -#define LOG_SCALE 0.1 /* scaling factor for energy log representation */ -#define LOG_SHIFT 0.5 /* shift of colors on log scale */ -#define FLUX_SCALE 1.0e1 /* scaling factor for enegy flux represtnation */ -#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#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 1.5 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 200.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ - -#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ - -#define NXMAZE 8 /* width of maze */ -#define NYMAZE 32 /* height of maze */ -#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 0 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ - -/* for compatibility with sub_wave and sub_maze */ -#define ADD_POTENTIAL 0 -#define POT_MAZE 7 -#define POTENTIAL 0 -/* end of constants only used by sub_wave and sub_maze */ - -/* For debugging purposes only */ -#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ -#define VMAX 10.0 /* max value of wave amplitude */ - -``` - -### 6 March 23 - A compressible Euler flow in a funnel: Vorticity and direction of flow ### - -**Program:** `rde.c` - -**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define DOUBLE_MOVIE 1 /* 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 */ - -/* General geometrical parameters */ - -#define WINWIDTH 1920 /* window width */ -#define WINHEIGHT 1150 /* window height */ -#define NX 960 /* number of grid points on x axis */ -#define NY 575 /* number of grid points on y axis */ - -#define XMIN -2.0 -#define XMAX 2.0 /* x interval */ -#define YMIN -1.197916667 -#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ - -/* Choice of simulated equation */ - -#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ -#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ -#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ - -#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ -#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ -#define ADD_FORCE_FIELD 0 /* set to 1 to add a foce field (for compressible Euler equation) */ -#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ -#define FORCE_FIELD 4 /* type of force field, see list in global_3d.c */ - -#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ -#define ADAPT_STATE_TO_BC 1 /* set to 1 to smoothly adapt initial state to obstacles */ -#define OBSTACLE_GEOMETRY 581 /* geometry of obstacles, as in B_DOMAIN */ -#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ - -#define JULIA_SCALE 0.5 /* scaling for Julia sets */ - -/* Choice of the billiard table */ - -#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ - -#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ - -#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.25 /* parameter controlling the dimensions of domain */ -#define MU 0.3 /* parameter controlling the dimensions of domain */ -#define NPOLY 5 /* number of sides of polygon */ -#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ -#define MDEPTH 7 /* depth of computation of Menger gasket */ -#define MRATIO 5 /* ratio defining Menger gasket */ -#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 15 /* number of grid point for grid of disks */ -#define NGRIDY 20 /* number of grid point for grid of disks */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -#define ISO_XSHIFT_LEFT -1.65 -#define ISO_XSHIFT_RIGHT 0.4 -#define ISO_YSHIFT_LEFT -0.05 -#define ISO_YSHIFT_RIGHT -0.05 -#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ - -/* You can add more billiard tables by adapting the functions */ -/* xy_in_billiard and draw_billiard in sub_wave.c */ - -/* Physical patameters of wave equation */ - -#define DT 0.00000025 - -#define VISCOSITY 2.0 - -#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ -#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ - -#define EPSILON 0.8 /* time scale separation */ -#define DELTA 0.1 /* time scale separation */ -#define FHNA 1.0 /* parameter in FHN equation */ -#define FHNC -0.01 /* parameter in FHN equation */ -#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ -#define K_COULOMB 0.5 /* constant in Coulomb potential */ -#define V_MAZE 0.4 /* potential in walls of maze */ -#define BZQ 0.0008 /* parameter in BZ equation */ -#define BZF 1.2 /* parameter in BZ equation */ -#define B_FIELD 10.0 /* magnetic field */ -#define G_FIELD 1.0e-7 /* gravity/constant in repulsive field from obstacles */ -#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ -#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ -#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ - -#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ -#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ -#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ -#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ - -#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ -#define N_TRACERS 1000 /* number of tracer particles */ -#define TRACERS_STEP 0.005 /* step size in tracer evolution */ - -#define T_OUT 2.0 /* outside temperature */ -#define T_IN 0.0 /* inside temperature */ -#define SPEED 0.0 /* speed of drift to the right */ - -#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ -#define NOISE_INTENSITY 0.005 /* noise intensity */ -#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ -#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ -#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ - -#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ -#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ -#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ -#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ -#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, - for numerical stability */ - -#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ -#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ -#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ -#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ - -#define CHANGE_FLOW_SPEED 1 /* set to 1 to change speed of laminar flow */ -#define IN_OUT_FLOW_BC 5 /* type of in-flow/out-flow boundary conditions for Euler equation */ - /* see list in global_pdes.c */ -#define IN_OUT_FLOW_MIN_AMP 0.0 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ -#define IN_OUT_FLOW_AMP 0.117 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ -#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ -#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ - -#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ - -/* Boundary conditions, see list in global_pdes.c */ - -#define B_COND 1 - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 1950 /* number of frames of movie */ -#define NVID 100 /* number of iterations between images displayed on screen */ -#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ -#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ -#define MAX_DT 0.024 /* maximal value of integration step */ -#define NSEG 100 /* number of segments of boundary */ -#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ - -#define PAUSE 100 /* number of frames after which to pause */ -#define PSLEEP 2 /* sleep time during pause */ -#define SLEEP1 2 /* initial sleeping time */ -#define SLEEP2 1 /* final sleeping time */ -#define INITIAL_TIME 0 /* initial still time */ -#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ -#define END_FRAMES 50 /* number of still frames at end of movie */ -#define FADE 1 /* set to 1 to fade at end of movie */ - -/* Visualisation */ - -#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ - -#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ -#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ - -#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ - -/* Plot type - color scheme */ - -#define CPLOT 62 -#define CPLOT_B 63 - -/* Plot type - height of 3D plot */ - -#define ZPLOT 62 /* z coordinate in 3D plot */ -#define ZPLOT_B 61 /* z coordinate in second 3D plot */ - -#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ -#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ -#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ -#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ -#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ -#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ -#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ -#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ - -#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ - -#define PRINT_TIME 0 /* set to 1 to print running time */ -#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ -#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ -#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ -#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ -#define PRINT_FLOW_SPEED 1 /* set to 1 to print speed of flow */ - -#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ -#define FIELD_LINE_WIDTH 1 /* width of field lines */ -#define N_FIELD_LINES 120 /* number of field lines */ -#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ -#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ -#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ -#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ - -/* 3D representation */ - -#define REPRESENTATION_3D 1 /* choice of 3D representation */ - -#define REP_AXO_3D 0 /* linear projection (axonometry) */ -#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ - -/* Color schemes, see list in global_pdes.c */ - -#define COLOR_PALETTE 10 /* Color palette, see list in global_pdes.c */ -#define COLOR_PALETTE_B 17 /* Color palette, see list in global_pdes.c */ - -#define BLACK 1 /* black background */ - -#define COLOR_SCHEME 3 /* choice of color scheme */ - -#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ -#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ -#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ -#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ -#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ -#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ -#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ -#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ -#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ -#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ -#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ -#define E_SCALE 100.0 /* scaling factor for energy representation */ -#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ -#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ -#define LOG_SHIFT 1.0 -#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ -#define VSCALE_SPEED 1.5 /* additional scaling factor for color scheme Z_EULER_SPEED */ -#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ -#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ -#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ -#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ -#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ - -#define NXMAZE 7 /* width of maze */ -#define NYMAZE 7 /* height of maze */ -#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 0 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ - -#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 2.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 1 /* set to 1 to draw color scheme horizontally */ - -/* only for compatibility with wave_common.c */ -#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ -#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ -#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ -#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ -#define OMEGA 0.005 /* frequency of periodic excitation */ -#define COURANT 0.08 /* Courant number */ -#define COURANTB 0.03 /* Courant number in medium B */ -#define INITIAL_AMP 0.5 /* amplitude of initial condition */ -#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ -#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ -#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ -#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ -#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ -#define ACHIRP 0.2 /* acceleration coefficient in chirp */ -#define DAMPING 0.0 /* damping of periodic excitation */ -#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ -#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ -#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ -#define FLUX_WINDOW 20 /* averaging window for energy flux */ -#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ -#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ -#define N_WAVE_PACKETS 15 /* number of wave packets */ -#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ -/* end of constants added only for compatibility with wave_common.c */ - - -double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ -double v_3d[2] = {-0.75, -0.45}; -double w_3d[2] = {0.0, 0.015}; -double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ -double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ -int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ - -#define Z_SCALING_FACTOR 2.4 /* overall scaling factor of z axis for REP_PROJ_3D representation */ -#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ -#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ -#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ -#define YSHIFT_3D 0.0 /* overall y shift for REP_PROJ_3D representation */ -#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ - -/* For debugging purposes only */ -#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ -#define VMAX 1000.0 /* max value of wave amplitude */ -#define TEST_GRADIENT 0 /* print norm squared of gradient */ - -``` - -### 5 March 23 - Particle distribution in a honeycomb maze with rounded cells ### - -**Program:** `particle_billiard.c` - -**Initial condition in function `animation()`:** `init_drop_config(-0.05, 0.05, 0.0, DPI, configs);` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ +#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ +#define INVERT_COUNTER 1 /* set to 1 to save frames in inverse order */ #define WINWIDTH 1280 /* window width */ #define WINHEIGHT 720 /* window height */ @@ -5054,7 +8654,7 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define B_DOMAIN 31 /* choice of domain shape */ #define CIRCLE_PATTERN 1 /* pattern of circles */ -#define POLYLINE_PATTERN 15 /* pattern of polyline */ +#define POLYLINE_PATTERN 14 /* pattern of polyline */ #define ABSORBING_CIRCLES 0 /* set to 1 for circular scatterers to be absorbing */ @@ -5082,1036 +8682,33 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO /* Simulation parameters */ -#define NPART 30000 /* number of particles */ +#define NPART 20000 /* number of particles */ #define NPARTMAX 100000 /* maximal number of particles after resampling */ #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 0 /* set to 1 to keep trails of the particles */ #define HEATMAP 1 /* set to 1 to show heat map of particles */ +#define DRAW_FINAL_HEATMAP 0 /* set to 1 to show final heat map of particles */ #define DRAW_HEATMAP_HISTOGRAM 1 /* set to 1 to draw a histogram of particle distribution in heat map */ #define NBIN_FACTOR 6.0 /* constant controlling number of bins in histogram */ #define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ -#define HEATMAP_MAX_PART_BY_CELL 10 /* to draw only limited number of particles in cell */ -#define PLOT_HEATMAP_AVERAGE 1 /* set to 1 to plot average number of particles in heat map */ -#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ -#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ -#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 1 /* set to 1 to print number of particles on left and right side */ -#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ -#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ - -#define NSTEPS 11750 /* number of frames of movie */ -#define TIME 1500 /* time between movie frames, for fluidity of real-time simulation */ -#define DPHI 0.00002 /* integration step */ -#define NVID 25 /* number of iterations between images displayed on screen */ -#define END_FRAMES 100 /* 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 */ -/* However, increasing DPHI too much deterioriates quality of simulation */ -/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ -/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ - -/* Colors and other graphical parameters */ - -#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ - -#define NCOLORS 1000 /* number of colors */ -#define COLORSHIFT 0 /* hue of initial color */ -#define COLOR_HUEMIN 360 /* minimal color hue */ -#define COLOR_HUEMAX 210 /* maximal color hue */ -#define RAINBOW_COLOR 0 /* 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.025 /* length of velocity vectors */ -#define BILLIARD_WIDTH 2 /* width of billiard */ -#define PARTICLE_WIDTH 2 /* width of particles */ -#define FRONT_WIDTH 3 /* width of wave front */ - -#define BLACK 1 /* set to 1 for black background */ -#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ -#define OUTER_COLOR 270.0 /* color outside billiard */ -#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ -#define PAINT_EXT 1 /* set to 1 to paint exterior */ - -#define PAUSE 1000 /* number of frames after which to pause */ -#define PSLEEP 2 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#define SLEEP2 1 /* final sleeping time */ - -#define NXMAZE 40 /* width of maze */ -#define NYMAZE 34 /* height of maze */ -#define MAZE_MAX_NGBH 6 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 11 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ -#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ -#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ - -``` - -### 4 March 23 - An autocatalytic chemical reaction ### - -**Program:** `lennardjones.c` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#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 while saving frames */ -#define NO_EXTRA_BUFFER_SWAP 0 /* some OS require one less buffer swap when recording images */ - -#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ - /* so far incompatible with double movie */ -#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ -#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ - -#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ - -/* General geometrical parameters */ - -#define WINWIDTH 1280 /* window width */ -#define WINHEIGHT 720 /* window height */ - -#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 */ - -#define INITXMIN -1.97 -#define INITXMAX 1.97 /* x interval for initial condition */ -#define INITYMIN -1.1 -#define INITYMAX 1.1 /* y interval for initial condition */ - -#define BCXMIN -2.0 -#define BCXMAX 2.0 /* x interval for boundary condition */ -#define BCYMIN -1.125 -#define BCYMAX 1.125 /* y interval for boundary condition */ - -#define OBSXMIN -2.0 -#define OBSXMAX 2.0 /* x interval for motion of obstacle */ - -#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ - -#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ -#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ - -#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ -#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ -#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ -#define ROCKET_SHAPE_B 2 /* shape of second rocket */ -#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ -#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ - -#define TWO_TYPES 0 /* set to 1 to have two types of particles */ -#define TYPE_PROPORTION 0.9997 /* proportion of particles of first type */ -#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ -#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ -#define CENTER_PY 0 /* set to 1 to center vertical momentum */ -#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ - -#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ -#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ -#define SPIN_INTER_FREQUENCY 5.0 /* angular frequency of spin-spin interaction */ -#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ - -#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define PDISC_DISTANCE 4.2 /* minimal distance in Poisson disc process, controls density of particles */ -#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ -#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ -#define MU 0.008 /* parameter controlling radius of particles */ -#define MU_B 0.01 /* parameter controlling radius of particles of second type */ -#define NPOLY 25 /* number of sides of polygon */ -#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ -#define MDEPTH 4 /* depth of computation of Menger gasket */ -#define MRATIO 3 /* ratio defining Menger gasket */ -#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 120 /* number of grid point for grid of disks */ -#define NGRIDY 51 /* number of grid point for grid of disks */ -#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ -#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ -#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ -#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 2700 /* number of frames of movie */ -#define NVID 100 /* number of iterations between images displayed on screen */ -#define NSEG 250 /* number of segments of boundary */ -#define INITIAL_TIME 10 /* time after which to start saving frames */ -#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ -#define BOUNDARY_WIDTH 1 /* width of particle boundary */ -#define LINK_WIDTH 2 /* width of links between particles */ -#define CONTAINER_WIDTH 4 /* width of container boundary */ - -#define PAUSE 1000 /* number of frames after which to pause */ -#define PSLEEP 1 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#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 */ - -/* Boundary conditions, see list in global_ljones.c */ - -#define BOUNDARY_COND 3 - -/* Plot type, see list in global_ljones.c */ - -#define PLOT 5 -#define PLOT_B 0 /* plot type for second movie */ - -#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ -#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ -#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ -#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ -#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ - -/* Color schemes */ - -#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ - -#define BLACK 1 /* background */ - -#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ -#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ -#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ - -#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ -#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ - -/* particle properties */ - -#define ENERGY_HUE_MIN 330.0 /* color of original particle */ -#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ -#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ -#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ -#define PARTICLE_EMAX 5.0e2 /* energy of particle with hottest color */ -#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ -#define HUE_TYPE1 270.0 /* hue of particles of type 1 */ -#define HUE_TYPE2 190.0 /* hue of particles of type 2 */ -#define HUE_TYPE3 150.0 /* hue of particles of type 3 */ - -#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ -#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ -#define KREPEL 12.0 /* constant in repelling force between particles */ -#define EQUILIBRIUM_DIST 3.5 /* Lennard-Jones equilibrium distance */ -#define EQUILIBRIUM_DIST_B 3.5 /* Lennard-Jones equilibrium distance for second type of particle */ -#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ -#define DAMPING 180.0 /* damping coefficient of particles */ -#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */ -#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ -#define PARTICLE_MASS_B 2.0 /* mass of particle of radius MU_B */ -#define PARTICLE_INERTIA_MOMENT 0.02 /* moment of inertia of particle */ -#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ -#define V_INITIAL 0.0 /* initial velocity range */ -#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ - -#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ -#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ -#define SIGMA 5.0 /* noise intensity in thermostat */ -#define BETA 0.002 /* initial inverse temperature */ -#define MU_XI 0.01 /* friction constant in thermostat */ -#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ -#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ -#define NBH_DIST_FACTOR 10.0 /* radius in which to count neighbours */ -#define GRAVITY 0.0 /* gravity acting on all particles */ -#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ -#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ -#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ -#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ -#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ -#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ - -#define ROTATION 1 /* set to 1 to include rotation of particles */ -#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ -#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ -#define KTORQUE 100.0 /* force constant in angular dynamics */ -#define KTORQUE_B 10.0 /* force constant in angular dynamics */ -#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ -#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ -#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ -#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ -#define SPIN_RANGE 7.0 /* range of spin-spin interaction */ -#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ -#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ - -#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ -#define BETA_FACTOR 0.025 /* factor by which to change BETA during simulation */ -#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ -#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ -#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ -#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ -#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ - -#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ -#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ -#define COMPRESSION_RATIO 0.3 /* final size of container */ -#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ -#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ - -#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ -#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ -#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ -#define NTRIALS 2000 /* number of trials when resampling */ -#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ -#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ -#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ -#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ -#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ -#define N_PRESSURES 100 /* number of intervals to record pressure */ -#define N_P_AVERAGE 100 /* size of pressure averaging window */ -#define N_T_AVERAGE 50 /* size of temperature averaging window */ -#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ -#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ -#define PARTIAL_THERMO_REGION 3 /* region for partial thermostat coupling (see list in global_ljones.c) */ -#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ -#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ -#define PARTIAL_THERMO_HEIGHT -0.48 /* vertical size of partial thermostat coupling */ - -#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ -#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ - -#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ -#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ -#define NPART_BOTTOM 100 /* number of particles at the bottom */ - -#define ADD_PARTICLES 0 /* set to 1 to add particles */ -#define ADD_TIME 0 /* time at which to add first particle */ -#define ADD_PERIOD 10000 /* time interval between adding further particles */ -#define N_ADD_PARTICLES 20 /* number of particles to add */ -#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ -#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ - -#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ -#define N_TRACER_PARTICLES 3 /* number of tracer particles */ -#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ -#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ -#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ - -#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ -#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ -#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ -#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ -#define ROTATE_FINAL_TIME 100 /* final time without rotation */ -#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ -#define OMEGAMAX 100.0 /* maximal rotation speed */ -#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ -#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ -#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ - -#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ -#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ -#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ -#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ -#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ -#define SEGMENTS_X0 1.5 /* initial position of segments */ -#define SEGMENTS_Y0 0.0 /* initial position of segments */ -#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ -#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ -#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ - -#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ -#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ -#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ -#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ -#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ -#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ -#define GROUP_WIDTH 0.05 /* interaction width of groups */ -#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ -#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ -#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ -#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ - -#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ -#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ -#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ - -#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ -#define RD_REACTION 10 /* type of reaction, see list in global_ljones.c */ -#define RD_TYPES 2 /* number of types in reaction-diffusion equation */ -#define RD_INITIAL_COND 2 /* initial condition of particles */ -#define REACTION_DIST 3.3 /* maximal distance for reaction to occur */ -#define REACTION_PROB 0.5 /* probability controlling reaction term */ -#define DISSOCIATION_PROB 0.005 /* probability controlling dissociation reaction */ -#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ -#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ -#define DELTA_EKIN -1500.0 /* change of kinetic energy in reaction */ -#define COLLISION_TIME 25 /* time during which collisions are shown */ - -#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ -#define PLOT_PARTICLE_NUMBER 1 /* set to 1 to make of plot of particle number over time */ -#define PARTICLE_NB_PLOT_FACTOR 1.0 /* expected final number of particles over initial number */ -#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ -#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ -#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ -#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ - -#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ - -#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ -#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ -#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ -#define WALL_VMAX 100.0 /* max speed of wall */ -#define WALL_TIME 0 /* time during which to keep wall */ - -#define NXMAZE 10 /* width of maze */ -#define NYMAZE 10 /* height of maze */ -#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 200 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ - -#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ -#define FMAX 1.0e10 /* maximal force */ -#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ -#define PMAX 1000.0 /* maximal force */ - -#define HASHX 100 /* size of hashgrid in x direction */ -#define HASHY 50 /* size of hashgrid in y direction */ -#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ -#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ - -#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ -#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ - -``` - -### 3 March 23 - Changing the beam direction in a phased array ### - -**Program:** `wave_billiard.c` - -**Initial condition in function `animation()`:** -``` - init_wave_flat(phi, psi, xy_in); - - p = phased_array_schedule(i); - y = -1.0; - sign1 = sign; - printf("p = %i\n", p); - for (k=-4; k<5; k++) - { - x1 = 0.1*((double)source_counter/(double)p + (double)k); - if ((x1 > 0.083333333*XMIN)&&(x1 < 0.083333333*XMAX)) - { - add_circular_wave(sign1, x1, y, phi, psi, xy_in); - printf("Adding wave at (%.2lg, %.2lg)\n", x1, y); - } - sign1 = -sign1; - } - source_counter++; - if (p > 0) q = p; - else q = -p; - if (source_counter >= q) - { - source_counter = 0; - sign = -sign; - } -``` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define DOUBLE_MOVIE 1 /* 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 */ - -#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ -#define IOR 5 /* choice of index of refraction, see list in global_pdes.c */ -#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ - - -/* General geometrical parameters */ - -#define WINWIDTH 1920 /* window width */ -#define WINHEIGHT 1150 /* window height */ -#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ - -/* Choice of the billiard table */ - -#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ - -#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ - -#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ -#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ -#define MU 0.5 /* parameter controlling the dimensions of domain */ -#define NPOLY 6 /* 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 */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 14 /* number of grid point for grid of disks */ -#define NGRIDY 8 /* number of grid point for grid of disks */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -#define ISO_XSHIFT_LEFT -2.9 -#define ISO_XSHIFT_RIGHT 1.4 -#define ISO_YSHIFT_LEFT -0.15 -#define ISO_YSHIFT_RIGHT -0.15 -#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ - -/* 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 */ -#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ -#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ -#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ - -#define OMEGA 0.0005 /* frequency of periodic excitation */ -#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ -#define ACHIRP 0.25 /* acceleration coefficient in chirp */ -#define DAMPING 0.0 /* damping of periodic excitation */ -#define COURANT 0.08 /* Courant number */ -#define COURANTB 0.0 /* 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 */ -#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ -#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ -#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ -#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ -/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ -/* The physical damping coefficient is given by GAMMA/(DT)^2 */ -/* Increasing COURANT speeds up the simulation, but decreases accuracy */ -/* 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 3 /* period of oscillating source */ -#define ALTERNATE_OSCILLATING_SOURCE 0 /* set to 1 to alternate sign of oscillating source */ - -/* Boundary conditions, see list in global_pdes.c */ - -#define B_COND 2 - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 3000 /* number of frames of movie */ -#define NVID 12 /* 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 */ -#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ -#define PRINT_SPEED 0 /* print speed of moving source */ - -#define PAUSE 200 /* number of frames after which to pause */ -#define PSLEEP 1 /* sleep time during pause */ -#define SLEEP1 1 /* initial sleeping time */ -#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 */ - -#define INITIAL_AMP 0.1 /* amplitude of initial condition */ -#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ -#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ - -/* Plot type, see list in global_pdes.c */ - -#define PLOT 0 - -#define PLOT_B 6 /* plot type for second movie */ - -/* Color schemes */ - -#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ -#define COLOR_PALETTE_B 12 /* Color palette, see list in global_pdes.c */ - -#define BLACK 1 /* background */ - -#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 0.75 /* sensitivity of color on wave amplitude */ -#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 E_SCALE 60.0 /* scaling factor for energy representation */ -#define LOG_SCALE 0.8 /* scaling factor for energy log representation */ -#define LOG_SHIFT 3.5 /* shift of colors on log scale */ -#define FLUX_SCALE 5.0e2 /* scaling factor for enegy flux represtnation */ -#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#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 1.5 /* scale of color scheme bar */ -#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ - -#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ - -#define NXMAZE 8 /* width of maze */ -#define NYMAZE 32 /* height of maze */ -#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 0 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ - -/* for compatibility with sub_wave and sub_maze */ -#define ADD_POTENTIAL 0 -#define POT_MAZE 7 -#define POTENTIAL 0 -/* end of constants only used by sub_wave and sub_maze */ - -/* For debugging purposes only */ -#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ -#define VMAX 10.0 /* max value of wave amplitude */ - -``` - -### 2 March 23 - A compressible Euler flow in a funnel ### - -**Program:** `rde.c` - -**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define DOUBLE_MOVIE 1 /* 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 */ - -/* General geometrical parameters */ - -#define WINWIDTH 1920 /* window width */ -#define WINHEIGHT 1150 /* window height */ -#define NX 960 /* number of grid points on x axis */ -#define NY 575 /* number of grid points on y axis */ - -#define XMIN -2.0 -#define XMAX 2.0 /* x interval */ -#define YMIN -1.197916667 -#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ - -/* Choice of simulated equation */ - -#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ -#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ -#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ - -#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ -#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ -#define ADD_FORCE_FIELD 0 /* set to 1 to add a foce field (for compressible Euler equation) */ -#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ -#define FORCE_FIELD 4 /* type of force field, see list in global_3d.c */ - -#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ -#define ADAPT_STATE_TO_BC 1 /* set to 1 to smoothly adapt initial state to obstacles */ -#define OBSTACLE_GEOMETRY 581 /* geometry of obstacles, as in B_DOMAIN */ -#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ - -#define JULIA_SCALE 0.5 /* scaling for Julia sets */ - -/* Choice of the billiard table */ - -#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ - -#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ - -#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ -#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ - -#define LAMBDA 0.25 /* parameter controlling the dimensions of domain */ -#define MU 0.3 /* parameter controlling the dimensions of domain */ -#define NPOLY 5 /* number of sides of polygon */ -#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ -#define MDEPTH 7 /* depth of computation of Menger gasket */ -#define MRATIO 5 /* ratio defining Menger gasket */ -#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ -#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ -#define FOCI 1 /* set to 1 to draw focal points of ellipse */ -#define NGRIDX 15 /* number of grid point for grid of disks */ -#define NGRIDY 20 /* number of grid point for grid of disks */ - -#define X_SHOOTER -0.2 -#define Y_SHOOTER -0.6 -#define X_TARGET 0.4 -#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ - -#define ISO_XSHIFT_LEFT -1.65 -#define ISO_XSHIFT_RIGHT 0.4 -#define ISO_YSHIFT_LEFT -0.05 -#define ISO_YSHIFT_RIGHT -0.05 -#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ - -/* You can add more billiard tables by adapting the functions */ -/* xy_in_billiard and draw_billiard in sub_wave.c */ - -/* Physical patameters of wave equation */ - -#define DT 0.00000025 - -#define VISCOSITY 2.0 - -#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ -#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ - -#define EPSILON 0.8 /* time scale separation */ -#define DELTA 0.1 /* time scale separation */ -#define FHNA 1.0 /* parameter in FHN equation */ -#define FHNC -0.01 /* parameter in FHN equation */ -#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ -#define K_COULOMB 0.5 /* constant in Coulomb potential */ -#define V_MAZE 0.4 /* potential in walls of maze */ -#define BZQ 0.0008 /* parameter in BZ equation */ -#define BZF 1.2 /* parameter in BZ equation */ -#define B_FIELD 10.0 /* magnetic field */ -#define G_FIELD 1.0e-7 /* gravity/constant in repulsive field from obstacles */ -#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ -#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ -#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ - -#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ -#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ -#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ -#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ - -#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ -#define N_TRACERS 1000 /* number of tracer particles */ -#define TRACERS_STEP 0.005 /* step size in tracer evolution */ - -#define T_OUT 2.0 /* outside temperature */ -#define T_IN 0.0 /* inside temperature */ -#define SPEED 0.0 /* speed of drift to the right */ - -#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ -#define NOISE_INTENSITY 0.005 /* noise intensity */ -#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ -#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ -#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ - -#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ -#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ -#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ -#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ -#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, - for numerical stability */ - -#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ -#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ -#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ -#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ - -#define CHANGE_FLOW_SPEED 1 /* set to 1 to change speed of laminar flow */ -#define IN_OUT_FLOW_BC 5 /* type of in-flow/out-flow boundary conditions for Euler equation */ - /* see list in global_pdes.c */ -#define IN_OUT_FLOW_MIN_AMP 0.0 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ -#define IN_OUT_FLOW_AMP 0.12 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ -#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ -#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ - -#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ - -/* Boundary conditions, see list in global_pdes.c */ - -#define B_COND 1 - -/* Parameters for length and speed of simulation */ - -#define NSTEPS 2000 /* number of frames of movie */ -#define NVID 100 /* number of iterations between images displayed on screen */ -#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ -#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ -#define MAX_DT 0.024 /* maximal value of integration step */ -#define NSEG 100 /* number of segments of boundary */ -#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ - -#define PAUSE 100 /* number of frames after which to pause */ -#define PSLEEP 2 /* sleep time during pause */ -#define SLEEP1 2 /* initial sleeping time */ -#define SLEEP2 1 /* final sleeping time */ -#define INITIAL_TIME 0 /* initial still time */ -#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ -#define END_FRAMES 50 /* number of still frames at end of movie */ -#define FADE 1 /* set to 1 to fade at end of movie */ - -/* Visualisation */ - -#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ - -#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ -#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ - -#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ - -/* Plot type - color scheme */ - -#define CPLOT 61 -#define CPLOT_B 60 - -/* Plot type - height of 3D plot */ - -#define ZPLOT 62 /* z coordinate in 3D plot */ -#define ZPLOT_B 61 /* z coordinate in second 3D plot */ - -#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ -#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ -#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ -#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ -#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ -#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ -#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ -#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ - -#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ - -#define PRINT_TIME 0 /* set to 1 to print running time */ -#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ -#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ -#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ -#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ -#define PRINT_FLOW_SPEED 1 /* set to 1 to print speed of flow */ - -#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ -#define FIELD_LINE_WIDTH 1 /* width of field lines */ -#define N_FIELD_LINES 120 /* number of field lines */ -#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ -#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ -#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ -#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ - -/* 3D representation */ - -#define REPRESENTATION_3D 1 /* choice of 3D representation */ - -#define REP_AXO_3D 0 /* linear projection (axonometry) */ -#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ - -/* Color schemes, see list in global_pdes.c */ - -#define COLOR_PALETTE 10 /* Color palette, see list in global_pdes.c */ -#define COLOR_PALETTE_B 11 /* Color palette, see list in global_pdes.c */ - -#define BLACK 1 /* black background */ - -#define COLOR_SCHEME 3 /* choice of color scheme */ - -#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ - -#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ -#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ -#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ -#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ -#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ -#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ -#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ -#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ -#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ -#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ -#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ - -#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 */ -#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ -#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ -#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ -#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ -#define E_SCALE 100.0 /* scaling factor for energy representation */ -#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ -#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ -#define LOG_SHIFT 1.0 -#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ -#define VSCALE_SPEED 1.5 /* additional scaling factor for color scheme Z_EULER_SPEED */ -#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ -#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ -#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ -#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ -#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ - -#define NXMAZE 7 /* width of maze */ -#define NYMAZE 7 /* height of maze */ -#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 0 /* seed of random number generator */ -#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ - -#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 3.0 /* scale of color scheme bar for 2nd part */ -#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ - -/* only for compatibility with wave_common.c */ -#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ -#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ -#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ -#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ -#define OMEGA 0.005 /* frequency of periodic excitation */ -#define COURANT 0.08 /* Courant number */ -#define COURANTB 0.03 /* Courant number in medium B */ -#define INITIAL_AMP 0.5 /* amplitude of initial condition */ -#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ -#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ -#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ -#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ -#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ -#define ACHIRP 0.2 /* acceleration coefficient in chirp */ -#define DAMPING 0.0 /* damping of periodic excitation */ -#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ -#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ -#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ -#define FLUX_WINDOW 20 /* averaging window for energy flux */ -#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ -#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ -#define N_WAVE_PACKETS 15 /* number of wave packets */ -#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ -/* end of constants added only for compatibility with wave_common.c */ - - -double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ -double v_3d[2] = {-0.75, -0.45}; -double w_3d[2] = {0.0, 0.015}; -double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ -double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ -int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ - -#define Z_SCALING_FACTOR 2.4 /* overall scaling factor of z axis for REP_PROJ_3D representation */ -#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ -#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ -#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ -#define YSHIFT_3D 0.0 /* overall y shift for REP_PROJ_3D representation */ -#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ - -/* For debugging purposes only */ -#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ -#define VMAX 1000.0 /* max value of wave amplitude */ -#define TEST_GRADIENT 0 /* print norm squared of gradient */ - -``` - -### 1 March 23 - Particle distribution in a circular maze ### - -**Program:** `particle_billiard.c` - -**Initial condition in function `animation()`:** `init_drop_config(-0.05, 0.05, 0.0, DPI, configs);` - -``` -#define MOVIE 1 /* set to 1 to generate movie */ -#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ - -#define WINWIDTH 1280 /* window width */ -#define WINHEIGHT 720 /* window height */ - -#define XMIN -1.5 -#define XMAX 2.5 /* x interval */ -#define YMIN -1.125 -#define YMAX 1.125 /* y interval for 9/16 aspect ratio */ - -#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ - -/* Choice of the billiard table, see global_particles.c */ - -#define B_DOMAIN 31 /* choice of domain shape */ - -#define CIRCLE_PATTERN 1 /* pattern of circles */ -#define POLYLINE_PATTERN 13 /* pattern of polyline */ - -#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ -#define MU 0.005 /* 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 */ -#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ - -#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ -#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ -#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ - -#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ -#define DEBUG 0 /* draw trajectories, for debugging purposes */ - -/* Simulation parameters */ - -#define NPART 50000 /* number of particles */ -#define NPARTMAX 100000 /* maximal number of particles after resampling */ -#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 0 /* set to 1 to keep trails of the particles */ -#define HEATMAP 1 /* set to 1 to show heat map of particles */ -#define DRAW_HEATMAP_HISTOGRAM 1 /* set to 1 to draw a histogram of particle distribution in heat map */ -#define NBIN_FACTOR 6.0 /* constant controlling number of bins in histogram */ -#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ -#define HEATMAP_MAX_PART_BY_CELL 10 /* to draw only limited number of particles in cell */ -#define PLOT_HEATMAP_AVERAGE 1 /* set to 1 to plot average number of particles in heat map */ +#define HEATMAP_MAX_PART_BY_CELL 0 /* set to positive value to draw only limited number of particles in cell */ +#define PLOT_HEATMAP_AVERAGE 0 /* set to 1 to plot average number of particles in heat map */ #define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ #define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ #define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles on left and right side */ -#define PRINT_CIRCLE_PARTICLE_NUMBER 1 /* set to 1 to print number of particles outside circular maze */ +#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ #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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ -#define NSTEPS 7500 /* number of frames of movie */ -#define TIME 1500 /* time between movie frames, for fluidity of real-time simulation */ +#define NSTEPS 8000 /* number of frames of movie */ +#define TIME 3000 /* time between movie frames, for fluidity of real-time simulation */ #define DPHI 0.00002 /* integration step */ #define NVID 25 /* number of iterations between images displayed on screen */ -#define END_FRAMES 100 /* number of still frames at the end of the movie */ +#define END_FRAMES 50 /* 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 */ @@ -6121,13 +8718,13 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO /* Colors and other graphical parameters */ -#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ -#define NCOLORS 1000 /* number of colors */ +#define NCOLORS 500 /* number of colors */ #define COLORSHIFT 0 /* hue of initial color */ #define COLOR_HUEMIN 0 /* minimal color hue */ #define COLOR_HUEMAX 300 /* maximal color hue */ -#define RAINBOW_COLOR 0 /* set to 1 to use different colors for all particles */ +#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.025 /* length of velocity vectors */ @@ -6146,13 +8743,14 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO #define SLEEP1 1 /* initial sleeping time */ #define SLEEP2 1 /* final sleeping time */ -#define NXMAZE 16 /* width of maze */ -#define NYMAZE 96 /* height of maze */ -#define MAZE_MAX_NGBH 6 /* max number of neighbours of maze cell */ -#define RAND_SHIFT 11 /* seed of random number generator */ +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 40 /* height of maze */ +#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 15 /* seed of random number generator */ #define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ #define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ #define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ +#define CLOSE_MAZE 1 /* set to 1 to close maze exits */ ``` diff --git a/Parameters_April23.md b/Parameters_April23.md new file mode 100644 index 0000000..449b89a --- /dev/null +++ b/Parameters_April23.md @@ -0,0 +1,8756 @@ +### Parameter values for YouTube simulations ### + +Created by **Nils Berglund** and optimized by **Marco Mancini** + +C code for videos on YouTube Channel https://www.youtube.com/c/NilsBerglund + +Below are parameter values used for different simulations, as well as initial conditions used in +function animation. Some simulations use variants of the published code. The list is going to be +updated gradually. + + +### 30 April 23 - Solving a maze with a pressure gradient ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_pressure_gradient_flow(flow_speed_schedule(0), 1.0 + PRESSURE_GRADIENT, 1.0 - PRESSURE_GRADIENT, phi, xy_in, bc_field);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 541 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 100.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 1.0e-4 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation, 0 for no b.c. */ +#define IN_OUT_BC_FACTOR 0.001 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ +#define PRESSURE_GRADIENT 0.3 /* amplitude of pressure gradient for Euler equation */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2500 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 60 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 0 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 11 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.25 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 29 April 23 - A school of fish exploring a maze ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 15 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 9 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3600 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 0.5 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 1.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e10 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e10 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 6 /* width of maze */ +#define NYMAZE 6 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 1 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 80 /* size of hashgrid in x direction */ +#define HASHY 40 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 28 April 23 - Waves spilling from the Mandelbrot set ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** +``` + init_circular_wave_mod(0.0, 0.0, phi, psi, xy_in); + + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign; + add_circular_wave_mod(sign, 0.0, 0.0, phi, psi, xy_in); + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 2500 /* number of grid points on x axis */ +#define NY 1250 /* number of grid points on y axis */ + +#define XMIN -2.2 +#define XMAX 1.8 /* x interval */ +#define YMIN -1.041666667 +#define YMAX 1.041666667 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 1 /* set to 1 for a variable index of refraction */ +#define IOR 101 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 2000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 20.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 8 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.06 /* Courant number */ +#define COURANTB 0.06 /* Courant number in medium B */ +#define GAMMA 0.0 /* damping factor in wave equation */ +#define GAMMAB 1.0e-6 /* damping factor in wave equation */ +#define GAMMA_SIDES 1.0e-4 /* damping factor on boundary */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 50 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2300 /* number of frames of movie */ +#define NVID 6 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.15 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 108 +#define CPLOT_B 108 /* plot type for second movie */ + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 0.4 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.5 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 18 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 14 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 0.5 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 15.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 240.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 20.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 500.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 5.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define ADD_POTENTIAL 1 /* set to 1 to add potential to z coordinate */ +#define POTENTIAL 10 +#define POT_FACT 400.0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +/* Parameters controlling 3D projection */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 6.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 0.05 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.8 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.2 /* overall y shift for REP_PROJ_3D representation */ + +``` + +### 27 April 23 - Tesla valves under a pressure gradient ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_pressure_gradient_flow(flow_speed_schedule(0), 1.0 + PRESSURE_GRADIENT, 1.0 - PRESSURE_GRADIENT, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 72 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 1.0e-4 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 6 /* type of in-flow/out-flow boundary conditions for Euler equation, 0 for no b.c. */ +#define IN_OUT_BC_FACTOR 0.001 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ +#define PRESSURE_GRADIENT 0.3 /* amplitude of pressure gradient for Euler equation */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3000 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 60 +#define CPLOT_B 61 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 1 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.25 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 26 April 23 - Video #800: A rocket fueled by a chemical reaction ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#define XMIN -3.3 +#define XMAX 4.7 /* x interval */ +#define YMIN -2.25 +#define YMAX 2.25 /* y interval for 9/16 aspect ratio */ + +#define INITXMIN -0.7 +#define INITXMAX 0.7 /* x interval for initial condition */ +#define INITYMIN -1.7 +#define INITYMAX 1.7 /* y interval for initial condition */ + +#define BCXMIN -5.1 +#define BCXMAX 6.1 /* x interval for boundary condition */ +#define BCYMIN -6.5 +#define BCYMAX 44.0 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 101 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 1 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.5 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 2.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.8 /* parameter controlling the dimensions of domain */ +#define MU 0.009 /* parameter controlling radius of particles */ +#define MU_B 0.009 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 5200 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 50 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 150 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 20 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 5 +#define PLOT_B 8 /* plot type for second movie */ + +#define DRAW_BONDS 0 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 1 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 1 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 1 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 2.0e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 280.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 180.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 210.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 4.5 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 3.5 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 5.0 /* damping coefficient of particles */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define INITIAL_DAMPING 5.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 1.0 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.2 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 0.0 /* initial velocity range */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.02 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 7.5 /* radius in which to count neighbours */ +#define GRAVITY 15.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 0 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.02 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 1 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 20 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 0 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 0.0 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 0 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 5.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 0 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 2 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 3 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.1 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.4 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 1 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 224.49 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 0 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 1 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 1 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.2 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 6 /* width of maze */ +#define NYMAZE 6 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 1 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 120 /* size of hashgrid in x direction */ +#define HASHY 450 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +**Part 2:** + +``` +#define REACTION_DIST 3.1245 /* maximal distance for reaction to occur */ +#define VMAX_PLOT_SPEEDS 0.25 /* vertical scale of plot of obstacle speeds + +``` + + +### 25 April 23 - Bloopers 9: Solving a maze with fish is not so easy ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 15 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 9 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3600 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 0.5 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 1.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e10 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e10 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_BOUNDARY 1.0e4 /* constant in torque from the boundary */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 6 /* width of maze */ +#define NYMAZE 6 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 120 /* size of hashgrid in x direction */ +#define HASHY 60 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 24 April 23 - 3D render of waves in a periodic medium, shown in their index of refraction landscape ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** +``` + init_circular_wave_mod(0.0, 0.0, phi, psi, xy_in); + + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign; + add_circular_wave_mod(sign, 0.0, 0.0, phi, psi, xy_in); + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 2500 /* number of grid points on x axis */ +#define NY 2500 /* number of grid points on y axis */ + +#define XMIN -1.5 +#define XMAX 1.5 /* x interval */ +#define YMIN -1.5 +#define YMAX 1.5 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 1 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 8 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.05 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 50 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2100 /* number of frames of movie */ +#define NVID 4 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.7 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 108 +#define CPLOT_B 108 /* plot type for second movie */ + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 0.1 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.5 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 3.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 15.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 20.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 500.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define ADD_POTENTIAL 1 /* set to 1 to add potential to z coordinate */ +#define POTENTIAL 10 +#define POT_FACT 30.0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + +### 23 April 23 - 3D view of an Euler flow solving a maze ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 700 /* number of grid points on x axis */ +#define NY 600 /* number of grid points on y axis */ + +#define XMIN -1.4 +#define XMAX 1.4 /* x interval */ +#define YMIN -1.2 +#define YMAX 1.2 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 541 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 150.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.3 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.3 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2400 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 1 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 62 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 62 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 0 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 5.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 4.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.05 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 22 April 23 - Your aquarium simulator: A Vicsek-type model with speed alignment ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 10 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 4200 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 0.1 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +**Part 2:** +``` +#define KSPRING_VICSEK 0.5 /* spring constant for I_VICSEK_SPEED interaction */ +``` + + +### 21 April 23 - 3D render of a circular phased array ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat_mod(phi, psi, xy_in); + + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + if (first_source) for (k=0; k<25; k++) + { + omega = DPI/25.0; + wave_source[k].xc = 0.15*cos((double)k*omega);; + wave_source[k].yc = 0.15*sin((double)k*omega); + wave_source[k].phase = 1.0 - (double)(k+1)*10.0/25.0; + wave_source[k].sign = 1; + first_source = 0; + } + + for (k=0; k<25; k++) + { + wave_source[k].phase += 1.0/25.0; + if (wave_source[k].phase > 1.0) + { + add_circular_wave_mod((double)wave_source[k].sign, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } + } + +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 1500 /* number of grid points on x axis */ +#define NY 1500 /* number of grid points on y axis */ + +#define XMIN -1.5 +#define XMAX 1.5 /* x interval */ +#define YMIN -1.5 +#define YMAX 1.5 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 5 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 14 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.04 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 1900 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.015 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 108 +#define CPLOT_B 108 /* plot type for second movie */ + + + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 1.0 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.5 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 3.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 15.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 360.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 20.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 500.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 5.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define ADD_POTENTIAL 1 /* set to 1 to add potential to z coordinate */ +#define POTENTIAL 10 +#define POT_FACT 30.0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +/* Parameters controlling 3D projection */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 0.2 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.8 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.1 /* overall y shift for REP_PROJ_3D representation */ + +``` + +### 20 April 23 - Several Tesla valves in series - Pressure and vorticity ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 72 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 0 /* type of in-flow/out-flow boundary conditions for Euler equation, 0 for no b.c. */ +#define IN_OUT_BC_FACTOR 0.001 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2300 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 60 +#define CPLOT_B 62 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 1 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 4.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 19 April 23 - A Vicsek-type swarming model with weak repulsion ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 9 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3200 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 50 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 0.1 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 18 April 23 - A circular phased array with slower rotation ### + +**Program:** `wave_billiard.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat(phi, psi, xy_in); + + if (first_source) for (k=0; k<25; k++) + { + omega = DPI/25.0; + wave_source[k].xc = 0.15*cos((double)k*omega);; + wave_source[k].yc = 0.15*sin((double)k*omega); + wave_source[k].phase = 1.1 - (double)(k+1)*10.0/25.0; + wave_source[k].sign = 1; + first_source = 0; + } + for (k=0; k<25; k++) + { + wave_source[k].phase += 1.0/50.0; + if (wave_source[k].phase > 1.0) + { + add_circular_wave((double)wave_source[k].sign, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* 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 */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.0005 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.25 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.04 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3000 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* print speed of moving source */ + +#define PAUSE 200 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +#define INITIAL_AMP 0.015 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define PLOT 0 + +#define PLOT_B 5 /* plot type for second movie */ + +/* Color schemes */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.75 /* sensitivity of color on wave amplitude */ +#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 E_SCALE 120.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ +#define LOG_SHIFT 3.5 /* shift of colors on log scale */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#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 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POT_MAZE 7 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + +/* For debugging purposes only */ +#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + +### 17 April 23 - Several Tesla valves in series ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 72 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 0 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2300 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 64 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 1 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#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 BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#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 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 16 April 23 - A Vicsek-type model with weaker coupling ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 8 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2500 /* number of frames of movie */ +#define NVID 175 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 0.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 20.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 1.0 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 0.04 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5000.0 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 15 April 23 - A circular phased array ### + +**Program:** `wave_billiard.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat(phi, psi, xy_in); + + if (first_source) for (k=0; k<25; k++) + { + omega = DPI/25.0; + wave_source[k].xc = 0.15*cos((double)k*omega);; + wave_source[k].yc = 0.15*sin((double)k*omega); + wave_source[k].phase = 1.0 - (double)(k+1)*10.0/25.0; + wave_source[k].sign = 1; + first_source = 0; + } + for (k=0; k<25; k++) + { + wave_source[k].phase += 1.0/25.0; + if (wave_source[k].phase > 1.0) + { + add_circular_wave((double)wave_source[k].sign, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* 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 */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.0005 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.25 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.04 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2700 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* print speed of moving source */ + +#define PAUSE 200 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +#define INITIAL_AMP 0.01 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define PLOT 0 + +#define PLOT_B 5 /* plot type for second movie */ + +/* Color schemes */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.75 /* sensitivity of color on wave amplitude */ +#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 E_SCALE 120.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ +#define LOG_SHIFT 3.5 /* shift of colors on log scale */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#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 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POT_MAZE 7 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + +/* For debugging purposes only */ +#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + +### 14 April 23 - Everything is illuminable (well, almost, in a closed maze with right angles) ### + +**Program:** `particle_billiard.c` + +**Initial condition in function `animation()`:** `init_drop_config(0.05, 0.05, 0.0, DPI, configs);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ +#define INVERT_COUNTER 0 /* set to 1 to save frames in inverse order */ + +#define WINWIDTH 720 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ + +/* Choice of the billiard table, see global_particles.c */ + +#define B_DOMAIN 30 /* choice of domain shape */ + +#define CIRCLE_PATTERN 1 /* pattern of circles */ +#define POLYLINE_PATTERN 10 /* pattern of polyline */ + +#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ +#define MU 0.005 /* 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 */ +#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ + +#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ +#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ + +#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ +#define DEBUG 0 /* draw trajectories, for debugging purposes */ + +/* Simulation parameters */ + +#define NPART 50000 /* number of particles */ +#define NPARTMAX 100000 /* maximal number of particles after resampling */ +#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 0 /* set to 1 to keep trails of the particles */ +#define HEATMAP 1 /* set to 1 to show heat map of particles */ +#define DRAW_FINAL_HEATMAP 1 /* set to 1 to show final heat map of particles */ +#define DRAW_HEATMAP_HISTOGRAM 0 /* set to 1 to draw a histogram of particle distribution in heat map */ +#define NBIN_FACTOR 6.0 /* constant controlling number of bins in histogram */ +#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ +#define HEATMAP_MAX_PART_BY_CELL 50 /* set to positive value to draw only limited number of particles in cell */ +#define PLOT_HEATMAP_AVERAGE 1 /* set to 1 to plot average number of particles in heat map */ +#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ +#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles on left and right side */ +#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ +#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ + +#define NSTEPS 1300 /* number of frames of movie */ +#define TIME 3000 /* time between movie frames, for fluidity of real-time simulation */ +#define DPHI 0.00002 /* integration step */ +#define NVID 25 /* number of iterations between images displayed on screen */ +#define END_FRAMES 50 /* 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 */ +/* However, increasing DPHI too much deterioriates quality of simulation */ +/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ +/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ + +/* Colors and other graphical parameters */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ + +#define NCOLORS 500 /* number of colors */ +#define COLORSHIFT 0 /* hue of initial color */ +#define COLOR_HUEMIN 0 /* minimal color hue */ +#define COLOR_HUEMAX 300 /* maximal color hue */ +#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.025 /* length of velocity vectors */ +#define BILLIARD_WIDTH 2 /* width of billiard */ +#define PARTICLE_WIDTH 2 /* width of particles */ +#define FRONT_WIDTH 3 /* width of wave front */ + +#define BLACK 1 /* set to 1 for black background */ +#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ +#define OUTER_COLOR 270.0 /* color outside billiard */ +#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ +#define PAINT_EXT 1 /* set to 1 to paint exterior */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ + +#define NXMAZE 18 /* width of maze */ +#define NYMAZE 18 /* height of maze */ +#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 15 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ +#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ +#define CLOSE_MAZE 1 /* set to 1 to close maze exits */ + +``` + +### 13 April 23 - 3D render of a Tesla valve ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 71 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 0 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2000 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 1 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 62 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 62 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#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 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +**Part 2:** +``` +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ +``` + +### 12 April 23 - A Vicsek-type model for swarming ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 8 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.6 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3500 /* number of frames of movie */ +#define NVID 175 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 0.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 20.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 1.0 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 0.04 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 10000.0 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 11 April 23 - A continuous sweep in a phased array ### + +**Program:** `wave_billiard.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat(phi, psi, xy_in); + + if (first_source) for (k=0; k<25; k++) + { + wave_source[k].xc = -0.1*XMAX + 0.1*(XMAX-XMIN)*(double)k/25.0; + wave_source[k].yc = -1.0; + wave_source[k].phase = 0.9 - (double)k*0.2; + wave_source[k].sign = 1; + first_source = 0; + } + for (k=0; k<25; k++) + { + wave_source[k].phase += 0.08*(1.0 + 0.05*((double)(i*k)/(double)NSTEPS)); + if (wave_source[k].phase > 1.0) + { + add_circular_wave((double)wave_source[k].sign, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* 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 */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.0005 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.25 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.04 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2800 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* print speed of moving source */ + +#define PAUSE 200 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +#define INITIAL_AMP 0.02 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define PLOT 0 + +#define PLOT_B 6 /* plot type for second movie */ + +/* Color schemes */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.75 /* sensitivity of color on wave amplitude */ +#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 E_SCALE 60.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ +#define LOG_SHIFT 3.5 /* shift of colors on log scale */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#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 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POT_MAZE 7 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + +/* For debugging purposes only */ +#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + +### 10 April 23 - An Euler flow in a larger maze with repelling walls ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 541 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 150.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 0 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2400 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 62 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 62 /* z coordinate in 3D plot */ +#define ZPLOT_B 61 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 1 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 2.4 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.0 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 9 April 23 - Approach to equilibrium of particle distribution in a maze with rounded corners ### + +**Program:** `particle_billiard.c` + +**Initial condition in function `animation()`:** `init_drop_config(0.05, 0.05, 0.0, DPI, configs);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ +#define INVERT_COUNTER 0 /* set to 1 to save frames in inverse order */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#define XMIN -1.5 +#define XMAX 2.5 /* x interval */ +#define YMIN -1.125 +#define YMAX 1.125 /* y interval for 9/16 aspect ratio */ + +#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ + +/* Choice of the billiard table, see global_particles.c */ + +#define B_DOMAIN 31 /* choice of domain shape */ + +#define CIRCLE_PATTERN 1 /* pattern of circles */ +#define POLYLINE_PATTERN 10 /* pattern of polyline */ + +#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ +#define MU 0.005 /* 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 */ +#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ + +#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ +#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ + +#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ +#define DEBUG 0 /* draw trajectories, for debugging purposes */ + +/* Simulation parameters */ + +#define NPART 50000 /* number of particles */ +#define NPARTMAX 100000 /* maximal number of particles after resampling */ +#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 0 /* set to 1 to keep trails of the particles */ +#define HEATMAP 1 /* set to 1 to show heat map of particles */ +#define DRAW_FINAL_HEATMAP 0 /* set to 1 to show final heat map of particles */ +#define DRAW_HEATMAP_HISTOGRAM 1 /* set to 1 to draw a histogram of particle distribution in heat map */ +#define NBIN_FACTOR 8.0 /* constant controlling number of bins in histogram */ +#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ +#define HEATMAP_MAX_PART_BY_CELL 0 /* set to positive value to draw only limited number of particles in cell */ +#define PLOT_HEATMAP_AVERAGE 0 /* set to 1 to plot average number of particles in heat map */ +#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ +#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles on left and right side */ +#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ +#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ + +#define NSTEPS 22000 /* number of frames of movie */ +#define TIME 2000 /* time between movie frames, for fluidity of real-time simulation */ +#define DPHI 0.00002 /* integration step */ +#define NVID 25 /* number of iterations between images displayed on screen */ +#define END_FRAMES 50 /* 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 */ +/* However, increasing DPHI too much deterioriates quality of simulation */ +/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ +/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ + +/* Colors and other graphical parameters */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ + +#define NCOLORS 500 /* number of colors */ +#define COLORSHIFT 0 /* hue of initial color */ +#define COLOR_HUEMIN 0 /* minimal color hue */ +#define COLOR_HUEMAX 160 /* maximal color hue */ +#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.025 /* length of velocity vectors */ +#define BILLIARD_WIDTH 2 /* width of billiard */ +#define PARTICLE_WIDTH 2 /* width of particles */ +#define FRONT_WIDTH 3 /* width of wave front */ + +#define BLACK 1 /* set to 1 for black background */ +#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ +#define OUTER_COLOR 270.0 /* color outside billiard */ +#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ +#define PAINT_EXT 1 /* set to 1 to paint exterior */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ + +#define NXMAZE 36 /* width of maze */ +#define NYMAZE 36 /* height of maze */ +#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 15 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ +#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ +#define CLOSE_MAZE 1 /* set to 1 to close maze exits */ + +``` + +**Part 2:** + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ +#define INVERT_COUNTER 0 /* set to 1 to save frames in inverse order */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#define XMIN -1.5 +#define XMAX 2.5 /* x interval */ +#define YMIN -1.125 +#define YMAX 1.125 /* y interval for 9/16 aspect ratio */ + +#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ + +/* Choice of the billiard table, see global_particles.c */ + +#define B_DOMAIN 31 /* choice of domain shape */ + +#define CIRCLE_PATTERN 1 /* pattern of circles */ +#define POLYLINE_PATTERN 10 /* pattern of polyline */ + +#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ +#define MU 0.005 /* 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 */ +#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ + +#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ +#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ + +#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ +#define DEBUG 0 /* draw trajectories, for debugging purposes */ + +/* Simulation parameters */ + +#define NPART 50000 /* number of particles */ +#define NPARTMAX 100000 /* maximal number of particles after resampling */ +#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 0 /* set to 1 to keep trails of the particles */ +#define HEATMAP 1 /* set to 1 to show heat map of particles */ +#define DRAW_FINAL_HEATMAP 1 /* set to 1 to show final heat map of particles */ +#define DRAW_HEATMAP_HISTOGRAM 1 /* set to 1 to draw a histogram of particle distribution in heat map */ +#define NBIN_FACTOR 8.0 /* constant controlling number of bins in histogram */ +#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ +#define HEATMAP_MAX_PART_BY_CELL 5 /* set to positive value to draw only limited number of particles in cell */ +#define PLOT_HEATMAP_AVERAGE 1 /* set to 1 to plot average number of particles in heat map */ +#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ +#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles on left and right side */ +#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ +#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ + +#define NSTEPS 22000 /* number of frames of movie */ +#define TIME 2000 /* time between movie frames, for fluidity of real-time simulation */ +#define DPHI 0.00002 /* integration step */ +#define NVID 25 /* number of iterations between images displayed on screen */ +#define END_FRAMES 50 /* 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 */ +/* However, increasing DPHI too much deterioriates quality of simulation */ +/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ +/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ + +/* Colors and other graphical parameters */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ + +#define NCOLORS 500 /* number of colors */ +#define COLORSHIFT 0 /* hue of initial color */ +#define COLOR_HUEMIN 0 /* minimal color hue */ +#define COLOR_HUEMAX 160 /* maximal color hue */ +#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.025 /* length of velocity vectors */ +#define BILLIARD_WIDTH 2 /* width of billiard */ +#define PARTICLE_WIDTH 2 /* width of particles */ +#define FRONT_WIDTH 3 /* width of wave front */ + +#define BLACK 1 /* set to 1 for black background */ +#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ +#define OUTER_COLOR 270.0 /* color outside billiard */ +#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ +#define PAINT_EXT 1 /* set to 1 to paint exterior */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ + +#define NXMAZE 36 /* width of maze */ +#define NYMAZE 36 /* height of maze */ +#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 15 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ +#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ +#define CLOSE_MAZE 1 /* set to 1 to close maze exits */ + +``` + +### 8 April 23 - 3D render of waves in a random medium, shown in their index of refraction landscape ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat_mod(phi, psi, xy_in); + + if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign; + add_circular_wave_mod(sign, 0.0, 0.0, phi, psi, xy_in); +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 2840 /* 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 -1.041666667 +#define YMAX 1.041666667 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 1 /* set to 1 for a variable index of refraction */ +#define IOR 5 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 14 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.05 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 75 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2200 /* number of frames of movie */ +#define NVID 4 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.25 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.00015 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.0075 /* wavelength of initial condition */ + + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 108 +#define CPLOT_B 108 /* plot type for second movie */ + + + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 0.1 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.2 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 14 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 3.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 25.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 240.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 20.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 500.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 5.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define ADD_POTENTIAL 1 /* set to 1 to add potential to z coordinate */ +#define POTENTIAL 10 +#define POT_FACT 30.0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +/* Parameters controlling 3D projection */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 7.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 0.15 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.8 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.1 /* overall y shift for REP_PROJ_3D representation */ + +``` + +### 7 April 23 - More periodic oscillations in a modified Brusselator ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 0 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 5.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 4.2 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.008 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 5000 /* number of frames of movie */ +#define NVID 175 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 20 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 0 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 5 +#define PLOT_B 0 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 200.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.02 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 0.0 /* initial velocity range */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 10.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 100.0 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 7.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 1 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 100 /* size of hashgrid in x direction */ +#define HASHY 50 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 6 April 23 - A Tesla valve with improved boundary conditions ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 71 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 0 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 1600 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 64 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 62 /* z coordinate in 3D plot */ +#define ZPLOT_B 61 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#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 BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 1 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 2.4 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.0 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +**Part 2:** +``` +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ +``` + +### 5 April 23 - 3D rendering of waves in a medium with random index of refraction ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat_mod(phi, psi, xy_in); + + if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign; + add_circular_wave_mod(sign, 0.0, 0.0, phi, psi, xy_in); +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 2840 /* 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 -1.041666667 +#define YMAX 1.041666667 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 1 /* set to 1 for a variable index of refraction */ +#define IOR 5 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 14 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.05 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 75 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2200 /* number of frames of movie */ +#define NVID 4 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.25 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.00015 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.0075 /* wavelength of initial condition */ + + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 108 +#define CPLOT_B 108 /* plot type for second movie */ + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 0.1 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.2 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 3.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 25.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 240.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 20.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 500.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 5.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +/* Parameters controlling 3D projection */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 7.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 0.15 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.8 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.1 /* overall y shift for REP_PROJ_3D representation */ + +``` + +### 4 April 23 - A second attempt at simulating the Belousov-Zhabotinsky/oregonator reaction ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 0 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.66 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 5.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 4.2 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.01 /* parameter controlling radius of particles */ +#define MU_B 0.008 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 5000 /* number of frames of movie */ +#define NVID 175 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 40 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 0 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 5 +#define PLOT_B 0 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 110.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 140.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 170.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 200.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.02 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 0.0 /* initial velocity range */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 10.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 100.0 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 7.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 14 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 8 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 6 /* initial condition of particles */ +#define REACTION_DIST 1.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.005 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 25 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 1 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 1.0 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 100 /* size of hashgrid in x direction */ +#define HASHY 50 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 3 April 23 - An Euler flow in a maze with repelling walls ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_laminar_flow(flow_speed_schedule(0), LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi, xy_in);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 541 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 100.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 0 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 2.0e-5 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 3 /* type of in-flow/out-flow boundary conditions for Euler equation */ +#define IN_OUT_BC_FACTOR 0.01 /* factor of convex combination between old and new flow */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.25 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.05 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2200 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 62 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 62 /* z coordinate in 3D plot */ +#define ZPLOT_B 61 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.5 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ + +#define NXMAZE 9 /* width of maze */ +#define NYMAZE 9 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.05 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 1 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 2.4 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.0 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 2 April 23 - Waves in a rotating medium, with fewer boundary effects ### + +**Program:** `wave_billiard.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat(phi, psi, xy_in); + + if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign; + add_circular_wave(sign, 0.0, 0.0, phi, psi, xy_in); +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +#define VARIABLE_IOR 1 /* set to 1 for a variable index of refraction */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* 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 */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.0005 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.25 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.04 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 50 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 1800 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* print speed of moving source */ + +#define PAUSE 200 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define PLOT 0 + +#define PLOT_B 5 /* plot type for second movie */ + +/* Color schemes */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.75 /* sensitivity of color on wave amplitude */ +#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 E_SCALE 60.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ +#define LOG_SHIFT 3.5 /* shift of colors on log scale */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#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 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POT_MAZE 7 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + +/* For debugging purposes only */ +#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + +### 1 April 23 - Cleaning up a maze using artificial intelligence ### + +**Program:** `particle_billiard.c` + +**Initial condition in function `animation()`:** `init_drop_config(0.05, 0.05, 0.0, DPI, configs);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define SAVE_MEMORY 1 /* set to 1 to save memory when writing tiff images */ +#define INVERT_COUNTER 1 /* set to 1 to save frames in inverse order */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#define XMIN -1.5 +#define XMAX 2.5 /* x interval */ +#define YMIN -1.125 +#define YMAX 1.125 /* y interval for 9/16 aspect ratio */ + +#define SCALING_FACTOR 1.0 /* scaling factor of drawing, needed for flower billiards, otherwise set to 1.0 */ + +/* Choice of the billiard table, see global_particles.c */ + +#define B_DOMAIN 31 /* choice of domain shape */ + +#define CIRCLE_PATTERN 1 /* pattern of circles */ +#define POLYLINE_PATTERN 14 /* pattern of polyline */ + +#define ABSORBING_CIRCLES 0 /* 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 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 1.5 /* parameter controlling shape of domain */ +#define MU 0.005 /* 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 */ +#define PENROSE_RATIO 2.5 /* parameter controlling the shape of small ellipses in Penrose room */ + +#define DRAW_BILLIARD 1 /* set to 1 to draw billiard */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw additional construction lines for billiard */ +#define PERIODIC_BC 0 /* set to 1 to enforce periodic boundary conditions when drawing particles */ + +#define RESAMPLE 0 /* set to 1 if particles should be added when dispersion too large */ +#define DEBUG 0 /* draw trajectories, for debugging purposes */ + +/* Simulation parameters */ + +#define NPART 20000 /* number of particles */ +#define NPARTMAX 100000 /* maximal number of particles after resampling */ +#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 0 /* set to 1 to keep trails of the particles */ +#define HEATMAP 1 /* set to 1 to show heat map of particles */ +#define DRAW_FINAL_HEATMAP 0 /* set to 1 to show final heat map of particles */ +#define DRAW_HEATMAP_HISTOGRAM 1 /* set to 1 to draw a histogram of particle distribution in heat map */ +#define NBIN_FACTOR 6.0 /* constant controlling number of bins in histogram */ +#define DRAW_HEATMAP_PARTICLES 1 /* set to 1 to draw particles in heat map */ +#define HEATMAP_MAX_PART_BY_CELL 0 /* set to positive value to draw only limited number of particles in cell */ +#define PLOT_HEATMAP_AVERAGE 0 /* set to 1 to plot average number of particles in heat map */ +#define SHOWZOOM 0 /* set to 1 to show zoom on specific area */ +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */ +#define PRINT_LEFT_RIGHT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles on left and right side */ +#define PRINT_CIRCLE_PARTICLE_NUMBER 0 /* set to 1 to print number of particles outside circular maze */ +#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 TEST_INITIAL_COND 0 /* set to 1 to allow only initial conditions that pass a test */ + +#define NSTEPS 8000 /* number of frames of movie */ +#define TIME 3000 /* time between movie frames, for fluidity of real-time simulation */ +#define DPHI 0.00002 /* integration step */ +#define NVID 25 /* number of iterations between images displayed on screen */ +#define END_FRAMES 50 /* 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 */ +/* However, increasing DPHI too much deterioriates quality of simulation */ +/* NVID tells how often a picture is drawn in the animation, increase it for faster anim */ +/* For a good quality movie, take for instance TIME = 400, DPHI = 0.00005, NVID = 100 */ + +/* Colors and other graphical parameters */ + +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ + +#define NCOLORS 500 /* number of colors */ +#define COLORSHIFT 0 /* hue of initial color */ +#define COLOR_HUEMIN 0 /* minimal color hue */ +#define COLOR_HUEMAX 300 /* maximal color hue */ +#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.025 /* length of velocity vectors */ +#define BILLIARD_WIDTH 2 /* width of billiard */ +#define PARTICLE_WIDTH 2 /* width of particles */ +#define FRONT_WIDTH 3 /* width of wave front */ + +#define BLACK 1 /* set to 1 for black background */ +#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */ +#define OUTER_COLOR 270.0 /* color outside billiard */ +#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon/Reuleaux) */ +#define PAINT_EXT 1 /* set to 1 to paint exterior */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 40 /* height of maze */ +#define MAZE_MAX_NGBH 8 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 15 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_RANDOM_FACTOR 0.1 /* randomization factor for S_MAZE_RANDOM */ +#define MAZE_CORNER_RADIUS 0.5 /* radius of tounded corners in maze */ +#define CLOSE_MAZE 1 /* set to 1 to close maze exits */ + +``` + diff --git a/Parameters_May23.md b/Parameters_May23.md new file mode 100644 index 0000000..2a28a2e --- /dev/null +++ b/Parameters_May23.md @@ -0,0 +1,6249 @@ +### Parameter values for YouTube simulations ### + +Created by **Nils Berglund** and optimized by **Marco Mancini** + +C code for videos on YouTube Channel https://www.youtube.com/c/NilsBerglund + +Below are parameter values used for different simulations, as well as initial conditions used in +function animation. Some simulations use variants of the published code. The list is going to be +updated gradually. + + +### 30 May 23 - ### + +**Program:** `` + +**Initial condition in function `animation()`:** `` + +``` + +``` + +### 28 May 23 - Fish swarm on a surface of genus 2 ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 10 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.3 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3800 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 14 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 0.1 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 2.0e3 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 27 May 23 - ### + +**Program:** `` + +**Initial condition in function `animation()`:** `` + +``` + +``` + +### 26 May 23 - ### + +**Program:** `` + +**Initial condition in function `animation()`:** `` + +``` + +``` + +### 25 May 23 - Fish swarm on the projective plane ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 10 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2800 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 13 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 0.1 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.5 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 24 May 23 - 3D render of a rotating beam in a circular phased a&rray ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** + +``` + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + phase_shift = 1/30.0; + if (first_source) for (k=0; k<25; k++) + { + angle = 0.0; + omega = DPI/25.0; + wave_source[k].xc = 0.05*cos((double)k*omega);; + wave_source[k].yc = 0.05*sin((double)k*omega); + wave_source[k].phase = 0.99 - 1.4*sin(0.7*(1.0 + wave_source[k].xc/0.05)); + wave_source[k].amp = 1.0; + wave_source[k].sign = 1; + } + first_source = 0; + + for (k=0; k<25; k++) + wave_source[k].phase += 1.4*sin(0.7*(1.0 + wave_source[k].xc*cos(angle)/0.05 + wave_source[k].yc*sin(angle)/0.05)); + + angle = DPI*(double)i/(double)NSTEPS; + + for (k=0; k<25; k++) + { + wave_source[k].phase += phase_shift; + wave_source[k].phase -= 1.4*sin(0.7*(1.0 + wave_source[k].xc*cos(angle)/0.05 + wave_source[k].yc*sin(angle)/0.05)); + + if (wave_source[k].phase > 1.0) + { + add_circular_wave_mod((double)wave_source[k].sign*wave_source[k].amp, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 1700 /* number of grid points on x axis */ +#define NY 1700 /* number of grid points on y axis */ + +#define XMIN -1.5 +#define XMAX 1.5 /* x interval */ +#define YMIN -1.5 +#define YMAX 1.5 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 101 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 2000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 20.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 8 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.06 /* Courant number */ +#define COURANTB 0.06 /* Courant number in medium B */ +#define GAMMA 0.0 /* damping factor in wave equation */ +#define GAMMAB 1.0e-6 /* damping factor in wave equation */ +#define GAMMA_SIDES 1.0e-4 /* damping factor on boundary */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2450 /* number of frames of movie */ +#define NVID 5 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.007 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 112 +#define CPLOT_B 113 /* plot type for second movie */ + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 0.4 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.5 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 15 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 2.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 15.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 240.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 4000.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 2.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 5.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define ADD_POTENTIAL 1 /* set to 1 to add potential to z coordinate */ +// #define POT_MAZE 7 +#define POTENTIAL 10 +#define POT_FACT 400.0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +/* Parameters controlling 3D projection */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 0.5 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.8 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.2 /* overall y shift for REP_PROJ_3D representation */ + +``` + +### 23 May 23 - ### + +**Program:** `` + +**Initial condition in function `animation()`:** `` + +``` + +``` + +### 21 May 23 - ### + +**Program:** `` + +**Initial condition in function `animation()`:** `` + +``` + +``` + +### 20 May 23 - Fish swarm on a Klein bottle ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ +#define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.97 +#define INITXMAX 1.97 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -2.0 +#define BCXMAX 2.0 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 10 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2800 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 11 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 0.1 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.5 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 19 May 23 - Rotating the beam in a circular phase array ### + +**Program:** `wave_billiard.c` + +**Initial condition in function `animation()`:** + +``` + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + if (first_source) for (k=0; k<25; k++) + { + omega = DPI/25.0; + wave_source[k].xc = 0.05*cos((double)k*omega);; + wave_source[k].yc = 0.05*sin((double)k*omega); + wave_source[k].phase = 0.99 - 1.4*sin(0.7*(1.0 + wave_source[k].xc/0.05)); + wave_source[k].amp = 1.0; + wave_source[k].sign = 1; + first_source = 0; + } + + for (k=0; k<25; k++) + wave_source[k].phase += 1.4*sin(0.7*(1.0 + wave_source[k].xc*cos(angle)/0.05 + wave_source[k].yc*sin(angle)/0.05)); + + angle = DPI*(double)i/(double)NSTEPS; + + for (k=0; k<25; k++) + { + wave_source[k].phase += 0.07; + wave_source[k].phase -= 1.4*sin(0.7*(1.0 + wave_source[k].xc*cos(angle)/0.05 + wave_source[k].yc*sin(angle)/0.05)); + + if (wave_source[k].phase > 1.0) + { + add_circular_wave((double)wave_source[k].sign*wave_source[k].amp, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* 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 */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.0005 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.25 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.06 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2750 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* print speed of moving source */ +#define PRINT_FREQUENCY 0 /* print frequency (for phased array) */ + +#define PAUSE 200 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +#define INITIAL_AMP 0.007 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define PLOT 0 + +#define PLOT_B 7 /* plot type for second movie */ + +/* Color schemes */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 0 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#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 E_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ +#define LOG_SHIFT 3.5 /* shift of colors on log scale */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#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.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POT_MAZE 7 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + +/* For debugging purposes only */ +#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + +### 18 May 23 - Interacting high- and low-pressure systems under a Coriolis force - Wind direction and vorticity ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** +``` + init_laminar_flow(0.05, LAMINAR_FLOW_MODULATION, 0.015, 0.1, 1.0, 0.0, 0.1, phi, xy_in); + add_vortex_state(0.2, 0.75, 0.1, 0.3, -0.5, phi, xy_in); + add_vortex_state(-0.35, -0.75, -0.1, 0.4, 0.5, phi, xy_in); + add_vortex_state(0.1, -0.3, 0.7, 0.1, -0.5, phi, xy_in); +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 0 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ +#define ADD_CORIOLIS_FORCE 1 /* set to 1 to add Coriolis force (quasigeostrophic Euler equations) */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 0 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 72 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 0.004 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 0 /* type of in-flow/out-flow boundary conditions for Euler equation, 0 for no b.c. */ +#define IN_OUT_BC_FACTOR 0.001 /* factor of convex combination between old and new flow */ +#define BC_FLOW_TYPE 1 /* type of initial condition */ + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ +#define PRESSURE_GRADIENT 0.3 /* amplitude of pressure gradient for Euler equation */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2250 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 64 +#define CPLOT_B 62 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 0 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 2.0 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 10.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 10.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 2.6 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 7.5 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 20.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.0 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 17 May 23 - Swarm formation in a Vicsek model ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 720 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#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 */ + +#define INITXMIN -1.1 +#define INITXMAX 1.1 /* x interval for initial condition */ +#define INITYMIN -1.1 +#define INITYMAX 1.1 /* y interval for initial condition */ + +#define BCXMIN -1.125 +#define BCXMAX 1.125 /* x interval for boundary condition */ +#define BCYMIN -1.125 +#define BCYMAX 1.125 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 0 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 181 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 2 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.3 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 10 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 1.5 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.035 /* parameter controlling radius of particles */ +#define MU_B 0.012 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 1300 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 3 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ + +#define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 0 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 1.2e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 260.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 210.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 160.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 290.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 0.1 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ + +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.002 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ +#define GRAVITY 0.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.5 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 1 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.5 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 4 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 200 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 1 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 1000.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 1 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 1.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 1 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 5 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 2 /* initial condition of particles */ +#define REACTION_DIST 3.5 /* maximal distance for reaction to occur */ +#define REACTION_PROB 0.5 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 0 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 500.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 0 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.6 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 10 /* width of maze */ +#define NYMAZE 10 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 200 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 16 May 23 - Increasing the frequency of a circular phased array with one main beam ### + +**Program:** `wave_billiard.c` + +**Initial condition in function `animation()`:** + +``` + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + phase_shift = 0.02 + 0.06*(double)i/(double)NSTEPS; + + if (first_source) for (k=0; k<25; k++) + { + omega = DPI/25.0; + wave_source[k].xc = 0.05*cos((double)k*omega);; + wave_source[k].yc = 0.05*sin((double)k*omega); + wave_source[k].phase = 0.99 - 1.4*sin(0.7*(1.0 + wave_source[k].xc/0.05)); + wave_source[k].amp = 1.0; + if (wave_source[k].phase) wave_source[k].sign = 1; + else wave_source[k].sign = -1; + first_source = 0; + } + + for (k=0; k<25; k++) + { + wave_source[k].phase += phase_shift; + if (wave_source[k].phase > 1.0) + { + add_circular_wave((double)wave_source[k].sign*wave_source[k].amp, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* 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 */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.0005 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.25 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.06 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2100 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* print speed of moving source */ +#define PRINT_FREQUENCY 1 /* print frequency (for phased array) */ + +#define PAUSE 200 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +#define INITIAL_AMP 0.01 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define PLOT 0 + +#define PLOT_B 5 /* plot type for second movie */ + +/* Color schemes */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#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 E_SCALE 60.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ +#define LOG_SHIFT 3.5 /* shift of colors on log scale */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#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.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POT_MAZE 7 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + +/* For debugging purposes only */ +#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +#define MEAN_FLUX (PLOT == P_TOTAL_ENERGY_FLUX)||(PLOT_B == P_TOTAL_ENERGY_FLUX) +#define REFRESH_IOR ((IOR == IOR_PERIODIC_WELLS_ROTATING)||(IOR == IOR_PERIODIC_WELLS_ROTATING_LARGE)) + +``` + +### 14 May 23 - Interacting high- and low-pressure systems under a Coriolis force ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** + +``` + init_laminar_flow(0.05, LAMINAR_FLOW_MODULATION, 0.015, 0.1, 1.0, 0.0, 0.1, phi, xy_in); + add_vortex_state(0.2, 0.75, 0.1, 0.3, -0.5, phi, xy_in); + add_vortex_state(-0.35, -0.75, -0.1, 0.4, 0.5, phi, xy_in); + add_vortex_state(0.1, -0.3, 0.7, 0.1, -0.5, phi, xy_in); +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 0 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ +#define ADD_CORIOLIS_FORCE 1 /* set to 1 to add Coriolis force (quasigeostrophic Euler equations) */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 0 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 72 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 0.004 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 0 /* type of in-flow/out-flow boundary conditions for Euler equation, 0 for no b.c. */ +#define IN_OUT_BC_FACTOR 0.001 /* factor of convex combination between old and new flow */ +#define BC_FLOW_TYPE 1 /* type of initial condition */ + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ +#define PRESSURE_GRADIENT 0.3 /* amplitude of pressure gradient for Euler equation */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2250 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 60 +#define CPLOT_B 61 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 0 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 2.0 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 10.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 10.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 2.6 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 7.5 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 20.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.0 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 13 May 23 - Rocket comparison 14: Bell-shaped vs straight nozzle, when fueled by a chemical reaction ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#define XMIN -3.3 +#define XMAX 4.7 /* x interval */ +#define YMIN -2.25 +#define YMAX 2.25 /* y interval for 9/16 aspect ratio */ + +#define INITXMIN -2.0 +#define INITXMAX 2.0 /* x interval for initial condition */ +#define INITYMIN -1.7 +#define INITYMAX 1.7 /* y interval for initial condition */ + +#define BCXMIN -7.1 +#define BCXMAX 8.1 /* x interval for boundary condition */ +#define BCYMIN -6.5 +#define BCYMAX 44.0 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 102 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 1 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 5 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.5 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 2.4 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.8 /* parameter controlling the dimensions of domain */ +#define MU 0.009 /* parameter controlling radius of particles */ +#define MU_B 0.009 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 4700 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 0 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 150 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 20 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 5 +#define PLOT_B 8 /* plot type for second movie */ + +#define DRAW_BONDS 0 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 1 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 1 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 1 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 2.0e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 280.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 180.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 210.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 4.5 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 3.5 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 5.0 /* damping coefficient of particles */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define INITIAL_DAMPING 5.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 1.0 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.2 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 0.0 /* initial velocity range */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.02 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 7.5 /* radius in which to count neighbours */ +#define GRAVITY 15.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 0 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.02 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 1 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 20 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 0 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 500.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 0 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 5.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 0 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 2 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 3 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 8 /* initial condition of particles */ +#define REACTION_DIST 4.0 /* maximal distance for reaction to occur */ +#define REACTION_PROB 1.0 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 1 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 2000.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 0 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 1 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 1 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.25 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 6 /* width of maze */ +#define NYMAZE 6 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 1 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 120 /* size of hashgrid in x direction */ +#define HASHY 450 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 12 May 23 - A circular phased array with one main beam ### + +**Program:** `wave_billiard.c` + +**Initial condition in function `animation()`:** + +``` + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + if (first_source) for (k=0; k<25; k++) + { + omega = DPI/25.0; + wave_source[k].xc = 0.05*cos((double)k*omega);; + wave_source[k].yc = 0.05*sin((double)k*omega); + wave_source[k].phase = 0.99 - 1.4*sin(0.7*(1.0 + wave_source[k].xc/0.05)); + wave_source[k].amp = 1.0; + if (wave_source[k].phase) wave_source[k].sign = 1; + else wave_source[k].sign = -1; + first_source = 0; + } + + for (k=0; k<25; k++) + { + wave_source[k].phase += 0.06; + if (wave_source[k].phase > 1.0) + { + add_circular_wave((double)wave_source[k].sign*wave_source[k].amp, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* 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 */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.0005 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.25 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.06 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2100 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* print speed of moving source */ + +#define PAUSE 200 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +#define INITIAL_AMP 0.01 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define PLOT 0 + +#define PLOT_B 5 /* plot type for second movie */ + +/* Color schemes */ + +#define COLOR_PALETTE 17 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#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 E_SCALE 60.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ +#define LOG_SHIFT 3.5 /* shift of colors on log scale */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#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.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POT_MAZE 7 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + +/* For debugging purposes only */ +#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + +### 11 May 23 - Tesla valves: Comparison of the forward and backward flow ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** `init_pressure_gradient_flow(flow_speed_schedule(0), 1.0 + PRESSURE_GRADIENT, 1.0 - PRESSURE_GRADIENT, phi, xy_in, bc_field);` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1150 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 575 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -2.2 +#define YMAX 1.8 /* x interval */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 1 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 1 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 72 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 1.0e-4 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 6 /* type of in-flow/out-flow boundary conditions for Euler equation, 0 for no b.c. */ +#define IN_OUT_BC_FACTOR 0.001 /* factor of convex combination between old and new flow */ +#define BC_FLOW_TYPE 1 /* type of initial condition */ + + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ +#define PRESSURE_GRADIENT 0.3 /* amplitude of pressure gradient for Euler equation */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 1200 /* number of frames of movie */ +#define NVID 300 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 60 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 1 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 11 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.25 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.1 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 10.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 10.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 1 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 10 May 23 - Rocket comparison 13: Round vs square chamber, when fueled by a chemical reaction ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#define XMIN -3.3 +#define XMAX 4.7 /* x interval */ +#define YMIN -2.25 +#define YMAX 2.25 /* y interval for 9/16 aspect ratio */ + +#define INITXMIN -2.0 +#define INITXMAX 2.0 /* x interval for initial condition */ +#define INITYMIN -1.7 +#define INITYMAX 1.7 /* y interval for initial condition */ + +#define BCXMIN -7.1 +#define BCXMAX 8.1 /* x interval for boundary condition */ +#define BCYMIN -6.5 +#define BCYMAX 44.0 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 102 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 0 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 1 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 1 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.5 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 2.4 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.8 /* parameter controlling the dimensions of domain */ +#define MU 0.009 /* parameter controlling radius of particles */ +#define MU_B 0.009 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 5700 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 0 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 150 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 20 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 5 +#define PLOT_B 8 /* plot type for second movie */ + +#define DRAW_BONDS 0 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 1 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 1 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 1 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 2.0e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 280.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 180.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 210.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 4.5 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 3.5 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 5.0 /* damping coefficient of particles */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define INITIAL_DAMPING 5.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 1.0 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.2 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 0.0 /* initial velocity range */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.02 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 7.5 /* radius in which to count neighbours */ +#define GRAVITY 15.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 0 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.02 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 1 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 20 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 0 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 1.5 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 500.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 0 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 5.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 0 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 2 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 3 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 8 /* initial condition of particles */ +#define REACTION_DIST 4.0 /* maximal distance for reaction to occur */ +#define REACTION_PROB 1.0 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 1 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 2000.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 0 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 1 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 1 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.25 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 6 /* width of maze */ +#define NYMAZE 6 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 1 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 120 /* size of hashgrid in x direction */ +#define HASHY 450 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 9 May 23 - 3D render of an asymmetric circular phased array ### + +**Program:** `wave_3d.c` + +**Initial condition in function `animation()`:** +``` + init_wave_flat_mod(phi, psi, xy_in); + + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + if (first_source) for (k=0; k<25; k++) + { + omega = DPI/25.0; + wave_source[k].xc = 0.06*cos((double)k*omega);; + wave_source[k].yc = 0.06*sin((double)k*omega); + wave_source[k].phase = 1.1 - (double)(k+1)*1.0/5.0; + wave_source[k].amp = 0.5*(1.0 + cos((double)k*omega)); + wave_source[k].sign = 1; + first_source = 0; + } + + for (k=0; k<25; k++) + { + wave_source[k].phase += 1.0/15.0; + if (wave_source[k].phase > 1.0) + { + add_circular_wave_mod((double)wave_source[k].sign*wave_source[k].amp, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 1700 /* number of grid points on x axis */ +#define NY 1700 /* number of grid points on y axis */ + +#define XMIN -1.5 +#define XMAX 1.5 /* x interval */ +#define YMIN -1.5 +#define YMAX 1.5 /* y interval for 9/16 aspect ratio */ + +#define HIGHRES 0 /* set to 1 if resolution of grid is double that of displayed image */ + +#define JULIA_SCALE 0.8 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 2 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 101 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.0 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 2000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 20.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 8 /* number of grid point for grid of disks */ +#define NGRIDY 8 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 3 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.001 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.06 /* Courant number */ +#define COURANTB 0.06 /* Courant number in medium B */ +#define GAMMA 0.0 /* damping factor in wave equation */ +#define GAMMAB 1.0e-6 /* damping factor in wave equation */ +#define GAMMA_SIDES 1.0e-4 /* damping factor on boundary */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +// #define B_COND 1 +#define B_COND 2 + +#define PRECOMPUTE_BC 0 /* set to 1 to compute neighbours for Laplacian in advance */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2200 /* number of frames of movie */ +#define NVID 6 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* set to 1 to print speed of moving source */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 3 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define MID_FRAMES 100 /* 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 */ +#define ROTATE_VIEW_WHILE_FADE 1 /* set to 1 to keep rotating viewpoint during fade */ + +/* Parameters of initial condition */ + +#define INITIAL_AMP 0.02 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define ZPLOT 103 /* wave height */ +#define CPLOT 103 /* color scheme */ + +#define ZPLOT_B 108 +#define CPLOT_B 108 /* plot type for second movie */ + +#define CHANGE_LUMINOSITY 1 /* set to 1 to let luminosity depend on energy flux intensity */ +#define FLUX_WINDOW 30 /* size of averaging window of flux intensity */ +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define FLOOR_ZCOORD 1 /* set to 1 to draw only facets with z not too negative */ +#define DRAW_BILLIARD 0 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 0 /* set to 1 to draw front of boundary after drawing wave */ +#define DRAW_CONSTRUCTION_LINES 0 /* set to 1 to draw construction lines of certain domains */ +#define FADE_IN_OBSTACLE 1 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental, draw outside of billiard in gray */ + +#define PLOT_SCALE_ENERGY 0.4 /* vertical scaling in energy plot */ +#define PLOT_SCALE_LOG_ENERGY 0.5 /* vertical scaling in log energy plot */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +/* Color schemes */ + +#define COLOR_PALETTE 15 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.75 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 2.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define VSCALE_ENERGY 15.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 E_SCALE 240.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.75 /* scaling factor for energy log representation */ +#define LOG_SHIFT 0.5 /* shift of colors on log scale */ +#define LOG_ENERGY_FLOOR -10.0 /* floor value for log of (total) energy */ +#define LOG_MEAN_ENERGY_SHIFT 1.0 /* additional shift for log of mean energy */ +#define FLUX_SCALE 20.0 /* scaling factor for energy flux representation */ +#define FLUX_CSCALE 500.0 /* scaling factor for color in energy flux representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 240.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -200.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 5 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 5.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define ADD_POTENTIAL 1 /* set to 1 to add potential to z coordinate */ +#define POTENTIAL 10 +#define POT_FACT 400.0 +/* end of constants only used by sub_wave and sub_maze */ + + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +/* Parameters controlling 3D projection */ + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, -0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 8.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 0.2 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.8 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D -0.1 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D 0.2 /* overall y shift for REP_PROJ_3D representation */ + +``` + +### 7 May 23 - The Coriolis force stabilizes pressure systems - Wind speed and vorticity ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** +``` + init_vortex_state(0.1, 0.4, 0.1, 0.3, -0.1, phi, xy_in); + add_vortex_state(-0.15, -0.4, -0.1, 0.4, 0.1, phi, xy_in); +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 0 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ +#define ADD_CORIOLIS_FORCE 1 /* set to 1 to add Coriolis force (quasigeostrophic Euler equations) */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 0 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 72 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 0.01 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 0 /* type of in-flow/out-flow boundary conditions for Euler equation, 0 for no b.c. */ +#define IN_OUT_BC_FACTOR 0.001 /* factor of convex combination between old and new flow */ +#define BC_FLOW_TYPE 1 /* type of initial condition */ + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ +#define PRESSURE_GRADIENT 0.3 /* amplitude of pressure gradient for Euler equation */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2550 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 61 +#define CPLOT_B 62 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 0 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 13 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 10 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.25 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.0 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 15.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 20.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.0 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 6 May 23 - A rocket using its fuel gradually ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1280 /* window width */ +#define WINHEIGHT 720 /* window height */ + +#define XMIN -3.3 +#define XMAX 4.7 /* x interval */ +#define YMIN -2.25 +#define YMAX 2.25 /* y interval for 9/16 aspect ratio */ + +#define INITXMIN -0.7 +#define INITXMAX 0.7 /* x interval for initial condition */ +#define INITYMIN -1.7 +#define INITYMAX 1.7 /* y interval for initial condition */ + +#define BCXMIN -7.1 +#define BCXMAX 8.1 /* x interval for boundary condition */ +#define BCYMIN -6.5 +#define BCYMAX 44.0 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 101 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 1 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.5 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 2.4 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.8 /* parameter controlling the dimensions of domain */ +#define MU 0.009 /* parameter controlling radius of particles */ +#define MU_B 0.009 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 5200 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 50 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 150 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 20 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 5 +#define PLOT_B 8 /* plot type for second movie */ + +#define DRAW_BONDS 0 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 1 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 1 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 1 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 2.0e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 280.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 180.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 210.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 4.5 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 3.5 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 5.0 /* damping coefficient of particles */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define INITIAL_DAMPING 5.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 1.0 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.2 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 0.0 /* initial velocity range */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.02 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 7.5 /* radius in which to count neighbours */ +#define GRAVITY 15.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 0 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.02 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 1 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 20 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 0 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 0.0 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 500.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 0 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 5.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 0 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 2.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 2 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 3 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 7 /* initial condition of particles */ +#define REACTION_DIST 4.0 /* maximal distance for reaction to occur */ +#define REACTION_PROB 1.0 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 1 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 2000.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 0 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 1 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 1 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.25 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 6 /* width of maze */ +#define NYMAZE 6 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 1 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 120 /* size of hashgrid in x direction */ +#define HASHY 450 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 5 May 23 - An asymmetric circular phased array with four beams ### + +**Program:** `wave_billiard.c` + +**Initial condition in function `animation()`:** + +``` + init_wave_flat(phi, psi, xy_in); + + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + if (first_source) for (k=0; k<25; k++) + { + omega = DPI/25.0; + wave_source[k].xc = 0.06*cos((double)k*omega);; + wave_source[k].yc = 0.06*sin((double)k*omega); + wave_source[k].phase = 1.1 - (double)(k+1)*1.0/5.0; + wave_source[k].amp = 0.5*(1.0 + cos((double)k*omega)); + wave_source[k].sign = 1; + first_source = 0; + } + + for (k=0; k<25; k++) + { + wave_source[k].phase += 1.0/15.0; + if (wave_source[k].phase > 1.0) + { + add_circular_wave((double)wave_source[k].sign*wave_source[k].amp, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* 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 */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.0005 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.25 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.04 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2300 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* print speed of moving source */ + +#define PAUSE 200 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +#define INITIAL_AMP 0.02 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define PLOT 0 + +#define PLOT_B 5 /* plot type for second movie */ + +/* Color schemes */ + +#define COLOR_PALETTE 15 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#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 E_SCALE 60.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ +#define LOG_SHIFT 3.5 /* shift of colors on log scale */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#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.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POT_MAZE 7 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + +/* For debugging purposes only */ +#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + +### 4 May 23 - The Coriolis force stabilizes pressure systems ### + +**Program:** `rde.c` + +**Initial condition in function `animation()`:** +``` + init_vortex_state(0.1, 0.4, 0.1, 0.3, -0.1, phi, xy_in); + add_vortex_state(-0.15, -0.4, -0.1, 0.4, 0.1, phi, xy_in); +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 960 /* number of grid points on x axis */ +#define NY 575 /* number of grid points on y axis */ + +#define XMIN -2.0 +#define XMAX 2.0 /* x interval */ +#define YMIN -1.197916667 +#define YMAX 1.197916667 /* y interval for 9/16 aspect ratio */ + +/* Choice of simulated equation */ + +#define RDE_EQUATION 7 /* choice of reaction term, see list in global_3d.c */ +#define NFIELDS 3 /* number of fields in reaction-diffusion equation */ +#define NLAPLACIANS 0 /* number of fields for which to compute Laplacian */ + +#define ADD_POTENTIAL 0 /* set to 1 to add a potential (for Schrodinger equation) */ +#define ADD_MAGNETIC_FIELD 0 /* set to 1 to add a magnetic field (for Schrodinger equation) - then set POTENTIAL 1 */ +#define ADD_FORCE_FIELD 0 /* set to 1 to add a foce field (for compressible Euler equation) */ +#define POTENTIAL 7 /* type of potential or vector potential, see list in global_3d.c */ +#define FORCE_FIELD 5 /* type of force field, see list in global_3d.c */ +#define ADD_CORIOLIS_FORCE 1 /* set to 1 to add Coriolis force (quasigeostrophic Euler equations) */ + +#define ANTISYMMETRIZE_WAVE_FCT 0 /* set tot 1 to make wave function antisymmetric */ +#define ADAPT_STATE_TO_BC 0 /* to smoothly adapt initial state to obstacles */ +#define OBSTACLE_GEOMETRY 72 /* geometry of obstacles, as in B_DOMAIN */ +#define BC_STIFFNESS 50.0 /* controls region of boundary condition control */ + +#define JULIA_SCALE 0.5 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 99 /* pattern of circles, see list in global_pdes.c */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.6 /* parameter controlling the dimensions of domain */ +#define MU 0.08 /* parameter controlling the dimensions of domain */ +#define NPOLY 5 /* number of sides of polygon */ +#define APOLY 2.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 7 /* depth of computation of Menger gasket */ +#define MRATIO 5 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 15 /* number of grid point for grid of disks */ +#define NGRIDY 20 /* number of grid point for grid of disks */ +#define REVERSE_TESLA_VALVE 1 /* set to 1 to orient Tesla valve in blocking configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -1.65 +#define ISO_XSHIFT_RIGHT 0.4 +#define ISO_YSHIFT_LEFT -0.05 +#define ISO_YSHIFT_RIGHT -0.05 +#define ISO_SCALE 0.85 /* coordinates for isospectral billiards */ + +/* You can add more billiard tables by adapting the functions */ +/* xy_in_billiard and draw_billiard in sub_wave.c */ + +/* Physical patameters of wave equation */ + +#define DT 0.00000025 + +#define VISCOSITY 2.0 + +#define RPSA 0.75 /* parameter in Rock-Paper-Scissors-type interaction */ +#define RPSLZB 0.75 /* second parameter in Rock-Paper-Scissors-Lizard-Spock type interaction */ + +#define EPSILON 0.8 /* time scale separation */ +#define DELTA 0.1 /* time scale separation */ +#define FHNA 1.0 /* parameter in FHN equation */ +#define FHNC -0.01 /* parameter in FHN equation */ +#define K_HARMONIC 1.0 /* spring constant of harmonic potential */ +#define K_COULOMB 0.5 /* constant in Coulomb potential */ +#define V_MAZE 0.4 /* potential in walls of maze */ +#define BZQ 0.0008 /* parameter in BZ equation */ +#define BZF 1.2 /* parameter in BZ equation */ +#define B_FIELD 10.0 /* magnetic field */ +#define G_FIELD 0.01 /* gravity/constant in repulsive field from obstacles */ +#define AB_RADIUS 0.2 /* radius of region with magnetic field for Aharonov-Bohm effect */ +#define K_EULER 50.0 /* constant in stream function integration of Euler equation */ +#define K_EULER_INC 0.5 /* constant in incompressible Euler equation */ + +#define SMOOTHEN_VORTICITY 0 /* set to 1 to smoothen vorticity field in Euler equation */ +#define SMOOTHEN_VELOCITY 1 /* set to 1 to smoothen velocity field in Euler equation */ +#define SMOOTHEN_PERIOD 10 /* period between smoothenings */ +#define SMOOTH_FACTOR 0.15 /* factor by which to smoothen */ + +#define ADD_TRACERS 1 /* set to 1 to add tracer particles (for Euler equations) */ +#define N_TRACERS 1000 /* number of tracer particles */ +#define TRACERS_STEP 0.005 /* step size in tracer evolution */ + +#define T_OUT 2.0 /* outside temperature */ +#define T_IN 0.0 /* inside temperature */ +#define SPEED 0.0 /* speed of drift to the right */ + +#define ADD_NOISE 0 /* set to 1 to add noise, set to 2 to add noise in right half */ +#define NOISE_INTENSITY 0.005 /* noise intensity */ +#define CHANGE_NOISE 1 /* set to 1 to increase noise intensity */ +#define NOISE_FACTOR 40.0 /* factor by which to increase noise intensity */ +#define NOISE_INITIAL_TIME 100 /* initial time during which noise remains constant */ + +#define CHANGE_VISCOSITY 0 /* set to 1 to change the viscosity in the course of the simulation */ +#define ADJUST_INTSTEP 0 /* set to 1 to decrease integration step when viscosity increases */ +#define VISCOSITY_INITIAL_TIME 10 /* initial time during which viscosity remains constant */ +#define VISCOSITY_FACTOR 100.0 /* factor by which to change viscosity */ +#define VISCOSITY_MAX 2.0 /* max value of viscosity beyond which NVID is increased and integration step is decrase, + for numerical stability */ + +#define CHANGE_RPSLZB 0 /* set to 1 to change second parameter in Rock-Paper-Scissors-Lizard-Spock equation */ +#define RPSLZB_CHANGE 0.75 /* factor by which to rpslzb parameter */ +#define RPSLZB_INITIAL_TIME 0 /* initial time during which rpslzb remains constant */ +#define RPSLZB_FINAL_TIME 500 /* final time during which rpslzb remains constant */ + +#define CHANGE_FLOW_SPEED 0 /* set to 1 to change speed of laminar flow */ +#define IN_OUT_FLOW_BC 0 /* type of in-flow/out-flow boundary conditions for Euler equation, 0 for no b.c. */ +#define IN_OUT_BC_FACTOR 0.001 /* factor of convex combination between old and new flow */ +#define BC_FLOW_TYPE 1 /* type of initial condition */ + /* see list in global_pdes.c */ +#define IN_OUT_FLOW_MIN_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - min value */ +#define IN_OUT_FLOW_AMP 0.45 /* amplitude of in-flow/out-flow boundary conditions (for Euler equation) - max value */ +#define LAMINAR_FLOW_MODULATION 0.01 /* asymmetry of laminar flow */ +#define LAMINAR_FLOW_YPERIOD 1.0 /* period of laminar flow in y direction */ +#define PRESSURE_GRADIENT 0.3 /* amplitude of pressure gradient for Euler equation */ + +#define EULER_GRADIENT_YSHIFT 0.0 /* y-shift in computation of gradient in Euler equation */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 1 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 2500 /* number of frames of movie */ +#define NVID 100 /* number of iterations between images displayed on screen */ +#define ACCELERATION_FACTOR 1.0 /* factor by which to increase NVID in course of simulation */ +#define DT_ACCELERATION_FACTOR 1.0 /* factor by which to increase time step in course of simulation */ +#define MAX_DT 0.024 /* maximal value of integration step */ +#define NSEG 100 /* number of segments of boundary */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ + +#define PAUSE 100 /* number of frames after which to pause */ +#define PSLEEP 2 /* sleep time during pause */ +#define SLEEP1 2 /* initial sleeping time */ +#define SLEEP2 1 /* final sleeping time */ +#define INITIAL_TIME 0 /* initial still time */ +#define MID_FRAMES 50 /* number of still frames between parts of two-part movie */ +#define END_FRAMES 50 /* number of still frames at end of movie */ +#define FADE 1 /* set to 1 to fade at end of movie */ + +/* Visualisation */ + +#define PLOT_3D 0 /* controls whether plot is 2D or 3D */ + +#define ROTATE_VIEW 0 /* set to 1 to rotate position of observer */ +#define ROTATE_ANGLE 360.0 /* total angle of rotation during simulation */ + +#define DRAW_PERIODICISED 0 /* set to 1 to repeat wave periodically in x and y directions */ + +/* Plot type - color scheme */ + +#define CPLOT 60 +#define CPLOT_B 64 + +/* Plot type - height of 3D plot */ + +#define ZPLOT 61 /* z coordinate in 3D plot */ +#define ZPLOT_B 64 /* z coordinate in second 3D plot */ + +#define AMPLITUDE_HIGH_RES 1 /* set to 1 to increase resolution of P_3D_AMPLITUDE plot */ +#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */ +#define NON_DIRICHLET_BC 0 /* set to 1 to draw only facets in domain, if field is not zero on boundary */ +#define WRAP_ANGLE 1 /* experimental: wrap angle to [0, 2Pi) for interpolation in angle schemes */ +#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */ +#define DRAW_OUTSIDE_GRAY 0 /* experimental - draw outside of billiard in gray */ +#define ADD_POTENTIAL_TO_Z 1 /* set to 1 to add the external potential to z-coordinate of plot */ +#define ADD_POT_CONSTANT 0.35 /* constant in front of added potential */ + +#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */ + +#define PRINT_TIME 0 /* set to 1 to print running time */ +#define PRINT_VISCOSITY 0 /* set to 1 to print viscosity */ +#define PRINT_RPSLZB 0 /* set to 1 to print rpslzb parameter */ +#define PRINT_PROBABILITIES 0 /* set to 1 to print probabilities (for Ehrenfest urn configuration) */ +#define PRINT_NOISE 0 /* set to 1 to print noise intensity */ +#define PRINT_FLOW_SPEED 0 /* set to 1 to print speed of flow */ +#define PRINT_AVERAGE_SPEED 0 /* set to 1 to print average speed of flow */ +#define PRINT_LEFT 1 /* set to 1 to print parameters at left side */ + +#define DRAW_FIELD_LINES 0 /* set to 1 to draw field lines */ +#define FIELD_LINE_WIDTH 1 /* width of field lines */ +#define N_FIELD_LINES 120 /* number of field lines */ +#define FIELD_LINE_FACTOR 120 /* factor controlling precision when computing origin of field lines */ +#define DRAW_BILLIARD 1 /* set to 1 to draw boundary */ +#define DRAW_BILLIARD_FRONT 1 /* set to 1 to draw boundary */ +#define FILL_BILLIARD_COMPLEMENT 1 /* set to 1 to fill complement of billiard (for certain shapes only) */ + +/* 3D representation */ + +#define REPRESENTATION_3D 1 /* choice of 3D representation */ + +#define REP_AXO_3D 0 /* linear projection (axonometry) */ +#define REP_PROJ_3D 1 /* projection on plane orthogonal to observer line of sight */ + +/* Color schemes, see list in global_pdes.c */ + +#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 17 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* black background */ + +#define COLOR_SCHEME 3 /* choice of color scheme */ + +#define COLOR_PHASE_SHIFT 0.0 /* phase shift of color scheme, in units of Pi */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#define VSCALE_AMPLITUDE 15.0 /* additional scaling factor for color scheme P_3D_AMPLITUDE */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ +#define CURL_SCALE 0.000015 /* scaling factor for curl representation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ +#define SLOPE_SCHROD_LUM 50.0 /* sensitivity of luminosity on module, for color scheme Z_ARGUMENT */ +#define MIN_SCHROD_LUM 0.2 /* minimal luminosity in color scheme Z_ARGUMENT*/ +#define VSCALE_PRESSURE 0.25 /* additional scaling factor for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_SHIFT 25.0 /* shift for color scheme Z_EULER_PRESSURE */ +#define PRESSURE_LOG_SHIFT -2.5 /* shift for color scheme Z_EULER_PRESSURE */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 359.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -359.0 /* amplitude of variation of hue for color scheme C_HUE */ +#define E_SCALE 100.0 /* scaling factor for energy representation */ +#define FLUX_SCALE 100.0 /* scaling factor for energy representation */ +#define LOG_SCALE 0.5 /* scaling factor for energy log representation */ +#define LOG_SHIFT 1.0 +#define LOG_MIN 1.0e-3 /* floor value for log vorticity plot */ +#define VSCALE_SPEED 15.0 /* additional scaling factor for color scheme Z_EULER_SPEED */ +#define VMEAN_SPEED 0.0 /* mean value around which to scale for color scheme Z_EULER_SPEED */ +#define SHIFT_DENSITY 1.0 /* shift for color scheme Z_EULER_DENSITY */ +#define VSCALE_DENSITY 15.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */ +#define VSCALE_VORTICITY 20.0 /* additional scaling factor for color scheme Z_EULERC_VORTICITY */ +#define VORTICITY_SHIFT 0.3 /* vertical shift of vorticity */ +#define ZSCALE_SPEED 1.0 /* additional scaling factor for z-coord Z_EULER_SPEED */ + +#define NXMAZE 13 /* width of maze */ +#define NYMAZE 13 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 3 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.03 /* half width of maze walls */ + +#define DRAW_COLOR_SCHEME 1 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 2.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 2.5 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +/* only for compatibility with wave_common.c */ +#define TWOSPEEDS 0 /* set to 1 to replace hardcore boundary by medium with different speed */ +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 4 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ +#define OMEGA 0.005 /* frequency of periodic excitation */ +#define COURANT 0.08 /* Courant number */ +#define COURANTB 0.03 /* Courant number in medium B */ +#define INITIAL_AMP 0.5 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0002 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */ +#define VSCALE_ENERGY 200.0 /* additional scaling factor for color scheme P_3D_ENERGY */ +#define PHASE_FACTOR 20.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 OSCILLATION_SCHEDULE 0 /* oscillation schedule, see list in global_pdes.c */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.2 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#define B_DOMAIN_B 20 /* second domain shape, for comparisons */ +#define CIRCLE_PATTERN_B 0 /* second pattern of circles or polygons */ +#define FLUX_WINDOW 20 /* averaging window for energy flux */ +#define ADD_WAVE_PACKET_SOURCES 1 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ +/* end of constants added only for compatibility with wave_common.c */ + + +double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_3D representation */ +double v_3d[2] = {-0.75, -0.45}; +double w_3d[2] = {0.0, 0.015}; +double light[3] = {0.816496581, 0.40824829, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */ +double observer[3] = {8.0, 8.0, 10.0}; /* location of observer for REP_PROJ_3D representation */ +int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */ + +#define Z_SCALING_FACTOR 1.25 /* overall scaling factor of z axis for REP_PROJ_3D representation */ +#define XY_SCALING_FACTOR 1.7 /* overall scaling factor for on-screen (x,y) coordinates after projection */ +#define ZMAX_FACTOR 1.0 /* max value of z coordinate for REP_PROJ_3D representation */ +#define XSHIFT_3D 0.0 /* overall x shift for REP_PROJ_3D representation */ +#define YSHIFT_3D -0.1 /* overall y shift for REP_PROJ_3D representation */ +#define BORDER_PADDING 0 /* distance from boundary at which to plot points, to avoid boundary effects due to gradient */ + +/* For debugging purposes only */ +#define FLOOR 1 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 1000.0 /* max value of wave amplitude */ +#define TEST_GRADIENT 0 /* print norm squared of gradient */ + +``` + +### 3 May 23 - A rocket gradually fueled by a chemical reaction ### + +**Program:** `lennardjones.c` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#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 while saving frames */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ + +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ + /* so far incompatible with double movie */ +#define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ + +/* General geometrical parameters */ + +#define WINWIDTH 1000 /* window width */ +#define WINHEIGHT 1000 /* window height */ + +#define XMIN -1.5 +#define XMAX 3.5 /* x interval */ +#define YMIN -2.25 +#define YMAX 2.25 /* y interval for 9/16 aspect ratio */ + +#define INITXMIN -0.7 +#define INITXMAX 0.7 /* x interval for initial condition */ +#define INITYMIN -1.7 +#define INITYMAX 1.7 /* y interval for initial condition */ + +#define BCXMIN -7.1 +#define BCXMAX 8.1 /* x interval for boundary condition */ +#define BCYMIN -6.5 +#define BCYMAX 44.0 /* y interval for boundary condition */ + +#define OBSXMIN -2.0 +#define OBSXMAX 2.0 /* x interval for motion of obstacle */ + +#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_ljones.c */ + +#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */ +#define OBSTACLE_PATTERN 181 /* pattern of obstacles, see list in global_ljones.c */ + +#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */ +#define SEGMENT_PATTERN 101 /* pattern of repelling segments, see list in global_ljones.c */ +#define ROCKET_SHAPE 2 /* shape of rocket combustion chamber, see list in global_ljones.c */ +#define ROCKET_SHAPE_B 2 /* shape of second rocket */ +#define NOZZLE_SHAPE 1 /* shape of nozzle, see list in global_ljones.c */ +#define NOZZLE_SHAPE_B 4 /* shape of nozzle for second rocket, see list in global_ljones.c */ + +#define TWO_TYPES 0 /* set to 1 to have two types of particles */ +#define TYPE_PROPORTION 0.5 /* proportion of particles of first type */ +#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ +#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ +#define CENTER_PY 0 /* set to 1 to center vertical momentum */ +#define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ + +#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ + +#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define PDISC_DISTANCE 2.4 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ +#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.8 /* parameter controlling the dimensions of domain */ +#define MU 0.009 /* parameter controlling radius of particles */ +#define MU_B 0.009 /* parameter controlling radius of particles of second type */ +#define NPOLY 25 /* number of sides of polygon */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ +#define MDEPTH 4 /* depth of computation of Menger gasket */ +#define MRATIO 3 /* ratio defining Menger gasket */ +#define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 120 /* number of grid point for grid of disks */ +#define NGRIDY 51 /* number of grid point for grid of disks */ +#define EHRENFEST_RADIUS 0.9 /* radius of container for Ehrenfest urn configuration */ +#define EHRENFEST_WIDTH 0.035 /* width of tube for Ehrenfest urn configuration */ +#define TWO_CIRCLES_RADIUS_RATIO 0.8 /* ratio of radii for S_TWO_CIRCLES_EXT segment configuration */ +#define DAM_WIDTH 0.05 /* width of dam for S_DAM segment configuration */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 1200 /* number of frames of movie */ +#define NVID 300 /* number of iterations between images displayed on screen */ +#define NSEG 250 /* number of segments of boundary */ +#define INITIAL_TIME 15 /* time after which to start saving frames */ +#define OBSTACLE_INITIAL_TIME 150 /* time after which to start moving obstacle */ +#define BOUNDARY_WIDTH 1 /* width of particle boundary */ +#define LINK_WIDTH 2 /* width of links between particles */ +#define CONTAINER_WIDTH 4 /* width of container boundary */ + +#define PAUSE 1000 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +/* Boundary conditions, see list in global_ljones.c */ + +#define BOUNDARY_COND 20 + +/* Plot type, see list in global_ljones.c */ + +#define PLOT 5 +#define PLOT_B 8 /* plot type for second movie */ + +#define DRAW_BONDS 0 /* set to 1 to draw bonds between neighbours */ +#define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ +#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define ALTITUDE_LINES 1 /* set to 1 to add horizontal lines to show altitude */ +#define COLOR_SEG_GROUPS 1 /* set to 1 to collor segment groups differently */ + +/* Color schemes */ + +#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_ljones.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 0.5 /* sensitivity of color on wave amplitude */ +#define ATTENUATION 0.0 /* exponential attenuation coefficient of contrast with time */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#define HUEMEAN 220.0 /* mean value of hue for color scheme C_HUE */ +#define HUEAMP -50.0 /* amplitude of variation of hue for color scheme C_HUE */ + +#define PRINT_PARAMETERS 1 /* set to 1 to print certain parameters */ +#define PRINT_TEMPERATURE 1 /* set to 1 to print current temperature */ + +/* particle properties */ + +#define ENERGY_HUE_MIN 330.0 /* color of original particle */ +#define ENERGY_HUE_MAX 50.0 /* color of saturated particle */ +#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ +#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ +#define PARTICLE_EMAX 2.0e3 /* energy of particle with hottest color */ +#define HUE_TYPE0 70.0 /* hue of particles of type 0 */ +#define HUE_TYPE1 280.0 /* hue of particles of type 1 */ +#define HUE_TYPE2 180.0 /* hue of particles of type 2 */ +#define HUE_TYPE3 210.0 /* hue of particles of type 3 */ + +#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ +#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ +#define KREPEL 12.0 /* constant in repelling force between particles */ +#define EQUILIBRIUM_DIST 4.5 /* Lennard-Jones equilibrium distance */ +#define EQUILIBRIUM_DIST_B 3.5 /* Lennard-Jones equilibrium distance for second type of particle */ +#define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ +#define DAMPING 5.0 /* damping coefficient of particles */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define INITIAL_DAMPING 5.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define PARTICLE_MASS_B 1.0 /* mass of particle of radius MU */ +#define PARTICLE_INERTIA_MOMENT 0.2 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ +#define V_INITIAL 0.0 /* initial velocity range */ +#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ + +#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ +#define SIGMA 5.0 /* noise intensity in thermostat */ +#define BETA 0.02 /* initial inverse temperature */ +#define MU_XI 0.01 /* friction constant in thermostat */ +#define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ +#define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ +#define NBH_DIST_FACTOR 7.5 /* radius in which to count neighbours */ +#define GRAVITY 15.0 /* gravity acting on all particles */ +#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ +#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ +#define GRAVITY_SCHEDULE 2 /* type of gravity schedule, see list in global_ljones.c */ +#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ +#define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ +#define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ + +#define ROTATION 0 /* set to 1 to include rotation of particles */ +#define COUPLE_ANGLE_TO_THERMOSTAT 1 /* set to 1 to couple angular degrees of freedom to thermostat */ +#define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ +#define KTORQUE 5.0e3 /* force constant in angular dynamics */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ +#define KTORQUE_B 10.0 /* force constant in angular dynamics */ +#define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ +#define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ +#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ +#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ + +#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ +#define BETA_FACTOR 0.02 /* factor by which to change BETA during simulation */ +#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ +#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ +#define MIDDLE_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ +#define FINAL_DECREASE_PHASE 1300 /* final phase in which temperature decreases */ +#define FINAL_CONSTANT_PHASE -1 /* final phase in which temperature is constant */ + +#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ +#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ +#define COMPRESSION_RATIO 0.3 /* final size of container */ +#define RESTORE_CONTAINER_SIZE 1 /* set to 1 to restore container to initial size at end of simulation */ +#define RESTORE_TIME 700 /* time before end of sim at which to restore size */ + +#define MOVE_OBSTACLE 0 /* set to 1 to have a moving obstacle */ +#define CENTER_VIEW_ON_OBSTACLE 0 /* set to 1 to center display on moving obstacle */ +#define RESAMPLE_Y 0 /* set to 1 to resample y coordinate of moved particles (for shock waves) */ +#define NTRIALS 2000 /* number of trials when resampling */ +#define OBSTACLE_RADIUS 0.12 /* radius of obstacle for circle boundary conditions */ +#define FUNNEL_WIDTH 0.25 /* funnel width for funnel boundary conditions */ +#define OBSTACLE_XMIN 0.0 /* initial position of obstacle */ +#define OBSTACLE_XMAX 3.0 /* final position of obstacle */ +#define RECORD_PRESSURES 0 /* set to 1 to record pressures on obstacle */ +#define N_PRESSURES 100 /* number of intervals to record pressure */ +#define N_P_AVERAGE 100 /* size of pressure averaging window */ +#define N_T_AVERAGE 1 /* size of temperature averaging window */ +#define MAX_PRESSURE 3.0e10 /* pressure shown in "hottest" color */ +#define PARTIAL_THERMO_COUPLING 0 /* set to 1 to couple only some particles to thermostat */ +#define PARTIAL_THERMO_REGION 1 /* region for partial thermostat coupling (see list in global_ljones.c) */ +#define PARTIAL_THERMO_SHIFT 0.2 /* distance from obstacle at the right of which particles are coupled to thermostat */ +#define PARTIAL_THERMO_WIDTH 0.5 /* vertical size of partial thermostat coupling */ +#define PARTIAL_THERMO_HEIGHT 0.25 /* vertical size of partial thermostat coupling */ + +#define INCREASE_KREPEL 0 /* set to 1 to increase KREPEL during simulation */ +#define KREPEL_FACTOR 1000.0 /* factor by which to change KREPEL during simulation */ + +#define PART_AT_BOTTOM 0 /* set to 1 to include "seed" particles at bottom */ +#define MASS_PART_BOTTOM 10000.0 /* mass of particles at bottom */ +#define NPART_BOTTOM 100 /* number of particles at the bottom */ + +#define ADD_PARTICLES 0 /* set to 1 to add particles */ +#define ADD_TIME 0 /* time at which to add first particle */ +#define ADD_PERIOD 10000 /* time interval between adding further particles */ +#define N_ADD_PARTICLES 20 /* number of particles to add */ +#define FINAL_NOADD_PERIOD 200 /* final period where no particles are added */ +#define SAFETY_FACTOR 2.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */ + +#define TRACER_PARTICLE 0 /* set to 1 to have a tracer particle */ +#define N_TRACER_PARTICLES 3 /* number of tracer particles */ +#define TRAJECTORY_LENGTH 8000 /* length of recorded trajectory */ +#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ +#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ + +#define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */ +#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ +#define PERIOD_ROTATE_BOUNDARY 1000 /* period of rotating boundary */ +#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ +#define ROTATE_FINAL_TIME 100 /* final time without rotation */ +#define ROTATE_CHANGE_TIME 0.33 /* relative duration of acceleration/deceleration phases */ +#define OMEGAMAX 100.0 /* maximal rotation speed */ +#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ +#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ +#define PRINT_SEGMENTS_SPEEDS 1 /* set to 1 to print velocity of moving segments */ + +#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ +#define SEGMENTS_MASS 40.0 /* mass of collection of segments */ +#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ +#define SEGMENT_DEACTIVATION_TIME 20 /* time at which to deactivate last segment */ +#define RELEASE_ROCKET_AT_DEACTIVATION 0 /* set to 1 to limit segments velocity before segment release */ +#define SEGMENTS_X0 0.0 /* initial position of segments */ +#define SEGMENTS_Y0 0.0 /* initial position of segments */ +#define SEGMENTS_VX0 0.0 /* initial velocity of segments */ +#define SEGMENTS_VY0 0.0 /* initial velocity of segments */ +#define DAMP_SEGS_AT_NEGATIVE_Y 0 /* set to 1 to dampen segments when y coordinate is negative */ + +#define MOVE_SEGMENT_GROUPS 1 /* set to 1 to group segments into moving units */ +#define SEGMENT_GROUP_MASS 500.0 /* mass of segment group */ +#define SEGMENT_GROUP_I 1000.0 /* moment of inertia of segment group */ +#define SEGMENT_GROUP_DAMPING 0.0 /* damping of segment groups */ +#define GROUP_REPULSION 0 /* set to 1 for groups of segments to repel each other */ +#define KSPRING_GROUPS 5.0e11 /* harmonic potential between segment groups */ +#define GROUP_WIDTH 0.05 /* interaction width of groups */ +#define GROUP_G_REPEL 0 /* set to 1 to add repulsion between centers of mass of groups */ +#define GROUP_G_REPEL_RADIUS 1.2 /* radius within which centers of mass of groups repel each other */ +#define TRACK_SEGMENT_GROUPS 1 /* set to 1 for view to track group of segments */ +#define TRACK_X_PADDING 1.0 /* distance from x boundary where tracking starts */ + +#define POSITION_DEPENDENT_TYPE 0 /* set to 1 to make particle type depend on initial position */ +#define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ +#define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ + +#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define RD_REACTION 2 /* type of reaction, see list in global_ljones.c */ +#define RD_TYPES 3 /* number of types in reaction-diffusion equation */ +#define RD_INITIAL_COND 7 /* initial condition of particles */ +#define REACTION_DIST 4.0 /* maximal distance for reaction to occur */ +#define REACTION_PROB 1.0 /* probability controlling reaction term */ +#define DISSOCIATION_PROB 0.002 /* probability controlling dissociation reaction */ +#define CENTER_COLLIDED_PARTICLES 0 /* set to 1 to recenter particles upon reaction (may interfere with thermostat) */ +#define EXOTHERMIC 1 /* set to 1 to make reaction exo/endothermic */ +#define DELTA_EKIN 2000.0 /* change of kinetic energy in reaction */ +#define COLLISION_TIME 15 /* time during which collisions are shown */ + +#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ +#define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ +#define PRINT_LEFT 0 /* set to 1 to print certain parameters at the top left instead of right */ +#define PLOT_SPEEDS 1 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ +#define PLOT_TRAJECTORIES 1 /* set to 1 to add a plot of obstacle trajectories (e.g. for rockets) */ +#define VMAX_PLOT_SPEEDS 0.5 /* vertical scale of plot of obstacle speeds */ + +#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ + +#define LID_MASS 1000.0 /* mass of lid for BC_RECTANGLE_LID b.c. */ +#define LID_WIDTH 0.1 /* width of lid for BC_RECTANGLE_LID b.c. */ +#define WALL_MASS 2000.0 /* mass of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_FRICTION 0.0 /* friction on wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_WIDTH 0.1 /* width of wall for BC_RECTANGLE_WALL b.c. */ +#define WALL_VMAX 100.0 /* max speed of wall */ +#define WALL_TIME 0 /* time during which to keep wall */ + +#define NXMAZE 6 /* width of maze */ +#define NYMAZE 6 /* height of maze */ +#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 1 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ + +#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ +#define FMAX 1.0e10 /* maximal force */ +#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ +#define PMAX 1000.0 /* maximal force */ + +#define HASHX 120 /* size of hashgrid in x direction */ +#define HASHY 450 /* size of hashgrid in y direction */ +#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ +#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ + +#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */ +#define COLORBAR_RANGE 8.0 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 12.0 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +``` + +### 2 May 23 - Beam formation in an asymmetric circular phased array ### + +**Program:** `wave_billiard.c` + +**Initial condition in function `animation()`:** + +``` + init_wave_flat(phi, psi, xy_in); + + if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1)) + { + if (first_source) for (k=0; k<25; k++) + { + omega = DPI/25.0; + wave_source[k].xc = 0.03*cos((double)k*omega);; + wave_source[k].yc = 0.03*sin((double)k*omega); + wave_source[k].phase = 1.1 - (double)(k+1)*1.0/5.0; + wave_source[k].amp = 0.5*(1.0 + cos((double)k*omega)); + wave_source[k].sign = 1; + first_source = 0; + } + + for (k=0; k<25; k++) + { + wave_source[k].phase += 1.0/6.0; + if (wave_source[k].phase > 1.0) + { + add_circular_wave((double)wave_source[k].sign*wave_source[k].amp, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } + } +``` + +``` +#define MOVIE 1 /* set to 1 to generate movie */ +#define DOUBLE_MOVIE 1 /* 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 */ + +#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */ +#define IOR 7 /* choice of index of refraction, see list in global_pdes.c */ +#define IOR_TOTAL_TURNS 1.5 /* total angle of rotation for IOR_PERIODIC_WELLS_ROTATING */ +#define MANDEL_IOR_SCALE -0.05 /* parameter controlling dependence of IoR on Mandelbrot escape speed */ + + +/* General geometrical parameters */ + +#define WINWIDTH 1920 /* window width */ +#define WINHEIGHT 1150 /* window height */ +#define NX 3840 /* 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 -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 JULIA_SCALE 1.0 /* scaling for Julia sets */ + +/* Choice of the billiard table */ + +#define B_DOMAIN 999 /* choice of domain shape, see list in global_pdes.c */ + +#define CIRCLE_PATTERN 1 /* pattern of circles or polygons, see list in global_pdes.c */ + +#define COMPARISON 0 /* set to 1 to compare two different patterns (beta) */ +#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.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ +#define NPOISSON 300 /* number of points for Poisson C_RAND_POISSON arrangement */ +#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */ + +#define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ +#define MU 0.5 /* parameter controlling the dimensions of domain */ +#define NPOLY 6 /* 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 */ +#define MANDELLIMIT 10.0 /* limit value for approximation of Mandelbrot set */ +#define FOCI 1 /* set to 1 to draw focal points of ellipse */ +#define NGRIDX 12 /* number of grid point for grid of disks */ +#define NGRIDY 12 /* number of grid point for grid of disks */ + +#define X_SHOOTER -0.2 +#define Y_SHOOTER -0.6 +#define X_TARGET 0.4 +#define Y_TARGET 0.7 /* shooter and target positions in laser fight */ + +#define ISO_XSHIFT_LEFT -2.9 +#define ISO_XSHIFT_RIGHT 1.4 +#define ISO_YSHIFT_LEFT -0.15 +#define ISO_YSHIFT_RIGHT -0.15 +#define ISO_SCALE 0.5 /* coordinates for isospectral billiards */ + +/* 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 */ +#define OSCILLATE_LEFT 0 /* set to 1 to add oscilating boundary condition on the left */ +#define OSCILLATE_TOPBOT 0 /* set to 1 to enforce a planar wave on top and bottom boundary */ +#define OSCILLATION_SCHEDULE 1 /* oscillation schedule, see list in global_pdes.c */ + +#define OMEGA 0.0005 /* frequency of periodic excitation */ +#define AMPLITUDE 0.8 /* amplitude of periodic excitation */ +#define ACHIRP 0.25 /* acceleration coefficient in chirp */ +#define DAMPING 0.0 /* damping of periodic excitation */ +#define COURANT 0.04 /* Courant number */ +#define COURANTB 0.0 /* 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 */ +#define GAMMA_TOPBOT 1.0e-7 /* damping factor on boundary */ +#define KAPPA 0.0 /* "elasticity" term enforcing oscillations */ +#define KAPPA_SIDES 5.0e-4 /* "elasticity" term on absorbing boundary */ +#define KAPPA_TOPBOT 0.0 /* "elasticity" term on absorbing boundary */ +/* The Courant number is given by c*DT/DX, where DT is the time step and DX the lattice spacing */ +/* The physical damping coefficient is given by GAMMA/(DT)^2 */ +/* Increasing COURANT speeds up the simulation, but decreases accuracy */ +/* 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 2 /* period of oscillating source */ +#define ALTERNATE_OSCILLATING_SOURCE 1 /* set to 1 to alternate sign of oscillating source */ + +#define ADD_WAVE_PACKET_SOURCES 0 /* set to 1 to add several sources emitting wave packets */ +#define WAVE_PACKET_SOURCE_TYPE 1 /* type of wave packet sources */ +#define N_WAVE_PACKETS 15 /* number of wave packets */ +#define WAVE_PACKET_RADIUS 20 /* radius of wave packets */ + +/* Boundary conditions, see list in global_pdes.c */ + +#define B_COND 2 + +/* Parameters for length and speed of simulation */ + +#define NSTEPS 3150 /* number of frames of movie */ +#define NVID 10 /* 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 */ +#define BOUNDARY_WIDTH 2 /* width of billiard boundary */ +#define PRINT_SPEED 0 /* print speed of moving source */ + +#define PAUSE 200 /* number of frames after which to pause */ +#define PSLEEP 1 /* sleep time during pause */ +#define SLEEP1 1 /* initial sleeping time */ +#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 */ + +#define INITIAL_AMP 0.02 /* amplitude of initial condition */ +#define INITIAL_VARIANCE 0.0003 /* variance of initial condition */ +#define INITIAL_WAVELENGTH 0.015 /* wavelength of initial condition */ + +/* Plot type, see list in global_pdes.c */ + +#define PLOT 0 + +#define PLOT_B 5 /* plot type for second movie */ + +/* Color schemes */ + +#define COLOR_PALETTE 15 /* Color palette, see list in global_pdes.c */ +#define COLOR_PALETTE_B 13 /* Color palette, see list in global_pdes.c */ + +#define BLACK 1 /* background */ + +#define COLOR_SCHEME 3 /* choice of color scheme, see list in global_pdes.c */ + +#define SCALE 0 /* set to 1 to adjust color scheme to variance of field */ +#define SLOPE 1.0 /* sensitivity of color on wave amplitude */ +#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 E_SCALE 60.0 /* scaling factor for energy representation */ +#define LOG_SCALE 1.0 /* scaling factor for energy log representation */ +#define LOG_SHIFT 3.5 /* shift of colors on log scale */ +#define FLUX_SCALE 5.0e3 /* scaling factor for enegy flux represtnation */ +#define RESCALE_COLOR_IN_CENTER 0 /* set to 1 to decrease color intentiy in the center (for wave escaping ring) */ + +#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 */ +#define LUMMEAN 0.5 /* amplitude of luminosity variation for scheme C_LUM */ +#define LUMAMP 0.3 /* amplitude of luminosity variation for scheme C_LUM */ +#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.5 /* scale of color scheme bar */ +#define COLORBAR_RANGE_B 0.1 /* scale of color scheme bar for 2nd part */ +#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */ + +#define SAVE_TIME_SERIES 0 /* set to 1 to save wave time series at a point */ + +#define NXMAZE 8 /* width of maze */ +#define NYMAZE 32 /* height of maze */ +#define MAZE_MAX_NGBH 5 /* max number of neighbours of maze cell */ +#define RAND_SHIFT 0 /* seed of random number generator */ +#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.02 /* half width of maze walls */ + +/* for compatibility with sub_wave and sub_maze */ +#define ADD_POTENTIAL 0 +#define POT_MAZE 7 +#define POTENTIAL 0 +/* end of constants only used by sub_wave and sub_maze */ + +/* For debugging purposes only */ +#define FLOOR 0 /* set to 1 to limit wave amplitude to VMAX */ +#define VMAX 10.0 /* max value of wave amplitude */ + +``` + diff --git a/global_ljones.c b/global_ljones.c index ae2b099..83b6a2e 100644 --- a/global_ljones.c +++ b/global_ljones.c @@ -81,6 +81,9 @@ #define I_LJ_DIPOLE 5 /* Lennard-Jones with a dipolar angle dependence */ #define I_LJ_QUADRUPOLE 6 /* Lennard-Jones with a quadropolar angle dependence */ #define I_LJ_WATER 7 /* model for water molecule */ +#define I_VICSEK 8 /* Vicsek-type interaction */ +#define I_VICSEK_REPULSIVE 9 /* Vicsek-type interaction with harmonic repulsion */ +#define I_VICSEK_SPEED 10 /* Vicsek-type interaction with speed adjustment */ /* Boundary conditions */ @@ -159,6 +162,8 @@ #define IC_CATALYSIS 4 /* mix of 1 and 2 in left half, only 1 in right half */ #define IC_LAYERS 5 /* layer of 2 below 1 */ #define IC_BZ 6 /* initial state for BZ reaction */ +#define IC_SIGNX 7 /* type 1 or 2 depending on sign of x */ +#define IC_TWOROCKETS 8 /* type 1 or 2 depending on rocket position */ /* Plot types */ @@ -201,6 +206,7 @@ #define COL_TURBO_CYCLIC 101 /* TURBO color palette (by Anton Mikhailov) corrected to be cyclic, beta */ +#define VICSEK_INT ((INTERACTION == I_VICSEK)||(INTERACTION == I_VICSEK_REPULSIVE)||(INTERACTION == I_VICSEK_SPEED)) typedef struct { @@ -216,6 +222,7 @@ typedef struct double fx; /* x component of force on particle */ double fy; /* y component of force on particle */ double torque; /* torque on particle */ + int close_to_boundary; /* has value 1 if particle is close to a boundary */ short int thermostat; /* whether particle is coupled to thermostat */ int hashcell; /* hash cell in which particle is located */ int neighb; /* number of neighbours within given distance */ diff --git a/global_pdes.c b/global_pdes.c index fdcdd1a..e4ad7d0 100644 --- a/global_pdes.c +++ b/global_pdes.c @@ -79,6 +79,7 @@ #define D_WING 70 /* complement of wing-shaped domain */ #define D_TESLA 71 /* Tesla valve */ +#define D_TESLA_FOUR 72 /* four Tesla valves */ #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) */ @@ -120,6 +121,7 @@ /* Variable index of refraction */ #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) */ +#define IOR_MANDELBROT_MOD 101 /* index of refraction depends on escape time in Mandelbrot set (linear) */ #define IOR_EARTH 2 /* index of refraction models speed of seismic waves */ #define IOR_EXPLO_LENSING 3 /* explosive lensing */ #define IOR_PERIODIC_WELLS 4 /* periodic superposition of "wells" */ @@ -235,11 +237,16 @@ #define Z_EULER_DIRECTION_SPEED 64 /* hut for direction of velocity, luminosity for speed */ /* special boundary conditions for Euler equation */ -#define BCE_TOPBOTTOM 1 /* laminar flow at top and bottom */ -#define BCE_TOPBOTTOMLEFT 2 /* laminar flow at top, bottom and left side */ -#define BCE_CHANNELS 3 /* laminar flow in channels at left and right */ -#define BCE_MIDDLE_STRIP 4 /* laminar flow in horizontal strip in the middle */ -#define BCE_LEFT 5 /* laminar flow at left side */ +#define BCE_TOPBOTTOM 1 /* special flow at top and bottom */ +#define BCE_TOPBOTTOMLEFT 2 /* special flow at top, bottom and left side */ +#define BCE_CHANNELS 3 /* special flow in channels at left and right */ +#define BCE_MIDDLE_STRIP 4 /* special flow in horizontal strip in the middle */ +#define BCE_LEFT 5 /* special flow at left side */ +#define BCE_FOUR_CHANNELS 6 /* special flow in four channels at left and right */ + +/* flow types for boundary conditions in Euler equation */ +#define BCF_LAMINAR 0 /* laminar flow */ +#define BCF_PRESSURE 1 /* laminar flow with pressure gradient */ typedef struct { @@ -300,6 +307,14 @@ typedef struct int time_shift; /* time shift */ } t_wave_packet; +typedef struct +{ + double xc, yc; /* (x,y) coordinates of center */ + double phase; /* phase of source */ + double amp; /* amplitude */ + int sign; +} t_wave_source; + int ncircles = NMAXCIRCLES; /* actual number of circles, can be decreased e.g. for random patterns */ diff --git a/lennardjones.c b/lennardjones.c index cd20d96..a854d13 100644 --- a/lennardjones.c +++ b/lennardjones.c @@ -37,14 +37,14 @@ #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 */ +#define DOUBLE_MOVIE 1 /* set to 1 to produce movies for wave height and energy simultaneously */ #define SAVE_MEMORY 1 /* set to 1 to save memory while saving frames */ -#define NO_EXTRA_BUFFER_SWAP 0 /* some OS require one less buffer swap when recording images */ +#define NO_EXTRA_BUFFER_SWAP 1 /* some OS require one less buffer swap when recording images */ -#define TIME_LAPSE 1 /* set to 1 to add a time-lapse movie at the end */ +#define TIME_LAPSE 0 /* set to 1 to add a time-lapse movie at the end */ /* so far incompatible with double movie */ #define TIME_LAPSE_FACTOR 3 /* factor of time-lapse movie */ -#define TIME_LAPSE_FIRST 1 /* set to 1 to show time-lapse version first */ +#define TIME_LAPSE_FIRST 0 /* set to 1 to show time-lapse version first */ #define SAVE_TIME_SERIES 0 /* set to 1 to save time series of particle positions */ @@ -90,22 +90,22 @@ #define CENTER_PY 0 /* set to 1 to center vertical momentum */ #define CENTER_PANGLE 0 /* set to 1 to center angular momentum */ -#define INTERACTION 1 /* particle interaction, see list in global_ljones.c */ +#define INTERACTION 10 /* particle interaction, see list in global_ljones.c */ #define INTERACTION_B 1 /* particle interaction for second type of particle, see list in global_ljones.c */ -#define SPIN_INTER_FREQUENCY 5.0 /* angular frequency of spin-spin interaction */ +#define SPIN_INTER_FREQUENCY 1.0 /* angular frequency of spin-spin interaction */ #define SPIN_INTER_FREQUENCY_B 2.0 /* angular frequency of spin-spin interaction for second particle type */ #define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ #define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ -#define PDISC_DISTANCE 4.2 /* minimal distance in Poisson disc process, controls density of particles */ +#define PDISC_DISTANCE 1.3 /* minimal distance in Poisson disc process, controls density of particles */ #define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ #define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ #define LAMBDA 0.5 /* parameter controlling the dimensions of domain */ -#define MU 0.008 /* parameter controlling radius of particles */ +#define MU 0.035 /* parameter controlling radius of particles */ #define MU_B 0.012 /* parameter controlling radius of particles of second type */ #define NPOLY 25 /* number of sides of polygon */ -#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ +#define APOLY 0.0 /* angle by which to turn polygon, in units of Pi/2 */ #define MDEPTH 4 /* depth of computation of Menger gasket */ #define MRATIO 3 /* ratio defining Menger gasket */ #define MANDELLEVEL 1000 /* iteration level for Mandelbrot set */ @@ -125,11 +125,10 @@ /* Parameters for length and speed of simulation */ -#define NSTEPS 5000 /* number of frames of movie */ -// #define NSTEPS 3000 /* number of frames of movie */ -#define NVID 175 /* number of iterations between images displayed on screen */ +#define NSTEPS 3800 /* number of frames of movie */ +#define NVID 50 /* number of iterations between images displayed on screen */ #define NSEG 250 /* number of segments of boundary */ -#define INITIAL_TIME 20 /* time after which to start saving frames */ +#define INITIAL_TIME 10 /* time after which to start saving frames */ #define OBSTACLE_INITIAL_TIME 200 /* time after which to start moving obstacle */ #define BOUNDARY_WIDTH 1 /* width of particle boundary */ #define LINK_WIDTH 2 /* width of links between particles */ @@ -144,22 +143,22 @@ /* Boundary conditions, see list in global_ljones.c */ -#define BOUNDARY_COND 0 +#define BOUNDARY_COND 3 /* Plot type, see list in global_ljones.c */ -#define PLOT 5 -#define PLOT_B 0 /* plot type for second movie */ +#define PLOT 4 +#define PLOT_B 6 /* plot type for second movie */ #define DRAW_BONDS 1 /* set to 1 to draw bonds between neighbours */ #define COLOR_BONDS 1 /* set to 1 to color bonds according to length */ -#define FILL_TRIANGLES 1 /* set to 1 to fill triangles between neighbours */ +#define FILL_TRIANGLES 0 /* set to 1 to fill triangles between neighbours */ #define ALTITUDE_LINES 0 /* set to 1 to add horizontal lines to show altitude */ #define COLOR_SEG_GROUPS 0 /* set to 1 to collor segment groups differently */ /* Color schemes */ -#define COLOR_PALETTE 10 /* Color palette, see list in global_ljones.c */ +#define COLOR_PALETTE 0 /* Color palette, see list in global_ljones.c */ #define BLACK 1 /* background */ @@ -193,27 +192,30 @@ #define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ #define DT_PARTICLE 3.0e-6 /* time step for particle displacement */ -#define KREPEL 12.0 /* constant in repelling force between particles */ +#define KREPEL 0.1 /* constant in repelling force between particles */ #define EQUILIBRIUM_DIST 2.0 /* Lennard-Jones equilibrium distance */ #define EQUILIBRIUM_DIST_B 2.0 /* Lennard-Jones equilibrium distance for second type of particle */ #define REPEL_RADIUS 15.0 /* radius in which repelling force acts (in units of particle radius) */ -#define DAMPING 200.0 /* damping coefficient of particles */ -#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */ -#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ +#define DAMPING 0.0 /* damping coefficient of particles */ +#define INITIAL_DAMPING 50.0 /* damping coefficient of particles during initial phase */ +#define DAMPING_ROT 100.0 /* dampint coefficient for rotation of particles */ +#define PARTICLE_MASS 0.25 /* mass of particle of radius MU */ #define PARTICLE_MASS_B 0.5 /* mass of particle of radius MU */ -#define PARTICLE_INERTIA_MOMENT 0.02 /* moment of inertia of particle */ +#define PARTICLE_INERTIA_MOMENT 0.5 /* moment of inertia of particle */ #define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ -#define V_INITIAL 0.0 /* initial velocity range */ -#define OMEGA_INITIAL 10.0 /* initial angular velocity range */ +#define V_INITIAL 20.0 /* initial velocity range */ +#define OMEGA_INITIAL 5.0 /* initial angular velocity range */ +#define VICSEK_VMIN 1.0 /* minimal speed of particles in Vicsek model */ +#define VICSEK_VMAX 40.0 /* minimal speed of particles in Vicsek model */ -#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ +#define THERMOSTAT 0 /* set to 1 to switch on thermostat */ #define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ #define SIGMA 5.0 /* noise intensity in thermostat */ #define BETA 0.002 /* initial inverse temperature */ #define MU_XI 0.01 /* friction constant in thermostat */ #define KSPRING_BOUNDARY 1.0e7 /* confining harmonic potential outside simulation region */ #define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */ -#define NBH_DIST_FACTOR 10.0 /* radius in which to count neighbours */ +#define NBH_DIST_FACTOR 3.0 /* radius in which to count neighbours */ #define GRAVITY 0.0 /* gravity acting on all particles */ #define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */ #define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ @@ -221,17 +223,19 @@ #define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ #define GRAVITY_INITIAL_TIME 200 /* time at start of simulation with constant gravity */ #define GRAVITY_RESTORE_TIME 700 /* time at end of simulation with gravity restored to initial value */ +#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */ #define ROTATION 1 /* set to 1 to include rotation of particles */ #define COUPLE_ANGLE_TO_THERMOSTAT 0 /* set to 1 to couple angular degrees of freedom to thermostat */ #define DIMENSION_FACTOR 1.0 /* scaling factor taking into account number of degrees of freedom */ -#define KTORQUE 100.0 /* force constant in angular dynamics */ +#define KTORQUE 2.0e3 /* force constant in angular dynamics */ #define KTORQUE_B 10.0 /* force constant in angular dynamics */ #define KTORQUE_DIFF 150.0 /* force constant in angular dynamics for different particles */ +#define KTORQUE_BOUNDARY 1.0e6 /* constant in torque from the boundary */ #define DRAW_SPIN 0 /* set to 1 to draw spin vectors of particles */ #define DRAW_SPIN_B 0 /* set to 1 to draw spin vectors of particles */ #define DRAW_CROSS 1 /* set to 1 to draw cross on particles of second type */ -#define SPIN_RANGE 7.0 /* range of spin-spin interaction */ +#define SPIN_RANGE 10.0 /* range of spin-spin interaction */ #define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ #define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ @@ -326,7 +330,7 @@ #define POSITION_Y_DEPENDENCE 0 /* set to 1 for the separation between particles to be horizontal */ #define PRINT_ENTROPY 0 /* set to 1 to compute entropy */ -#define REACTION_DIFFUSION 1 /* set to 1 to simulate a chemical reaction (particles may change type) */ +#define REACTION_DIFFUSION 0 /* set to 1 to simulate a chemical reaction (particles may change type) */ #define RD_REACTION 15 /* type of reaction, see list in global_ljones.c */ #define RD_TYPES 5 /* number of types in reaction-diffusion equation */ #define RD_INITIAL_COND 2 /* initial condition of particles */ @@ -339,7 +343,7 @@ #define COLLISION_TIME 15 /* time during which collisions are shown */ #define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ -#define PLOT_PARTICLE_NUMBER 1 /* set to 1 to make of plot of particle number over time */ +#define PLOT_PARTICLE_NUMBER 0 /* set to 1 to make of plot of particle number over time */ #define PARTICLE_NB_PLOT_FACTOR 0.5 /* expected final number of particles over initial number */ #define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */ #define PLOT_SPEEDS 0 /* set to 1 to add a plot of obstacle speeds (e.g. for rockets) */ @@ -361,14 +365,15 @@ #define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */ #define RAND_SHIFT 200 /* seed of random number generator */ #define MAZE_XSHIFT 0.0 /* horizontal shift of maze */ +#define MAZE_WIDTH 0.01 /* width of maze walls */ #define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ #define FMAX 1.0e10 /* maximal force */ #define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */ #define PMAX 1000.0 /* maximal force */ -#define HASHX 100 /* size of hashgrid in x direction */ -#define HASHY 50 /* size of hashgrid in y direction */ +#define HASHX 60 /* size of hashgrid in x direction */ +#define HASHY 30 /* size of hashgrid in y direction */ #define HASHMAX 100 /* maximal number of particles per hashgrid cell */ #define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ @@ -703,12 +708,13 @@ double evolve_particles(t_particle particle[NMAXCIRCLES], t_hashgrid hashgrid[HA { px[j] *= exp(- 0.5*DT_PARTICLE*xi); py[j] *= exp(- 0.5*DT_PARTICLE*xi); + if (!COUPLE_ANGLE_TO_THERMOSTAT) pangle[j] *= exp(- DT_PARTICLE*DAMPING_ROT); } else { px[j] *= exp(- DT_PARTICLE*damping); py[j] *= exp(- DT_PARTICLE*damping); - pangle[j] *= exp(- DT_PARTICLE*damping); + pangle[j] *= exp(- DT_PARTICLE*DAMPING_ROT); } if ((THERMOSTAT_ON)&&(COUPLE_ANGLE_TO_THERMOSTAT)&&(particle[j].thermostat)) pangle[j] *= exp(- 0.5*DT_PARTICLE*xi); @@ -895,7 +901,15 @@ void evolve_segment_groups(t_segment segment[NMAXSEGMENTS], int time, t_group_se double fx[NMAXGROUPS], fy[NMAXGROUPS], torque[NMAXGROUPS], dx[NMAXGROUPS], dy[NMAXGROUPS], dalpha[NMAXGROUPS]; double x, y, dx0, dy0, padding, proj, distance, f, xx[2], yy[2], xmean = 0.0, ymean = 0.0; int i, j, k, group = 0; - static double maxdepth, saturation_depth; + static double maxdepth, saturation_depth, xmax; + static int first = 1; + + if (first) + { + xmax = XMAX - TRACK_X_PADDING; + if ((PLOT_SPEEDS)||(PLOT_TRAJECTORIES)) xmax -= 1.8; + first = 0; + } maxdepth = 0.5*GROUP_WIDTH; saturation_depth = 0.1*GROUP_WIDTH; @@ -1038,8 +1052,8 @@ void evolve_segment_groups(t_segment segment[NMAXSEGMENTS], int time, t_group_se ymean = ymean/((double)(ngroups-1)); if (ymean > ytrack) ytrack = ymean; - if (xmean > XMAX - TRACK_X_PADDING) - xtrack = xmean - XMAX + TRACK_X_PADDING; + if (xmean > xmax) + xtrack = xmean - xmax; else if (xmean < XMIN + TRACK_X_PADDING) xtrack = xmean - XMIN - TRACK_X_PADDING; } @@ -1048,10 +1062,8 @@ void evolve_segment_groups(t_segment segment[NMAXSEGMENTS], int time, t_group_se void animation() { - double time, scale, diss, rgb[3], dissip, gradient[2], x, y, dx, dy, dt, xleft, xright, a, b, - length, fx, fy, force[2], totalenergy = 0.0, krepel = KREPEL, pos[2], prop, vx, - beta = BETA, xi = 0.0, xmincontainer = BCXMIN, xmaxcontainer = BCXMAX, torque, torque_ij, - fboundary = 0.0, pleft = 0.0, pright = 0.0, entropy[2], mean_energy, gravity = GRAVITY, speed_ratio, ymin, ymax, delta_energy; + double time, scale, diss, rgb[3], dissip, gradient[2], x, y, dx, dy, dt, xleft, xright, + a, b, length, fx, fy, force[2], totalenergy = 0.0, krepel = KREPEL, pos[2], prop, vx, beta = BETA, xi = 0.0, xmincontainer = BCXMIN, xmaxcontainer = BCXMAX, torque, torque_ij, fboundary = 0.0, pleft = 0.0, pright = 0.0, entropy[2], mean_energy, gravity = GRAVITY, speed_ratio, ymin, ymax, delta_energy, speed, ratio = 1.0, ratioc; double *qx, *qy, *px, *py, *qangle, *pangle, *pressure, *obstacle_speeds; int i, j, k, n, m, s, ij[2], i0, iplus, iminus, j0, jplus, jminus, p, q, p1, q1, p2, q2, total_neighbours = 0, min_nb, max_nb, close, wrapx = 0, wrapy = 0, nactive = 0, nadd_particle = 0, nmove = 0, nsuccess = 0, @@ -1070,7 +1082,8 @@ void animation() t_hashgrid *hashgrid; char message[100]; - + ratioc = 1.0 - ratio; + particle = (t_particle *)malloc(NMAXCIRCLES*sizeof(t_particle)); /* particles */ if (ADD_FIXED_OBSTACLES) obstacle = (t_obstacle *)malloc(NMAXOBSTACLES*sizeof(t_obstacle)); /* circular obstacles */ if (ADD_FIXED_SEGMENTS) @@ -1127,9 +1140,9 @@ void animation() -// printf("1\n"); + printf("Initializing configuration\n"); - nactive = initialize_configuration(particle, hashgrid, obstacle, px, py, pangle, tracer_n); + nactive = initialize_configuration(particle, hashgrid, obstacle, px, py, pangle, tracer_n, segment); // xi = 0.0; @@ -1140,8 +1153,9 @@ void animation() sleep(1); update_hashgrid(particle, hashgrid, 1); + printf("Updated hashgrid\n"); compute_relative_positions(particle, hashgrid); - + printf("Computed relative positions\n"); blank(); // glColor3f(0.0, 0.0, 0.0); @@ -1166,9 +1180,12 @@ void animation() thermostat_on = thermostat_schedule(i); printf("Termostat: %i\n", thermostat_on); } + + /* deactivate some segments */ if ((ADD_FIXED_SEGMENTS)&&(DEACTIVATE_SEGMENT)&&(i == INITIAL_TIME + SEGMENT_DEACTIVATION_TIME + 1)) for (j=0; j 0.0)&&(speed < VICSEK_VMIN)) speed = VICSEK_VMIN; + if (speed > VICSEK_VMAX) speed = 0.5*(speed + VICSEK_VMAX); + particle[j].vx = speed*cos(particle[j].angle); + particle[j].vy = speed*sin(particle[j].angle); + + speed = module2(px[j],py[j]); + if ((VICSEK_VMIN > 0.0)&&(speed < VICSEK_VMIN)) speed = VICSEK_VMIN; + if (speed > VICSEK_VMAX) speed = 0.5*(speed + VICSEK_VMAX); + px[j] = speed*cos(particle[j].angle); + py[j] = speed*sin(particle[j].angle); + } + /* add gravity */ if (INCREASE_GRAVITY) particle[j].fy -= gravity/particle[j].mass_inv; else @@ -1260,7 +1293,9 @@ void animation() } if ((MOVE_BOUNDARY)&&(i > OBSTACLE_INITIAL_TIME)) evolve_segments(segment, i); - if ((MOVE_SEGMENT_GROUPS)&&(i > OBSTACLE_INITIAL_TIME)) evolve_segment_groups(segment, i, segment_group); + if ((MOVE_SEGMENT_GROUPS)&&(i > INITIAL_TIME + SEGMENT_DEACTIVATION_TIME)) evolve_segment_groups(segment, i, segment_group); + +// if ((MOVE_SEGMENT_GROUPS)&&(i > OBSTACLE_INITIAL_TIME)) evolve_segment_groups(segment, i, segment_group); } /* end of for (n=0; nINITIAL_TIME)&&(SAVE_TIME_SERIES)) @@ -1305,7 +1340,7 @@ void animation() // if ((PARTIAL_THERMO_COUPLING)) if ((PARTIAL_THERMO_COUPLING)&&(i>N_T_AVERAGE)) { - nthermo = partial_thermostat_coupling(particle, xshift + PARTIAL_THERMO_SHIFT); + nthermo = partial_thermostat_coupling(particle, xshift + PARTIAL_THERMO_SHIFT, segment); printf("%i particles coupled to thermostat out of %i active\n", nthermo, nactive); mean_energy = compute_mean_energy(particle); } @@ -1326,7 +1361,6 @@ void animation() while (particle[j].angle < 0.0) particle[j].angle += DPI; } - /* update tracer particle trajectory */ if ((TRACER_PARTICLE)&&(i > INITIAL_TIME)) { @@ -1347,7 +1381,7 @@ void animation() printf("Boundary force: %.3f\n", fboundary/(double)(ncircles*NVID)); if (RESAMPLE_Y) printf("%i succesful moves out of %i trials\n", nsuccess, nmove); if (INCREASE_GRAVITY) printf("Gravity: %.3f\n", gravity); - + total_neighbours = 0; min_nb = 100; max_nb = 0; @@ -1509,6 +1543,7 @@ void animation() { if (DOUBLE_MOVIE) { + blank(); if (TRACER_PARTICLE) draw_trajectory(trajectory, traj_position, traj_length); draw_particles(particle, PLOT, beta, collisions, ncollisions); draw_container(xmincontainer, xmaxcontainer, obstacle, segment, wall); @@ -1528,9 +1563,14 @@ void animation() else if (PRINT_PARTICLE_SPEEDS) print_particles_speeds(particle); else if (PRINT_SEGMENTS_SPEEDS) print_segment_group_speeds(segment_group); // print_segments_speeds(vxsegments, vysegments); - glutSwapBuffers(); +// glutSwapBuffers(); } - for (i=0; i 0)) - { - switch (IN_OUT_FLOW_BC) { - case (BCE_LEFT): - { - set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, 0.1, 1.0, 0.0, 0.1, phi_out, xy_in, 0, 5, 0, NY, IN_OUT_BC_FACTOR); - break; - } - case (BCE_TOPBOTTOM): - { - set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, -0.1, 0.1, phi_out, xy_in, 0, NX, 0, 10, IN_OUT_BC_FACTOR); - set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, -0.1, 0.1, phi_out, xy_in, 0, NX, NY-10, NY, IN_OUT_BC_FACTOR); - break; - } - case (BCE_TOPBOTTOMLEFT): - { - set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, -0.1, 0.1, phi_out, xy_in, 0, NX, 0, 10, IN_OUT_BC_FACTOR); - set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, -0.1, 0.1, phi_out, xy_in, 0, NX, NY-10, NY, IN_OUT_BC_FACTOR); - set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, -0.1, 0.1, phi_out, xy_in, 0, 2, 0, NY, IN_OUT_BC_FACTOR); - break; - } - case (BCE_CHANNELS): - { - set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, 0.0, 0.1, phi_out, xy_in, 0, imin+5, NY - y_channels, y_channels, IN_OUT_BC_FACTOR); - set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, 0.0, 0.1, phi_out, xy_in, imax-5, NX - 1, NY- y_channels, y_channels, IN_OUT_BC_FACTOR); -// set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, 0.0, 0.1, phi_out, xy_in, imin-5, imin+10, NY - y_channels, y_channels); -// set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, 0.0, 0.1, phi_out, xy_in, imax-10, imax+5, NY- y_channels, y_channels); - break; - } - case (BCE_MIDDLE_STRIP): - { - set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, 0.0, 0.1, phi_out, xy_in, 0, NX, NY/2 - 10, NY/2 + 10, IN_OUT_BC_FACTOR); - set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, 0.0, 0.1, phi_out, xy_in, 0, 2, 0, NY, IN_OUT_BC_FACTOR); - set_boundary_laminar_flow(flow_speed, LAMINAR_FLOW_MODULATION, 0.02, LAMINAR_FLOW_YPERIOD, 1.0, 0.0, 0.1, phi_out, xy_in, NX-2, NX, 0, NY, IN_OUT_BC_FACTOR); - break; - } - } - } + set_in_out_flow_bc(phi_out, xy_in, flow_speed); - if (TEST_GRADIENT) { +// if (TEST_GRADIENT) { // test = 0.0; // for (i=0; iangle = DPI - particle->angle; move++; } else if (x > BCXMAX) { x1 += BCXMIN - BCXMAX; y1 = -y1; + particle->angle = DPI - particle->angle; *py *= -1.0; move++; } diff --git a/sub_lj.c b/sub_lj.c index 6d2f304..0d6ce4f 100644 --- a/sub_lj.c +++ b/sub_lj.c @@ -511,6 +511,24 @@ void set_type_color(int type, double lum, double rgb[3]) glColor3f(lum*rgb[0], lum*rgb[1], lum*rgb[2]); } +double distance_to_segment(double x, double y, double x1, double y1, double x2, double y2) +/* distance of (x,y) to segment from (x1,y1) to (x2,y2) */ +{ + double xp, yp, angle, length, ca, sa; + + angle = argument(x2 - x1, y2 - y1); + length = module2(x2 - x1, y2 - y1); + + ca = cos(angle); + sa = sin(angle); + + xp = ca*(x - x1) + sa*(y - y1); + yp = -sa*(x - x1) + ca*(y - y1); + + if ((xp >= 0)&&(xp <= length)) return(vabs(yp)); + else if (xp < 0) return(module2(xp, yp)); + else return(module2(xp-length, yp)); +} void init_particle_config(t_particle particles[NMAXCIRCLES]) @@ -1207,7 +1225,7 @@ void add_rocket_to_segments(t_segment segment[NMAXSEGMENTS], double x0, double y case (RCK_RECT_HAT): /* rectangular chamber with a hat */ { a = 0.5*LAMBDA; - b = 0.49*PI*LAMBDA; + b = (0.49*PI-0.25)*LAMBDA; add_rotated_angle_to_segments(x0+nozx, nozy, x0+a, nozy, 0.02, segment, 0); add_rotated_angle_to_segments(x0+a, nozy, x0+a, nozy+b, 0.02, segment, 0); add_rotated_angle_to_segments(x0+a, nozy+b, x0, nozy+b+a, 0.02, segment, 0); @@ -1262,7 +1280,7 @@ int init_maze_segments(t_segment segment[NMAXSEGMENTS]) { t_maze* maze; int i, j, n; - double x1, y1, x2, y2, dx, dy, padding = 0.02, width = 0.01; + double x1, y1, x2, y2, dx, dy, padding = 0.02, width = MAZE_WIDTH; maze = (t_maze *)malloc(NXMAZE*NYMAZE*sizeof(t_maze)); @@ -2085,7 +2103,8 @@ int in_rocket(double x, double y, int rocket_shape) { l = 0.7*LAMBDA; y1 = y - YMIN - 1.7*LAMBDA; - return ((x*x + y1*y1)/(l*l) + MU*MU < 0.925); + return ((x*x + y1*y1)/(l*l) + MU*MU < 0.875); +// return ((x*x + y1*y1)/(l*l) + MU*MU < 0.925*LAMBDA*LAMBDA); } case (RCK_RECT) : { @@ -2096,20 +2115,23 @@ int in_rocket(double x, double y, int rocket_shape) } case (RCK_RECT_HAT) : { +// printf("(%.2lg,%.2lg) in rocket?\n", x, y); a = 0.5*LAMBDA; - b = 0.49*PI*LAMBDA; + b = (0.49*PI-0.25)*LAMBDA; y1 = y - YMIN - LAMBDA; if (vabs(x) > 0.95*a) return(0); if (y1 < 0.05) return(0); if (y1 < b - 0.05) return(1); return(y1 < a + b - 0.05 - vabs(x)); +// return(1); } } } -int in_segment_region(double x, double y) +int in_segment_region(double x, double y, t_segment segment[NMAXSEGMENTS]) /* returns 1 if (x,y) is inside region delimited by obstacle segments */ { + int i; double angle, dx, height, width, theta, lx, ly, x1, y1, x2, y2, padding; if (x >= BCXMAX) return(0); @@ -2231,8 +2253,8 @@ int in_segment_region(double x, double y) else if ((y1 > YMIN + 3.5*LAMBDA)&&(y2 > YMIN + 3.5*LAMBDA)) return(0); else { - if (in_rocket(x - xsegments[0], y1, ROCKET_SHAPE)) return(1); - if (in_rocket(x - xsegments[1], y2, ROCKET_SHAPE_B)) return(1); + if (in_rocket(x - xsegments[0], y1, ROCKET_SHAPE_B)) return(1); + if (in_rocket(x - xsegments[1], y2, ROCKET_SHAPE)) return(1); } return(0); } @@ -2263,6 +2285,14 @@ int in_segment_region(double x, double y) if ((y > 1.0 - LAMBDA + padding)&&(vabs(x) < LAMBDA - padding)) return(1); return(0); } + case (S_MAZE): + { + for (i=0; i REPEL_RADIUS*particle.radius) return(0.0); + else + { +// if (r > rmin) rplus = r; +// else rplus = rmin; +// ratio = rplus/particle.eq_dist*particle.radius; + + ratio = r/particle.eq_dist*particle.radius; + + if (ratio < 1.0) return(ratio - 1.0); + else return(0.0); + } +} + +double coulomb_force(double r, t_particle particle) +{ + int i; + double rmin = 0.01, rplus, ratio = 1.0; + + if (r > REPEL_RADIUS*particle.radius) return(0.0); + else + { +// if (r > rmin) rplus = r; +// else rplus = rmin; +// ratio = rplus/particle.eq_dist*particle.radius; + + ratio = r/particle.eq_dist*particle.radius; + + return(-1.0/(ratio*ratio + rmin*rmin)); +// if (ratio < 1.0) return(ratio - 1.0); +// else return(0.0); + } +} + void aniso_lj_force(double r, double ca, double sa, double ca_rel, double sa_rel, double force[2], t_particle particle) { int i; @@ -2844,7 +2913,7 @@ int compute_particle_interaction(int i, int k, double force[2], double *torque, { double x1, y1, x2, y2, r, f, angle, aniso, fx, fy, ff[2], dist_scaled, spin_f, ck, sk, ck_rel, sk_rel; static double dxhalf = 0.5*(BCXMAX - BCXMIN), dyhalf = 0.5*(BCYMAX - BCYMIN); - int wwrapx, wwrapy; + int wwrapx, wwrapy, twrapx, twrapy; if (BOUNDARY_COND == BC_GENUS_TWO) { @@ -2859,6 +2928,8 @@ int compute_particle_interaction(int i, int k, double force[2], double *torque, wwrapx = ((BOUNDARY_COND == BC_KLEIN)||(BOUNDARY_COND == BC_BOY)||(BOUNDARY_COND == BC_GENUS_TWO))&&(vabs(x2 - x1) > dxhalf); wwrapy = ((BOUNDARY_COND == BC_BOY)||(BOUNDARY_COND == BC_GENUS_TWO))&&(vabs(y2 - y1) > dyhalf); + twrapx = ((BOUNDARY_COND == BC_KLEIN)||(BOUNDARY_COND == BC_BOY))&&(vabs(x2 - x1) > dxhalf); + twrapy = (BOUNDARY_COND == BC_BOY)&&(vabs(y2 - y1) > dyhalf); switch (particle[k].interaction) { case (I_COULOMB): @@ -2917,6 +2988,28 @@ int compute_particle_interaction(int i, int k, double force[2], double *torque, force[1] = f*sa; break; } + case (I_VICSEK): + { + force[0] = 0.0; + force[1] = 0.0; + break; + } + case (I_VICSEK_REPULSIVE): + { + f = krepel*coulomb_force(distance, particle[k]); +// f = krepel*harmonic_force(distance, particle[k]); +// f = krepel*lennard_jones_force(distance, particle[k]); + force[0] = f*ca; + force[1] = f*sa; + break; + } + case (I_VICSEK_SPEED): + { + f = cos(0.5*(particle[k].angle - particle[i].angle)); + force[0] = f*KSPRING_VICSEK*(particle[k].vx - particle[i].vx); + force[1] = f*KSPRING_VICSEK*(particle[k].vy - particle[i].vy); + break; + } } if (ROTATION) @@ -2939,10 +3032,31 @@ int compute_particle_interaction(int i, int k, double force[2], double *torque, // printf("force = (%.3lg, %.3lg)\n", ff[0], ff[1]); break; } + case (I_VICSEK): + { + if (dist_scaled > 1.0) *torque = 0.0; + else if (twrapx||twrapy) *torque = sin(-particle[k].angle - particle[i].angle); + else *torque = sin(particle[k].angle - particle[i].angle); + break; + } + case (I_VICSEK_REPULSIVE): + { + if (dist_scaled > 1.0) *torque = 0.0; + else if (twrapx||twrapy) *torque = sin(-particle[k].angle - particle[i].angle); + else *torque = sin(particle[k].angle - particle[i].angle); + break; + } + case (I_VICSEK_SPEED): + { + if (dist_scaled > 1.0) *torque = 0.0; + else if (twrapx||twrapy) *torque = sin(-particle[k].angle - particle[i].angle); + else *torque = sin(particle[k].angle - particle[i].angle); + break; + } default: { spin_f = particle[i].spin_freq; - if (wwrapx||wwrapy) *torque = sin(spin_f*(-particle[k].angle - particle[i].angle))/(1.0e-8 + dist_scaled*dist_scaled); + if (twrapx||twrapy) *torque = sin(spin_f*(-particle[k].angle - particle[i].angle))/(1.0e-8 + dist_scaled*dist_scaled); else *torque = sin(spin_f*(particle[k].angle - particle[i].angle))/(1.0e-8 + dist_scaled*dist_scaled); } @@ -3897,7 +4011,7 @@ void draw_one_particle(t_particle particle, double xc, double yc, double radius, /* specific shapes for chemical reactions */ if (REACTION_DIFFUSION) cont = draw_special_particle(particle, xc1, yc1, radius, angle, nsides, rgb, 1); - if ((particle.interaction == I_LJ_QUADRUPOLE)||(particle.interaction == I_LJ_DIPOLE)) + if ((particle.interaction == I_LJ_QUADRUPOLE)||(particle.interaction == I_LJ_DIPOLE)||(particle.interaction == I_VICSEK)||(particle.interaction == I_VICSEK_REPULSIVE)||(particle.interaction == I_VICSEK_SPEED)) draw_colored_rhombus(xc1, yc1, radius, angle + APOLY*PID, rgb); else if (cont) draw_colored_polygon(xc1, yc1, radius, nsides, angle + APOLY*PID, rgb); @@ -3927,7 +4041,7 @@ void draw_one_particle(t_particle particle, double xc, double yc, double radius, glColor3f(1.0, 1.0, 1.0); if (REACTION_DIFFUSION) cont = draw_special_particle(particle, xc1, yc1, radius, angle, nsides, rgb, 0); - if ((particle.interaction == I_LJ_QUADRUPOLE)||(particle.interaction == I_LJ_DIPOLE)) + if ((particle.interaction == I_LJ_QUADRUPOLE)||(particle.interaction == I_LJ_DIPOLE)||(particle.interaction == I_VICSEK)||(particle.interaction == I_VICSEK_REPULSIVE)||(particle.interaction == I_VICSEK_SPEED)) draw_rhombus(xc1, yc1, radius, angle + APOLY*PID); else if (cont) draw_polygon(xc1, yc1, radius, nsides, angle + APOLY*PID); @@ -3946,14 +4060,28 @@ void draw_collisions(t_collision *collisions, int ncollisions) /* draw discs where collisions happen */ { int i, j; - double rgb[3], lum; + double rgb[3], lum, x, y, x1, y1; + + for (i=0; i 0) { lum = (double)collisions[i].time/(double)COLLISION_TIME; if (collisions[i].color == 0.0) for (j=0; j<3; j++) rgb[j] = lum; else hsl_to_rgb_palette(collisions[i].color, 0.9, lum, rgb, COLOR_PALETTE); - draw_colored_polygon(collisions[i].x, collisions[i].y, 5.0*MU, NSEG, 0.0, rgb); + x = collisions[i].x; + y = collisions[i].y; + + if (CENTER_VIEW_ON_OBSTACLE) x1 = x - xshift; + else x1 = x; + if (TRACK_SEGMENT_GROUPS) + { + x1 -= xtrack; + y1 = y - ytrack; + } + else y1 = y; + + draw_colored_polygon(x1, y1, 5.0*MU, NSEG, 0.0, rgb); collisions[i].time--; } @@ -4939,8 +5067,16 @@ void print_segment_group_speeds(t_group_segments *segment_group) av_vy *= inv_t_window; av_omega *= inv_t_window; - xbox = xleftbox + (xrightbox - xleftbox)*(group-1)/(ngroups-2); - xtext = xlefttext + (xrighttext - xlefttext)*(group-1)/(ngroups-2); + if (ngroups > 2) + { + xbox = xleftbox + (xrightbox - xleftbox)*(group-1)/(ngroups-2); + xtext = xlefttext + (xrighttext - xlefttext)*(group-1)/(ngroups-2); + } + else + { + xbox = xrightbox - 0.2; + xtext = xrighttext - 0.2; + } // printf("xbox = %.2f, xtext = %.2f, av_vy = %.2f\n", xbox, xtext, av_vy); @@ -5013,8 +5149,7 @@ double compute_boundary_force(int j, t_particle particle[NMAXCIRCLES], t_obstacl double xleft, double xright, double *pleft, double *pright, double pressure[N_PRESSURES], int wall) { int i, k; - double xmin, xmax, ymin, ymax, padding, r, rp, r2, cphi, sphi, f, fperp = 0.0, x, y, xtube, distance, dx, dy, - width, ybin, angle, x1, x2, h, ytop, norm, dleft, dplus, dminus, tmp_pleft = 0.0, tmp_pright = 0.0, proj; + double xmin, xmax, ymin, ymax, padding, r, rp, r2, cphi, sphi, f, fperp = 0.0, x, y, xtube, distance, dx, dy, width, ybin, angle, x1, x2, h, ytop, norm, dleft, dplus, dminus, tmp_pleft = 0.0, tmp_pright = 0.0, proj, pscal, pvect, pvmin; /* compute force from fixed circular obstacles */ if (ADD_FIXED_OBSTACLES) for (i=0; i 0.0)&&(proj < 1.0)) { +// distance = segment[i].nx*x + segment[i].ny*y - segment[i].c; distance = segment[i].nx*x + segment[i].ny*y - segment[i].c; r = 1.5*particle[j].radius; if (vabs(distance) < r) { + particle[j].close_to_boundary = 1; + f = KSPRING_OBSTACLE*(r - distance); particle[j].fx += f*segment[i].nx; particle[j].fy += f*segment[i].ny; + + + if ((MOVE_BOUNDARY)||(MOVE_SEGMENT_GROUPS)) { segment[i].fx -= f*segment[i].nx; @@ -5056,6 +5198,15 @@ double compute_boundary_force(int j, t_particle particle[NMAXCIRCLES], t_obstacl segment[i].torque -= (x - segment[i].xc)*f*segment[i].ny - (y - segment[i].yc)*f*segment[i].nx; } } + if ((VICSEK_INT)&&(vabs(distance) < 1.5*r)) + { + pvmin = 2.0; + pvect = cos(particle[j].angle)*segment[i].ny - sin(particle[j].angle)*segment[i].nx; + if ((pvect > 0.0)&&(pvect < pvmin)) pvect = pvmin; + else if ((pvect < 0.0)&&(pvect > -pvmin)) pvect = -pvmin; +// particle[j].torque += KTORQUE_BOUNDARY*pvect; + particle[j].torque += KTORQUE_BOUNDARY*pvect*(1.5*r - vabs(distance)); + } } /* compute force from concave corners */ @@ -5531,7 +5682,7 @@ void compute_particle_force(int j, double krepel, t_particle particle[NMAXCIRCLE int reorder_particles(t_particle particle[NMAXCIRCLES], double py[NMAXCIRCLES], double pangle[NMAXCIRCLES]) -/* keep only active particles */ +/* keep only active particles, beta */ { int i, k, new = 0, nactive = 0; @@ -5580,7 +5731,8 @@ int reorder_particles(t_particle particle[NMAXCIRCLES], double py[NMAXCIRCLES], int initialize_configuration(t_particle particle[NMAXCIRCLES], t_hashgrid hashgrid[HASHX*HASHY], - t_obstacle obstacle[NMAXOBSTACLES], double px[NMAXCIRCLES], double py[NMAXCIRCLES], double pangle[NMAXCIRCLES], int tracer_n[N_TRACER_PARTICLES]) + t_obstacle obstacle[NMAXOBSTACLES], double px[NMAXCIRCLES], double py[NMAXCIRCLES], double pangle[NMAXCIRCLES], int tracer_n[N_TRACER_PARTICLES], + t_segment segment[NMAXSEGMENTS]) /* initialize all particles, obstacles, and the hashgrid */ { int i, j, k, n, nactive = 0; @@ -5599,6 +5751,7 @@ int initialize_configuration(t_particle particle[NMAXCIRCLES], t_hashgrid hashgr particle[i].neighb = 0; particle[i].diff_neighb = 0; particle[i].thermostat = 1; + particle[i].close_to_boundary = 0; // particle[i].energy = 0.0; // y = particle[i].yc; @@ -5671,6 +5824,7 @@ int initialize_configuration(t_particle particle[NMAXCIRCLES], t_hashgrid hashgr particle[i].eq_dist = EQUILIBRIUM_DIST; particle[i].spin_range = SPIN_RANGE; particle[i].spin_freq = SPIN_INTER_FREQUENCY; + particle[i].close_to_boundary = 0; } /* add particles at the bottom as seed */ @@ -5803,7 +5957,7 @@ int initialize_configuration(t_particle particle[NMAXCIRCLES], t_hashgrid hashgr /* case of segment obstacles */ if (ADD_FIXED_SEGMENTS) for (i=0; i< ncircles; i++) - if (!in_segment_region(particle[i].xc, particle[i].yc)) + if (!in_segment_region(particle[i].xc, particle[i].yc, segment)) particle[i].active = 0; /* case of reaction-diffusion equation/chemical reactions */ @@ -5910,6 +6064,27 @@ int initialize_configuration(t_particle particle[NMAXCIRCLES], t_hashgrid hashgr } break; } + case (IC_SIGNX): + { + if (particle[i].xc < 0.0) particle[i].type = 1; + else + { + particle[i].type = 2; + particle[i].radius = MU_B; + particle[i].mass_inv = 1.0/PARTICLE_MASS_B; + } + break; + }case (IC_TWOROCKETS): + { + if (vabs(particle[i].xc) < SEGMENTS_X0) particle[i].type = 1; + else + { + particle[i].type = 2; + particle[i].radius = MU_B; + particle[i].mass_inv = 1.0/PARTICLE_MASS_B; + } + break; + } } } @@ -6012,7 +6187,7 @@ int floor_momentum(double p[NMAXCIRCLES]) return (floor); } -int partial_thermostat_coupling(t_particle particle[NMAXCIRCLES], double xmin) +int partial_thermostat_coupling(t_particle particle[NMAXCIRCLES], double xmin, t_segment segment[NMAXSEGMENTS]) /* only couple particles satisfying condition PARTIAL_THERMO_REGION to thermostat */ { int condition, i, nthermo = 0; @@ -6049,7 +6224,7 @@ int partial_thermostat_coupling(t_particle particle[NMAXCIRCLES], double xmin) } case (TH_INSEGMENT): { - condition = (in_segment_region(particle[i].xc, particle[i].yc)); + condition = (in_segment_region(particle[i].xc, particle[i].yc, segment)); // condition = (in_segment_region(particle[i].xc - xsegments[0], particle[i].yc - ysegments[0])); // // condition = (in_segment_region(particle[i].xc - xsegments[0], particle[i].yc - ysegments[0])); // if (TWO_OBSTACLES) @@ -6776,7 +6951,7 @@ int chem_catalytic_convert(int i, int type2, int newtype, t_particle particle[NM int update_types(t_particle particle[NMAXCIRCLES], t_collision *collisions, int ncollisions, int *particle_numbers, int time, double *delta_e) /* update the types in case of reaction-diffusion equation */ { - int i, j, k, n, n3, n4, type, oldncollisions; + int i, j, k, n, n3, n4, type, oldncollisions, delta_n; double distance, rnd, p1, p2; static double inv_masses[RD_TYPES+1], radii[RD_TYPES+1]; static int first = 1; @@ -6819,7 +6994,10 @@ int update_types(t_particle particle[NMAXCIRCLES], t_collision *collisions, int for (i=0; i 1) delta_n = 1; + if (EXOTHERMIC) *delta_e = (double)(delta_n)*DELTA_EKIN; return(ncollisions); } case (CHEM_A2BC): @@ -7223,6 +7401,8 @@ void draw_trajectory_plot(t_group_data *group_speeds, int i) glLineWidth(2); + printf("ngroups = %i\n", ngroups); + /* plot trajectories */ for (group=1; group NY/2) j1 -= NY/2; + j1 *= 2; + + ij_to_xy(i1, j1, xy); + xy[1] -= 1.5*a; + if (j > NY/2) + { + xy[0] *= -1.0; + xy[0] += 2.0*l*ct; + } + + d0 = tesla_distance(xy[0] +l*ct, xy[1], a, l, theta); + + d = tesla_distance(xy[0], -l*st-xy[1]-0.5*a, a, l, theta); + if (d < d0) d0 = d; + + d = tesla_distance(xy[0] - l*ct -0.2*a, xy[1], a, l, theta); + if (d < d0) d0 = d; + + d = tesla_distance(xy[0] - 2.0*l*ct -0.2*a, -l*st-xy[1]-0.5*a, a, l, theta); + if (d < d0) d0 = d; + + if ((xy[0] < -l*ct)||(xy[0] > 3*l*ct)) + { + d = vabs(xy[1]); + if (d < d0) d0 = d; + } + + r = a - d0; + + f = 0.5*(1.0 + tanh(BC_STIFFNESS*r)); + bc_field[i*NY+j] = f; + + r = 0.9*a - d0; + + f = 0.5*(1.0 + tanh(0.5*BC_STIFFNESS*r)); + bc_field2[i*NY+j] = f; } break; } @@ -886,6 +1011,9 @@ void initialize_bcfield(double bc_field[NX*NY], t_rectangle polyrect[NMAXPOLY]) if (distance < d0) f = fmin*distance/d0; else f = 0.5*(1.0 + tanh(BC_STIFFNESS*(distance - 1.25*MAZE_WIDTH))); bc_field[i*NY+j] = f; + + if (distance >= d0) f = 0.5*(1.0 + tanh(BC_STIFFNESS*(distance - 1.5*MAZE_WIDTH))); + bc_field2[i*NY+j] = f; // printf("distance = %.5lg, bcfield = %.5lg\n", distance, f); } } @@ -897,12 +1025,15 @@ void adapt_state_to_bc(double *phi[NFIELDS], double bc_field[NX*NY], short int x /* apply smooth modulation to adapt initial state to obstacles */ { int i, j, field; - double xy[2], r, f; + double xy[2], r, f; +// double ratio = 1.0e-1; #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 = 5.0 - 4.0*pow((double)k/(double)MANDELLEVEL, 0.1); + speed = 1.0 + 4.0*log(1.0 - 0.1*log((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] = courantb2*speed; + tc[i*NY+j] = COURANTB*sqrt(speed); + tgamma[i*NY+j] = GAMMAB; + } + } + } + break; + } case (IOR_EARTH): { for (i=0; i 0.0) wave_source[k].sign = 1; +// else wave_source[k].sign = -1; + wave_source[k].sign = 1; + } + first_source = 0; + + for (k=0; k<25; k++) + wave_source[k].phase += 1.4*sin(0.7*(1.0 + wave_source[k].xc*cos(angle)/0.05 + wave_source[k].yc*sin(angle)/0.05)); + + angle = DPI*(double)i/(double)NSTEPS; +// phase_shift = 0.02 + 0.08*(double)i/(double)NSTEPS; +// printf("Phase shift = %.3lg\n", phase_shift); + + for (k=0; k<25; k++) + { +// wave_source[k].phase += 0.07; + wave_source[k].phase += phase_shift; + wave_source[k].phase -= 1.4*sin(0.7*(1.0 + wave_source[k].xc*cos(angle)/0.05 + wave_source[k].yc*sin(angle)/0.05)); + + if (wave_source[k].phase > 1.0) + { + add_circular_wave_mod((double)wave_source[k].sign*wave_source[k].amp, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } // for (j=0; j 1.0) + { + add_circular_wave((double)wave_source[k].sign*wave_source[k].amp, wave_source[k].xc, wave_source[k].yc, phi, psi, xy_in); + printf("Adding wave at (%.2lg, %.2lg)\n", wave_source[k].xc, wave_source[k].yc); + wave_source[k].phase -= 1.0; + wave_source[k].sign *= -1; + } + } + // p = 3; // y = -1.0; // sign1 = sign; @@ -834,6 +870,7 @@ void animation() } if (ADD_WAVE_PACKET_SOURCES) add_wave_packets(phi, psi, xy_in, packet, i, WAVE_PACKET_RADIUS, 0, 10, 1); if (PRINT_SPEED) print_speed(speed, 0, 1.0); + if (PRINT_FREQUENCY) print_frequency(phase_shift, 0, 1.0); if ((VARIABLE_IOR)&&(REFRESH_IOR)&&(i%3 == 0)) { ior_angle = ior_angle_schedule(i); @@ -858,6 +895,7 @@ void animation() draw_billiard(0, 1.0); if (DRAW_COLOR_SCHEME) draw_color_bar_palette(PLOT_B, COLORBAR_RANGE_B, COLOR_PALETTE_B, 0, 1.0); if (PRINT_SPEED) print_speed(speed, 0, 1.0); + if (PRINT_FREQUENCY) print_frequency(phase_shift, 0, 1.0); glutSwapBuffers(); save_frame_counter(NSTEPS + MID_FRAMES + 1 + counter); counter++; @@ -886,6 +924,7 @@ void animation() draw_billiard(0, 1.0); if (DRAW_COLOR_SCHEME) draw_color_bar_palette(PLOT, COLORBAR_RANGE, COLOR_PALETTE, 0, 1.0); if (PRINT_SPEED) print_speed(speed, 0, 1.0); + if (PRINT_FREQUENCY) print_frequency(phase_shift, 0, 1.0); glutSwapBuffers(); } if (!FADE) for (i=0; i