All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----edu.cornell.lassp.mck10.Hysteresis.HysteresisLattice
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.
cDimensions is a configurable integer containing the
number of dimensions of the lattice.
cDisorder is a configurable double containing the
disorder of the system.
cDownSeed is a configurable boolean which is true if there
is a row of seed spins initially flipped down.
cFieldGoal is a configurable double containing the target
value for the external field.
cLorenzian is a configurable boolean which is true if
the random fields obey a Lorenzian distribution, and false if they
obey a Gaussian distribution.
cUpSeed is a configurable boolean which is true if there
is a row of seed spins initially flipped up.
cWidth is a configurable integer containing the width
of the simulation.
running is a ConfigurableBoolean which
contains the value true if the model is running,
and false otherwise.
checkSeedsDown() is used to check the status of the DOWN
seed spins.
checkSeedsUp() is used to check the status of the UP
seed spins.
downSeedsOff() is used to turn off the row of seed spins
that are always flipped down.
downSeedsOn() is used to turn on a row of seed spins
that are always flipped down.
getField() returns the current value of the external
field.
getLimits(lower,upper) method is used to find
out the range of values possible for the external field (X)
and the magnetization (Y).
getSize() returns the current size of the simulation
in an array of integers.
incrementField(byte dir) is used to start
a single avalanche in the direction direction.
registerAvalancheConsumer(consumer)
method is used to keep track of what
classes want to be sent the avalanche data.
registerXYConsumer(consumer) method is
used to keep track of what classes
want to be sent the external field and magnetization data.
removeAvalancheConsumer(consumer) method is used
to stop sending avalanche data to a consumer.
removeXYConsumer(consumer) method is used
to stop sending field and magnetization data to a consumer.
setGoal(goal) method is used to set the model
running until it passes a certain goal field.
setSize(dimensions,width) method can be used to
the dimensions of the system.
stop() method will stop the simulation
as soon as the current avalanche is complete.
upSeedsOff() is used to turn off the row of seed spins
that are always flipped up.
upSeedsOn() is used to add a row of seed spins that are
always flipped up.
update(obs,obj) method is called whenever
one of the configurable variables is changed.
public final static byte UP
public final static byte DOWN
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.
protected Vector XYConsumers
protected Vector AvalancheConsumers
protected short dimensions
protected short sizes[]
protected int steps[]
protected int numSpins
protected byte spinDirs[]
protected double spinFields[]
protected byte spinNFields[]
protected int sortedSpins[]
protected int nextToFlip[]
protected ConfigurableCollection ccMenu
public ConfigurableDouble cFieldGoal
cFieldGoal is a configurable double containing the target
value for the external field.
public ConfigurableDouble cDisorder
cDisorder is a configurable double containing the
disorder of the system.
public ConfigurableInteger cDimensions
cDimensions is a configurable integer containing the
number of dimensions of the lattice.
public ConfigurableInteger cWidth
cWidth is a configurable integer containing the width
of the simulation.
public ConfigurableBoolean cUpSeed
cUpSeed is a configurable boolean which is true if there
is a row of seed spins initially flipped up.
public ConfigurableBoolean cDownSeed
cDownSeed is a configurable boolean which is true if there
is a row of seed spins initially flipped down.
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.
protected double oldDisorder
protected final int maxAvalancheChunk
protected double magnetization
protected double externalField
protected double maxField
protected double minField
protected byte direction
protected Thread modelThread
protected int minUnflipped
protected int maxUnflipped
protected double nf[]
protected SpinFlipQueue queue
protected Avalanche avalanches[]
protected int avalancheNum
protected boolean settingSize
public HysteresisLattice(short dimensions,
short sizes[],
double disorder,
ConfigurableCollection parentMenu)
public void registerAvalancheConsumer(AvalancheConsumer consumer)
registerAvalancheConsumer(consumer)
method is used to keep track of what
classes want to be sent the avalanche data.
public void registerXYConsumer(XYConsumer consumer)
registerXYConsumer(consumer) method is
used to keep track of what classes
want to be sent the external field and magnetization data.
public void removeAvalancheConsumer(AvalancheConsumer consumer)
removeAvalancheConsumer(consumer) method is used
to stop sending avalanche data to a consumer.
public void removeXYConsumer(XYConsumer consumer)
removeXYConsumer(consumer) method is used
to stop sending field and magnetization data to a consumer.
protected void generateRandomFields()
protected void sortSpins(int first,
int last)
protected int randomPartition(int first,
int last)
public void setGoal(double goal)
setGoal(goal) method is used to set the model
running until it passes a certain goal field.
public void incrementField(byte direction)
incrementField(byte dir) is used to start
a single avalanche in the direction direction.
public void run()
public synchronized void stop()
stop() method will stop the simulation
as soon as the current avalanche is complete.
public void waitForStop()
public void setSize(short dimensions,
short width)
setSize(dimensions,width) method can be used to
the dimensions of the system. These can also be set through the
configuration system.
public void update(Observable obs,
Object obj)
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.
protected int findNextSpin()
protected void setDirection(byte dir)
protected Avalanche newAvalanche(double externalField,
byte direction)
protected boolean flipNextSpin()
public void upSeedsOn()
upSeedsOn() is used to add a row of seed spins that are
always flipped up.
public void upSeedsOff()
upSeedsOff() is used to turn off the row of seed spins
that are always flipped up.
public void downSeedsOn()
downSeedsOn() is used to turn on a row of seed spins
that are always flipped down.
public void downSeedsOff()
downSeedsOff() is used to turn off the row of seed spins
that are always flipped down.
public boolean checkSeedsUp()
checkSeedsUp() is used to check the status of the UP
seed spins.
public boolean checkSeedsDown()
checkSeedsDown() is used to check the status of the DOWN
seed spins.
public void getLimits(XYPair lower,
XYPair upper)
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.
public double getField()
getField() returns the current value of the external
field.
public int[] getSize()
getSize() returns the current size of the simulation
in an array of integers.
All Packages Class Hierarchy This Package Previous Next Index