Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
|
#include <RungeKuttaFehlbergIvpOdeSolver.hpp>
Public Member Functions | |
RungeKuttaFehlbergIvpOdeSolver () | |
OdeSolution | Solve (AbstractOdeSystem *pAbstractOdeSystem, std::vector< double > &rYValues, double startTime, double endTime, double timeStep, double ignoredSamplingTime) |
void | Solve (AbstractOdeSystem *pAbstractOdeSystem, std::vector< double > &rYValues, double startTime, double endTime, double timeStep) |
Public Member Functions inherited from AbstractIvpOdeSolver | |
virtual void | SolveAndUpdateStateVariable (AbstractOdeSystem *pAbstractOdeSystem, double startTime, double endTime, double timeStep) |
bool | StoppingEventOccurred () |
double | GetStoppingTime () |
AbstractIvpOdeSolver () | |
virtual | ~AbstractIvpOdeSolver () |
Public Member Functions inherited from Identifiable | |
virtual | ~Identifiable () |
std::string | GetIdentifier () const |
Protected Member Functions | |
void | InternalSolve (OdeSolution &rSolution, AbstractOdeSystem *pAbstractOdeSystem, std::vector< double > &rCurrentYValues, std::vector< double > &rWorkingMemory, double startTime, double endTime, double maxTimeStep, double minTimeStep, double tolerance, bool outputSolution) |
void | CalculateNextYValue (AbstractOdeSystem *pAbstractOdeSystem, double timeStep, double time, std::vector< double > &rCurrentYValues, std::vector< double > &rNextYValues) |
void | AdjustStepSize (double &rCurrentStepSize, const double &rError, const double &rTolerance, const double &rMaxTimeStep, const double &rMinTimeStep) |
Private Member Functions | |
template<class Archive > | |
void | serialize (Archive &archive, const unsigned int version) |
Private Attributes | |
double | m1932o2197 |
double | m7200o2197 |
double | m7296o2197 |
double | m12o13 |
double | m439o216 |
double | m3680o513 |
double | m845o4104 |
double | m8o27 |
double | m3544o2565 |
double | m1859o4104 |
double | m1o360 |
double | m128o4275 |
double | m2197o75240 |
double | m2o55 |
double | m25o216 |
double | m1408o2565 |
double | m2197o4104 |
std::vector< double > | mError |
std::vector< double > | mk1 |
std::vector< double > | mk2 |
std::vector< double > | mk3 |
std::vector< double > | mk4 |
std::vector< double > | mk5 |
std::vector< double > | mk6 |
std::vector< double > | myk2 |
std::vector< double > | myk3 |
std::vector< double > | myk4 |
std::vector< double > | myk5 |
std::vector< double > | myk6 |
Friends | |
class | TestRungeKuttaFehlbergIvpOdeSolver |
class | boost::serialization::access |
Additional Inherited Members | |
Protected Attributes inherited from AbstractIvpOdeSolver | |
bool | mStoppingEventOccurred |
double | mStoppingTime |
A concrete one step ODE solver class that employs the Runge Kutta Fehlberg adaptive solver (RKF45).
This solver is good for problems where you need to be able to guarantee the accuracy of the answer as it is specified via the tolerance parameter.
The solver should also be reasonably fast as it increases the timestep when the solutions are changing slowly, whilst maintaining accuracy.
Definition at line 56 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
RungeKuttaFehlbergIvpOdeSolver::RungeKuttaFehlbergIvpOdeSolver | ( | ) |
Constructor.
Definition at line 263 of file RungeKuttaFehlbergIvpOdeSolver.cpp.
|
protected |
Use the error approximation of the last call to the CalculateNextYValue() method to change the time step appropriately.
rCurrentStepSize | the current step size being used (returns answer via this reference) |
rError | the error in the approximation at this time step |
rTolerance | the tolerance required |
rMaxTimeStep | the maximum timestep to be used |
rMinTimeStep | the minimum timestep to be used (to prevent huge loops) |
Definition at line 220 of file RungeKuttaFehlbergIvpOdeSolver.cpp.
References EXCEPTION.
Referenced by InternalSolve().
|
protected |
Calculate the solution to the ODE system at the next timestep. Updates the mError vector with current error.
pAbstractOdeSystem | the ODE system to solve |
timeStep | dt |
time | the current time |
rCurrentYValues | the current (initial) state |
rNextYValues | the state at the next timestep |
Definition at line 159 of file RungeKuttaFehlbergIvpOdeSolver.cpp.
References AbstractOdeSystem::EvaluateYDerivatives(), AbstractUntemplatedParameterisedSystem::GetNumberOfStateVariables(), m128o4275, m12o13, m1408o2565, m1859o4104, m1932o2197, m1o360, m2197o4104, m2197o75240, m25o216, m2o55, m3544o2565, m3680o513, m439o216, m7200o2197, m7296o2197, m845o4104, m8o27, mError, mk1, mk2, mk3, mk4, mk5, mk6, myk2, myk3, myk4, myk5, and myk6.
Referenced by InternalSolve().
|
protected |
Method that actually performs the solving on behalf of the public Solve methods.
rSolution | an ODE solution to input data into if requited |
pAbstractOdeSystem | the ODE system to solve |
rCurrentYValues | the current (initial) state; results will also be returned in here |
rWorkingMemory | working memory; same size as rCurrentYValues |
startTime | initial time |
endTime | time to solve to |
maxTimeStep | the maximum size of timestep allowable |
minTimeStep | the maximum size of timestep allowable (to prevent huge loops) |
tolerance | how accurate the numerical solution must be |
outputSolution | whether to output into rSolution (or save time by not doing) |
Definition at line 46 of file RungeKuttaFehlbergIvpOdeSolver.cpp.
References AdjustStepSize(), CalculateNextYValue(), AbstractOdeSystem::CalculateStoppingEvent(), AbstractUntemplatedParameterisedSystem::GetNumberOfStateVariables(), mError, mk1, mk2, mk3, mk4, mk5, mk6, AbstractIvpOdeSolver::mStoppingEventOccurred, AbstractIvpOdeSolver::mStoppingTime, myk2, myk3, myk4, myk5, myk6, OdeSolution::rGetSolutions(), OdeSolution::rGetTimes(), and OdeSolution::SetNumberOfTimeSteps().
|
inlineprivate |
Archive, never used directly - boost uses this.
archive | the archive |
version | the current version of this class |
Definition at line 70 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
|
virtual |
Second version of Solve. Solves a system of ODEs using a specified one-step ODE solver. This method does not return the solution and therefore does not take in a sampling time. Instead, the mStateVariables component in the ODE system object is updated.
pAbstractOdeSystem | pointer to the concrete ODE system to be solved |
rYValues | a standard vector specifying the intial condition of each solution variable in the system (this can be the initial conditions vector stored in the ODE system) |
startTime | the time at which the initial conditions are specified |
endTime | the time to which the system should be solved and the solution returned |
timeStep | the time interval to be used by the solver |
Implements AbstractIvpOdeSolver.
Definition at line 310 of file RungeKuttaFehlbergIvpOdeSolver.cpp.
References AbstractOdeSystem::CalculateStoppingEvent(), EXCEPTION, AbstractUntemplatedParameterisedSystem::GetNumberOfStateVariables(), InternalSolve(), and AbstractIvpOdeSolver::mStoppingEventOccurred.
|
virtual |
Solves a system of ODEs using a specified one-step ODE solver and returns the solution as an OdeSolution object.
pAbstractOdeSystem | pointer to the concrete ODE system to be solved |
rYValues | a standard vector specifying the intial condition of each solution variable in the system (this can be the initial conditions vector stored in the ODE system) |
startTime | the time at which the initial conditions are specified |
endTime | the time to which the system should be solved and the solution returned |
timeStep | the time interval to be used by the solver |
ignoredSamplingTime | the interval at which to sample the solution to the ODE system (ignored in this class as the timestep is variable) |
Implements AbstractIvpOdeSolver.
Definition at line 284 of file RungeKuttaFehlbergIvpOdeSolver.cpp.
References AbstractOdeSystem::CalculateStoppingEvent(), EXCEPTION, AbstractUntemplatedParameterisedSystem::GetNumberOfStateVariables(), InternalSolve(), and AbstractIvpOdeSolver::mStoppingEventOccurred.
|
friend |
Needed for serialization.
Definition at line 62 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
|
friend |
Definition at line 58 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
|
private |
Working memory: numerical value for the fraction 128/4275.
Definition at line 92 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 12/13.
Definition at line 84 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 1408/2565.
Definition at line 96 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 1859/4104.
Definition at line 90 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 1932/2197.
Definition at line 81 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 1/360.
Definition at line 91 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 2197/4104.
Definition at line 97 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 2197/75240.
Definition at line 93 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 25/216.
Definition at line 95 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 2/55.
Definition at line 94 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 3544/2565.
Definition at line 89 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 3680/513.
Definition at line 86 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 439/216.
Definition at line 85 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 7200/2197.
Definition at line 82 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 7296/2197.
Definition at line 83 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 845/4104.
Definition at line 87 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Working memory: numerical value for the fraction 8/27.
Definition at line 88 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue().
|
private |
Error expression, used to adjust the timestep in the RKF45 method.
Definition at line 99 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().
|
private |
Working memory: expression k1 in the RKF45 method.
Definition at line 101 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().
|
private |
Working memory: expression k2 in the RKF45 method.
Definition at line 102 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().
|
private |
Working memory: expression k3 in the RKF45 method.
Definition at line 103 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().
|
private |
Working memory: expression k4 in the RKF45 method.
Definition at line 104 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().
|
private |
Working memory: expression k5 in the RKF45 method.
Definition at line 105 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().
|
private |
Working memory: expression k6 in the RKF45 method.
Definition at line 106 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().
|
private |
Working memory: expression yk2 in the RKF45 method.
Definition at line 107 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().
|
private |
Working memory: expression yk3 in the RKF45 method.
Definition at line 108 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().
|
private |
Working memory: expression yk4 in the RKF45 method.
Definition at line 109 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().
|
private |
Working memory: expression yk5 in the RKF45 method.
Definition at line 110 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().
|
private |
Working memory: expression yk6 in the RKF45 method.
Definition at line 111 of file RungeKuttaFehlbergIvpOdeSolver.hpp.
Referenced by CalculateNextYValue(), and InternalSolve().