Add files via upload

This commit is contained in:
Nils Berglund 2025-01-11 19:25:51 +01:00 committed by GitHub
parent ac6280f770
commit 8a20ab883a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 2539 additions and 289 deletions

View File

@ -12,6 +12,7 @@
#define E_EULER_INCOMP 6 /* incompressible Euler equation */
#define E_EULER_COMP 7 /* compressible Euler equation */
#define E_SHALLOW_WATER 8 /* shallow water equation */
#define E_KURAMOTO 9 /* Kuramoto-type equation (nearest neighbor coupling) */
/* Choice of potential */

View File

@ -13,15 +13,17 @@
#define NMAXCIRCLES 200000 /* total number of circles/polygons (must be at least NCX*NCY for square grid) */
#define MAXNEIGH 20 /* max number of neighbours kept in memory */
#define NMAXOBSTACLES 1000 /* max number of obstacles */
#define NMAXSEGMENTS 1000 /* max number of repelling segments */
#define NMAXGROUPS 50 /* max number of groups of segments */
#define NMAXOBSTACLES 5000 /* max number of obstacles */
#define NMAXSEGMENTS 1200 /* max number of repelling segments */
#define NMAXGROUPS 100 /* max number of groups of segments */
#define NMAXCOLLISIONS 200000 /* max number of collisions */
#define NMAXPARTNERS 30 /* max number of partners in molecule */
#define NMAXPARTNERMOLECULES 30 /* max number of partners of a molecule */
#define NMAXPARTINCLUSTER 500 /* max number of particles in cluster */
#define NMAXBELTS 10 /* max number of conveyor belts */
#define NMAXSHOVELS 50 /* max number of shovels */
#define NMAX_TRIANGLES_PER_OBSTACLE 10 /* max number of triangles per obstacle */
#define NMAX_TRIANGLES_PER_FACET 5 /* max number of triangles per facet between obstacles */
#define C_SQUARE 0 /* square grid of circles */
#define C_HEX 1 /* hexagonal/triangular grid of circles */
@ -46,6 +48,7 @@
/* pattern of additional obstacles */
#define O_CORNERS 0 /* obstacles in the corners (for Boy b.c.) */
#define O_GALTON_BOARD 1 /* Galton board pattern */
#define O_GALTON_BOARD_WIDE 11 /* wide Galton board pattern */
#define O_GENUS_TWO 2 /* obstacles in corners of L-shape domeain (for genus 2 b.c.) */
#define O_POOL_TABLE 3 /* obstacles around pockets of pool table */
#define O_HLINE_HOLE_SPOKES 181 /* tips of spokes for S_HLINE_HOLE_SPOKES segment pattern */
@ -58,6 +61,22 @@
#define O_SIEVE_B 81 /* obstacles form a sieve, v2 */
#define O_SIEVE_LONG 82 /* obstacles form a long sieve */
#define O_SIEVE_LONG_B 83 /* obstacles form a long sieve, version with varying spacing */
#define O_SIEVE_VIDEO1400 84 /* sieve for vide #1400 */
#define O_SQUARE 9 /* square lattice */
#define O_SQUARE_TWOMASSES 91 /* square lattice with alternating masses */
#define O_POISSON_DISC 20 /* Poisson disc sample */
/* type of obstacle pinning */
#define OP_NPINNED 0 /* obstacles with NMAX_OBSTACLE_PINNED neighbours or less are pinned*/
#define OP_LEFT 1 /* obstacles on the left are pinned */
#define OP_LEFTTOPBOT 2 /* obstacles on the left, top or bottom are pinned */
#define OP_CORNERS 3 /* obstacles in corners are pinned */
#define OP_LEFTCORNERS 4 /* obstacles in left half and corners are pinned */
#define OP_BNDRY_STEP 5 /* obstacles on boundary are pinned when at distance BDRY_PINNING_STEP */
/* type of obstacle recoupling */
#define OR_FIXED_DIST 0 /* resample within fixed distance */
#define OR_BREAK_MAX 1 /* break bonds when max length is reached */
/* pattern of additional repelling segments */
#define S_RECTANGLE 0 /* segments forming a rectangle */
@ -95,6 +114,7 @@
#define S_COANDA_SHORT 26 /* shorter wall for Coanda effect */
#define S_CYLINDER 27 /* walls at top and bottom, for cylindrical b.c. */
#define S_TREE 28 /* Christmas tree(s) */
#define S_TREES_B 281 /* Christmas trees, variant 2 */
#define S_CONE 29 /* cone */
#define S_CONVEYOR_BELT 30 /* conveyor belt */
#define S_TWO_CONVEYOR_BELTS 31 /* two angled conveyor belts */
@ -105,8 +125,11 @@
#define S_CONVEYOR_SIEVE 35 /* conveyor belts for polygon sieve */
#define S_CONVEYOR_SIEVE_B 351 /* conveyor belts for polygon sieve, v2 with backward top conveyor */
#define S_CONVEYOR_SIEVE_LONG 352 /* conveyor belts for long polygon sieve */
#define S_CONVEYORS_1400 353 /* conveyors for video #1400 */
#define S_MASS_SPECTROMETER 36 /* bins for mass spectrometer */
#define S_WIND_FORCE 361 /* bins for sorting by wind force */
#define S_BINS_GALTON 362 /* bins for Galton board */
#define S_BINS_GALTON_WIDE 363 /* more bins for Galton board */
/* particle interaction */
@ -151,6 +174,7 @@
#define BC_ABSORBING 20 /* "no-return" boundary conditions outside BC area */
#define BC_REFLECT_ABS 21 /* reflecting on lower boundary, and "no-return" boundary conditions outside BC area */
#define BC_REFLECT_ABS_BOTTOM 22 /* absorbing on lower boundary, and reflecting elsewhere */
#define BC_REFLECT_ABS_RIGHT 23 /* absorbing on right boundary, and reflecting elsewhere */
/* Regions for partial thermostat couplings */
@ -302,6 +326,12 @@
#define IP_X 0 /* color depends on x coordinate of initial position */
#define IP_Y 1 /* color depends on y coordinate of initial position */
/* Space dependence of electric field */
#define EF_CONST 0 /* constant magnetic field */
#define EF_SQUARE 1 /* magnetic field concentrated in square */
#define EF_LEFT 2 /* magnetic field concentrated region x < YMIN */
/* Space dependence of magnetic field */
#define BF_CONST 0 /* constant magnetic field */
@ -336,6 +366,16 @@
#define BG_CHARGE 2 /* background color depends on charge density */
#define BG_EKIN 3 /* background color depends on kinetic energy */
#define BG_FORCE 4 /* background color depends on total force */
#define BG_EOBSTACLES 5 /* background color depends on obstacle energy */
#define BG_EKIN_OBSTACLES 6 /* background color depends on kinetic energy plus obstacle energy */
#define BG_DIR_OBSTACLES 7 /* background color depends on direction of velocity of obstacles */
#define BG_POS_OBSTACLES 8 /* background color depends on displacement of obstacles */
/* Obstacle color schemes */
#define OC_ENERGY 0 /* obstacle color depends on energy */
#define OC_DIRECTION 1 /* obstacle color depends on direction */
#define OC_DIRECTION_ENERGY 2 /* obstacle hue depends on direction, luminosity on energy */
/* Particle add regions */
@ -447,6 +487,8 @@ typedef struct
{
int number; /* total number of particles in cell */
int particles[HASHMAX]; /* numbers of particles in cell */
int nobs; /* number of obstacles in cell */
int obstacle; /* obstacle number */
int nneighb; /* number of neighbouring cells */
int neighbour[9]; /* numbers of neighbouring cells */
double x1, y1, x2, y2; /* coordinates of hashcell corners */
@ -475,16 +517,47 @@ typedef struct
typedef struct
{
double xc, yc, radius; /* center and radius of circle */
double vx, vy; /* speed for option OSCILLATING_OBSTACLES */
double fx, fy; /* force for option OSCILLATING_OBSTACLES */
double xc0, yc0; /* center of oscillation for option RATTLE_OBSTACLES */
double energy; /* total energy (kinetic + potential) of obstacle */
short int active; /* circle is active */
double charge; /* charge of obstacle, for EM simulations */
double mass; /* mass for option OSCILLATING_OBSTACLES */
double omega0, omega; /* speed of rotation */
double angle; /* angle of obstacle */
short int oscillate; /* has value 1 if the obstacles oscillates over time */
int period; /* oscillation period */
double amplitude, phase; /* amplitude and phase of oscillation */
int nneighb; /* number of neighbours, for option OSCILLATING_OBSTACLES */
int neighb[NMAX_OBSTACLE_NEIGHBOURS]; /* list of neighour numbers */
double eqdist[NMAX_OBSTACLE_NEIGHBOURS]; /* equilibrium distance to neighbours */
short int pinned; /* has value 1 if particle is pinned to a fixed position */
short int chessboard; /* has value 1 on a chessboard, for some arrangements */
} t_obstacle;
typedef struct
{
int i[3]; /* indices of obstacles forming triangle */
int facet; /* index of facet triangle belongs to */
short int acute; /* value depends on central angle */
short int infacet; /* has value 1 if triangle belongs to a facet */
double area0; /* initial area */
} t_otriangle;
typedef struct
{
int ntriangles; /* number of triangles belonging to facet */
int triangle[NMAX_TRIANGLES_PER_FACET]; /* indices of triangles belonging to facet */
double area0; /* initial area */
} t_ofacet;
typedef struct
{
double xc, yc; /* point in R^2, for Poisson disc generation */
} t_point;
typedef struct
{
double x1, x2, y1, y2; /* extremities of segment */
@ -586,6 +659,6 @@ typedef struct
int frame_time = 0, ncircles, nobstacles, nsegments, ngroups = 1, counter = 0, nmolecules = 0, nbelts = 0, n_tracers = 0;
int frame_time = 0, ncircles, nobstacles, nsegments, ngroups = 1, counter = 0, nmolecules = 0, nbelts = 0, n_tracers = 0, n_otriangles = 0, n_ofacets = 0;
FILE *lj_log;

View File

@ -109,6 +109,12 @@
#define D_TWOCIRCLES 79 /* two circles of different size */
#define D_POLYCIRCLES 791 /* one large circle and NPOLY small ones */
#define D_POLYCIRCLES_ANGLED 792 /* variant of D_POLYCIRCLES with angled small cavities */
#define D_TWOCIRCLES_ELLIPSE 793 /* ellipse with two adjacent circular cavities */
#define D_CIRCLES_ELLIPSE 794 /* ellipse with NPOLY adjacent circles */
#define D_CARDIOID 90 /* cardioid */
#define D_NEPHROID 91 /* nephroid */
#define D_EPICYCLOID 92 /* epicycloid */
/* for wave_sphere.c */
@ -126,6 +132,16 @@
#define D_SPHERE_MAZE_SPIRAL 101 /* circular maze on the sphere with slanted walls */
#define D_SPHERE_MAZE_WAVE 102 /* circular maze on the sphere with wavy walls */
/* image files for D_IMAGE option */
#define IM_PHOTONS 0 /* word "photons" */
#define IM_GUITAR 1 /* guitar shape */
#define IM_GUITAR_NOHOLE 11 /* guitar shape without sound hole or neck */
#define IM_EGUITAR 2 /* electric guitar shape */
#define IM_HAPPY_NEW_YEAR 3 /* "Happy New Year 2025" */
#define IM_DICKSON 4 /* Dickson fjord and others nearbys in Greenland */
#define IM_DICKSON_ZOOM 5 /* zoom on Dickson fjord in Greenland */
#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) */
#define NMAXSOURCES 30 /* maximal number of sources */
@ -466,3 +482,6 @@ double julia_x = 0.37468, julia_y = 0.21115; /* parameters for Julia sets */
double wave_source_x[NMAXSOURCES], wave_source_y[NMAXSOURCES]; /* position of wave source */
double focus_x = XMAX; /* position of focus */
double michelson_position = 0.0; /* position of mirror in Michelson interferometer */
#define NEPICYCLOID 2000 /* number of sampled values for epicycloid */
double epicycloid_phi_to_r[NEPICYCLOID]; /* angles for epicycloid */

1
heat.c
View File

@ -67,6 +67,7 @@
#define B_DOMAIN 27 /* choice of domain shape, see list in global_pdes.c */
#define CIRCLE_PATTERN 0 /* pattern of circles, see list in global_pdes.c */
#define IMAGE_FILE 5 /* for option D_IMAGE */
#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 */

View File

@ -58,42 +58,57 @@
#define YMIN -1.125
#define YMAX 1.125 /* y interval for 9/16 aspect ratio */
#define INITXMIN -2.1
#define INITXMAX -2.0 /* x interval for initial condition */
#define INITYMIN -0.7
#define INITYMAX -0.6 /* y interval for initial condition */
#define INITXMIN -1.0
#define INITXMAX -1.9 /* x interval for initial condition */
#define INITYMIN -0.1
#define INITYMAX 0.1 /* y interval for initial condition */
#define THERMOXMIN -1.25
#define THERMOXMAX 1.25 /* x interval for initial condition */
#define THERMOYMIN 0.0
#define THERMOYMAX 0.75 /* y interval for initial condition */
#define ADDXMIN -2.1
#define ADDXMAX -2.0 /* x interval for adding particles */
#define ADDYMIN -0.6
#define ADDYMAX -0.5 /* y interval for adding particles */
#define ADDXMIN -2.2
#define ADDXMAX -2.0 /* x interval for adding particles */
#define ADDYMIN -1.0
#define ADDYMAX 1.0 /* y interval for adding particles */
#define ADDRMIN 4.75
#define ADDRMAX 6.0 /* r interval for adding particles */
#define BCXMIN -2.2
#define BCXMAX 2.0 /* x interval for boundary condition */
#define BCXMIN -2.5
#define BCXMAX 2.5 /* x interval for boundary condition */
#define BCYMIN -1.125
#define BCYMAX 1.4 /* y interval for boundary condition */
#define BCYMAX 1.125 /* y interval for boundary condition */
#define OBSXMIN -2.0
#define OBSXMIN -1.8
#define OBSXMAX 2.0 /* x interval for motion of obstacle */
#define OBSYMIN -1.125
#define OBSYMAX 1.125 /* x interval for motion of obstacle */
#define CIRCLE_PATTERN 1 /* pattern of circles, see list in global_ljones.c */
#define ADD_INITIAL_PARTICLES 0 /* set to 1 to add a second type of particles */
#define CIRCLE_PATTERN_B 0 /* pattern of circles for additional particles */
#define ADD_FIXED_OBSTACLES 0 /* set to 1 do add fixed circular obstacles */
#define OBSTACLE_PATTERN 82 /* pattern of obstacles, see list in global_ljones.c */
#define RATTLE_OBSTACLES 1 /* set to 1 to rattle obstacles (for pattern O_SIEVE_B) */
#define ADD_FIXED_OBSTACLES 1 /* set to 1 do add fixed circular obstacles */
#define OBSTACLE_PATTERN 20 /* pattern of obstacles, see list in global_ljones.c */
#define RATTLE_OBSTACLES 0 /* set to 1 to rattle obstacles (for pattern O_SIEVE_B) */
#define OSCILLATE_OBSTACLES 1 /* set to 1 to make obstacles oscillate */
#define COUPLE_OBSTACLES 1 /* set to 1 to couple obstacles to neighbours */
#define OBSTACLE_PISC_DISTANCE 0.12 /* minimal distance in Poisson disc process for obstacles, controls density of obstacles */
#define OBSTACLE_COUPLING_DIST 0.18 /* max distance of coupled obstacles */
#define NMAX_OBSTACLE_NEIGHBOURS 8 /* max number of obstacle neighbours */
#define NMAX_OBSTACLE_PINNED 10 /* max number of neighbours to be pinned */
#define OBSTACLE_PINNING_TYPE 0 /* type of obstacle pinning, see OP_ in global_ljones */
#define BDRY_PINNING_STEP 4 /* interval between pinned obstacles on boundary */
#define RECOUPLE_OBSTACLES 0 /* set to 1 to reset obstacle coupling */
#define OBSTACLE_RECOUPLE_TYPE 1 /* algorithm for recoupling, see OR_ in global_ljones */
#define OBSTACLE_RECOUPLE_TIME 200 /* time between obstacle recouplings */
#define UNCOUPLE_MAXLENGTH 2.0 /* length at which bonds decouple */
#define COUPLE_MINLENGTH 0.5 /* length at which bonds decouple */
#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */
#define SEGMENT_PATTERN 361 /* pattern of repelling segments, see list in global_ljones.c */
#define ADD_FIXED_SEGMENTS 0 /* 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 3 /* shape of rocket combustion chamber, see list in global_ljones.c */
#define ROCKET_SHAPE_B 3 /* shape of second rocket */
#define NOZZLE_SHAPE 6 /* shape of nozzle, see list in global_ljones.c */
@ -124,7 +139,7 @@
#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */
#define LAMBDA 0.2 /* parameter controlling the dimensions of domain */
#define MU 0.02 /* parameter controlling radius of particles */
#define MU 0.007 /* parameter controlling radius of particles */
#define MU_B 0.03 /* parameter controlling radius of particles of second type */
#define NPOLY 3 /* number of sides of polygon */
#define APOLY 0.075 /* angle by which to turn polygon, in units of Pi/2 */
@ -140,8 +155,8 @@
#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 NOBSX 10
#define NOBSY 5 /* obstacles for O_HEX obstacle pattern */
#define NOBSX 20
#define NOBSY 10 /* obstacles for O_HEX obstacle pattern */
#define NTREES 15 /* number of trees in S_TREES */
#define X_SHOOTER -0.2
@ -150,9 +165,9 @@
#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 120 /* number of iterations between images displayed on screen */
#define NSTEPS 4500 /* number of frames of movie */
#define NVID 4500 /* number of iterations between images displayed on screen */
#define NSEG 25 /* number of segments of boundary of circles */
#define INITIAL_TIME 0 /* time after which to start saving frames */
#define OBSTACLE_INITIAL_TIME 0 /* time after which to start moving obstacle */
@ -169,29 +184,34 @@
/* Boundary conditions, see list in global_ljones.c */
#define BOUNDARY_COND 1
#define BOUNDARY_COND 23
/* Plot type, see list in global_ljones.c */
#define PLOT 23
#define PLOT_B 13 /* plot type for second movie */
#define PLOT 13
#define PLOT_B 12 /* plot type for second movie */
/* Background color depending on particle properties */
#define COLOR_BACKGROUND 0 /* set to 1 to color background */
#define BG_COLOR 2 /* type of background coloring, see list in global_ljones.c */
#define BG_COLOR_B 0 /* type of background coloring, see list in global_ljones.c */
#define BG_COLOR 7 /* type of background coloring, see list in global_ljones.c */
#define BG_COLOR_B 5 /* type of background coloring, see list in global_ljones.c */
#define OBSTACLE_COLOR 0 /* type of obstacle, see OC_ in global_ljones.c */
#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 0 /* set to 1 to fill triangles between neighbours */
#define DRAW_CLUSTER_LINKS 0 /* set to 1 to draw links between particles in cluster */
#define DRAW_OBSTACLE_LINKS 1 /* set to 1 to draw links between interacting obstacles */
#define FILL_OBSTACLE_TRIANGLES 0 /* set to 1 to fill triangles between interacting obstacles */
#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 */
#define N_PARTICLE_COLORS 300 /* number of colors for P_NUMBER color scheme */
#define N_PARTICLE_COLORS 5 /* number of colors for P_NUMBER color scheme */
#define INITIAL_POS_TYPE 0 /* type of initial position dependence */
#define ERATIO 0.995 /* ratio for time-averaging in P_EMEAN color scheme */
#define DRATIO 0.999 /* ratio for time-averaging in P_DIRECT_EMEAN color scheme */
#define OBSTACLE_AREA_SHADE_FACTOR 160.0 /* controls sensitivity of triangle shade for option FILL_OBSTACLE_TRIANGLES */
#define SHADE_OBSTACLE_FACETS 0 /* set to 1 to shade facets instead of triangles */
/* Color schemes */
@ -242,8 +262,12 @@
#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_EMIN 10.0 /* energy of particle with coolest color */
#define PARTICLE_EMAX 2000.0 /* energy of particle with hottest color */
#define PARTICLE_EMIN 100.0 /* energy of particle with coolest color */
#define PARTICLE_EMAX 3000.0 /* energy of particle with hottest color */
#define SEGMENT_HUE_MIN 275.0 /* color of original segment */
#define SEGMENT_HUE_MAX 30.0 /* color of saturated segment */
#define OBSTACLE_EMAX 200.0 /* energy of obstacle with hottest color */
#define OBSTACLE_VMAX 4.0 /* speed of obstacle with largest luminosity */
#define HUE_TYPE0 320.0 /* hue of particles of type 0 */
#define HUE_TYPE1 60.0 /* hue of particles of type 1 */
#define HUE_TYPE2 320.0 /* hue of particles of type 2 */
@ -254,26 +278,26 @@
#define HUE_TYPE7 150.0 /* hue of particles of type 7 */
#define BG_FORCE_SLOPE 7.5e-8 /* contant in BG_FORCE backgound color scheme*/
#define RANDOM_RADIUS 1 /* set to 1 for random particle radius */
#define RANDOM_RADIUS_MIN 0.25 /* min of random particle radius (default 0.75) */
#define RANDOM_RADIUS_RANGE 1.5 /* range of random particle radius (default 0.5) */
#define ADAPT_MASS_TO_RADIUS 0 /* set to positive value to for mass prop to power of radius */
#define RANDOM_RADIUS 0 /* set to 1 for random particle radius */
#define RANDOM_RADIUS_MIN 0.4 /* min of random particle radius (default 0.75) */
#define RANDOM_RADIUS_RANGE 1.0 /* range of random particle radius (default 0.5) */
#define ADAPT_MASS_TO_RADIUS 1 /* set to positive value to for mass prop to power of radius */
#define ADAPT_DAMPING_TO_RADIUS 0.5 /* set to positive value to for friction prop to power of radius */
#define ADAPT_DAMPING_FACTOR 0.5 /* factor by which damping is adapted to radius */
#define DT_PARTICLE 3.0e-6 /* time step for particle displacement */
#define DT_PARTICLE 2.0e-7 /* time step for particle displacement */
#define KREPEL 50.0 /* constant in repelling force between particles */
#define EQUILIBRIUM_DIST 2.5 /* Lennard-Jones equilibrium distance */
#define EQUILIBRIUM_DIST_B 2.5 /* Lennard-Jones equilibrium distance for second type of particle */
#define SEGMENT_FORCE_EQR 1.0 /* equilibrium distance factor for force from segments (default 1.5) */
#define REPEL_RADIUS 25.0 /* radius in which repelling force acts (in units of particle radius) */
#define DAMPING 150.0 /* damping coefficient of particles */
#define DAMPING 0.0 /* damping coefficient of particles */
#define INITIAL_DAMPING 1000.0 /* damping coefficient of particles during initial phase */
#define DAMPING_ROT 5.0 /* damping coefficient for rotation of particles */
#define PARTICLE_MASS 2.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.5 /* moment of inertia of particle */
#define PARTICLE_INERTIA_MOMENT_B 0.5 /* moment of inertia of second type of particle */
#define V_INITIAL 800.0 /* initial velocity range */
#define V_INITIAL 50.0 /* initial velocity range */
#define OMEGA_INITIAL 100.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 */
@ -289,7 +313,7 @@
#define KSPRING_BOUNDARY 2.0e11 /* confining harmonic potential outside simulation region */
#define KSPRING_OBSTACLE 1.0e9 /* harmonic potential of obstacles */
#define NBH_DIST_FACTOR 4.0 /* radius in which to count neighbours */
#define GRAVITY 5000.0 /* gravity acting on all particles */
#define GRAVITY 0.0 /* gravity acting on all particles */
#define GRAVITY_X 0.0 /* horizontal gravity acting on all particles */
#define CIRCULAR_GRAVITY 0 /* set to 1 to have gravity directed to center */
#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */
@ -300,10 +324,11 @@
#define KSPRING_VICSEK 0.2 /* spring constant for I_VICSEK_SPEED interaction */
#define VICSEK_REPULSION 10.0 /* repulsion between particles in Vicsek model */
#define ADD_EFIELD 0 /* set to 1 to add an electric field */
#define EFIELD 30000.0 /* value of electric field */
#define ADD_BFIELD 0 /* set to 1 to add a magnetic field */
#define BFIELD 225.0 /* value of magnetic field */
#define ADD_EFIELD 1 /* set to 1 to add an electric field */
#define EFIELD 0.0 /* value of electric field */
#define EFIELD_Y 1500.0 /* value of electric field */
#define ADD_BFIELD 1 /* set to 1 to add a magnetic field */
#define BFIELD 1200.0 /* value of magnetic field */
#define CHARGE 1.0 /* charge of particles of first type */
#define CHARGE_B 1.0 /* charge of particles of second type */
#define INCREASE_E 0 /* set to 1 to increase electric field */
@ -312,14 +337,20 @@
#define BFIELD_FACTOR 1.0 /* factor by which to increase magnetic field */
#define CHARGE_OBSTACLES 0 /* set to 1 for obstacles to be charged */
#define OBSTACLE_CHARGE 3.0 /* charge of obstacles */
#define OBSTACLE_MASS 100.0 /* mass of obstacles, if oscillating */
#define KSPRING_OBSTACLE_OSC 1.0e7 /* spring constant for oscillating obstacles */
#define KSPRING_OBSTACLE_COUPLE 5.0e6 /* spring constant for coupled obstacles */
#define OBSTACLE_HARDCORE 1 /* set to 1 to add "hard core" repulsion between obstacles */
#define KSPRING_OBSTACLE_HARDCORE 1.0e11 /* spring constant for obstacle hard core repulsion */
#define KCOULOMB_OBSTACLE 1000.0 /* Coulomb force constant for charged obstacles */
#define BFIELD_REGION 1 /* space-dependent magnetic field (0 for constant) */
#define EFIELD_REGION 0 /* space-dependent magnetic field (0 for constant) */
#define BFIELD_REGION 0 /* space-dependent magnetic field (0 for constant) */
#define ADD_WIND 1 /* set to 1 to add a "wind" friction force */
#define ADD_WIND 0 /* set to 1 to add a "wind" friction force */
#define WIND_FORCE 1.35e6 /* force of wind */
#define WIND_YMIN -0.6 /* min altitude of region with wind */
#define ROTATION 1 /* set to 1 to include rotation of particles */
#define ROTATION 0 /* 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 1.0e5 /* force constant in angular dynamics */
@ -355,7 +386,7 @@
#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.018 /* radius of obstacle for circle boundary conditions */
#define OBSTACLE_RADIUS 0.03 /* 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 */
@ -382,17 +413,22 @@
#define ADD_PARTICLES 1 /* set to 1 to add particles */
#define ADD_REGION 0 /* shape of add regions, cf ADD_* in global_ljones */
#define ADD_TIME 0 /* time at which to add first particle */
#define ADD_PERIOD 15 /* time interval between adding further particles */
#define ADD_PERIOD 150 /* time interval between adding further particles */
#define N_ADD_PARTICLES 1 /* number of particles to add */
#define FINAL_NOADD_PERIOD 500 /* final period where no particles are added */
#define SAFETY_FACTOR 4.0 /* no particles are added at distance less than MU*SAFETY_FACTOR of other particles */
#define TRACER_PARTICLE 1 /* set to 1 to have a tracer particle */
#define N_TRACER_PARTICLES 500 /* number of tracer particles */
#define TRAJECTORY_LENGTH 4800 /* length of recorded trajectory */
#define TRACER_LUM_FACTOR 5.0 /* controls luminosity decrease of trajectories with time */
#define N_TRACER_PARTICLES 100 /* number of tracer particles */
#define TRACER_STEPS 5 /* number of tracer steps recorded between images */
#define TRAJECTORY_LENGTH 40000 /* length of recorded trajectory */
#define TRACER_LUM_FACTOR 100.0 /* controls luminosity decrease of trajectories with time */
#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */
#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */
#define TRAJECTORY_WIDTH 2 /* width of tracer particle trajectory */
#define TRACK_PARTICLE 0 /* set to 1 to track a given particle */
#define TRACKED_PARTICLE 2 /* number of tracked particle */
#define TRACK_INITIAL_TIME 900 /* time when starting to track */
#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) */
@ -416,9 +452,11 @@
#define SHOW_SEGMENTS_PRESSURE 0 /* set to 1 to show (averaged) pressure acting on segments */
#define SEGMENT_PMAX 7.5e7 /* pressure of segment with hottest color */
#define P_AVRG_FACTOR 0.02 /* factor in computation of mean pressure */
#define INACTIVATE_SEGMENTS_UNDER_PRESSURE 0 /* set to 1 to inactivate segment groups when limit pressure is reached */
#define SEGMENT_P_INACTIVATE 6.0e7 /* pressure at which to inactivate group */
#define MOVE_SEGMENT_GROUPS 0 /* set to 1 to group segments into moving units */
#define SEGMENT_GROUP_MASS 500.0 /* mass of segment group */
#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 */
@ -478,7 +516,7 @@
#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.015 /* width of wall for BC_RECTANGLE_WALL b.c. */
#define WALL_WIDTH 0.025 /* 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 */
@ -517,19 +555,19 @@
#define PARTICLE_MASS_D 2.0 /* mass or partner particle */
#define CHARGE_D 1.0 /* charge of partner particle */
#define NXMAZE 12 /* width of maze */
#define NYMAZE 12 /* height of maze */
#define NXMAZE 16 /* width of maze */
#define NYMAZE 16 /* height of maze */
#define MAZE_MAX_NGBH 4 /* max number of neighbours of maze cell */
#define RAND_SHIFT 4 /* seed of random number generator */
#define MAZE_XSHIFT 0.5 /* horizontal shift of maze */
#define MAZE_WIDTH 0.01 /* width of maze walls */
#define RAND_SHIFT 5 /* seed of random number generator */
#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */
#define MAZE_WIDTH 0.015 /* width of maze walls */
#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */
#define FMAX 1.0e9 /* maximal force */
#define FLOOR_OMEGA 0 /* set to 1 to limit particle momentum to PMAX */
#define PMAX 1000.0 /* maximal force */
#define HASHX 40 /* size of hashgrid in x direction */
#define HASHX 29 /* size of hashgrid in x direction */
#define HASHY 20 /* 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 */
@ -549,10 +587,11 @@
#define COUNT_PARTNER_TYPE ((RD_REACTION == CHEM_H2O_H_OH)||(RD_REACTION == CHEM_2H2O_H3O_OH))
#define PAIR_FORCE ((PAIR_PARTICLES)||((REACTION_DIFFUSION)&&((RD_REACTION == CHEM_AGGREGATION)||(RD_REACTION == CHEM_AGGREGATION_CHARGE)||(RD_REACTION == CHEM_AGGREGATION_NNEIGH)||(RD_REACTION == CHEM_POLYGON_AGGREGATION))))
#define COMPUTE_PAIR_TORQUE (KTORQUE_PAIR_ANGLE != 0.0)
#define ADD_CONVEYOR_FORCE ((ADD_FIXED_SEGMENTS)&&((SEGMENT_PATTERN == S_CONVEYOR_BELT)||(SEGMENT_PATTERN == S_TWO_CONVEYOR_BELTS)||(SEGMENT_PATTERN == S_PERIODIC_CONVEYORS)||(SEGMENT_PATTERN == S_TEST_CONVEYORS)||(SEGMENT_PATTERN == S_CONVEYOR_SHOVELS)||(SEGMENT_PATTERN == S_CONVEYOR_MIXED)||(SEGMENT_PATTERN == S_CONVEYOR_SIEVE)||(SEGMENT_PATTERN == S_CONVEYOR_SIEVE_B)||(SEGMENT_PATTERN == S_CONVEYOR_SIEVE_LONG)))
#define MOVE_CONVEYOR_BELT ((ADD_FIXED_SEGMENTS)&&((SEGMENT_PATTERN == S_CONVEYOR_SHOVELS)||(SEGMENT_PATTERN == S_CONVEYOR_MIXED)||(SEGMENT_PATTERN == S_CONVEYOR_SIEVE_LONG)))
#define ROTATE_OBSTACLES ((ADD_FIXED_OBSTACLES)&&((OBSTACLE_PATTERN == O_SIEVE)||(OBSTACLE_PATTERN == O_SIEVE_B)||(OBSTACLE_PATTERN == O_SIEVE_LONG)))
#define ADD_CONVEYOR_FORCE ((ADD_FIXED_SEGMENTS)&&((SEGMENT_PATTERN == S_CONVEYOR_BELT)||(SEGMENT_PATTERN == S_TWO_CONVEYOR_BELTS)||(SEGMENT_PATTERN == S_PERIODIC_CONVEYORS)||(SEGMENT_PATTERN == S_TEST_CONVEYORS)||(SEGMENT_PATTERN == S_CONVEYOR_SHOVELS)||(SEGMENT_PATTERN == S_CONVEYOR_MIXED)||(SEGMENT_PATTERN == S_CONVEYOR_SIEVE)||(SEGMENT_PATTERN == S_CONVEYOR_SIEVE_B)||(SEGMENT_PATTERN == S_CONVEYOR_SIEVE_LONG)||(SEGMENT_PATTERN == S_CONVEYORS_1400)))
#define MOVE_CONVEYOR_BELT ((ADD_FIXED_SEGMENTS)&&((SEGMENT_PATTERN == S_CONVEYOR_SHOVELS)||(SEGMENT_PATTERN == S_CONVEYOR_MIXED)||(SEGMENT_PATTERN == S_CONVEYOR_SIEVE_LONG)||(SEGMENT_PATTERN == S_CONVEYORS_1400)))
#define ROTATE_OBSTACLES ((ADD_FIXED_OBSTACLES)&&((OBSTACLE_PATTERN == O_SIEVE)||(OBSTACLE_PATTERN == O_SIEVE_B)||(OBSTACLE_PATTERN == O_SIEVE_LONG)||(OBSTACLE_PATTERN == O_SIEVE_VIDEO1400)))
#define POLYGON_INTERACTION ((INTERACTION == I_POLYGON)||(INTERACTION == I_POLYGON_ALIGN))
#define TRACK ((TRACK_SEGMENT_GROUPS)||(TRACK_PARTICLE))
double xshift = 0.0; /* x shift of shown window */
double xspeed = 0.0; /* x speed of obstacle */
@ -981,7 +1020,8 @@ double radius_schedule(int i)
return(1.0 + (MU_RATIO - 1.0)*(double)i/(double)NSTEPS);
}
double evolve_particles(t_particle particle[NMAXCIRCLES], t_hashgrid hashgrid[HASHX*HASHY],
double evolve_particles(t_particle particle[NMAXCIRCLES], t_obstacle obstacle[NMAXOBSTACLES],
t_hashgrid hashgrid[HASHX*HASHY],
double qx[NMAXCIRCLES], double qy[NMAXCIRCLES], double qangle[NMAXCIRCLES],
double px[NMAXCIRCLES], double py[NMAXCIRCLES], double pangle[NMAXCIRCLES],
double beta, int *nactive, int *nsuccess, int *nmove, int *ncoupled, int initial_phase)
@ -993,11 +1033,12 @@ double evolve_particles(t_particle particle[NMAXCIRCLES], t_hashgrid hashgrid[HA
if (initial_phase) damping = INITIAL_DAMPING;
else damping = DAMPING;
// printf("Evolving particles\n");
// printf("Evolving %i particles\n", ncircles);
#pragma omp parallel for private(j,xi,totalenergy,a,move)
// #pragma omp parallel for private(j,xi,totalenergy,a,move)
for (j=0; j<ncircles; j++) if (particle[j].active)
{
// printf("Particle %i\n", j);
particle[j].vx = px[j] + 0.5*DT_PARTICLE*particle[j].fx;
particle[j].vy = py[j] + 0.5*DT_PARTICLE*particle[j].fy;
particle[j].omega = pangle[j] + 0.5*DT_PARTICLE*particle[j].torque;
@ -1108,7 +1149,7 @@ double evolve_particles(t_particle particle[NMAXCIRCLES], t_hashgrid hashgrid[HA
{
px[j] = particle[j].vx;
py[j] = particle[j].vy;
update_hashgrid(particle, hashgrid, 0);
update_hashgrid(particle, obstacle, hashgrid, 0);
*nsuccess++;
}
}
@ -1562,18 +1603,93 @@ void evolve_segment_groups(t_segment segment[NMAXSEGMENTS], int time, t_group_se
}
}
void evolve_obstacles(t_obstacle obstacle[NMAXOBSTACLES])
/* evolve obstacles, for option OSCILLATE_OBSTACLES */
{
int i, j, n, m;
double dist, accel, ekin, epot, etot;
// printf("Evolving %i obstacles\n", nobstacles);
/* Verlet scheme */
if (COUPLE_OBSTACLES)
{
for (i = 0; i < nobstacles; i++)
{
n = obstacle[i].nneighb;
// printf("Obstacle %i has %i neighbours\n", i, n);
obstacle[i].vx += DT_PARTICLE*obstacle[i].fx/obstacle[i].mass;
obstacle[i].vy += DT_PARTICLE*obstacle[i].fy/obstacle[i].mass;
obstacle[i].energy = 0.0;
// printf("1\n");
for (j=0; j<n; j++)
{
m = obstacle[i].neighb[j];
// printf("Neighbour %i is number %i\n", j, m);
dist = module2(obstacle[i].xc - obstacle[m].xc, obstacle[i].yc - obstacle[m].yc);
/* test */
// if (dist > 4.0*OBSTACLE_COUPLING_DIST) dist = 4.0*OBSTACLE_COUPLING_DIST;
if (dist > 5.0*obstacle[i].eqdist[j]) dist = 5.0*obstacle[i].eqdist[j];
if (dist < 0.2*OBSTACLE_RADIUS) dist = 0.2*OBSTACLE_RADIUS;
accel = KSPRING_OBSTACLE_COUPLE*(obstacle[i].eqdist[j] - dist)/(dist*obstacle[i].mass);
if (OBSTACLE_HARDCORE)
{
if (dist < 2.0*OBSTACLE_RADIUS)
accel += KSPRING_OBSTACLE_HARDCORE*(2.0*OBSTACLE_RADIUS - dist)/(obstacle[i].mass);
}
obstacle[i].vx += DT_PARTICLE*(obstacle[i].xc - obstacle[m].xc)*accel;
obstacle[i].vy += DT_PARTICLE*(obstacle[i].yc - obstacle[m].yc)*accel;
obstacle[i].energy += 0.5*KSPRING_OBSTACLE_COUPLE*(obstacle[i].eqdist[j] - dist)*(obstacle[i].eqdist[j] - dist);
}
// printf("2\n");
if (obstacle[i].pinned)
{
obstacle[i].vx -= DT_PARTICLE*KSPRING_OBSTACLE_OSC*(obstacle[i].xc - obstacle[i].xc0)/obstacle[i].mass;
obstacle[i].vy -= DT_PARTICLE*KSPRING_OBSTACLE_OSC*(obstacle[i].yc - obstacle[i].yc0)/obstacle[i].mass;
obstacle[i].energy += KSPRING_OBSTACLE_OSC*((obstacle[i].xc - obstacle[i].xc0)*(obstacle[i].xc - obstacle[i].xc0) + (obstacle[i].yc - obstacle[i].yc0)*(obstacle[i].yc - obstacle[i].yc0));
}
}
for (i = 0; i < nobstacles; i++)
{
obstacle[i].xc += DT_PARTICLE*obstacle[i].vx;
obstacle[i].yc += DT_PARTICLE*obstacle[i].vy;
}
for (i = 0; i < nobstacles; i++)
{
ekin = obstacle[i].mass*(obstacle[i].vx*obstacle[i].vx + obstacle[i].vy*obstacle[i].vy);
obstacle[i].energy += ekin;
}
}
else
{
for (i = 0; i < nobstacles; i++)
{
obstacle[i].vx += DT_PARTICLE*(obstacle[i].fx - KSPRING_OBSTACLE_OSC*(obstacle[i].xc - obstacle[i].xc0))/obstacle[i].mass;
obstacle[i].vy += DT_PARTICLE*(obstacle[i].fy - KSPRING_OBSTACLE_OSC*(obstacle[i].yc - obstacle[i].yc0))/obstacle[i].mass;
obstacle[i].xc += DT_PARTICLE*obstacle[i].vx;
obstacle[i].yc += DT_PARTICLE*obstacle[i].vy;
}
for (i = 0; i < nobstacles; i++)
{
ekin = obstacle[i].mass*(obstacle[i].vx*obstacle[i].vx + obstacle[i].vy*obstacle[i].vy);
epot = KSPRING_OBSTACLE_OSC*((obstacle[i].xc - obstacle[i].xc0)*(obstacle[i].xc - obstacle[i].xc0) + (obstacle[i].yc - obstacle[i].yc0)*(obstacle[i].yc - obstacle[i].yc0));
etot = ekin + epot;
obstacle[i].energy = etot;
}
}
// printf("Evolved %i obstacles\n", nobstacles);
}
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, pos[2], prop, vx, xi = 0.0, torque, torque_ij, pleft = 0.0, pright = 0.0, entropy[2], speed_ratio, xmin, xmax, ymin, ymax, delta_energy, speed, ratio = 1.0, ratioc, cum_etot = 0.0, emean = 0.0, radius_ratio, t,
angle, theta, sum, alpha, bfield;
a, b, length, fx, fy, force[2], totalenergy = 0.0, pos[2], prop, vx, xi = 0.0, torque, torque_ij, pleft = 0.0, pright = 0.0, entropy[2], speed_ratio, xmin, xmax, ymin, ymax, delta_energy, speed, ratio = 1.0, ratioc, cum_etot = 0.0, emean = 0.0, radius_ratio, t, angle, theta, sum, alpha, bfield, track_x0, track_y0, efield, efieldy;
double *qx, *qy, *px, *py, *qangle, *pangle, *pressure, *obstacle_speeds;
double *cqx, *cqy, *cpx, *cpy, *cqangle, *cpangle;
int i, j, k, n, m, s, ij[2], i0, iplus, iminus, j0, jplus, jminus, p, q, p1, q1, p2, q2, total_neighbours = 0, cl,
min_nb, max_nb, close, wrapx = 0, wrapy = 0, nadd_particle = 0, nmove = 0, nsuccess = 0,
tracer_n[N_TRACER_PARTICLES], traj_position = 0, traj_length = 0, move = 0, old, m0, floor, nthermo, wall = 0,
group, gshift, n_total_active = 0, ncollisions = 0, ncoupled = 1, np, belt, obs;
group, gshift, n_total_active = 0, ncollisions = 0, ncoupled = 1, np, belt, obs, reset_obs;
int *particle_numbers;
static int imin, imax;
static short int first = 1;
@ -1589,6 +1705,8 @@ void animation()
t_molecule *molecule;
t_lj_parameters params;
t_belt *conveyor_belt;
t_otriangle *otriangle;
t_ofacet *ofacet;
char message[100];
ratioc = 1.0 - ratio;
@ -1616,7 +1734,7 @@ void animation()
}
if (TRACER_PARTICLE)
trajectory = (t_tracer *)malloc(TRAJECTORY_LENGTH*N_TRACER_PARTICLES*sizeof(t_tracer));
trajectory = (t_tracer *)malloc(TRAJECTORY_LENGTH*N_TRACER_PARTICLES*TRACER_STEPS*sizeof(t_tracer));
if (PAIR_PARTICLES)
molecule = (t_molecule *)malloc(NMAXCIRCLES*sizeof(t_molecule)); /* molecules */
@ -1641,6 +1759,12 @@ void animation()
cpangle = (double *)malloc(NMAXCIRCLES*sizeof(double));
}
if (FILL_OBSTACLE_TRIANGLES)
{
otriangle = (t_otriangle *)malloc(NMAX_TRIANGLES_PER_OBSTACLE*NMAXOBSTACLES*sizeof(t_otriangle));
ofacet = (t_ofacet *)malloc(NMAXOBSTACLES*sizeof(t_ofacet));
}
if (REACTION_DIFFUSION)
{
collisions = (t_collision *)malloc(2*NMAXCOLLISIONS*sizeof(t_collision));
@ -1655,7 +1779,7 @@ void animation()
lj_log = fopen("lj_logfile.txt", "w");
if (ADD_FIXED_OBSTACLES) init_obstacle_config(obstacle);
if (ADD_FIXED_OBSTACLES) init_obstacle_config(obstacle, otriangle, ofacet);
if (ADD_FIXED_SEGMENTS) init_segment_config(segment, conveyor_belt);
if ((MOVE_SEGMENT_GROUPS)&&(ADD_FIXED_SEGMENTS))
@ -1705,7 +1829,7 @@ void animation()
// }
// sleep(1);
update_hashgrid(particle, hashgrid, 1);
update_hashgrid(particle, obstacle, hashgrid, 1);
printf("Updated hashgrid\n");
compute_relative_positions(particle, hashgrid);
printf("Computed relative positions\n");
@ -1787,6 +1911,8 @@ void animation()
pright = 0.0;
if (RECORD_PRESSURES) for (j=0; j<N_PRESSURES; j++) pressure[j] = 0.0;
printf("1\n");
// printf("evolving particles\n");
for(n=0; n<NVID; n++)
{
@ -1819,11 +1945,12 @@ void animation()
segment[j].fy = 0.0;
segment[j].torque = 0.0;
}
compute_relative_positions(particle, hashgrid);
update_hashgrid(particle, hashgrid, 0);
update_hashgrid(particle, obstacle, hashgrid, 0);
/* compute forces on particles */
reset_obs = 1;
for (j=0; j<ncircles; j++) if (particle[j].active)
{
particle[j].fx = 0.0;
@ -1834,8 +1961,9 @@ void animation()
compute_particle_force(j, params.krepel, particle, hashgrid);
/* take care of boundary conditions */
params.fboundary += compute_boundary_force(j, particle, obstacle, segment, params.xmincontainer, params.xmaxcontainer, &pleft, &pright, pressure, wall, params.krepel);
params.fboundary += compute_boundary_force(j, particle, obstacle, segment, params.xmincontainer, params.xmaxcontainer, &pleft, &pright, pressure, wall, params.krepel, reset_obs);
reset_obs = 0;
/* align velocities in case of Vicsek models */
// if (VICSEK_INT)
if ((VICSEK_INT)&&(!particle[j].close_to_boundary))
@ -1939,7 +2067,18 @@ void animation()
if (ADD_EFIELD)
{
if (INCREASE_E) particle[j].fx += params.efield*particle[j].charge;
else particle[j].fx += EFIELD*particle[j].charge;
else
{
efield = EFIELD;
efieldy = EFIELD_Y;
if (EFIELD_REGION != EF_CONST)
{
efield *= (double)partial_efield(particle[j].xc, particle[j].yc);
efieldy *= (double)partial_efield(particle[j].xc, particle[j].yc);
}
particle[j].fx += efield*particle[j].charge;
particle[j].fy += efieldy*particle[j].charge;
}
}
/* add magnetic force */
@ -1972,8 +2111,6 @@ void animation()
/* compute force and torque on clusters */
if (CLUSTER_PARTICLES) compute_cluster_force(cluster, particle);
/* timestep of thermostat algorithm */
if (CLUSTER_PARTICLES)
{
@ -1984,14 +2121,16 @@ void animation()
particle[j].emean = cluster[particle[j].cluster].emean;
}
else
totalenergy = evolve_particles(particle, hashgrid, qx, qy, qangle, px, py, pangle, params.beta, &params.nactive, &nsuccess, &nmove, &ncoupled, i < INITIAL_TIME);
totalenergy = evolve_particles(particle, obstacle, hashgrid, qx, qy, qangle, px, py, pangle, params.beta, &params.nactive, &nsuccess, &nmove, &ncoupled, i < INITIAL_TIME);
/* TEST */
/* repair clusters */
if ((CLUSTER_PARTICLES)&&(REPAIR_CLUSTERS)) for (cl=0; cl<ncircles; cl++)
if ((cluster[cl].active)&&(cluster[cl].nparticles >= 2))
repair_cluster(cl, particle, cluster, 1000/NVID, 1);
/* evolution of lid coordinate */
if (BOUNDARY_COND == BC_RECTANGLE_LID) evolve_lid(params.fboundary);
if (BOUNDARY_COND == BC_RECTANGLE_WALL)
@ -2020,11 +2159,43 @@ void animation()
}
}
if (OSCILLATE_OBSTACLES) evolve_obstacles(obstacle);
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);
/* update tracer particle trajectory */
if ((TRACER_PARTICLE)&&(i > INITIAL_TIME)&&(n%(NVID/TRACER_STEPS)==0))
{
for (j=0; j<n_tracers; j++)
{
trajectory[j*TRAJECTORY_LENGTH*TRACER_STEPS + traj_position].xc = particle[tracer_n[j]].xc;
trajectory[j*TRAJECTORY_LENGTH*TRACER_STEPS + traj_position].yc = particle[tracer_n[j]].yc;
}
traj_position++;
if (traj_position >= TRAJECTORY_LENGTH*TRACER_STEPS) traj_position = 0;
traj_length++;
if (traj_length >= TRAJECTORY_LENGTH*TRACER_STEPS)
traj_length = TRAJECTORY_LENGTH*TRACER_STEPS - 1;
}
} /* end of for (n=0; n<NVID; n++) */
if (TRACK_PARTICLE)
{
if (i < TRACK_INITIAL_TIME)
{
track_x0 = particle[TRACKED_PARTICLE].xc;
track_y0 = particle[TRACKED_PARTICLE].yc;
}
else
{
xtrack *= 0.9;
ytrack *= 0.9;
xtrack += 0.1*(particle[TRACKED_PARTICLE].xc - track_x0);
ytrack += 0.1*(particle[TRACKED_PARTICLE].yc - track_y0);
}
printf("(xtrack, ytrack) = (%.3lg, %.3lg)\n", xtrack, ytrack);
}
/* TEST */
// for (j=0; j<ncircles; j++)
// {
@ -2099,20 +2270,20 @@ void animation()
}
/* update tracer particle trajectory */
if ((TRACER_PARTICLE)&&(i > INITIAL_TIME))
{
for (j=0; j<n_tracers; j++)
{
trajectory[j*TRAJECTORY_LENGTH + traj_position].xc = particle[tracer_n[j]].xc;
trajectory[j*TRAJECTORY_LENGTH + traj_position].yc = particle[tracer_n[j]].yc;
}
traj_position++;
if (traj_position >= TRAJECTORY_LENGTH) traj_position = 0;
traj_length++;
if (traj_length >= TRAJECTORY_LENGTH) traj_length = TRAJECTORY_LENGTH - 1;
// for (j=0; j<traj_length; j++)
// printf("Trajectory[%i] = (%.3lg, %.3lg)\n", j, trajectory[j].xc, trajectory[j].yc);
}
// if ((TRACER_PARTICLE)&&(i > INITIAL_TIME))
// {
// for (j=0; j<n_tracers; j++)
// {
// trajectory[j*TRAJECTORY_LENGTH + traj_position].xc = particle[tracer_n[j]].xc;
// trajectory[j*TRAJECTORY_LENGTH + traj_position].yc = particle[tracer_n[j]].yc;
// }
// traj_position++;
// if (traj_position >= TRAJECTORY_LENGTH) traj_position = 0;
// traj_length++;
// if (traj_length >= TRAJECTORY_LENGTH) traj_length = TRAJECTORY_LENGTH - 1;
// // for (j=0; j<traj_length; j++)
// // printf("Trajectory[%i] = (%.3lg, %.3lg)\n", j, trajectory[j].xc, trajectory[j].yc);
// }
printf("Mean kinetic energy: %.3f\n", totalenergy/(double)ncircles);
printf("Kinetic energy by coupled particle: %.3f\n", totalenergy/(double)ncoupled);
@ -2138,7 +2309,21 @@ void animation()
printf("Boundary force: %.3f\n", params.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", params.gravity);
if ((RECOUPLE_OBSTACLES)&&(i%OBSTACLE_RECOUPLE_TIME == 0))
switch (OBSTACLE_RECOUPLE_TYPE) {
case (OR_FIXED_DIST):
{
n_ofacets = init_obstacle_coupling(obstacle, otriangle, ofacet);
break;
}
case (OR_BREAK_MAX):
{
n_ofacets = reset_obstacle_coupling(obstacle, otriangle, ofacet);
break;
}
}
total_neighbours = 0;
min_nb = 100;
max_nb = 0;
@ -2178,10 +2363,10 @@ void animation()
change_type_proportion(particle, params.prop);
}
if (TRACER_PARTICLE) draw_trajectory(trajectory, traj_position, traj_length, particle, cluster, tracer_n, PLOT);
draw_particles(particle, cluster, PLOT, params.beta, collisions, ncollisions, BG_COLOR, hashgrid, params);
draw_container(params.xmincontainer, params.xmaxcontainer, obstacle, segment, conveyor_belt, wall);
// if (TRACER_PARTICLE) draw_trajectory(trajectory, traj_position, traj_length, particle, cluster, tracer_n, PLOT);
// draw_particles(particle, cluster, PLOT, params.beta, collisions, ncollisions, BG_COLOR, hashgrid, params);
// draw_container(params.xmincontainer, params.xmaxcontainer, obstacle, segment, conveyor_belt, wall);
/* add a particle */
if ((ADD_PARTICLES)&&(i > ADD_TIME)&&((i - INITIAL_TIME - ADD_TIME)%ADD_PERIOD == 1)&&(i < NSTEPS - FINAL_NOADD_PERIOD))
{
@ -2215,7 +2400,7 @@ void animation()
/* compute force on segments */
if (PRINT_SEGMENTS_FORCE) compute_segments_force(&params, segment);
update_hashgrid(particle, hashgrid, 1);
update_hashgrid(particle, obstacle, hashgrid, 1);
if ((i > INITIAL_TIME + WALL_TIME)&&(PRINT_ENTROPY))
{
@ -2236,7 +2421,7 @@ void animation()
draw_frame(i, PLOT, BG_COLOR, ncollisions, traj_position, traj_length,
wall, pressure, pleft, pright, particle_numbers, 1, params, particle, cluster,
collisions, hashgrid, trajectory, obstacle, segment, group_speeds, segment_group, conveyor_belt, tracer_n);
collisions, hashgrid, trajectory, obstacle, segment, group_speeds, segment_group, conveyor_belt, tracer_n, otriangle, ofacet);
if (!((NO_EXTRA_BUFFER_SWAP)&&(MOVIE))) glutSwapBuffers();
@ -2268,7 +2453,7 @@ void animation()
{
draw_frame(i, PLOT_B, BG_COLOR_B, ncollisions, traj_position, traj_length,
wall, pressure, pleft, pright, particle_numbers, 0, params, particle, cluster,
collisions, hashgrid, trajectory, obstacle, segment, group_speeds, segment_group, conveyor_belt, tracer_n);
collisions, hashgrid, trajectory, obstacle, segment, group_speeds, segment_group, conveyor_belt, tracer_n, otriangle, ofacet);
glutSwapBuffers();
save_frame_lj_counter(NSTEPS + MID_FRAMES + 1 + counter);
counter++;
@ -2309,7 +2494,7 @@ void animation()
blank();
draw_frame(NSTEPS, PLOT, BG_COLOR, ncollisions, traj_position, traj_length,
wall, pressure, pleft, pright, particle_numbers, 0, params, particle, cluster,
collisions, hashgrid, trajectory, obstacle, segment, group_speeds, segment_group, conveyor_belt, tracer_n);
collisions, hashgrid, trajectory, obstacle, segment, group_speeds, segment_group, conveyor_belt, tracer_n, otriangle, ofacet);
}
if (DOUBLE_MOVIE) for (i=0; i<MID_FRAMES; i++)
{
@ -2321,7 +2506,7 @@ void animation()
{
draw_frame(NSTEPS, PLOT_B, BG_COLOR_B, ncollisions, traj_position, traj_length,
wall, pressure, pleft, pright, particle_numbers, 0, params, particle, cluster,
collisions, hashgrid, trajectory, obstacle, segment, group_speeds, segment_group, conveyor_belt, tracer_n);
collisions, hashgrid, trajectory, obstacle, segment, group_speeds, segment_group, conveyor_belt, tracer_n, otriangle, ofacet);
if (!((NO_EXTRA_BUFFER_SWAP)&&(MOVIE))) glutSwapBuffers();
}
if ((TIME_LAPSE)&&(!DOUBLE_MOVIE))
@ -2388,6 +2573,12 @@ void animation()
free(cpangle);
}
if (FILL_OBSTACLE_TRIANGLES)
{
free(otriangle);
free(ofacet);
}
free(pressure);
// printf("16\n");
if (REACTION_DIFFUSION) free(collisions);

View File

@ -68,6 +68,7 @@
// #define CIRCLE_PATTERN 1 /* pattern of circles, see list in global_pdes.c */
#define CIRCLE_PATTERN 8 /* pattern of circles, see list in global_pdes.c */
#define IMAGE_FILE 5 /* for option D_IMAGE */
#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */
#define NPOISSON 340 /* number of points for Poisson C_RAND_POISSON arrangement */

22
rde.c
View File

@ -50,7 +50,7 @@
#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 HRES 4 /* factor for high resolution plots */
#define HRES 6 /* factor for high resolution plots */
#define XMIN -2.0
#define XMAX 2.0 /* x interval */
@ -254,13 +254,13 @@
/* Visualisation */
#define PLOT_3D 1 /* controls whether plot is 2D or 3D */
#define PLOT_3D 0 /* controls whether plot is 2D or 3D */
#define PLOT_SPHERE 1 /* draws fields on a sphere */
#define ROTATE_VIEW 1 /* set to 1 to rotate position of observer */
#define ROTATE_ANGLE -45.0 /* total angle of rotation during simulation */
#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */
#define SHADE_2D 0 /* set to 1 to change luminosity according to normal vector */
#define SHADE_3D 0 /* set to 1 to change luminosity according to normal vector */
#define SHADE_2D 1 /* set to 1 to change luminosity according to normal vector */
#define VIEWPOINT_TRAJ 1 /* type of viewpoint trajectory */
#define MAX_LATITUDE 45.0 /* maximal latitude for viewpoint trajectory VP_ORBIT2 */
@ -291,7 +291,8 @@
#define FLOODING 1 /* set to 1 for drawing water when higher than continents */
// #define FLOODING_VSHIFT 0.51 /* controls when wave is considered higher than land */
#define FLOODING_VSHIFT 0.56 /* controls when wave is considered higher than land */
#define FLOODING_VSHIFT_2D 0.61 /* controls when wave is considered higher than land */
#define FLOODING_VSHIFT_2D 0.56 /* controls when wave is considered higher than land */
// #define FLOODING_VSHIFT_2D 0.61 /* controls when wave is considered higher than land */
#define PLOT_SCALE_ENERGY 0.05 /* vertical scaling in energy plot */
@ -369,7 +370,7 @@
#define ZSCALE_SPEED 300.0 /* additional scaling factor for z-coord Z_EULER_SPEED and Z_SWATER_SPEED */
#define ZSHIFT_SPEED 0.0 /* additional shift of z-coord Z_EULER_SPEED and Z_SWATER_SPEED */
#define ZSCALE_NORMGRADIENT -0.0001 /* vertical scaling for Z_NORM_GRADIENT */
#define VSCALE_SWATER 60.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */
#define VSCALE_SWATER 100.0 /* additional scaling factor for color scheme Z_EULER_DENSITY */
#define NXMAZE 7 /* width of maze */
#define NYMAZE 7 /* height of maze */
@ -378,7 +379,7 @@
#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */
#define MAZE_WIDTH 0.04 /* half width of maze walls */
#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 3.0 /* 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 */
@ -437,13 +438,14 @@
#define MESSAGE_LINTERLETTER 1 /* length of interval between letters for Morse code message */
#define MESSAGE_LSPACE 1 /* length of space for Morse code message */
#define MESSAGE_INITIAL_TIME 1 /* initial time before starting message for Morse code message */
#define IMAGE_FILE 0 /* for option D_IMAGE */
/* 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] = {-6.0, -6.0, 4.5}; /* location of observer for REP_PROJ_3D representation */
double light[3] = {0.40824829, -0.816496581, 0.40824829}; /* vector of "light" direction for P_3D_ANGLE color scheme */
double observer[3] = {0.0, -6.0, 2.5}; /* location of observer for REP_PROJ_3D representation */
int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */
/* constants for simulations on planets */
@ -2242,7 +2244,7 @@ void animation()
// init_linear_blob_sphere(0, 1.3*PI, 0.65*PI, 0.0, 0.0, 0.3, 0.1, 0.1, SWATER_MIN_HEIGHT, phi, xy_in, wsphere);
init_expanding_blob_sphere(0, (220.0/180.0)*PI, (140.0/180.0)*PI, 1.0, 0.075, 0.1, SWATER_MIN_HEIGHT, phi, xy_in, wsphere);
init_expanding_blob_sphere(0, (279.0/180.0)*PI, (115.0/180.0)*PI, 0.75, 0.04, 0.06, SWATER_MIN_HEIGHT, phi, xy_in, wsphere);
// add_gaussian_wave(-1.6, -0.5, 0.015, 0.25, SWATER_MIN_HEIGHT, phi, xy_in);

View File

@ -63,6 +63,7 @@
#define B_DOMAIN 10 /* choice of domain shape */
#define CIRCLE_PATTERN 0 /* pattern of circles, see list in global_pdes.c */
#define IMAGE_FILE 5 /* for option D_IMAGE */
#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 */

View File

@ -31,6 +31,7 @@ int bc_grouped(int bc)
case (BC_ABSORBING): return(0);
case (BC_REFLECT_ABS): return(0);
case (BC_REFLECT_ABS_BOTTOM): return(0);
case (BC_REFLECT_ABS_RIGHT): return(0);
default:
{
printf("Warning: Hashgrid will not be properly initialised, update bc_grouped()\n\n");
@ -417,7 +418,7 @@ void init_hashgrid(t_hashgrid hashgrid[HASHX*HASHY])
// sleep(1);
}
void update_hashgrid(t_particle* particle, t_hashgrid* hashgrid, int verbose)
void update_hashgrid(t_particle* particle, t_obstacle *obstacle, t_hashgrid* hashgrid, int verbose)
{
int i, j, k, n, m, max = 0, hashcell;
@ -439,6 +440,19 @@ void update_hashgrid(t_particle* particle, t_hashgrid* hashgrid, int verbose)
if (n > max) max = n;
}
if (OSCILLATE_OBSTACLES)
{
for (i=0; i<HASHX*HASHY; i++) hashgrid[i].nobs = 0;
for (k=0; k<nobstacles; k++)
if (obstacle[k].active)
{
hashcell = hash_cell(obstacle[k].xc, obstacle[k].yc);
/* note: only one obstacle per cell is counted */
hashgrid[hashcell].nobs = 1;
hashgrid[hashcell].obstacle = k;
}
}
if(verbose) printf("Maximal number of particles per hash cell: %i\n", max);
}

1444
sub_lj.c

File diff suppressed because it is too large Load Diff

View File

@ -4877,6 +4877,98 @@ void compute_laplacian_rde(double phi_in[NX*NY], double phi_out[NX*NY], short in
}
}
void compute_kuramoto_int_planar(double phi_in[NX*NY], double phi_out[NX*NY], short int xy_in[NX*NY])
/* computes Kuramoto interaction of phi_in and stores it in phi_out - case with whole rectangular domain */
{
int i, j, iplus, iminus, jplus, jminus;
double phi;
#pragma omp parallel for private(i,j)
for (i=1; i<NX-1; i++){
for (j=1; j<NY-1; j++){
if (xy_in[i*NY+j]){
phi = phi_in[i*NY+j];
phi_out[i*NY+j] = sin(phi_in[(i+1)*NY+j] - phi) + sin(phi_in[(i-1)*NY+j] - phi) + sin(phi_in[i*NY+j+1] - phi) + sin(phi_in[i*NY+j-1] - phi);
}
}
}
/* TODO */
/* boundary conditions - left side */
switch (B_COND_LEFT) {
case (BC_PERIODIC):
{
for (j = 0; j < NY; j++)
{
jplus = j+1; if (jplus == NY) jplus = 0;
jminus = j-1; if (jminus == -1) jminus = NY-1;
phi = phi_in[j];
phi_out[j] = sin(phi_in[jminus] - phi) + sin(phi_in[jplus] - phi) + sin(phi_in[(NX-1)*NY+j] - phi) + sin(phi_in[NY+j] - phi);
}
break;
}
}
/* boundary conditions - right side */
switch (B_COND_RIGHT) {
case (BC_PERIODIC):
{
for (j = 0; j < NY; j++)
{
jplus = j+1; if (jplus == NY) jplus = 0;
jminus = j-1; if (jminus == -1) jminus = NY-1;
phi = phi_in[(NX-1)*NY+j];
phi_out[(NX-1)*NY+j] = sin(phi_in[(NX-1)*NY+jminus] - phi) + sin(phi_in[(NX-1)*NY+jplus] - phi) + sin(phi_in[(NX-2)*NY+j] - phi) + sin(phi_in[j] - phi);
}
break;
}
}
/* boundary conditions - bottom side */
switch (B_COND_BOTTOM) {
case (BC_PERIODIC):
{
for (i = 1; i < NX-1; i++)
{
iplus = i+1; /*if (iplus == NX) iplus = 0;*/
iminus = i-1; /*if (iminus == -1) iminus = NX-1;*/
phi = phi_in[i*NY];
phi_out[i*NY] = sin(phi_in[iminus*NY] - phi) + sin(phi_in[iplus*NY] - phi) + sin(phi_in[i*NY+1] - phi) + sin(phi_in[i*NY+NY-1] -phi);
}
break;
}
}
/* boundary conditions - top side */
switch (B_COND_TOP) {
case (BC_PERIODIC):
{
for (i = 1; i < NX-1; i++)
{
iplus = i+1; /*if (iplus == NX) iplus = 0;*/
iminus = i-1; /*if (iminus == -1) iminus = NX-1;*/
phi = phi_in[i*NY+NY-1];
phi_out[i*NY+NY-1] = sin(phi_in[iminus*NY+NY-1] - phi) + sin(phi_in[iplus*NY+NY-1] - phi) + sin(phi_in[i*NY] - phi) + sin(phi_in[i*NY+NY-2] - phi);
}
break;
}
}
}
void compute_kuramoto_interaction(double phi_in[NX*NY], double phi_out[NX*NY], short int xy_in[NX*NY], t_wave_sphere wsphere[NX*NY])
/* computes interaction for Kuramoto model */
{
compute_kuramoto_int_planar(phi_in, phi_out, xy_in);
}
void compute_light_angle_sphere_rde(short int xy_in[NX*NY], t_rde rde[NX*NY], t_wave_sphere wsphere[NX*NY], double potential[NX*NY], int movie, int transparent)
/* computes cosine of angle between normal vector and vector light */
@ -6327,6 +6419,7 @@ void draw_wave_2d_rde(short int xy_in[NX*NY], t_rde rde[NX*NY], t_wave_sphere ws
first = 0;
}
// printf("Drawing wave\n");
/* draw the field */
glBegin(GL_QUADS);
for (i=0; i<NX; i++)
@ -6366,7 +6459,8 @@ void draw_wave_sphere_rde_ij(int i, int iplus, int j, int jplus, int jcolor, int
// draw = 1;
for (p=0; p<HRES; p++)
for (q=0; q<HRES; q++)
draw_hr[p*HRES+q] = (draw)&&(wsphere_hr[(HRES*i+p)*HRES*NY+HRES*j+q].indomain);
draw_hr[p*HRES+q] = (draw)||(wsphere_hr[(HRES*i+p)*HRES*NY+HRES*j+q].indomain);
// draw_hr[p*HRES+q] = (draw)&&(wsphere_hr[(HRES*i+p)*HRES*NY+HRES*j+q].indomain);
for (k=0; k<3; k++) rgb[k] = rde[i*NY+jcolor].rgb[k];
glColor3f(rgb[0], rgb[1], rgb[2]);

View File

@ -312,6 +312,16 @@ void write_text( double x, double y, char *st)
return(i);
}
double ipow(double x, int n)
{
double y;
int i;
y = x;
for (i=1; i<n; i++) y *= x;
return(y);
}
double gaussian()
/* returns standard normal random variable, using Box-Mueller algorithm */
@ -637,6 +647,23 @@ void draw_circle_arc(double x, double y, double r, double angle1, double dangle,
glEnd();
}
void draw_ellipse_arc(double x, double y, double a, double b, double angle1, double dangle, int nseg)
{
int i;
double pos[2], alpha, dalpha;
dalpha = dangle/(double)nseg;
glBegin(GL_LINE_STRIP);
for (i=0; i<=nseg; i++)
{
alpha = angle1 + (double)i*dalpha;
xy_to_pos(x + a*cos(alpha), y + b*sin(alpha), pos);
glVertex2d(pos[0], pos[1]);
}
glEnd();
}
void draw_colored_circle(double x, double y, double r, int nseg, double rgb[3])
{
int i;
@ -2648,11 +2675,56 @@ int init_xyin_from_image(short int * xy_in[NX])
/* initialize table xy_in from an image file */
{
FILE *image_file;
int nx, ny, maxrgb, i, j, k, ii, jj, nmaxpixels = 2000000, rgbtot, scan, rgbval;
int nx, ny, maxrgb, i, j, k, ii, jj, nmaxpixels, rgbtot, rgbmax, scan, rgbval, sign;
int *rgb_values;
double scalex, scaley;
double scalex, scaley, scale;
image_file = fopen("PHOTONSband.ppm", "r");
switch (IMAGE_FILE)
{
case (IM_PHOTONS):
{
image_file = fopen("PHOTONSband.ppm", "r");
nmaxpixels = 2000000;
break;
}
case (IM_GUITAR):
{
image_file = fopen("guitar.ppm", "r");
nmaxpixels = 11059200;
break;
}
case (IM_GUITAR_NOHOLE):
{
image_file = fopen("guitar_nohole.ppm", "r");
nmaxpixels = 11059200;
break;
}
case (IM_EGUITAR):
{
image_file = fopen("electric_guitar.ppm", "r");
nmaxpixels = 2459520;
break;
}
case (IM_HAPPY_NEW_YEAR):
{
image_file = fopen("Happy_New_Year_2025.ppm", "r");
nmaxpixels = 2073600;
break;
}
case (IM_DICKSON):
{
image_file = fopen("Greenland.ppm", "r");
nmaxpixels = 1756*948;
break;
}
case (IM_DICKSON_ZOOM):
{
image_file = fopen("Dickson_fjord.ppm", "r");
nmaxpixels = 1070*601;
break;
}
}
scan = fscanf(image_file,"%i %i\n", &nx, &ny);
scan = fscanf(image_file,"%i\n", &maxrgb);
@ -2661,9 +2733,64 @@ int init_xyin_from_image(short int * xy_in[NX])
scalex = (double)nx/(double)NX;
scaley = (double)ny/(double)NY;
switch (IMAGE_FILE)
{
case (IM_PHOTONS):
{
rgbmax = 3*maxrgb/2;
scale = scalex;
sign = 1;
break;
}
case (IM_GUITAR):
{
rgbmax = 150;
scale = scaley;
sign = 1;
break;
}
case (IM_GUITAR_NOHOLE):
{
rgbmax = 150;
scale = scaley;
sign = 1;
break;
}
case (IM_EGUITAR):
{
rgbmax = 700;
scale = scaley;
sign = -1;
break;
}
case (IM_HAPPY_NEW_YEAR):
{
rgbmax = 3*maxrgb/2;
scale = scalex;
sign = -1;
break;
}
case (IM_DICKSON):
{
rgbmax = 1;
scale = scalex;
sign = -1;
break;
}
case (IM_DICKSON_ZOOM):
{
rgbmax = 1;
scale = scalex;
sign = -1;
break;
}
}
if (nx*ny > nmaxpixels)
{
printf("Image too large, increase nmaxpixels in init_xyin_from_image()\n");
printf("Image too large, increase nmaxpixels in init_xyin_from_image() to %i\n", nx*ny);
exit(0);
}
@ -2679,17 +2806,24 @@ int init_xyin_from_image(short int * xy_in[NX])
for (i=0; i<NX; i++)
for (j=0; j<NY; j++)
{
ii = nx/2 + (int)((double)(i-NX/2)*scalex);
jj = ny/2 - (int)((double)(j-NY/2)*scalex);
ii = nx/2 + (int)((double)(i-NX/2)*scale);
jj = ny/2 - (int)((double)(j-NY/2)*scale);
if (ii > nx-1) ii = nx-1;
if (ii < 0) ii = 0;
if (jj > ny-1) jj = ny-1;
if (jj < 0) jj = 0;
k = 3*(jj*nx+ii);
rgbtot = rgb_values[k] + rgb_values[k+1] + rgb_values[k+2];
if (rgbtot > 3*maxrgb/2) xy_in[i][j] = 1;
if (rgbtot*sign > rgbmax*sign) xy_in[i][j] = 1;
else xy_in[i][j] = 0;
if (ii == 0) xy_in[i][j] = 0;
// if (ii == nx-1) xy_in[i][j] = 0;
}
/* to avoid reflection on left boundary */
if (IMAGE_FILE == IM_HAPPY_NEW_YEAR)
for (j=0; j<NY; j++) xy_in[0][j] = 1;
fclose(image_file);
free(rgb_values);
@ -2697,10 +2831,40 @@ int init_xyin_from_image(short int * xy_in[NX])
}
void init_epicyloid()
/* initialise radii of epicycloid */
{
int i, j, j0;
double phi, dphi, x, y, a, theta[NEPICYCLOID], r[NEPICYCLOID];
dphi = DPI/(double)(NPOLY*NEPICYCLOID);
a = (double)(NPOLY + 1);
for (i=0; i<NEPICYCLOID; i++)
{
phi = dphi*(double)i;
x = a*cos(phi) - cos(a*phi);
y = a*sin(phi) - sin(a*phi);
theta[i] = argument(x,y);
r[i] = module2(x,y);
}
j0 = 0;
for (i=0; i<NEPICYCLOID; i++)
{
j = (int)(theta[i]/dphi);
while (j0 < j)
{
epicycloid_phi_to_r[j0] = r[i];
j0++;
}
}
}
int xy_in_billiard_single_domain(double x, double y, int b_domain, int ncirc, t_circle *circles)
/* returns 1 if (x,y) represents a point in the billiard */
{
double l2, r1, r2, r2mu, omega, b, c, d, angle, z, x1, y1, x2, y2, y3, u, v, u1, v1, dx, dy, width, alpha, s, a, r, height, ca, sa, l, ht, xshift, zz[9][2], x5, x6, f, fp, h1, cb, sb, c1, c2;
double l2, r1, r2, r2mu, omega, b, c, d, angle, z, x1, y1, x2, y2, y3, u, v, u1, v1, dx, dy, width, alpha, s, a, r, height, ca, sa, l, ht, xshift, zz[9][2], x5, x6, f, fp, h1, cb, sb, c1, c2, nx, ny, phi;
int i, j, k, k1, k2, condition = 0, m;
static int first = 1, nsides;
static double h, hh, ra, rb, ll, salpha;
@ -3790,6 +3954,70 @@ int xy_in_billiard_single_domain(double x, double y, int b_domain, int ncirc, t_
}
return(0);
}
case (D_TWOCIRCLES_ELLIPSE):
{
a = 0.9*XMAX - 3.0*MU;
b = a/LAMBDA;
if (x*x/(a*a) + y*y/(b*b) < 1.0) return(1);
x1 = a + 2.0*MU;
if ((x-x1)*(x-x1) + y*y < MU*MU) return(1);
if ((x+x1)*(x+x1) + y*y < MU*MU) return(1);
if ((vabs(x) < a + 2.0*MU)&&(vabs(y) < WALL_WIDTH)) return(1);
return(0);
}
case (D_CIRCLES_ELLIPSE):
{
a = 0.9*XMAX - 3.0*MU;
b = a/LAMBDA;
x = x/JULIA_SCALE;
y = y/JULIA_SCALE;
if (x*x/(a*a) + y*y/(b*b) < 1.0) return(1);
for (k=0; k<NPOLY; k++)
{
phi = APOLY*PID + (double)k*DPI/(double)NPOLY;
x1 = a*cos(phi);
y1 = b*sin(phi);
nx = b*cos(phi);
ny = a*sin(phi);
r = 1.0/module2(nx,ny);
nx *= r;
ny *= r;
x2 = x1 + 2.0*MU*nx;
y2 = y1 + 2.0*MU*ny;
if (module2(x-x2, y-y2) < MU) return(1);
r = module2(x-x1, y-y1);
h = (x-x1)*nx + (y-y1)*ny;
if ((h > -MU)&&(h < 2.0*MU)&&(r*r - h*h < WALL_WIDTH*WALL_WIDTH)) return(1);
}
return(0);
}
case (D_CARDIOID):
{
y1 = y - MU;
r = x*x + y1*y1;
return(r*r + 4.0*LAMBDA*y1*r - 4.0*LAMBDA*LAMBDA*x*x < 0.0);
}
case (D_NEPHROID):
{
return(108*ipow(LAMBDA,4)*x*x > ipow(x*x + y*y - 4.0*LAMBDA*LAMBDA,3));
}
case (D_EPICYCLOID):
{
if (first)
{
init_epicyloid();
first = 0;
}
phi = argument(x, y) - APOLY*PID;
if (phi < 0.0) phi += DPI;
if (phi >= DPI) phi -= DPI;
a = DPI/(double)NPOLY;
phi += PID;
while (phi > a) phi -= a;
if (phi > 0.5*a) phi = a - phi;
k = (int)(phi*(double)NEPICYCLOID/a);
return(module2(x,y) < epicycloid_phi_to_r[k]*LAMBDA/(double)(NPOLY));
}
case (D_MENGER):
{
x1 = 0.5*(x+1.0);
@ -4074,7 +4302,7 @@ void draw_rc_hyp()
void draw_billiard(int fade, double fade_value) /* draws the billiard boundary */
{
double x0, y0, x, y, x1, y1, x2, y2, dx, dy, phi, r = 0.01, pos[2], pos1[2], alpha, alpha2, dphi, omega, z, l, width, a, b, c, d, r1, r2, ymax, height, xmin, xmax, ca, sa, xshift, x5, x6, f, fp, xratio, w;
double x0, y0, x, y, x1, y1, x2, y2, dx, dy, phi, r = 0.01, pos[2], pos1[2], alpha, alpha2, dphi, omega, z, l, width, a, b, c, d, r1, r2, ymax, height, xmin, xmax, ca, sa, xshift, x5, x6, f, fp, xratio, w, nx, ny, x3, y3, psi, psi0, psi2;
int i, j, k, k1, k2, mr2, ntiles;
static int first = 1, nsides;
static double h, hh, sqr3, ll, salpha, arcangle;
@ -5916,6 +6144,122 @@ void draw_billiard(int fade, double fade_value) /* draws the billiard bound
}
break;
}
case (D_TWOCIRCLES_ELLIPSE):
{
a = 0.9*XMAX - 3.0*MU;
b = a/LAMBDA;
alpha2 = asin(WALL_WIDTH/MU);
alpha = asin(WALL_WIDTH/b);
x1 = a + 2.0*MU;
draw_circle_arc(x1, 0.0, MU, -PI + alpha2, DPI - 2.0*alpha2, NSEG);
draw_line(x1 - MU*cos(alpha2), WALL_WIDTH, a*cos(alpha), WALL_WIDTH);
draw_ellipse_arc(0.0, 0.0, a, b, alpha, PI - 2.0*alpha, NSEG);
draw_line(-a*cos(alpha), WALL_WIDTH, -x1 + MU*cos(alpha2), WALL_WIDTH);
draw_circle_arc(-x1, 0.0, MU, alpha2, DPI - 2.0*alpha2, NSEG);
draw_line(-x1 + MU*cos(alpha2), -WALL_WIDTH, -a*cos(alpha), -WALL_WIDTH);
draw_ellipse_arc(0.0, 0.0, a, b, PI + alpha, PI - 2.0*alpha, NSEG);
draw_line(a*cos(alpha), -WALL_WIDTH, x1 - MU*cos(alpha2), -WALL_WIDTH);
break;
}
case (D_CIRCLES_ELLIPSE):
{
a = JULIA_SCALE*(0.9*XMAX - 3.0*MU);
b = a/LAMBDA;
alpha2 = asin(WALL_WIDTH/MU);
for (k=0; k<NPOLY; k++)
{
phi = APOLY*PID + (double)k*DPI/(double)NPOLY;
x1 = a*cos(phi);
y1 = b*sin(phi);
nx = b*cos(phi);
ny = a*sin(phi);
r = 1.0/module2(nx,ny);
nx *= r;
ny *= r;
x2 = x1 + 2.0*JULIA_SCALE*MU*nx;
y2 = y1 + 2.0*JULIA_SCALE*MU*ny;
alpha = argument(nx, ny);
x3 = x1 + JULIA_SCALE*WALL_WIDTH*ny;
y3 = y1 - JULIA_SCALE*WALL_WIDTH*nx;
psi2 = argument(x3/a, y3/b);
if (psi2 < psi) psi2 += DPI;
if (k>0) draw_ellipse_arc(0.0, 0.0, a, b, psi, psi2 - psi, NSEG);
draw_line(x2 - JULIA_SCALE*MU*cos(alpha + alpha2), y2 - JULIA_SCALE*MU*sin(alpha + alpha2), x3, y3);
draw_circle_arc(x2, y2, JULIA_SCALE*MU, alpha - PI + alpha2, DPI - 2.0*alpha2, NSEG);
x3 = x1 - JULIA_SCALE*WALL_WIDTH*ny;
y3 = y1 + JULIA_SCALE*WALL_WIDTH*nx;
draw_line(x2 - JULIA_SCALE*MU*cos(alpha - alpha2), y2 - JULIA_SCALE*MU*sin(alpha - alpha2), x3, y3);
psi = argument(x3/a, y3/b);
if (k == 0) psi0 = psi2;
}
if (psi0 < psi) psi0 += DPI;
draw_ellipse_arc(0.0, 0.0, a, b, psi, psi0 - psi, NSEG);
/* draw foci */
if (FOCI)
{
if (fade) glColor3f(0.3*fade_value, 0.3*fade_value, 0.3*fade_value);
else glColor3f(0.3, 0.3, 0.3);
x0 = sqrt(a*a - b*b);
glLineWidth(2);
glEnable(GL_LINE_SMOOTH);
draw_circle(x0, 0.0, 0.01, NSEG);
draw_circle(-x0, 0.0, 0.01, NSEG);
}
break;
}
case (D_CARDIOID):
{
glBegin(GL_LINE_LOOP);
for (i=0; i<NSEG; i++)
{
phi = DPI*(double)i/(double)NSEG;
r = 2.0*LAMBDA*(1.0 - sin(phi));
xy_to_pos(r*cos(phi), MU + r*sin(phi), pos);
glVertex2d(pos[0], pos[1]);
}
glEnd();
break;
}
case (D_NEPHROID):
{
glBegin(GL_LINE_LOOP);
for (i=0; i<NSEG; i++)
{
phi = DPI*(double)i/(double)NSEG;
x = 3.0*sin(phi) - sin(3.0*phi);
y = 3.0*cos(phi) - cos(3.0*phi);
xy_to_pos(LAMBDA*x, LAMBDA*y, pos);
glVertex2d(pos[0], pos[1]);
}
glEnd();
break;
}
case (D_EPICYCLOID):
{
glBegin(GL_LINE_LOOP);
for (i=0; i<NSEG; i++)
{
phi = DPI*(double)i/(double)NSEG + APOLY*PID;
a = (double)(NPOLY+1);
x = a*sin(phi) - sin(a*phi);
y = -(a*cos(phi) - cos(a*phi));
r = LAMBDA/(double)NPOLY;
xy_to_pos(r*x, r*y, pos);
glVertex2d(pos[0], pos[1]);
}
glEnd();
break;
}
case (D_POLYCIRCLES_ANGLED):
{
alpha = atan(WALL_WIDTH/LAMBDA);

View File

@ -2503,3 +2503,161 @@ void init_wave_fields(t_wave wave[NX*NY])
}
}
int init_xyin_from_image_3d(short int *xy_in)
/* initialize table xy_in from an image file */
{
FILE *image_file;
int nx, ny, maxrgb, i, j, k, ii, jj, nmaxpixels, rgbtot, rgbmax, scan, rgbval, sign;
int *rgb_values;
double scalex, scaley, scale;
short int flipy = 1;
switch (IMAGE_FILE)
{
case (IM_PHOTONS):
{
image_file = fopen("PHOTONSband.ppm", "r");
nmaxpixels = 2000000;
break;
}
case (IM_GUITAR):
{
image_file = fopen("guitar.ppm", "r");
nmaxpixels = 11059200;
break;
}
case (IM_GUITAR_NOHOLE):
{
image_file = fopen("guitar_nohole.ppm", "r");
nmaxpixels = 11059200;
break;
}
case (IM_EGUITAR):
{
image_file = fopen("electric_guitar.ppm", "r");
nmaxpixels = 2459520;
break;
}
case (IM_HAPPY_NEW_YEAR):
{
image_file = fopen("Happy_New_Year_2025.ppm", "r");
nmaxpixels = 2073600;
break;
}
case (IM_DICKSON):
{
image_file = fopen("Greenland.ppm", "r");
nmaxpixels = 1756*948;
break;
}
case (IM_DICKSON_ZOOM):
{
image_file = fopen("Dickson_fjord.ppm", "r");
nmaxpixels = 1070*601;
break;
}
}
scan = fscanf(image_file,"%i %i\n", &nx, &ny);
scan = fscanf(image_file,"%i\n", &maxrgb);
rgb_values = (int *)malloc(3*nmaxpixels*sizeof(int));
scalex = (double)nx/(double)NX;
scaley = (double)ny/(double)NY;
switch (IMAGE_FILE)
{
case (IM_PHOTONS):
{
rgbmax = 3*maxrgb/2;
scale = scalex;
sign = 1;
break;
}
case (IM_GUITAR):
{
rgbmax = 150;
scale = scaley;
sign = 1;
break;
}
case (IM_GUITAR_NOHOLE):
{
rgbmax = 150;
scale = scaley;
sign = 1;
break;
}
case (IM_EGUITAR):
{
rgbmax = 700;
scale = scaley;
sign = -1;
break;
}
case (IM_HAPPY_NEW_YEAR):
{
rgbmax = 3*maxrgb/2;
scale = scalex;
sign = -1;
break;
}
case (IM_DICKSON):
{
rgbmax = 1;
scale = scalex;
sign = -1;
flipy = -1;
break;
}
case (IM_DICKSON_ZOOM):
{
rgbmax = 1;
scale = scalex;
sign = -1;
flipy = -1;
break;
}
}
if (nx*ny > nmaxpixels)
{
printf("Image too large, increase nmaxpixels in init_xyin_from_image() to %i\n", nx*ny);
exit(0);
}
/* read rgb values */
for (j=0; j<ny; j++)
for (i=0; i<nx; i++)
for (k=0; k<3; k++)
{
scan = fscanf(image_file,"%i\n", &rgbval);
rgb_values[3*(j*nx+i)+k] = rgbval;
}
for (i=0; i<NX; i++)
for (j=0; j<NY; j++)
{
ii = nx/2 + (int)((double)(i-NX/2)*scale);
jj = ny/2 - flipy*(int)((double)(j-NY/2)*scale);
if (ii > nx-1) ii = nx-1;
if (ii < 0) ii = 0;
if (jj > ny-1) jj = ny-1;
if (jj < 0) jj = 0;
k = 3*(jj*nx+ii);
rgbtot = rgb_values[k] + rgb_values[k+1] + rgb_values[k+2];
if (rgbtot*sign > rgbmax*sign) xy_in[i*NY+j] = 1;
else xy_in[i*NY+j] = 0;
if (ii == 0) xy_in[i*NY+j] = 0;
// if (ii == nx-1) xy_in[i*NY+j] = 0;
}
fclose(image_file);
free(rgb_values);
return(1);
}

View File

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

View File

@ -1894,14 +1894,26 @@ void init_wave_flat_mod(double phi[NX*NY], double psi[NX*NY], short int xy_in[NX
int i, j;
double xy[2];
if (!XYIN_INITIALISED)
{
#pragma omp parallel for private(i,j,xy)
for (i=0; i<NX; i++) {
if (i%100 == 0) printf("Wave and table xy_in - Initialising column %i of %i\n", i, NX);
for (j=0; j<NY; j++)
{
ij_to_xy(i, j, xy);
xy_in[i*NY+j] = xy_in_billiard(xy[0],xy[1]);
}
}
}
#pragma omp parallel for private(i,j,xy)
for (i=0; i<NX; i++) {
if (i%100 == 0) printf("Wave and table xy_in - Initialising column %i of %i\n", i, NX);
for (j=0; j<NY; j++)
{
ij_to_xy(i, j, xy);
xy_in[i*NY+j] = xy_in_billiard(xy[0],xy[1]);
phi[i*NY+j] = 0.0;
phi[i*NY+j] = 0.0;
psi[i*NY+j] = 0.0;
}
}

View File

@ -90,6 +90,7 @@
#define CIRCLE_PATTERN 13 /* pattern of circles, see list in global_pdes.c */
#define CIRCLE_PATTERN_B 13 /* pattern of circles, see list in global_pdes.c */
#define IMAGE_FILE 5 /* for option D_IMAGE */
#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 */

View File

@ -70,6 +70,7 @@
#define CIRCLE_PATTERN 2 /* pattern of circles, see list in global_pdes.c */
#define CIRCLE_PATTERN_B 11 /* pattern of circles, see list in global_pdes.c */
#define IMAGE_FILE 5 /* for option D_IMAGE */
#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 */

View File

@ -71,11 +71,12 @@
#define B_DOMAIN 81 /* choice of domain shape, see list in global_pdes.c */
#define CIRCLE_PATTERN 31 /* pattern of circles or polygons, see list in global_pdes.c */
#define CIRCLE_PATTERN 32 /* 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 IMAGE_FILE 0 /* for option D_IMAGE */
#define VARIABLE_IOR 0 /* set to 1 for a variable index of refraction */
#define IOR 20 /* choice of index of refraction, see list in global_pdes.c */
@ -88,7 +89,7 @@
#define RANDOM_POLY_ANGLE 1 /* set to 1 to randomize angle of polygons */
#define LAMBDA 0.75 /* parameter controlling the dimensions of domain */
#define MU 0.2 /* parameter controlling the dimensions of domain */
#define MU 0.1 /* parameter controlling the dimensions of domain */
#define MU_B 1.0 /* 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 */
@ -128,7 +129,7 @@
#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.1 /* Courant number */
#define COURANT 0.12 /* Courant number */
#define COURANTB 0.005 /* Courant number in medium B */
#define GAMMA 0.0 /* damping factor in wave equation */
#define GAMMAB 0.0 /* damping factor in wave equation */
@ -144,7 +145,7 @@
/* 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 25 /* period of oscillating 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 */
@ -171,8 +172,7 @@
/* Parameters for length and speed of simulation */
// #define NSTEPS 2800 /* number of frames of movie */
#define NSTEPS 1800 /* number of frames of movie */
#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 */
@ -184,14 +184,15 @@
#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 500 /* number of still frames at end of movie */
#define END_FRAMES 250 /* 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 2.5 /* amplitude of initial condition */
#define INITIAL_VARIANCE 0.003 /* variance of initial condition */
#define INITIAL_WAVELENGTH 0.1 /* wavelength of initial condition */
#define INITIAL_AMP 2.5 /* amplitude of initial condition */
#define INITIAL_VARIANCE 0.01 /* variance of initial condition */
#define INITIAL_WAVELENGTH 0.2 /* wavelength of initial condition */
#define N_SOURCES 6 /* number of sources, for option draw_sources */
/* Plot type, see list in global_pdes.c */
@ -204,8 +205,8 @@
#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 0 /* set to 1 to change luminosity according to normal vector */
#define SHADE_2D 1 /* set to 1 to change luminosity according to normal vector to plane */
#define SHADE_3D 1 /* set to 1 to change luminosity according to normal vector */
#define SHADE_2D 0 /* set to 1 to change luminosity according to normal vector to plane */
#define SHADE_WAVE 1 /* set to 1 to have luminosity depend on wave height */
#define NON_DIRICHLET_BC 1 /* set to 1 to draw only facets in domain, if field is not zero on boundary */
#define FLOOR_ZCOORD 0 /* set to 1 to draw only facets with z not too negative */
@ -224,7 +225,7 @@
/* 3D representation */
#define REPRESENTATION_3D 1 /* choice of 3D representation */
#define PLOT_2D 1 /* switch to 2D representation, equirectangular projection */
#define PLOT_2D 0 /* switch to 2D representation, equirectangular projection */
#define PHISHIFT 0.0 /* shift of phi in 2D plot (in degrees) */
#define FLOODING 0 /* set to 1 to draw waves above altitude (for Earth representations) */
@ -240,7 +241,7 @@
/* Color schemes */
#define COLOR_PALETTE 14 /* Color palette, see list in global_pdes.c */
#define COLOR_PALETTE 11 /* Color palette, see list in global_pdes.c */
#define COLOR_PALETTE_B 16 /* Color palette, see list in global_pdes.c */
#define BLACK 1 /* background */
@ -252,7 +253,7 @@
#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_AMPLITUDE 0.5 /* additional scaling factor for color scheme P_3D_AMPLITUDE */
#define VSHIFT_AMPLITUDE 0.0 /* additional shift for wave amplitude */
#define VSCALE_ENERGY 5.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 */
@ -288,10 +289,10 @@
#define MAZE_XSHIFT 0.0 /* horizontal shift of maze */
#define MAZE_WIDTH 0.02 /* half width of maze walls */
#define DRAW_COLOR_SCHEME 0 /* set to 1 to plot the color scheme */
#define COLORBAR_RANGE 1.5 /* scale of color scheme bar */
#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 6.0 /* scale of color scheme bar for 2nd part */
#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */
#define ROTATE_COLOR_SCHEME 0 /* set to 1 to draw color scheme horizontally */
#define CIRC_COLORBAR 0 /* set to 1 to draw circular color scheme */
#define CIRC_COLORBAR_B 0 /* set to 1 to draw circular color scheme */
#define DRAW_MOON_POSITION 0 /* set to 1 to draw position of Moon (for tide simulation) */
@ -318,7 +319,6 @@
#define INITIAL_SHIFT 20.0 /* time shift of initial wave packet (in oscillation periods) */
#define WAVE_PACKET_SHIFT 200.0 /* time shift between wave packets (in oscillation periods) */
#define FADE_IN_OBSTACLE 0 /* set to 1 to fade color inside obstacles */
#define N_SOURCES 20 /* number of sources, for option draw_sources */
#define XYIN_INITIALISED (B_DOMAIN == D_IMAGE)
/* end of constants only used by sub_wave and sub_maze */
@ -332,7 +332,7 @@ double u_3d[2] = {0.75, -0.45}; /* projections of basis vectors for REP_AXO_
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] = {-5.0, -5.0, 3.5}; /* location of observer for REP_PROJ_3D representation */
double observer[3] = {-5.0, -5.0, 5.5}; /* location of observer for REP_PROJ_3D representation */
int reset_view = 0; /* switch to reset 3D view parameters (for option ROTATE_VIEW) */
#define ADD_DEM 0 /* add DEM (digital elevation model) */
@ -348,8 +348,8 @@ int reset_view = 0; /* switch to reset 3D view parameters (for option RO
#define TRANSPARENT_WAVE 0 /* set to 1 for waves to be "transparent" */
#define RSCALE 1.0 /* scaling factor of radial component */
#define RMAX 1.1 /* max value of radial component */
#define RMIN 0.9 /* min value of radial component */
#define RMAX 7.5 /* max value of radial component */
#define RMIN 0.2 /* min value of radial component */
#define Z_SCALING_FACTOR 0.8 /* overall scaling factor of z axis for REP_PROJ_3D representation */
#define XY_SCALING_FACTOR 2.2 /* 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 */
@ -710,10 +710,11 @@ void viewpoint_schedule(int i)
void animation()
{
double time, scale, ratio, startleft[2], startright[2], sign = -1.0, r2, xy[2], fade_value, yshift, speed = 0.0, a, b, c, angle = 0.0, lambda1, y, x1, sign1, omega, phase_shift, theta, amp;
double *phi, *psi, *tmp, *color_scale, *tc, *tcc, *tgamma;
double *phi, *psi, *tmp, *color_scale, *tc, *tcc, *tgamma, wave_signs[N_SOURCES];
// double *total_energy;
short int *xy_in;
int i, j, s, sample_left[2], sample_right[2], period = 0, fade, source_counter = 0, k, p, q, drift_counter = 0;
char message[100];
int i, j, s, sample_left[2], sample_right[2], period = 0, fade, source_counter = 0, k, p, q, drift_counter = 0, wave_shift[N_SOURCES];
static int counter = 0, first_source = 1;
long int wave_value;
t_wave *wave;
@ -844,30 +845,23 @@ void animation()
// add_circular_wave_sphere(1.0, 1.0 - PI/9.0 + DPI/3.0, 0.15, phi, psi, xy_in, wsphere);
// add_circular_wave_sphere(1.0, 1.0 - PI/9.0 + 2.0*DPI/3.0, 0.15, phi, psi, xy_in, wsphere);
for (j=0; j<5; j++)
for (j=0; j<ncircles; j++)
{
a = circ_sphere[1].x + circ_sphere[2].x;
b = circ_sphere[1].y + circ_sphere[2].y;
c = 1.0 + circ_sphere[1].z + circ_sphere[2].z;
theta = acos(c/sqrt(a*a + b*b + c*c));
wave_source_x[4*j] = (double)j*DPI/5.0;
wave_source_y[4*j] = PID - theta;
wave_source_x[4*j+1] = (double)j*DPI/5.0 + PI/5.0;
wave_source_y[4*j+1] = theta - PID;
a = circ_sphere[1].x + circ_sphere[2].x + circ_sphere[6].x;
b = circ_sphere[1].y + circ_sphere[2].y + circ_sphere[6].y;
c = circ_sphere[1].z + circ_sphere[2].z + circ_sphere[6].z;
theta = acos(c/sqrt(a*a + b*b + c*c));
wave_source_x[4*j+2] = (double)j*DPI/5.0 + PI/5.0;
wave_source_y[4*j+2] = theta - PID;
wave_source_x[4*j+3] = (double)j*DPI/5.0;
wave_source_y[4*j+3] = PID - theta;
wave_source_x[j] = circ_sphere[j].phi;
wave_source_y[j] = circ_sphere[j].theta - PID;
}
wave_shift[0] = 0;
wave_signs[0] = 1.0;
wave_shift[1] = OSCILLATING_SOURCE_PERIOD/3;
wave_signs[1] = -1.0;
wave_shift[2] = OSCILLATING_SOURCE_PERIOD*2/3;
wave_signs[2] = 1.0;
wave_shift[3] = OSCILLATING_SOURCE_PERIOD/3;
wave_signs[3] = -1.0;
wave_shift[4] = OSCILLATING_SOURCE_PERIOD*2/3;
wave_signs[4] = 1.0;
wave_shift[5] = 0;
wave_signs[5] = 1.0;
// printf("Wave initialized\n");
@ -973,12 +967,20 @@ void animation()
if (DRAW_COLOR_SCHEME) draw_color_bar_palette(CPLOT, COLORBAR_RANGE, COLOR_PALETTE, CIRC_COLORBAR, fade, fade_value);
/* add oscillating waves */
if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1))
{
if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign;
for (j=0; j<N_SOURCES; j++)
add_circular_wave_sphere(sign,wave_source_x[j], wave_source_y[j], phi, psi, xy_in, wsphere);
}
for (j=0; j<N_SOURCES; j++)
if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1 + wave_shift[j]))
{
if (ALTERNATE_OSCILLATING_SOURCE) wave_signs[j] = -wave_signs[j];
add_circular_wave_sphere(wave_signs[j], wave_source_x[j], wave_source_y[j], phi, psi, xy_in, wsphere);
}
// /* add oscillating waves */
// if ((ADD_OSCILLATING_SOURCE)&&(i%OSCILLATING_SOURCE_PERIOD == 1))
// {
// if (ALTERNATE_OSCILLATING_SOURCE) sign = -sign;
// for (j=0; j<N_SOURCES; j++)
// add_circular_wave_sphere(sign*wave_signs[j], wave_source_x[j], wave_source_y[j], phi, psi, xy_in, wsphere);
// }
if (PRINT_SPEED) print_speed_3d(speed, 0, 1.0);
if (!((NO_EXTRA_BUFFER_SWAP)&&(MOVIE))) glutSwapBuffers();
@ -1086,6 +1088,10 @@ void animation()
}
s = system("mv wave*.tif tif_wave/");
/* sometimes, image NSTEPS+1 is black, replace by image NSTEPS */
sprintf(message, "cp tif_wave/wave.%05i.tif tif_wave/wave.%05i.tif", NSTEPS, NSTEPS+1);
s = system(message);
}
free(xy_in);