Class edu.cornell.lassp.mck10.Hysteresis.HysteresisLattice
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class edu.cornell.lassp.mck10.Hysteresis.HysteresisLattice

java.lang.Object
   |
   +----edu.cornell.lassp.mck10.Hysteresis.HysteresisLattice

public class HysteresisLattice
extends Object
implements XYProducer, AvalancheProducer, Observer, Runnable
The class HysteresisLattice models hysteresis in a magnetic system using a zero temperature random-field Ising model. For more information about the physics behind the model, see hysteresis. The model will run in any number of dimensions and with any width greater than zero.

The data from the model is accessed through a producer consumer interface. Any class which wishes to have access to the magnetization data must implement the XYConsumer interface, and any class which wishes to have access to the avalanche data must implement the AvalancheConsumer interface. In order to start receiving the data, they must call either the registerXYConsumer method or the registerAvalancheConsumer method. Some other data can be accessed through the methods provided by the Configurable and Observable classes. The variables running, cFieldGoal, cDisorder, cDimensions cWidth, cUpSeed, cDownSeed, and cLorenzian are all Configurables/Observables. See their documentation for their functions. Any of them (except running) can be changed at any time, with the appropriate result.

Source Code is available.

Version:
1.0
Author:
Matt Kuntz (e-mail: mck10@cornell.edu)

Variable Index

 o AvalancheConsumers
 o DOWN
DOWN is used to represent a spin that is pointing DOWN
 o UP
UP is used to represent a spin that is pointing UP
 o XYConsumers
 o avalancheNum
 o avalanches
 o cDimensions
cDimensions is a configurable integer containing the number of dimensions of the lattice.
 o cDisorder
cDisorder is a configurable double containing the disorder of the system.
 o cDownSeed
cDownSeed is a configurable boolean which is true if there is a row of seed spins initially flipped down.
 o cFieldGoal
cFieldGoal is a configurable double containing the target value for the external field.
 o cLorenzian
cLorenzian is a configurable boolean which is true if the random fields obey a Lorenzian distribution, and false if they obey a Gaussian distribution.
 o cUpSeed
cUpSeed is a configurable boolean which is true if there is a row of seed spins initially flipped up.
 o cWidth
cWidth is a configurable integer containing the width of the simulation.
 o ccMenu
 o dimensions
 o direction
 o externalField
 o magnetization
 o maxAvalancheChunk
 o maxField
 o maxUnflipped
 o minField
 o minUnflipped
 o modelThread
 o nextToFlip
 o nf
 o numSpins
 o oldDisorder
 o queue
 o running
running is a ConfigurableBoolean which contains the value true if the model is running, and false otherwise.
 o settingSize
 o sizes
 o sortedSpins
 o spinDirs
 o spinFields
 o spinNFields
 o steps

Constructor Index

 o HysteresisLattice(short, short[], double, ConfigurableCollection)
The constructor for HysteresisLattice creates a new lattice with a given size and disorder, generates the random fields, sorts them, sets all spins down, and sets the initial external field to the field at which the first spin is about to flip up.

Method Index

 o checkSeedsDown()
checkSeedsDown() is used to check the status of the DOWN seed spins.
 o checkSeedsUp()
checkSeedsUp() is used to check the status of the UP seed spins.
 o downSeedsOff()
downSeedsOff() is used to turn off the row of seed spins that are always flipped down.
 o downSeedsOn()
downSeedsOn() is used to turn on a row of seed spins that are always flipped down.
 o findNextSpin()
 o flipNextSpin()
 o generateRandomFields()
 o getField()
getField() returns the current value of the external field.
 o getLimits(XYPair, XYPair)
The getLimits(lower,upper) method is used to find out the range of values possible for the external field (X) and the magnetization (Y).
 o getSize()
getSize() returns the current size of the simulation in an array of integers.
 o incrementField(byte)
The incrementField(byte dir) is used to start a single avalanche in the direction direction.
 o newAvalanche(double, byte)
 o randomPartition(int, int)
 o registerAvalancheConsumer(AvalancheConsumer)
The registerAvalancheConsumer(consumer) method is used to keep track of what classes want to be sent the avalanche data.
 o registerXYConsumer(XYConsumer)
The registerXYConsumer(consumer) method is used to keep track of what classes want to be sent the external field and magnetization data.
 o removeAvalancheConsumer(AvalancheConsumer)
The removeAvalancheConsumer(consumer) method is used to stop sending avalanche data to a consumer.
 o removeXYConsumer(XYConsumer)
The removeXYConsumer(consumer) method is used to stop sending field and magnetization data to a consumer.
 o run()
The run method is called when a new thread is started, and will keep starting avalanches until the goal field is reached.
 o setDirection(byte)
 o setGoal(double)
The setGoal(goal) method is used to set the model running until it passes a certain goal field.
 o setSize(short, short)
The setSize(dimensions,width) method can be used to the dimensions of the system.
 o sortSpins(int, int)
 o stop()
The stop() method will stop the simulation as soon as the current avalanche is complete.
 o upSeedsOff()
upSeedsOff() is used to turn off the row of seed spins that are always flipped up.
 o upSeedsOn()
upSeedsOn() is used to add a row of seed spins that are always flipped up.
 o update(Observable, Object)
The update(obs,obj) method is called whenever one of the configurable variables is changed.
 o waitForStop()
The waitForStop() method will wait for the simulation to stop, and then it will return.

Variables

 o UP
  public final static byte UP
UP is used to represent a spin that is pointing UP
 o DOWN
  public final static byte DOWN
DOWN is used to represent a spin that is pointing DOWN
 o running
  public ConfigurableBoolean running
running is a ConfigurableBoolean which contains the value true if the model is running, and false otherwise. It is not attatched to the menu system.
 o XYConsumers
  protected Vector XYConsumers
 o AvalancheConsumers
  protected Vector AvalancheConsumers
 o dimensions
  protected short dimensions
 o sizes
  protected short sizes[]
 o steps
  protected int steps[]
 o numSpins
  protected int numSpins
 o spinDirs
  protected byte spinDirs[]
 o spinFields
  protected double spinFields[]
 o spinNFields
  protected byte spinNFields[]
 o sortedSpins
  protected int sortedSpins[]
 o nextToFlip
  protected int nextToFlip[]
 o ccMenu
  protected ConfigurableCollection ccMenu
 o cFieldGoal
  public ConfigurableDouble cFieldGoal
cFieldGoal is a configurable double containing the target value for the external field.
 o cDisorder
  public ConfigurableDouble cDisorder
cDisorder is a configurable double containing the disorder of the system.
 o cDimensions
  public ConfigurableInteger cDimensions
cDimensions is a configurable integer containing the number of dimensions of the lattice.
 o cWidth
  public ConfigurableInteger cWidth
cWidth is a configurable integer containing the width of the simulation.
 o cUpSeed
  public ConfigurableBoolean cUpSeed
cUpSeed is a configurable boolean which is true if there is a row of seed spins initially flipped up.
 o cDownSeed
  public ConfigurableBoolean cDownSeed
cDownSeed is a configurable boolean which is true if there is a row of seed spins initially flipped down.
 o cLorenzian
  public ConfigurableBoolean cLorenzian
cLorenzian is a configurable boolean which is true if the random fields obey a Lorenzian distribution, and false if they obey a Gaussian distribution.
 o oldDisorder
  protected double oldDisorder
 o maxAvalancheChunk
  protected final int maxAvalancheChunk
 o magnetization
  protected double magnetization
 o externalField
  protected double externalField
 o maxField
  protected double maxField
 o minField
  protected double minField
 o direction
  protected byte direction
 o modelThread
  protected Thread modelThread
 o minUnflipped
  protected int minUnflipped
 o maxUnflipped
  protected int maxUnflipped
 o nf
  protected double nf[]
 o queue
  protected SpinFlipQueue queue
 o avalanches
  protected Avalanche avalanches[]
 o avalancheNum
  protected int avalancheNum
 o settingSize
  protected boolean settingSize

Constructors

 o HysteresisLattice
  public HysteresisLattice(short dimensions,
                           short sizes[],
                           double disorder,
                           ConfigurableCollection parentMenu)
The constructor for HysteresisLattice creates a new lattice with a given size and disorder, generates the random fields, sorts them, sets all spins down, and sets the initial external field to the field at which the first spin is about to flip up.
Parameters:
dimensions - The number of dimensions.
sizes - An array containing the width, height, etc.
disorder - The higher the disorder, the wider the range of random fields
parentMenu - The configuration menu in which the model will appear.

Methods

 o registerAvalancheConsumer
  public void registerAvalancheConsumer(AvalancheConsumer consumer)
The registerAvalancheConsumer(consumer) method is used to keep track of what classes want to be sent the avalanche data.
Parameters:
consumer - The consumer which wants to be registered.
 o registerXYConsumer
  public void registerXYConsumer(XYConsumer consumer)
The registerXYConsumer(consumer) method is used to keep track of what classes want to be sent the external field and magnetization data.
Parameters:
consumer - The consumer which wants to be registered.
 o removeAvalancheConsumer
  public void removeAvalancheConsumer(AvalancheConsumer consumer)
The removeAvalancheConsumer(consumer) method is used to stop sending avalanche data to a consumer.
Parameters:
consumer - The consumer which no longer wants to be sent avalanches.
 o removeXYConsumer
  public void removeXYConsumer(XYConsumer consumer)
The removeXYConsumer(consumer) method is used to stop sending field and magnetization data to a consumer.
Parameters:
consumer - The consumer which no longer wants to be sent XY data.
 o generateRandomFields
  protected void generateRandomFields()
 o sortSpins
  protected void sortSpins(int first,
                           int last)
 o randomPartition
  protected int randomPartition(int first,
                                int last)
 o setGoal
  public void setGoal(double goal)
The setGoal(goal) method is used to set the model running until it passes a certain goal field.
Parameters:
goal - The field to move to.
 o incrementField
  public void incrementField(byte direction)
The incrementField(byte dir) is used to start a single avalanche in the direction direction.
Parameters:
direction - The direction in which spins should flip in the avalanche.
 o run
  public void run()
The run method is called when a new thread is started, and will keep starting avalanches until the goal field is reached.
 o stop
  public synchronized void stop()
The stop() method will stop the simulation as soon as the current avalanche is complete.
 o waitForStop
  public void waitForStop()
The waitForStop() method will wait for the simulation to stop, and then it will return.
 o setSize
  public void setSize(short dimensions,
                      short width)
The setSize(dimensions,width) method can be used to the dimensions of the system. These can also be set through the configuration system.
 o update
  public void update(Observable obs,
                     Object obj)
The update(obs,obj) method is called whenever one of the configurable variables is changed. If cFieldGoal has changed, it starts the model running towards the new goal. If cDisorder has changed, it stops the model, and generates and sorts new random fields with the new disorder. The spins are all flipped into the down position. If cDimensions or cWidth is changed, a new model is generated at the new size. If cUpSeed or cDownSeed is changed, the a new model is generated with the appropriate seed spins. If cLorenzian is changed, a new model is generated with the appropriate random field distribution.
Parameters:
obs - The observable variable which has changed.
obj - An object passed by the observable variable.
 o findNextSpin
  protected int findNextSpin()
 o setDirection
  protected void setDirection(byte dir)
 o newAvalanche
  protected Avalanche newAvalanche(double externalField,
                                   byte direction)
 o flipNextSpin
  protected boolean flipNextSpin()
 o upSeedsOn
  public void upSeedsOn()
upSeedsOn() is used to add a row of seed spins that are always flipped up.
 o upSeedsOff
  public void upSeedsOff()
upSeedsOff() is used to turn off the row of seed spins that are always flipped up.
 o downSeedsOn
  public void downSeedsOn()
downSeedsOn() is used to turn on a row of seed spins that are always flipped down.
 o downSeedsOff
  public void downSeedsOff()
downSeedsOff() is used to turn off the row of seed spins that are always flipped down.
 o checkSeedsUp
  public boolean checkSeedsUp()
checkSeedsUp() is used to check the status of the UP seed spins.
Returns:
TRUE if there is a row of spins always up.
 o checkSeedsDown
  public boolean checkSeedsDown()
checkSeedsDown() is used to check the status of the DOWN seed spins.
Returns:
TRUE if there is a row of spins always down.
 o getLimits
  public void getLimits(XYPair lower,
                        XYPair upper)
The getLimits(lower,upper) method is used to find out the range of values possible for the external field (X) and the magnetization (Y). These values are returned in the parameters lower and upper.
Parameters:
lower - The lower limits are returned in this variable.
upper - The upper limits are returned in this variable.
 o getField
  public double getField()
getField() returns the current value of the external field.
Returns:
The current value of the external field.
 o getSize
  public int[] getSize()
getSize() returns the current size of the simulation in an array of integers.
Returns:
An array of integers containing the current dimensions of the simulation.

All Packages  Class Hierarchy  This Package  Previous  Next  Index