the ODESim that defines the differential equation to solve
gives information about energy in the ODESim
the DiffEqSolver to use with various step sizes.
Private
specialenables debug code for particular test
Name of this object, either the language-independent name for scripting purposes or the localized name for display to user.
The language-independent name should be the same as the English version but capitalized and with spaces and dashes replaced by underscore, see Util.toName and nameEquals.
Optional
opt_localized: booleantrue
means return the localized version of the name;
default is false
which means return the language independent name.
name of this object
Returns whether to use second order differences for deciding when to reduce the step size. See setSecondDiff.
whether to use change in change in energy as the criteria for accuracy
Whether this DiffEqSolver has the given name, adjusting for the transformation to a language-independent form of the name, as is done by Util.toName.
the English or language-independent version of the name
whether this DiffEqSolver has the given name (adjusted to language-independent form)
Whether to use second order differences for deciding when to reduce the step size. The first difference is the change in energy of the system over a time step. We can only use first differences when the energy of the system is constant. If the energy of the system changes over time, then we need to reduce the step size until the change of energy over the step stabilizes. Put another way: we reduce the step size until the change in the change in energy becomes small.
true means use change in change in energy (second derivative) as the criteria for accuracy
Advances the associated ODESim by the given small time increment, which results in modifiying the state variables of the ODESim. Modifies the variables array obtained from ODESim.getVarsList by using the change rates obtained from ODESim.evaluate.
the amount of time to advance the differential equation
null if the step succeeds, otherwise an object relating to the error that occurred
Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.
For an object whose main purpose is to represent another Printable object, it is
recommended to include the result of calling toStringShort
on that other object.
For example, calling toStringShort()
on a DisplayShape might return something like
this:
DisplayShape{polygon:Polygon{'chain3'}}
a minimal string representation of this object.
Generated using TypeDoc
Experimental differential equation solver which reduces step size as needed to ensure that energy stays constant over every time step. Uses Decorator design pattern to wrap another DiffEqSolver.
For each step in solving the differential equation, we solve the step several times, taking multiple smaller time steps until some criteria tells us that we have achieved sufficient accuracy.
There are two criteria that can be used:
For a constant energy system, we reduce the step size until the change in energy for the overall step becomes small.
For a non-constant energy system, we look at the change in energy during the overall step; we reduce the step size until this change in energy stabilizes.
TO DO Probably a better approach is to use a method like Runge Kutta Fehlberg which modifies the step size based on error estimates for the diff eqns.
TO DO To make this a true Decorator pattern we need to modify the ODESim interface to support getting energy information and also add some other methods that are part of the Simulation and ODESim classes, like
modifyObjects, saveState, restoreState
. Note that the current CollisionSim interface has several of these methods, so there is an argument to extend ODESim in this way.