integrators
Class Integrator

java.lang.Object
  extended byintegrators.Integrator
Direct Known Subclasses:
AdamsIntegrator, BackwardEulerIntegrator, CashKarpIntegrator, HuenIntegrator, MidpointIntegrator, SemiExplicitAPCIntegrator

public class Integrator
extends java.lang.Object

Base class for objects that implement numerical integration routines. Does nothing but provide generic methods for all such classes. Subclass and override at least the methods Integrator.init() and Integrator.IntegrateOneStep(), and probably Integrator.reset() as well.


Nested Class Summary
protected  class Integrator.NVmatrix
          This class was intended for storing a Jacobian matrix, or something like that.
 class Integrator.NVvector
          This utility class may be more convenient for some purposes than an array of NodeValues objects would be.
 
Constructor Summary
Integrator()
           
 
Method Summary
 void copyNVarray(NodeValues[] from, NodeValues[] to)
           
protected  void getCurrentValues(NodeValues[] node_values)
           
protected  void getDerivatives(NodeValues[] deriv_values)
           
 float getErrorEstimate()
          Returns an estimate of the error introduced per timestep.
 void init(Model model)
          Any object planning to use an Integrator of any kind MUST call its init(Model) method, which (among other things) is generally used to allocate storage arrays for the intermediates in an integration method.
 float IntegrateOneStep()
          Integrates across a single time step.
 boolean isType(java.lang.String t)
           
 void reset()
          Should be called after the Integrator has crossed an entire interval.
 void setDefaultStepSize(float ts)
          Set the default step size; this is usually only used by Integrator.reset() to return the Integrator to it's defualt state after an entire integration.
 void setErrorTolerance(float err_tol)
          Set the per-step error tolerance; different methods make different use of this value, so see documentation of each Integrator subclass to determine how best to set this, or whether the default value is appropriate.
protected  void setFinalValues(NodeValues[] node_values)
           
protected  void setIntegrationValues(NodeValues[] node_values)
           
 void setStepSize(float ts)
          Set the size of the timestep used by the integrator for the next (and subsequent) calls to IntegrateOneStep.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Integrator

public Integrator()
Method Detail

init

public void init(Model model)
Any object planning to use an Integrator of any kind MUST call its init(Model) method, which (among other things) is generally used to allocate storage arrays for the intermediates in an integration method. This method does NOT do any numerics so does not depend on the state of the model, but it DOES need to be called after the model has been properly populated with Cells and Nodes, and needs to be called again if these change.


reset

public void reset()
Should be called after the Integrator has crossed an entire interval. The base class does nothing; typical subclasses will override Integrator.reset() to reset the time step size to the default value. This method is NOT used to reallocate storage; that requires a call to init().


IntegrateOneStep

public float IntegrateOneStep()
Integrates across a single time step. Return value is the size of the timestep, which may differ from that specified by the calling method if the Integrator subclass adapts the step size to match error requirements.


getCurrentValues

protected void getCurrentValues(NodeValues[] node_values)

getDerivatives

protected void getDerivatives(NodeValues[] deriv_values)

setIntegrationValues

protected void setIntegrationValues(NodeValues[] node_values)

setFinalValues

protected void setFinalValues(NodeValues[] node_values)

setStepSize

public void setStepSize(float ts)
Set the size of the timestep used by the integrator for the next (and subsequent) calls to IntegrateOneStep. Keep in mind that the stepsize means different things to different methods, and also that this value may change as a consequence of attempts by the Integrator to make a step sufficiently accurate. Thus, IntegrateOneStep() returns the timestep actually taken.


setDefaultStepSize

public void setDefaultStepSize(float ts)
Set the default step size; this is usually only used by Integrator.reset() to return the Integrator to it's defualt state after an entire integration.


setErrorTolerance

public void setErrorTolerance(float err_tol)
Set the per-step error tolerance; different methods make different use of this value, so see documentation of each Integrator subclass to determine how best to set this, or whether the default value is appropriate.


getErrorEstimate

public float getErrorEstimate()
Returns an estimate of the error introduced per timestep. Although this is often a conservative estimate, it is the duty of the derived Integrator to determine the error according to whatever algorithm it implements; see the documentation for each Integrator to see how the error is estimated.


isType

public boolean isType(java.lang.String t)

copyNVarray

public void copyNVarray(NodeValues[] from,
                        NodeValues[] to)