/* This file is part of EZRide. Copyright 2007 Dwight Barkley, Copyright 2010 Vadim Biktashev & Andrew Foulkes. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef _EZRIDE_ #define _EZRIDE_ /* If nonzero, can do Goldstone Modes */ #define GM 0 /* If nonzero, can do response functions */ #define RF 0 /* ----------------------------------------------------------------------------- */ /* These are the main parameters affecting the compilation of EZride. */ /* Define them according to your needs. */ /* */ typedef float Real; /* precision of Real variables (float or double) */ /* */ #define V_DIFF_ON 0 /* if 1 then v-field diffuses */ #define EXPLICIT 1 /* if 1 then explicit u-kinetics, else implicit */ #define SPLIT 1 /* if 1 then split diffusion and kinetics steps */ #define NINEPOINT 0 /* if 1 then 9 pt Laplacian formulas, else 5 pt */ #define PBC_x 0 /* if 1 then periodic BCs in x, else Neumann BCs */ #define PBC_y 0 /* if 1 then periodic BCs in y, else Neumann BCs */ #define TIPRIM 5 /* width of rim where tips are ignored - needed if DBC */ #define EUCLID 0 /* if 1 then quot sys found via shift in Euclidean gp */ /* ----------------------------------------------------------------------------- */ /* * I always define min, max, and make sure M_PI is defined * ------------------------------------------------------- */ #define min(a,b) ((a)>(b) ? (b) : (a)) #define max(a,b) ((a)>(b) ? (a) : (b)) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif /* --------------------------------------------------- * Global variables used throughout the EZride Code * --------------------------------------------------- */ extern Real *fields, *u, *v, *u1, *v1, /* arrays for concentration fields */ *sigma_u, *sigma_v; /* and spatial sums (Laplacians) */ extern Real *tip_x, *tip_y; /* spiral tip arrays */ /* NB: name of parameter eps is kept to comply with EZSpiral tradition */ extern Real one_o_eps, eps, /* model parameters */ delta, grid_h, dt, /* numerical parameters */ dt_o_eps, dt_o_2eps, /* useful parameter combinations */ one_o_a, b_o_a, /* useful parameter combinations */ a2, one_o_a2, b_o_a2, /* useful parameter combinations */ dt_o_2h, one_o_h, /* useful parameter combinations */ dteps, dt_h, /* useful parameter combinations */ Utip,Vtip, /* U and V pinning constants */ cx,cy,omega, /* cx, cy, omega in the quotient system */ stab_cx,stab_cy,stab_om, /* stability limits for cx, cy, omega */ cx_prev, diff_cx, /* variables used in testing */ cy_prev, diff_cy, /* variables used in testing */ om_prev, diff_om, /* variables used in testing */ LX2,LY2, /* mode half-sizes of the box */ X0,Y0,TH0, /* tip coords in EZRide FoR */ X1,Y1,TH1, /* EZRide FoR position wrt lab FoR */ u_root, v_root, /* coordinates relating to the fixed point */ Au, Av, /* anisotropy coeeficients */ dt_o_wh2, dtDv_o_wh2; /* useful parameter combinations */ extern Real u_root, v_root, ulo, uhi, umin, umax, vmin, vmax; /* visualization benchmarks, model-dependent */ extern int nx, ny, /* # of grid points per direction */ plot_step, /* plot step */ x_inc, y_inc, /* x,y increment for second pinning point */ graphics, /* no graphics if 0, even if compiled with GRAPHICS=1 */ ride_on, /* flag to switch on convection */ perturb_on, /* Flag to switch on perturbation */ NBC, /* Flag to switch between NBC's and DBC's */ cxdiff,cydiff,omdiff, /* variables used in testing */ XX,YY, /* grid coords of tip */ NX2,NY2, /* grid coords of centre of box */ field_size, /* array size for each field */ nsteps, /* # time steps to take */ istep, /* current time step */ write_tip, /* write tip flag */ write_quot, /* write quotient flag */ show_tip, /* Tip draw flag */ autostart, /* start run without waiting for any buttons */ verbose, /* verbosity level */ ntips; /* number of spiral tips */ /* NB: name of parameter eps is kept to comply with EZSpiral and Winfree'91 tradition */ #if FHN Real bet, gam; #else Real a_param, b_param; #endif /* ------------------------------------------------------------------------- * All index ranges throughout the code are expressed in terms of NX, and * NY. The code is generally more efficient if these are known numbers * at compile time, but then one must recompile for each change. If the * values are known (eg specified on the compile line) then do nothing * here, otherwise define NX etc to be the *variables* nx, etc. * ------------------------------------------------------------------------- */ #ifndef NX #define NX nx #endif #ifndef NY #define NY ny #endif /* ------------------------------------------------------------------------- * Memory for the chemical fields (u and v) and the spatial sums (sigma_u * and sigma_v) is allocated in Allocate_memory() in ezride.c. These are * allocated as long (single dimensional) arrays. Here macros are defined * so that one can easily reference a value corresponding to a particular * grid point, i.e. macros are defined to treat all arrays as * multi-dimensional. * * INDEX(i,j) converts grid point (i,j) to the array index. * * U(i,j) -- u field at grid point (i,j) * V(i,j) -- v field at grid point (i,j) * Sigma_u(s,i,j) -- Spatial-sum array for u: s=0 or 1 (see ezstep.c) * Sigma_v(s,i,j) -- Spatial-sum array for v: s=0 or 1 (see ezstep.c) * Fields (f,i,j) -- array of fields: f=0 for u or f=1 for v. * * ------------------------------------------------------------------------- */ #define J_INC (NX+2) #define I_INC 1 #define FIELD_SIZE ((NY+2)*(NX+2)) #define INDEX(i,j) ((i)*I_INC + (j)*J_INC) #define U(i,j) u[INDEX(i,j)] #define U1(i,j) u1[INDEX(i,j)] #define V(i,j) v[INDEX(i,j)] #define V1(i,j) v1[INDEX(i,j)] #define Sigma_u(s,i,j) sigma_u[(s)*FIELD_SIZE + INDEX(i,j)] #define Sigma_v(s,i,j) sigma_v[(s)*FIELD_SIZE + INDEX(i,j)] #define Fields(f,i,j) fields [(f)*FIELD_SIZE + INDEX(i,j)] /* Visualization limits */ #define UMAX umax #define UMIN umin #define VMAX vmax #define VMIN vmin /* ------------------------------------------- * Prototypes for public functions defined in: * ------------------------------------------- */ /* ezride.c * ---------- */ void Write_tip_data (float x, float y, float th); void Write_quot (float cx, float cy, float omega); void Make_images (void); void Make_image (int num, char *stem, Real *ufield, Real *vfield, Real umin, Real umax, Real vmin, Real vmax); /* ezstep3d.c * ---------- */ void Step (void); void Step1 (void); void Step_ini (void); void Impose_boundary_conditions(void); /* ezdrift.c * --------- */ void Perturb (void); #if GRAPHICS /* ezgraphGL.c * ----------- */ void Draw (void); void Draw_ini (int initial_field); int Event_check (void); void Center (void); void QuitX (void); #endif /* eztip.c * ------- */ void Find_tips (void); void Tip_ini (void); void tips (Real x_tip,Real y_tip); #endif /* _EZRIDE_ */