<!–Converted with LaTeX2HTML 2022 (Released January 1, 2022) –> <HTML lang="en"> <HEAD> <TITLE>Contents of Margolus Neighborhood</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0"> <META NAME="Generator" CONTENT="LaTeX2HTML v2022">
<LINK REL="STYLESHEET" HREF="tutorial.css">
<LINK REL="next" HREF="node7_mn.html"> <LINK REL="previous" HREF="node5_mn.html"> <LINK REL="up" HREF="node5_mn.html"> <LINK REL="next" HREF="node7_mn.html"> </HEAD>
<BODY bgcolor="#ffffff" text="#000000" link="#9944EE" vlink="#0000ff" alink="#00ff00">
<H2><A ID="SECTION00051000000000000000"> Margolus Neighborhood</A> </H2> Gas diffusion can be simulated by implementing a random walk for each particle/molecule of gas. The random walk can be implemented by using non–overlapping blocks of four cells (two on a side) which are offset at alternate times (Margolus neighborhood) and having each block of cells randomly rotate their gas particles either clockwise or counter–clockwise.
<P> To better understand the Margolus neighborhood, consider Figure <A HREF="node4_ct.html#Margolus_neighborhood"><IMG ALT="[*]" SRC="crossref.png"></A>. The four cell block with a solid outline, and the other with the dashed outline, would be used at alternate times. At any particular time, however, the universe of cells is completely covered by a non–overlapping set of blocks. To implement a Margolus neighborhood in <EM>Cellang 2.0</EM> requires use of the <TT>time</TT> variable and some way of distinguishing between different blocks of 4 cells. The latter is accomplished by introducing a field, <TT>which</TT>, that contains a value, 0 to 3, indicating the cells relative position in the block. A portion of the cell universe <TT>which</TT> values are shown in Figure <A HREF="node4_ct.html#which_Margolus"><IMG ALT="[*]" SRC="crossref.png"></A>.
<P> Now that the four cell block can be identified, a random number, common to each cell in the block, must be generated. This is done by having each cell maintain a two value (0 or 1) <TT>rand</TT> field. By using <TT>time</TT> and the value of <TT>which</TT> a random number, ``shared'' by each cell of the block, can be calculated. This random number is used to determine whether the particles of gas, denoted by the value of the <TT>gas</TT> fields, are rotated clockwise or counter–clockwise. To maintain an ever changing <TT>rand</TT> field for each cell, a new value is calculated using the Von Neumann neighborhood. The <EM>Cellang 2.0</EM> program that implements gas diffusion is shown in Figure <A HREF="node5_ct.html#gas_diffusion"><IMG ALT="[*]" SRC="crossref.png"></A>.
<P>
<DIV class="CENTER"><A ID="hexagons"></A><A ID="239"></A> <TABLE> <CAPTION class="BOTTOM"><STRONG>Figure:</STRONG> A portion of a ``squeezed'' hexagonal universe</CAPTION> <TR><TD><IMG STYLE="height: 261.66ex; " SRC="img9.png" ALT="
<P>
<DIV class="CENTER"><A ID="which_hexagon"></A><A ID="334"></A> <TABLE> <CAPTION class="BOTTOM"><STRONG>Figure:</STRONG> The pattern of <TT>which</TT> field values for the hexagonal neighborhood</CAPTION> <TR><TD><IMG STYLE="height: 261.66ex; " SRC="img10.png" ALT="
<P>
<HR>
</BODY> </HTML>