Message Boards Message Boards

boundary conditions in the CellularAutomaton function

Posted 9 years ago

the CellularAutomaton function is incredibly fast (i have compared the speed of the Game of Life program written using CellularAutomaton with the speed of 3 different GoL programs that i created (see my note set on WL Fundamentals in the Library Archves) and my fastest version ran 400 times slower than the CellularAutomaton GoL program. but in modelng natural phenomena with a CA, the boundary conditions are of fundamental importance. and i do not understand the b.c. being used in CellularAutomaton by default or how they might be changed when appropriate.

for example, for the two-dimensional forest fire CA ((

ForestFireRule[pGrowth_ /; 0 <= pGrowth <= 1, pBurn_ /; 0 <= pBurn <= 1] := Function[Switch[#[[2, 2]], 0, If[Random[] <= pGrowth, 1, 0], 1, Which[Count[#, 2, {2}] > 0, 2, Random[] <= pBurn, 2, True, 1], 2, 0]]

CellularAutomaton[{ForestFireRule[0.02, 0.001], {}, {1, 1}}, Table[If[Random[Integer, 5] == 0, 1, 0], {100}, {100}], 100];

my question is; what are the b.c. here?

when considering some systems, such as snowflake creation or forest fire spread, we do not want to use wrap-around b.c. (creating a toroid) because what happens on one side of system should not affect what happens on the opposing side.

in physical terms, latent heat effects on the right side of a growing snowflake cannot affect snowflake growth on the left side. and a spreading forest fire on upper side doesn't affect the spread of the fire on the lower side.

similarly, for a model of animals wandering around a territory 'marking' locations that have not already been 'marked' by other animals. wrap-around b.c, are inappropriate - in fact, there should no boundaries in the model; the space should be infinite (with great difficulty, i'll avoid going into a rant about the luring of Cecil out of his protected territory in Zimbabwe)

note: i say wrap-around rather than periodic becuase there is some confusion in my mind between what absorbing, reflecting, periodic, mixed and wrap-around b.c. represent or are appropriate - e.g. in my previous research field of theoretical polymer physics, the behavior of a polymer chain in the vicinity of a surface was modeled for many years using a reflecting b.c. (in order to represent the physical fact that that when a polymer chain moving around by making configurational changes, encounters an impenetrable surface it bounces off the surface) until it was pointed out that the use of a reflecting b.c. gives unequal probabilities to the the possible configurations of the polymer chain, in violation of the statistical mechanics requirement that every microstate in a microcanonical ensemble has to have an equal probability and therefore an absorbing b.c. should be used.

so to restate, in the Forest fire CA that uses CellularAutomaton, what b.c. are being used? and in general, how does one incorporate the various possible boundary conditions in CellularAutomaton?

POSTED BY: Richard Gaylord
2 Replies

More concretely, to add a boundary to the forest fire model one might just add cells which cannot burn and the boundary can be made of those types of cells. E.g., here adding state 3

BoundableForestFireRule[pGrowth_ /; 0 <= pGrowth <= 1, 
  pBurn_ /; 0 <= pBurn <= 1] := 
 Function[Switch[#[[2, 2]], 0, If[Random[] <= pGrowth, 1, 0], 1, 
   Which[Count[#, 2, {2}] > 0, 2, Random[] <= pBurn, 2, True, 1], 2, 
   0, 3, 3]]

   CellularAutomaton[{BoundableForestFireRule[0.02, 0.001], {}, {1, 
      1}}, Table[
     If[i == 1 || i == 100 || j == 1 || j == 100, 3, 
      If[i < 50 && Random[Integer, 5] == 0, 1, 0]], {i, 100}, {j, 
      100}], 11]], 4]]

enter image description here

In general one thinks of a boundary as doing something and then implement those states in the rule.

POSTED BY: Todd Rowland

With the CellularAutomaton function the syntax allows wrap around (aka periodic) boundary conditions and an infinite repetitive background. To have other boundary conditions, like outside forcing, then you need to implement it as part of the rule and (to be safe) add some new states to represent the boundary.

Vitaliy has some useful information in a post on the NKS forum

POSTED BY: Todd Rowland
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract