Add files via upload

This commit is contained in:
nilsberglund-orleans 2022-05-28 14:44:43 +02:00 committed by GitHub
parent 111822f852
commit 564f4eb251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 43 deletions

View File

@ -14,7 +14,7 @@
#define NMAXCIRCLES 20000 /* total number of circles/polygons (must be at least NCX*NCY for square grid) */ #define NMAXCIRCLES 20000 /* 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 MAXNEIGH 20 /* max number of neighbours kept in memory */
#define NMAXOBSTACLES 100 /* max number of obstacles */ #define NMAXOBSTACLES 100 /* max number of obstacles */
#define NMAXSEGMENTS 100 /* max number of repelling segments */ #define NMAXSEGMENTS 1000 /* max number of repelling segments */
#define C_SQUARE 0 /* square grid of circles */ #define C_SQUARE 0 /* square grid of circles */
#define C_HEX 1 /* hexagonal/triangular grid of circles */ #define C_HEX 1 /* hexagonal/triangular grid of circles */
@ -30,6 +30,8 @@
#define C_GOLDEN_SPIRAL 11 /* spiral pattern based on golden mean */ #define C_GOLDEN_SPIRAL 11 /* spiral pattern based on golden mean */
#define C_SQUARE_HEX 12 /* alternating between square and hexagonal/triangular */ #define C_SQUARE_HEX 12 /* alternating between square and hexagonal/triangular */
#define C_POOL_TABLE 20 /* pool table initial position */
#define C_ONE 97 /* one single circle, as for Sinai */ #define C_ONE 97 /* one single circle, as for Sinai */
#define C_TWO 98 /* two concentric circles of different type */ #define C_TWO 98 /* two concentric circles of different type */
#define C_NOTHING 99 /* no circle at all, for comparisons */ #define C_NOTHING 99 /* no circle at all, for comparisons */
@ -38,6 +40,7 @@
#define O_CORNERS 0 /* obstacles in the corners (for Boy b.c.) */ #define O_CORNERS 0 /* obstacles in the corners (for Boy b.c.) */
#define O_GALTON_BOARD 1 /* Galton board pattern */ #define O_GALTON_BOARD 1 /* Galton board pattern */
#define O_GENUS_TWO 2 /* obstacles in corners of L-shape domeain (for genus 2 b.c.) */ #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 */
/* pattern of additional repelling segments */ /* pattern of additional repelling segments */
#define S_RECTANGLE 0 /* segments forming a rectangle */ #define S_RECTANGLE 0 /* segments forming a rectangle */
@ -46,6 +49,9 @@
#define S_PENTA 3 /* segments forming a pentagon with 3 angles of 120° and 2 right angles */ #define S_PENTA 3 /* segments forming a pentagon with 3 angles of 120° and 2 right angles */
#define S_CENTRIFUGE 4 /* segments forming "centrifuge" (polygon with radial segments) */ #define S_CENTRIFUGE 4 /* segments forming "centrifuge" (polygon with radial segments) */
#define S_POLY_ELLIPSE 5 /* segments forming a polygonal approximation of an ellipse */ #define S_POLY_ELLIPSE 5 /* segments forming a polygonal approximation of an ellipse */
#define S_POOL_TABLE 6 /* pool table with pockets */
#define S_CENTRIFUGE_RND 7 /* segments forming centrifuge with more rounded bins */
#define S_CENTRIFUGE_LEAKY 8 /* segments forming centrifuge with rounded bins and holes */
/* particle interaction */ /* particle interaction */
@ -74,6 +80,7 @@
#define BC_SCREEN_BINS 12 /* harmonic boundary conditions outside screen area plus "bins" (for Galton board) */ #define BC_SCREEN_BINS 12 /* harmonic boundary conditions outside screen area plus "bins" (for Galton board) */
#define BC_BOY 13 /* Boy surface/projective plane (periodic with twisted horizontal and vertical parts) */ #define BC_BOY 13 /* Boy surface/projective plane (periodic with twisted horizontal and vertical parts) */
#define BC_GENUS_TWO 14 /* surface of genus 2, obtained by identifying opposite sides of an L shape */ #define BC_GENUS_TWO 14 /* surface of genus 2, obtained by identifying opposite sides of an L shape */
#define BC_ABSORBING 20 /* "no-return" boundary conditions outside screen area */
/* Regions for partial thermostat couplings */ /* Regions for partial thermostat couplings */
@ -188,6 +195,7 @@ typedef struct
double c; /* constant term in cartesian eq nx*x + ny*y = c */ double c; /* constant term in cartesian eq nx*x + ny*y = c */
double length; /* length of segment */ double length; /* length of segment */
short int concave; /* corner is concave, to add extra repelling force */ short int concave; /* corner is concave, to add extra repelling force */
short int cycle; /* set to 1 if (x2, y2) is equal to (x1, y1) of next segment */
double angle1, angle2; /* angles in which concave corners repel */ double angle1, angle2; /* angles in which concave corners repel */
short int active; /* segment is active */ short int active; /* segment is active */
double x01, x02, y01, y02; /* initial values of extremities, in case of rotation/translation */ double x01, x02, y01, y02; /* initial values of extremities, in case of rotation/translation */

View File

@ -56,13 +56,13 @@
#define INITXMIN -0.7 #define INITXMIN -0.7
#define INITXMAX 0.7 /* x interval for initial condition */ #define INITXMAX 0.7 /* x interval for initial condition */
#define INITYMIN 0.1 #define INITYMIN -0.5
#define INITYMAX 0.6 /* y interval for initial condition */ #define INITYMAX 0.5 /* y interval for initial condition */
#define BCXMIN -0.7 #define BCXMIN -2.0
#define BCXMAX 0.7 /* x interval for boundary condition */ #define BCXMAX 5.0 /* x interval for boundary condition */
#define BCYMIN -0.85 #define BCYMIN -1.6
#define BCYMAX 0.85 /* y interval for boundary condition */ #define BCYMAX 1.6 /* y interval for boundary condition */
#define OBSXMIN -2.0 #define OBSXMIN -2.0
#define OBSXMAX 2.0 /* x interval for motion of obstacle */ #define OBSXMAX 2.0 /* x interval for motion of obstacle */
@ -73,10 +73,10 @@
#define OBSTACLE_PATTERN 2 /* pattern of obstacles, see list in global_ljones.c */ #define OBSTACLE_PATTERN 2 /* pattern of obstacles, see list in global_ljones.c */
#define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */ #define ADD_FIXED_SEGMENTS 1 /* set to 1 to add fixed segments as obstacles */
#define SEGMENT_PATTERN 2 /* pattern of repelling segments, see list in global_ljones.c */ #define SEGMENT_PATTERN 5 /* pattern of repelling segments, see list in global_ljones.c */
#define TWO_TYPES 0 /* set to 1 to have two types of particles */ #define TWO_TYPES 0 /* set to 1 to have two types of particles */
#define TPYE_PROPORTION 0.8 /* proportion of particles of first type */ #define TPYE_PROPORTION 0.7 /* proportion of particles of first type */
#define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */ #define SYMMETRIZE_FORCE 1 /* set to 1 to symmetrize two-particle interaction, only needed if particles are not all the same */
#define CENTER_PX 0 /* set to 1 to center horizontal momentum */ #define CENTER_PX 0 /* set to 1 to center horizontal momentum */
#define CENTER_PY 0 /* set to 1 to center vertical momentum */ #define CENTER_PY 0 /* set to 1 to center vertical momentum */
@ -89,14 +89,14 @@
#define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */ #define P_PERCOL 0.25 /* probability of having a circle in C_RAND_PERCOL arrangement */
#define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */ #define NPOISSON 100 /* number of points for Poisson C_RAND_POISSON arrangement */
#define PDISC_DISTANCE 2.75 /* minimal distance in Poisson disc process, controls density of particles */ #define PDISC_DISTANCE 3.33 /* minimal distance in Poisson disc process, controls density of particles */
#define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */ #define PDISC_CANDIDATES 100 /* number of candidates in construction of Poisson disc process */
#define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */ #define RANDOM_POLY_ANGLE 0 /* set to 1 to randomize angle of polygons */
#define LAMBDA 2.0 /* parameter controlling the dimensions of domain */ #define LAMBDA 0.7 /* parameter controlling the dimensions of domain */
#define MU 0.013 /* parameter controlling radius of particles */ #define MU 0.012 /* parameter controlling radius of particles */
#define MU_B 0.0254 /* parameter controlling radius of particles of second type */ #define MU_B 0.018 /* parameter controlling radius of particles of second type */
#define NPOLY 3 /* number of sides of polygon */ #define NPOLY 18 /* number of sides of polygon */
#define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */ #define APOLY 0.666666666 /* angle by which to turn polygon, in units of Pi/2 */
#define MDEPTH 4 /* depth of computation of Menger gasket */ #define MDEPTH 4 /* depth of computation of Menger gasket */
#define MRATIO 3 /* ratio defining Menger gasket */ #define MRATIO 3 /* ratio defining Menger gasket */
@ -115,10 +115,10 @@
/* Parameters for length and speed of simulation */ /* Parameters for length and speed of simulation */
#define NSTEPS 5500 /* number of frames of movie */ #define NSTEPS 2000 /* number of frames of movie */
#define NVID 650 /* number of iterations between images displayed on screen */ #define NVID 500 /* number of iterations between images displayed on screen */
#define NSEG 250 /* number of segments of boundary */ #define NSEG 250 /* number of segments of boundary */
#define INITIAL_TIME 10 /* time after which to start saving frames */ #define INITIAL_TIME 50 /* time after which to start saving frames */
#define BOUNDARY_WIDTH 1 /* width of particle boundary */ #define BOUNDARY_WIDTH 1 /* width of particle boundary */
#define LINK_WIDTH 2 /* width of links between particles */ #define LINK_WIDTH 2 /* width of links between particles */
#define CONTAINER_WIDTH 4 /* width of container boundary */ #define CONTAINER_WIDTH 4 /* width of container boundary */
@ -132,7 +132,7 @@
/* Boundary conditions, see list in global_ljones.c */ /* Boundary conditions, see list in global_ljones.c */
#define BOUNDARY_COND 0 #define BOUNDARY_COND 3
/* Plot type, see list in global_ljones.c */ /* Plot type, see list in global_ljones.c */
@ -167,19 +167,19 @@
#define PARTICLE_HUE_MIN 359.0 /* color of original particle */ #define PARTICLE_HUE_MIN 359.0 /* color of original particle */
#define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */ #define PARTICLE_HUE_MAX 0.0 /* color of saturated particle */
#define PARTICLE_EMAX 2.0e2 /* energy of particle with hottest color */ #define PARTICLE_EMAX 2.0e2 /* energy of particle with hottest color */
#define HUE_TYPE0 280.0 /* hue of particles of type 0 */ #define HUE_TYPE0 45.0 /* hue of particles of type 0 */
#define HUE_TYPE1 135.0 /* hue of particles of type 1 */ #define HUE_TYPE1 300.0 /* hue of particles of type 1 */
#define HUE_TYPE2 70.0 /* hue of particles of type 1 */ #define HUE_TYPE2 300.0 /* hue of particles of type 2 */
#define HUE_TYPE3 210.0 /* hue of particles of type 1 */ #define HUE_TYPE3 300.0 /* hue of particles of type 3 */
#define RANDOM_RADIUS 0 /* set to 1 for random circle radius */ #define RANDOM_RADIUS 0 /* set to 1 for random circle radius */
#define DT_PARTICLE 5.0e-7 /* time step for particle displacement */ #define DT_PARTICLE 2.0e-6 /* time step for particle displacement */
#define KREPEL 12.0 /* constant in repelling force between particles */ #define KREPEL 12.0 /* constant in repelling force between particles */
#define EQUILIBRIUM_DIST 4.0 /* Lennard-Jones equilibrium distance */ #define EQUILIBRIUM_DIST 4.5 /* Lennard-Jones equilibrium distance */
#define EQUILIBRIUM_DIST_B 5.0 /* Lennard-Jones equilibrium distance for second type of particle */ #define EQUILIBRIUM_DIST_B 3.5 /* Lennard-Jones equilibrium distance for second type of particle */
#define REPEL_RADIUS 20.0 /* radius in which repelling force acts (in units of particle radius) */ #define REPEL_RADIUS 20.0 /* radius in which repelling force acts (in units of particle radius) */
#define DAMPING 0.0 /* damping coefficient of particles */ #define DAMPING 1.0e-1 /* damping coefficient of particles */
#define PARTICLE_MASS 1.0 /* mass of particle of radius MU */ #define PARTICLE_MASS 4.0 /* mass of particle of radius MU */
#define PARTICLE_MASS_B 1.0 /* mass of particle of radius MU */ #define PARTICLE_MASS_B 1.0 /* mass of particle of radius MU */
#define PARTICLE_INERTIA_MOMENT 0.2 /* moment of inertia of particle */ #define PARTICLE_INERTIA_MOMENT 0.2 /* moment of inertia of particle */
#define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */ #define PARTICLE_INERTIA_MOMENT_B 0.02 /* moment of inertia of second type of particle */
@ -189,12 +189,12 @@
#define THERMOSTAT 1 /* set to 1 to switch on thermostat */ #define THERMOSTAT 1 /* set to 1 to switch on thermostat */
#define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */ #define VARY_THERMOSTAT 0 /* set to 1 for time-dependent thermostat schedule */
#define SIGMA 5.0 /* noise intensity in thermostat */ #define SIGMA 5.0 /* noise intensity in thermostat */
#define BETA 0.01 /* initial inverse temperature */ #define BETA 0.02 /* initial inverse temperature */
#define MU_XI 0.01 /* friction constant in thermostat */ #define MU_XI 0.01 /* friction constant in thermostat */
#define KSPRING_BOUNDARY 5.0e9 /* confining harmonic potential outside simulation region */ #define KSPRING_BOUNDARY 1.0e11 /* confining harmonic potential outside simulation region */
#define KSPRING_OBSTACLE 5.0e9 /* harmonic potential of obstacles */ #define KSPRING_OBSTACLE 1.0e11 /* harmonic potential of obstacles */
#define NBH_DIST_FACTOR 4.5 /* radius in which to count neighbours */ #define NBH_DIST_FACTOR 4.0 /* radius in which to count neighbours */
#define GRAVITY 10000.0 /* gravity acting on all particles */ #define GRAVITY 0.0 /* gravity acting on all particles */
#define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */ #define INCREASE_GRAVITY 0 /* set to 1 to increase gravity during the simulation */
#define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */ #define GRAVITY_FACTOR 100.0 /* factor by which to increase gravity */
#define GRAVITY_INITIAL_TIME 500 /* time at start of simulation with constant gravity */ #define GRAVITY_INITIAL_TIME 500 /* time at start of simulation with constant gravity */
@ -213,11 +213,11 @@
#define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */ #define SPIN_RANGE_B 5.0 /* range of spin-spin interaction for second type of particle */
#define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */ #define QUADRUPOLE_RATIO 0.6 /* anisotropy in quadrupole potential */
#define INCREASE_BETA 0 /* set to 1 to increase BETA during simulation */ #define INCREASE_BETA 1 /* set to 1 to increase BETA during simulation */
#define BETA_FACTOR 20.0 /* factor by which to change BETA during simulation */ #define BETA_FACTOR 0.025 /* factor by which to change BETA during simulation */
#define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */ #define N_TOSCILLATIONS 1.5 /* number of temperature oscillations in BETA schedule */
#define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */ #define NO_OSCILLATION 1 /* set to 1 to have exponential BETA change only */
#define FINAL_CONSTANT_PHASE 2000 /* final phase in which temperature is constant */ #define FINAL_CONSTANT_PHASE 1000 /* final phase in which temperature is constant */
#define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */ #define DECREASE_CONTAINER_SIZE 0 /* set to 1 to decrease size of container */
#define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */ #define SYMMETRIC_DECREASE 0 /* set tp 1 to decrease container symmetrically */
@ -261,7 +261,7 @@
#define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */ #define TRACER_PARTICLE_MASS 4.0 /* relative mass of tracer particle */
#define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */ #define TRAJECTORY_WIDTH 3 /* width of tracer particle trajectory */
#define ROTATE_BOUNDARY 1 /* set to 1 to rotate the repelling segments */ #define ROTATE_BOUNDARY 0 /* set to 1 to rotate the repelling segments */
#define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */ #define SMOOTH_ROTATION 1 /* set to 1 to update segments at each time step (rather than at each movie frame) */
#define PERIOD_ROTATE_BOUNDARY 2500 /* period of rotating boundary */ #define PERIOD_ROTATE_BOUNDARY 2500 /* period of rotating boundary */
#define ROTATE_INITIAL_TIME 0 /* initial time without rotation */ #define ROTATE_INITIAL_TIME 0 /* initial time without rotation */
@ -269,7 +269,7 @@
#define PRINT_OMEGA 0 /* set to 1 to print angular speed */ #define PRINT_OMEGA 0 /* set to 1 to print angular speed */
#define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */ #define PRINT_PARTICLE_SPEEDS 0 /* set to 1 to print average speeds/momenta of particles */
#define MOVE_BOUNDARY 0 /* set to 1 to move repelling segments, due to force from particles */ #define MOVE_BOUNDARY 1 /* set to 1 to move repelling segments, due to force from particles */
#define SEGMENTS_MASS 100.0 /* mass of collection of segments */ #define SEGMENTS_MASS 100.0 /* mass of collection of segments */
#define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */ #define DEACTIVATE_SEGMENT 1 /* set to 1 to deactivate last segment after a certain time */
#define SEGMENT_DEACTIVATION_TIME 1000 /* time at which to deactivate last segment */ #define SEGMENT_DEACTIVATION_TIME 1000 /* time at which to deactivate last segment */
@ -283,7 +283,7 @@
#define REACTION_PROB 0.03 /* probability controlling reaction term */ #define REACTION_PROB 0.03 /* probability controlling reaction term */
#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */ #define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print total number of particles */
#define PRINT_LEFT 0 /* set to 1 to print certain parameters at the top left instead of right */ #define PRINT_LEFT 1 /* set to 1 to print certain parameters at the top left instead of right */
#define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */ #define EHRENFEST_COPY 0 /* set to 1 to add equal number of larger particles (for Ehrenfest model) */
@ -296,12 +296,12 @@
#define WALL_TIME 500 /* time during which to keep wall */ #define WALL_TIME 500 /* time during which to keep wall */
#define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */ #define FLOOR_FORCE 1 /* set to 1 to limit force on particle to FMAX */
#define FMAX 1.0e9 /* maximal force */ #define FMAX 1.0e12 /* maximal force */
#define FLOOR_OMEGA 1 /* set to 1 to limit particle momentum to PMAX */ #define FLOOR_OMEGA 1 /* set to 1 to limit particle momentum to PMAX */
#define PMAX 1000.0 /* maximal force */ #define PMAX 1000.0 /* maximal force */
#define HASHX 40 /* size of hashgrid in x direction */ #define HASHX 100 /* size of hashgrid in x direction */
#define HASHY 20 /* size of hashgrid in y direction */ #define HASHY 40 /* size of hashgrid in y direction */
#define HASHMAX 100 /* maximal number of particles per hashgrid cell */ #define HASHMAX 100 /* maximal number of particles per hashgrid cell */
#define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */ #define HASHGRID_PADDING 0.1 /* padding of hashgrid outside simulation window */
@ -783,7 +783,7 @@ void animation()
thermostat_on = thermostat_schedule(i); thermostat_on = thermostat_schedule(i);
printf("Termostat: %i\n", thermostat_on); printf("Termostat: %i\n", thermostat_on);
} }
if ((ADD_FIXED_SEGMENTS)&&(DEACTIVATE_SEGMENT)&&(i > INITIAL_TIME + SEGMENT_DEACTIVATION_TIME)) if ((DEACTIVATE_SEGMENT)&&(i > INITIAL_TIME + SEGMENT_DEACTIVATION_TIME))
segment[nsegments-1].active = 0; segment[nsegments-1].active = 0;
blank(); blank();

View File

@ -20,6 +20,7 @@ int bc_grouped(int bc)
case (BC_SCREEN_BINS): return(0); case (BC_SCREEN_BINS): return(0);
case (BC_BOY): return(3); case (BC_BOY): return(3);
case (BC_GENUS_TWO): return(4); case (BC_GENUS_TWO): return(4);
case (BC_ABSORBING): return(0);
default: default:
{ {
printf("Warning: Hashgrid will not be properly initialised, update bc_grouped()\n\n"); printf("Warning: Hashgrid will not be properly initialised, update bc_grouped()\n\n");
@ -378,7 +379,7 @@ void update_hashgrid(t_particle* particle, t_hashgrid* hashgrid, int verbose)
/* place each particle in hash grid */ /* place each particle in hash grid */
for (k=0; k<ncircles; k++) for (k=0; k<ncircles; k++)
// if (circleactive[k]) if (particle[k].active)
{ {
// printf("placing circle %i\t", k); // printf("placing circle %i\t", k);
hashcell = hash_cell(particle[k].xc, particle[k].yc); hashcell = hash_cell(particle[k].xc, particle[k].yc);