simulations.experiments.electrostatics
Class ChargeInFieldExperiment

java.lang.Object
  extended bysimulations.experiments.BaseExperiment
      extended bysimulations.experiments.electrostatics.ChargeInFieldExperiment

public class ChargeInFieldExperiment
extends BaseExperiment

Experiment to show the electric field motion for an electric charge moving in a constant background electric field. Extends BaseExperiment. We provide a method getHue which allows us to color the field lines connected to the charge a different color than the field lines connected to the charges which produce the constant field.


Nested Class Summary
 class ChargeInFieldExperiment.Motion
          the equation of motion for a charge in an electric field
 
Field Summary
private  MovingPointCharge charge
          the charge (initially moving upward)
private  EMCollection collection
          collection of EM objects consisting of the charge and the constant electric field
private  double E
          electric field
private  ChargeInFieldExperiment.Motion equations
          equation of motion of the particle
private  ConstantFields fields
          the electric field pointing downward
private  RungeKuttaIntegration integrator
          integrator for the equation of motion of the particle
private  double m
          mass of the particle
private  double q
          charge of the particle
private  double t
          time
private  double v
          z velocity of the particle
private  double z
          z position of the particle
 
Fields inherited from class simulations.experiments.BaseExperiment
eps, FieldMotionType, FieldType, FluidFlowSpeed, Fnorm, Fpower, numberSmallSteps
 
Constructor Summary
ChargeInFieldExperiment(double E, double q, double m, double z0, double v0)
          constructor for charge in field experiment
 
Method Summary
 void ConstructEMSource()
          constructs the EM source consisting of the charge and the constant field
 void Evolve(double dt)
          method to evolve the particle motion in time
 BaseObject getEMSource()
          returns the collecton of charge and constant field as the EM source
 double getFlowSpeed(Vec3 r, Vec RegionFlow)
          Method to find the flow speed in a given region when we are determining that speed according to region.
 double getHue(double TargetHue, Vec3 r, Vec RegionColor)
          Method to find the hue in a given region when we are coloring according to region (Color Mode 4).
private static void println(java.lang.String s)
          prints the string s
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

E

private double E
electric field


q

private double q
charge of the particle


m

private double m
mass of the particle


z

private double z
z position of the particle


v

private double v
z velocity of the particle


t

private double t
time


charge

private MovingPointCharge charge
the charge (initially moving upward)


fields

private ConstantFields fields
the electric field pointing downward


collection

private EMCollection collection
collection of EM objects consisting of the charge and the constant electric field


equations

private ChargeInFieldExperiment.Motion equations
equation of motion of the particle


integrator

private RungeKuttaIntegration integrator
integrator for the equation of motion of the particle

Constructor Detail

ChargeInFieldExperiment

public ChargeInFieldExperiment(double E,
                               double q,
                               double m,
                               double z0,
                               double v0)
constructor for charge in field experiment

Parameters:
E - background electric field
q - charge
m - mass of charge
z0 - initial position of charge at t = 0
v0 - initial velocity of charge at t = 0
Method Detail

ConstructEMSource

public void ConstructEMSource()
constructs the EM source consisting of the charge and the constant field

Specified by:
ConstructEMSource in class BaseExperiment

getEMSource

public BaseObject getEMSource()
returns the collecton of charge and constant field as the EM source

Specified by:
getEMSource in class BaseExperiment

Evolve

public void Evolve(double dt)
method to evolve the particle motion in time

Specified by:
Evolve in class BaseExperiment

println

private static void println(java.lang.String s)
prints the string s


getHue

public double getHue(double TargetHue,
                     Vec3 r,
                     Vec RegionColor)
Method to find the hue in a given region when we are coloring according to region (Color Mode 4).

Specified by:
getHue in class BaseExperiment
Parameters:
TargetHue - This is the target hue from the renderer.
r - This is the vector postion of the point in the image.
RegionColor - This is the varous hues for the regions.
Returns:
The hue for the part of the image map at r.

getFlowSpeed

public double getFlowSpeed(Vec3 r,
                           Vec RegionFlow)
Method to find the flow speed in a given region when we are determining that speed according to region. This method is used when we have set experiment.FieldMotionType to one of either Constants.FIELD_MOTION_VREFIELD or Constants.FIELD_MOTION_VRBFIELD.

Specified by:
getFlowSpeed in class BaseExperiment
Parameters:
r - This is the vector postion of the point in the image.
RegionFlow - This is the flow speeds for the regions.
Returns:
The flow speed for the part of the image map at r.