15.08.2015 Views

Introduction to the Modeling and Analysis of Complex Systems

introduction-to-the-modeling-and-analysis-of-complex-systems-sayama-pdf

introduction-to-the-modeling-and-analysis-of-complex-systems-sayama-pdf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

13.5. SIMULATION OF CONTINUOUS FIELD MODELS 251The numera<strong>to</strong>r <strong>of</strong> <strong>the</strong> formula above has an intuitive interpretation: “Just add <strong>the</strong> values<strong>of</strong> f in all <strong>of</strong> your nearest neighbors (e.g., <strong>to</strong>p, bot<strong>to</strong>m, left, <strong>and</strong> right for a 2-D space) <strong>and</strong><strong>the</strong>n subtract your own value f(x, t) as many times as <strong>the</strong> number <strong>of</strong> those neighbors.”Or, equivalently: “Measure <strong>the</strong> difference between your neighbor <strong>and</strong> yourself, <strong>and</strong> <strong>the</strong>nsum up all those differences.” It is interesting <strong>to</strong> see that a higher-order opera<strong>to</strong>r likeLaplacians can be approximated by such a simple set <strong>of</strong> arithmetic operations once <strong>the</strong>space is discretized.You can also derive higher-order spatial derivatives in a similar manner, but I don’t thinkwe need <strong>to</strong> cover those cases here. Anyway, now we have a basic set <strong>of</strong> ma<strong>the</strong>matical<strong>to</strong>ols (Eqs. (13.31), (13.33), (13.34), (13.35)) <strong>to</strong> discretize PDE-based models so we cansimulate <strong>the</strong>ir behavior as CA models.Let’s work on an example. Consider discretizing a simple transport equation withoutsource or sink in a 2-D space, where <strong>the</strong> velocity <strong>of</strong> particles is given by a constant vec<strong>to</strong>r:∂c= −∇ · (cw) (13.36)∂t( )wxw =(13.37)w yWe can discretize this equation in both time <strong>and</strong> space, as follows:c(x, y, t + ∆t) ≈ c(x, y, t) − ∇ · (c(x, y, t)w) ∆t (13.38)⎛ ⎞∂ ( ( ))⎜= c(x, y, t) − ⎝∂x ⎟wx∂ ⎠Tc(x, y, t) ∆t (13.39)w y∂y()∂c= c(x, y, t) − w x∂x + w ∂cy ∆t (13.40)∂y(c(x + ∆h, y, t) − c(x − ∆h, y, t)≈ c(x, y, t) − w x2∆h)c(x, y + ∆h, t) − c(x, y − ∆h, t)+w y ∆t (13.41)2∆h= c(x, y, t) − ( w x c(x + ∆h, y, t) − w x c(x − ∆h, y, t)+ w y c(x, y + ∆h, t) − w y c(x, y − ∆h, t) ) ∆t2∆h(13.42)This is now fully discretized for both time <strong>and</strong> space, <strong>and</strong> thus it can be used as astate-transition function <strong>of</strong> CA. We can implement this CA model in Python, using Code11.5 as a template. Here is an example <strong>of</strong> implementation:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!