molecular
Class MolecularFlow

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--edu.davidson.tools.SApplet
                                |
                                +--molecular.MolecularFlow
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class MolecularFlow
extends SApplet

See Also:
Serialized Form

Fields inherited from class edu.davidson.tools.SApplet
clock, dataConnections, dataListeners, dataSources, lock
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
MolecularFlow()
           
 
Method Summary
 void addCaption(java.lang.String cap)
          Adds a title to ensemble in top-center
 int addParticleDataSourceL(int i)
          Make a particle in the left ensemble into a data source.
 int addParticleDataSourceM(int i)
          Make a particle in the right ensemble into a data source.
 int addParticleDataSourceR(int i)
          Make a particle in the right ensemble into a data source.
 int addParticleL(double xin, double yin, double xvel, double yvel, double r)
          Adds one particle to the left ensemble
 int addParticleM(double xin, double yin, double xvel, double yvel, double r)
          Adds one particle to the middle ensemble
 int addParticleR(double xin, double yin, double xvel, double yvel, double r)
          Adds one particle to the right ensemble
 void createParticlesL(int n)
           
 void createParticlesM(int n)
           
 void createParticlesR(int n)
           
 void forward()
          Start the animation
 java.lang.String getAppletInfo()
           
 double getBWPos()
          Returns the bottom wall position
 int getEnsembleLeftID()
          Returns the id of the left ensemble.
 int getEnsembleMiddleID()
          Returns the id of the middle ensemble.
 int getEnsembleRightID()
          Returns the id of theright ensemble.
 int getHistogramLeftID(int nbins, double vmin, double vmax)
          Returns the id of the velocity histogram of the left ensemble.
 int getHistogramMiddleID(int nbins, double vmin, double vmax)
          Returns the id of the velocity histogram of the middle ensemble.
 int getHistogramRightID(int nbins, double vmin, double vmax)
          Returns the id of the velocity histogram of the right ensemble.
 double getLWPos()
          Returns the left wall position
 java.lang.String getParameter(java.lang.String key, java.lang.String def)
           
 java.lang.String[][] getParameterInfo()
           
 double getRWPos()
          Returns the right wall position
 double getTWPos()
          Returns the top wall position
 void init()
           
 void pause()
          Stop the animation
 void removeParticle(int i)
          Removes ith particle from ensemble
 void removeWallTempL(java.lang.String wall)
           
 void removeWallTempR(java.lang.String wall)
           
 void setAutoRefresh(boolean ar)
          Repaint whenevers the system parameters are changed.
 void setBackgroundRGBL(int r, int g, int b)
          Sets Background color inside left ensemble
 void setBackgroundRGBM(int r, int g, int b)
          Sets Background color inside middle ensemble
 void setBackgroundRGBR(int r, int g, int b)
          Sets Background color inside right ensemble
 void setBoltzmann(double kb)
           
 void setDefault()
          Reset the clock to time=0.
 void setDefaultColorL(int r, int g, int b)
          Sets default color when adding new particles to LEFT Ensemble.
 void setDefaultColorR(int r, int g, int b)
          Sets default color when adding new particles to RIGHT Ensemble.
 void setDefaultMass(double m)
          Sets default mass when adding new particles.
 void setDefaultSize(double r)
          Sets default size when adding new particles.
 void setDefaultTemp(double t)
           
 void setDisplayOffset(int xoff, int yoff)
          Sets offsets for title
 void setDt(double dt)
          Sets calculation time step
 void setEnableFlow(boolean tf)
           
 void setFPS(int f)
          Sets frames per second of animation
 void setInflowLeft(double rate)
          Method sets rate at which particles flow into left ensemble
 void setInflowRight(double rate)
          Method sets rate at which particles flow into right ensemble
 void setLeftWidth(int w, boolean tf)
          Method sets length of diffusion tube in pixels Default is 100
 void setMaxParticles(int p)
          Sets maximum number of particles that can be stored in arrays of each ensemble
 void setMessage(java.lang.String msg)
          Adds a message to small yellow box opposite coordinate display.
 void setOFProbLeft(double prob)
          Method sets probability of particle flow out of left ensemble
 void setOFProbRight(double prob)
          Method sets probability of particle flow out of right ensemble
 void setOutflowLeft(double rate)
          Method sets rate at which particles flow out of left ensemble
 void setOutflowRight(double rate)
          Method sets rate at which particles flow out of right ensemble
 void setParticleMassL(int i, double m)
          Sets mass of a particle in the left ensemble Default mass is 1.
 void setParticleMassM(int i, double m)
          Sets mass of a particle in the middle ensemble Default mass is 1.
 void setParticleMassR(int i, double m)
          Sets mass of a particle in the right ensemble Default mass is 1.
 void setParticlePosL(int i, double xin, double yin)
          Sets Position of a particle in the left ensemble
 void setParticlePosR(int i, double xin, double yin)
          Sets Position of a particle in the right ensemble
 void setParticleRGBL(int i, int rd, int gr, int bl)
          Sets color of particles in Right ensemble
 void setParticleRGBR(int i, int rd, int gr, int bl)
          Sets color of particles in left ensemble
 void setParticleSizeL(int i, double s)
          Sets size of a particle in the left ensemble.
 void setParticleSizeR(int i, double s)
          Sets size of a particle in the left ensemble.
 void setParticlesL(int n)
           
 void setParticlesM(int n)
           
 void setParticlesR(int n)
           
 void setParticleVelL(int i, double xvel, double yvel)
          Sets Velocity of a particle in the left ensemble.
 void setParticleVelR(int i, double xvel, double yvel)
          Sets Velocity of a particle in the right ensemble.
 void setPartInteractions(boolean tf)
          Turns particle-to-particle interations on and off
 void setPeriodicV(boolean p)
          Sets Periodic periodic boundary conditions ion vertical direction
 void setPpu(int p)
          Sets pixels per unit of ensemble
 void setRGB(int r, int g, int b)
          Sets color of title
 void setShowControls(boolean s)
          Shows or hides control panel
 void setTemperatureL(double temp, int steps)
          Set the temperature of the ensemble in n steps.
 void setTemperatureR(double temp, int steps)
          Set the temperature of the right ensemble in n steps.
 void setTempL(double temp)
          Set the temperature of the ensemble in one step.
 void setTempR(double temp)
          Set the temperature of the ensemble in one step.
 void setTubeLength(int l)
          Method sets length of diffusion tube in pixles Default is 70
 void setTubeWidth(int w)
          Method sets width of diffusion tube in units Default is 20
 void setWallTempL(java.lang.String wall, double t)
          Sets wall temperature for walls in left ensemble
 void setWallTempR(java.lang.String wall, double t)
          Sets wall temperature for walls in right ensemble
 void start()
           
 void stepForward()
          Steps simulation forward one time step
 
Methods inherited from class edu.davidson.tools.SApplet
addDataListener, addDataSource, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, destroy, getClockID, getDataConnectionFromDL, getDataConnectionFromDS, getDataFromDS, getDataListener, getDataListener, getDataSource, getDataSource, getID, getRunningID, getSourceData, getSourceVariables, isAutoRefresh, isClockRunning, makeDataConnection, removeDataListener, removeDataSource, reset, reverse, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setFPS, setRunningID, setRunningID, setTimeContinuous, setTimeCycle, setTimeOneShot, startClock, stepClock, stepTime, stepTimeBack, stepTimeForward, stopClock, updateDataConnection, updateDataConnections, useMasterClock
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MolecularFlow

public MolecularFlow()
Method Detail

getParameter

public java.lang.String getParameter(java.lang.String key,
                                     java.lang.String def)

init

public void init()
Overrides:
init in class java.applet.Applet

getAppletInfo

public java.lang.String getAppletInfo()
Overrides:
getAppletInfo in class java.applet.Applet

getParameterInfo

public java.lang.String[][] getParameterInfo()
Overrides:
getParameterInfo in class java.applet.Applet

start

public void start()
Overrides:
start in class java.applet.Applet

setTempL

public void setTempL(double temp)
Set the temperature of the ensemble in one step.
Parameters:
temp - double The new temperature.

setTemperatureL

public void setTemperatureL(double temp,
                            int steps)
Set the temperature of the ensemble in n steps. Data will be sent to data listeners after each step.
Parameters:
temp - double The new temperature.
steps - int The number of steps.

setTempR

public void setTempR(double temp)
Set the temperature of the ensemble in one step.
Parameters:
temp - double The new temperature.

setTemperatureR

public void setTemperatureR(double temp,
                            int steps)
Set the temperature of the right ensemble in n steps. Data will be sent to data listeners after each step.
Parameters:
temp - double The new temperature.
steps - int The number of steps.

setShowControls

public void setShowControls(boolean s)
Shows or hides control panel
Parameters:
s - boolean

setMessage

public void setMessage(java.lang.String msg)
Adds a message to small yellow box opposite coordinate display.
Parameters:
msg - String

setDisplayOffset

public void setDisplayOffset(int xoff,
                             int yoff)
Sets offsets for title
Parameters:
int - xoff
int - yoff

setRGB

public void setRGB(int r,
                   int g,
                   int b)
Sets color of title
Parameters:
r - int red
g - int green
b - int blue

addCaption

public void addCaption(java.lang.String cap)
Adds a title to ensemble in top-center
Parameters:
cap - String

setDefault

public void setDefault()
Description copied from class: SApplet
Reset the clock to time=0.
Overrides:
setDefault in class SApplet

setPartInteractions

public void setPartInteractions(boolean tf)
Turns particle-to-particle interations on and off
Parameters:
tf - boolean

setTubeWidth

public void setTubeWidth(int w)
Method sets width of diffusion tube in units Default is 20
Parameters:
w - double

setTubeLength

public void setTubeLength(int l)
Method sets length of diffusion tube in pixles Default is 70
Parameters:
l - double

setLeftWidth

public void setLeftWidth(int w,
                         boolean tf)
Method sets length of diffusion tube in pixels Default is 100
Parameters:
l - double
tf - boolean if true, then feature is activated if false, then ensembles will be symmetric

setEnableFlow

public void setEnableFlow(boolean tf)

setInflowLeft

public void setInflowLeft(double rate)
Method sets rate at which particles flow into left ensemble
Parameters:
rate - double

setInflowRight

public void setInflowRight(double rate)
Method sets rate at which particles flow into right ensemble
Parameters:
rate - double

setOutflowRight

public void setOutflowRight(double rate)
Method sets rate at which particles flow out of right ensemble
Parameters:
rate - double

setOutflowLeft

public void setOutflowLeft(double rate)
Method sets rate at which particles flow out of left ensemble
Parameters:
rate - double

setOFProbLeft

public void setOFProbLeft(double prob)
Method sets probability of particle flow out of left ensemble
Parameters:
prob - double

setOFProbRight

public void setOFProbRight(double prob)
Method sets probability of particle flow out of right ensemble
Parameters:
prob - double

pause

public void pause()
Stop the animation
Overrides:
pause in class SApplet

forward

public void forward()
Start the animation
Overrides:
forward in class SApplet

stepForward

public void stepForward()
Steps simulation forward one time step

addParticleL

public int addParticleL(double xin,
                        double yin,
                        double xvel,
                        double yvel,
                        double r)
Adds one particle to the left ensemble
Parameters:
xin - double initial xposition
yin - double initial yposition
xvel - double initial x-velocity
yvel - double initial y-velocity
r - double particle radius

addParticleR

public int addParticleR(double xin,
                        double yin,
                        double xvel,
                        double yvel,
                        double r)
Adds one particle to the right ensemble
Parameters:
xin - double initial xposition
yin - double initial yposition
xvel - double initial x-velocity
yvel - double initial y-velocity
r - double particle radius

addParticleM

public int addParticleM(double xin,
                        double yin,
                        double xvel,
                        double yvel,
                        double r)
Adds one particle to the middle ensemble
Parameters:
xin - double initial xposition
yin - double initial yposition
xvel - double initial x-velocity
yvel - double initial y-velocity
r - double particle radius

createParticlesL

public void createParticlesL(int n)

createParticlesR

public void createParticlesR(int n)

createParticlesM

public void createParticlesM(int n)

removeParticle

public void removeParticle(int i)
Removes ith particle from ensemble
Parameters:
i - int particle number

setParticlesL

public void setParticlesL(int n)

setParticlesR

public void setParticlesR(int n)

setParticlesM

public void setParticlesM(int n)

setMaxParticles

public void setMaxParticles(int p)
Sets maximum number of particles that can be stored in arrays of each ensemble
Parameters:
p - max particles

setBackgroundRGBL

public void setBackgroundRGBL(int r,
                              int g,
                              int b)
Sets Background color inside left ensemble
Parameters:
r - int red
g - int green
b - int blue

setBackgroundRGBM

public void setBackgroundRGBM(int r,
                              int g,
                              int b)
Sets Background color inside middle ensemble
Parameters:
r - int red
g - int green
b - int blue

setBackgroundRGBR

public void setBackgroundRGBR(int r,
                              int g,
                              int b)
Sets Background color inside right ensemble
Parameters:
r - int red
g - int green
b - int blue

setDefaultMass

public void setDefaultMass(double m)
Sets default mass when adding new particles. All particles created after calling this method will have this mass
Parameters:
m - double mass

setDefaultSize

public void setDefaultSize(double r)
Sets default size when adding new particles. All particles created after calling this method will have this radius
Parameters:
r - double radius

setDefaultColorL

public void setDefaultColorL(int r,
                             int g,
                             int b)
Sets default color when adding new particles to LEFT Ensemble. All particles created after calling this method will have this color
Parameters:
r - int red
g - int green
b - int blue

setDefaultColorR

public void setDefaultColorR(int r,
                             int g,
                             int b)
Sets default color when adding new particles to RIGHT Ensemble. All particles created after calling this method will have this color
Parameters:
r - int red
g - int green
b - int blue

setDefaultTemp

public void setDefaultTemp(double t)

setParticleRGBR

public void setParticleRGBR(int i,
                            int rd,
                            int gr,
                            int bl)
Sets color of particles in left ensemble
Parameters:
i - int particle number
rd - int red value (<256)
gr - int green value (<256)
bl - int blue value (<256)

setParticleRGBL

public void setParticleRGBL(int i,
                            int rd,
                            int gr,
                            int bl)
Sets color of particles in Right ensemble
Parameters:
i - int particle number
rd - int red value (<256)
gr - int green value (<256)
bl - int blue value (<256)

setParticleMassL

public void setParticleMassL(int i,
                             double m)
Sets mass of a particle in the left ensemble Default mass is 1.
Parameters:
i - int particle number
m - double mass.

setParticleMassR

public void setParticleMassR(int i,
                             double m)
Sets mass of a particle in the right ensemble Default mass is 1.
Parameters:
i - int particle number
m - double mass.

setParticleMassM

public void setParticleMassM(int i,
                             double m)
Sets mass of a particle in the middle ensemble Default mass is 1.
Parameters:
i - int particle number
m - double mass.

setParticlePosL

public void setParticlePosL(int i,
                            double xin,
                            double yin)
Sets Position of a particle in the left ensemble
Parameters:
i - int particle number
xin - double initial x-position
yin - double initial y-position

setParticlePosR

public void setParticlePosR(int i,
                            double xin,
                            double yin)
Sets Position of a particle in the right ensemble
Parameters:
i - int particle number
xin - double initial x-position
yin - double initial y-position

setParticleVelL

public void setParticleVelL(int i,
                            double xvel,
                            double yvel)
Sets Velocity of a particle in the left ensemble.
Parameters:
i - int particle number
xvel - double initial x-velocity
yvel - double initial y-velocity

setParticleVelR

public void setParticleVelR(int i,
                            double xvel,
                            double yvel)
Sets Velocity of a particle in the right ensemble.
Parameters:
i - int particle number
xvel - double initial x-velocity
yvel - double initial y-velocity

setParticleSizeL

public void setParticleSizeL(int i,
                             double s)
Sets size of a particle in the left ensemble. Default size is 1 in world units.
Parameters:
i - int particle number
s - double size.

setParticleSizeR

public void setParticleSizeR(int i,
                             double s)
Sets size of a particle in the left ensemble. Default size is 1 in world units.
Parameters:
i - int particle number
s - double size.

addParticleDataSourceL

public int addParticleDataSourceL(int i)
Make a particle in the left ensemble into a data source.
Parameters:
i - int particle number
s - double size.

addParticleDataSourceR

public int addParticleDataSourceR(int i)
Make a particle in the right ensemble into a data source.
Parameters:
i - int particle number
s - double size.

addParticleDataSourceM

public int addParticleDataSourceM(int i)
Make a particle in the right ensemble into a data source.
Parameters:
i - int particle number
s - double size.

setFPS

public void setFPS(int f)
Sets frames per second of animation
Parameters:
f - int

setAutoRefresh

public void setAutoRefresh(boolean ar)
Description copied from class: SApplet
Repaint whenevers the system parameters are changed.
Overrides:
setAutoRefresh in class SApplet
Tags copied from class: SApplet
Parameters:
autoRefresh - Automatic repaint?

setDt

public void setDt(double dt)
Sets calculation time step
Overrides:
setDt in class SApplet
Parameters:
dt - double timestep

setBoltzmann

public void setBoltzmann(double kb)

setWallTempR

public void setWallTempR(java.lang.String wall,
                         double t)
Sets wall temperature for walls in right ensemble

setWallTempL

public void setWallTempL(java.lang.String wall,
                         double t)
Sets wall temperature for walls in left ensemble

removeWallTempL

public void removeWallTempL(java.lang.String wall)

removeWallTempR

public void removeWallTempR(java.lang.String wall)

setPpu

public void setPpu(int p)
Sets pixels per unit of ensemble
Parameters:
p - int

setPeriodicV

public void setPeriodicV(boolean p)
Sets Periodic periodic boundary conditions ion vertical direction
Parameters:
p - boolean

getRWPos

public double getRWPos()
Returns the right wall position
Returns:
double

getLWPos

public double getLWPos()
Returns the left wall position
Returns:
double

getTWPos

public double getTWPos()
Returns the top wall position
Returns:
double

getBWPos

public double getBWPos()
Returns the bottom wall position
Returns:
double

getEnsembleLeftID

public int getEnsembleLeftID()
Returns the id of the left ensemble. This id can be used to make data connections.
Returns:
int The id.

getEnsembleRightID

public int getEnsembleRightID()
Returns the id of theright ensemble. This id can be used to make data connections.
Returns:
int The id.

getEnsembleMiddleID

public int getEnsembleMiddleID()
Returns the id of the middle ensemble. This id can be used to make data connections.
Returns:
int The id.

getHistogramLeftID

public int getHistogramLeftID(int nbins,
                              double vmin,
                              double vmax)
Returns the id of the velocity histogram of the left ensemble. This id can be used to make data connections.
Parameters:
nbins - int The number of bins in the histogram.
min - double The minimum velocity
max - double The maximum velocity
Returns:
int The id.

getHistogramRightID

public int getHistogramRightID(int nbins,
                               double vmin,
                               double vmax)
Returns the id of the velocity histogram of the right ensemble. This id can be used to make data connections.
Parameters:
nbins - int The number of bins in the histogram.
min - double The minimum velocity
max - double The maximum velocity
Returns:
int The id.

getHistogramMiddleID

public int getHistogramMiddleID(int nbins,
                                double vmin,
                                double vmax)
Returns the id of the velocity histogram of the middle ensemble. This id can be used to make data connections.
Parameters:
nbins - int The number of bins in the histogram.
min - double The minimum velocity
max - double The maximum velocity
Returns:
int The id.

Copyright Wolfgang Christian

Visit the Davidson CollegePhyslets Page