diffusion_arguments
Andy Ferris
Simple one-dimensional diffusion with a pointless second dimension thrown in for fun. Uses arguments and argument preprocessing. Essentially the simulation "looks" the same for any given "size", as the interval/etc is scaled to fit the interesting region. The user may use width_scale, time_scale and ratio to zoom out and in...
real minx; real maxx; real miny; real maxy; real width; real time_interval;
minx = -0.5*size; maxx = 0.5*size; miny = -0.5*size*ratio; maxy = 0.5*size*ratio; width = 0.5*sqrt(0.5)*size*ratio*width_factor; // half the simulation size // The time intersting stuff happens scales as width^2 time_interval = 20.0 * width*width * time_factor;
t
phi
phi = exp(-y*y/(2*width*width));
24
L
L = -0.02*ky*ky;
main
dphi_dt = L[phi];
dens
main
dens = mod2(phi);