Skip to main content Accessibility help
×
Hostname: page-component-78c5997874-mlc7c Total loading time: 0 Render date: 2024-11-07T23:20:56.813Z Has data issue: false hasContentIssue false

B - Code for the Lattice Gas

Published online by Cambridge University Press:  05 November 2012

Henrik Jeldtoft Jensen
Affiliation:
Imperial College of Science, Technology and Medicine, London
Get access

Summary

We discuss here some details of writing a computer code for the dynamics of the lattice gas defined in Section 4.4. The code is not optimized; it is included as a guide and for inspiration only.

The configuration of the particles on the (two-dimensional) lattice is stored in the array n(l: L, 1: L). The elements of this array take the value n(i, j) =1 if the site (i, j) is occupied by a particle; otherwise, n(i, j) =0. The update, as defined in Section 4.4.1, can be coded as sketched below. A complete code of the lattice gas will include an initiation of the array n(i, j), and special attention must be paid to the boundary. Since the lattice is updated simultaneously, we need the array nnew (1: L, 1: L) to store intermediate changes in the particle configuration. We update the lattice by visiting all the empty sites of the lattice. An empty site (i, j) becomes an occupied site if a particle on one of the eight neighbor sites is able to move onto site (i, j). We therefore visit all eight neighbor sites to calculate the forces acting on particles in these sites. We then check if one of these particles has a force pointing toward site (i, j) and is of a magnitude greater than any other force pointing toward site (i, j).

Type
Chapter
Information
Self-Organized Criticality
Emergent Complex Behavior in Physical and Biological Systems
, pp. 134 - 137
Publisher: Cambridge University Press
Print publication year: 1998

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure [email protected] is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Code for the Lattice Gas
  • Henrik Jeldtoft Jensen, Imperial College of Science, Technology and Medicine, London
  • Book: Self-Organized Criticality
  • Online publication: 05 November 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9780511622717.009
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Code for the Lattice Gas
  • Henrik Jeldtoft Jensen, Imperial College of Science, Technology and Medicine, London
  • Book: Self-Organized Criticality
  • Online publication: 05 November 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9780511622717.009
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Code for the Lattice Gas
  • Henrik Jeldtoft Jensen, Imperial College of Science, Technology and Medicine, London
  • Book: Self-Organized Criticality
  • Online publication: 05 November 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9780511622717.009
Available formats
×