Class HaynesShockley

java.lang.Object
  |
  +--TimeDepSchrodinger
        |
        +--HaynesShockley

class HaynesShockley
extends TimeDepSchrodinger

Class to model the Haynes-Shockley experiment. Uses the fourth-order Runge-Kutta method to interpolate across time.


Field Summary
protected  double field
          The field strength
protected  double lifetime
          The carrier lifetime
protected  double[] p
          The function data
 
Fields inherited from class TimeDepSchrodinger
dt, energy, h, pot, potFn, psi, t, width, x0
 
Constructor Summary
HaynesShockley()
           
 
Method Summary
protected  void advanceOnce(double dt)
          Performs one step of the Runge-Kutta method.
 double getField()
          Returns the selected field strength
 double getLifetime()
          Returns the selected carrier lifetime
 void initFunction(double x, double h, int steps)
          Resets the model, replacing the function data with a new square wave.
 double integralCheck()
          Approximates the integral of the function, by summing the function data and dividing by h.
 void setField(double d)
          Sets the selected field strength
 void setLifetime(double d)
          Sets the selected carrier lifetime
 void solve(double x, double h, double[] vals)
          Since all the work is done in advanceOnce(), this method need only return the function data.
protected  double xderiv(double[] d, int i)
          Measures the derivative with respect to x using a finite difference method.
protected  double xderiv2(double[] d, int i)
          Measures the second derivative with respect to x using a finite difference method.
 
Methods inherited from class TimeDepSchrodinger
advanceOnce, getEnergy, getT, getWidth, getX0, setEnergy, setT, setWidth, setX0, xderiv
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

lifetime

protected double lifetime
The carrier lifetime

field

protected double field
The field strength

p

protected double[] p
The function data
Constructor Detail

HaynesShockley

public HaynesShockley()
Method Detail

initFunction

public void initFunction(double x,
                         double h,
                         int steps)
Resets the model, replacing the function data with a new square wave.
Overrides:
initFunction in class TimeDepSchrodinger
Parameters:
x - The smallest x-value to consider
h - The gap between x-values
steps - The number of x-values to consider

advanceOnce

protected void advanceOnce(double dt)
Performs one step of the Runge-Kutta method.
Overrides:
advanceOnce in class TimeDepSchrodinger
Parameters:
dt - The size of the advancement in time

xderiv

protected double xderiv(double[] d,
                        int i)
Measures the derivative with respect to x using a finite difference method. If the region considered touches the edge of the function data (so i <= 1 or i >= d.length-2, zero will be returned.
Parameters:
d - The function data on which to operate
i - The index at which the derivative is required
Returns:
(d[i+1]-d[i-1])/2h

xderiv2

protected double xderiv2(double[] d,
                         int i)
Measures the second derivative with respect to x using a finite difference method. If the region considered touches the edge of the function data (so i <= 1 or i >= d.length-2, zero will be returned.
Parameters:
d - The function data on which to operate
i - The index at which the derivative is required
Returns:
(d[i+1]+d[i-1]-2d[i])/(h*h)

solve

public void solve(double x,
                  double h,
                  double[] vals)
Since all the work is done in advanceOnce(), this method need only return the function data. Since it is not practical to adjust the size or x-spacing of the data in the array while the simulation is running, the x and h parameters are ignored.
Overrides:
solve in class TimeDepSchrodinger
Throws:
java.lang.RuntimeException - if vals is not the same size as the array of function data

integralCheck

public double integralCheck()
Approximates the integral of the function, by summing the function data and dividing by h.
Overrides:
integralCheck in class TimeDepSchrodinger

getField

public double getField()
Returns the selected field strength

setField

public void setField(double d)
Sets the selected field strength

getLifetime

public double getLifetime()
Returns the selected carrier lifetime

setLifetime

public void setLifetime(double d)
Sets the selected carrier lifetime