Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
|
#include <AbstractOdeSystem.hpp>
Public Member Functions | |
AbstractOdeSystem (unsigned numberOfStateVariables) | |
virtual | ~AbstractOdeSystem () |
virtual void | EvaluateYDerivatives (double time, const std::vector< double > &rY, std::vector< double > &rDY)=0 |
virtual bool | CalculateStoppingEvent (double time, const std::vector< double > &rY) |
virtual double | CalculateRootFunction (double time, const std::vector< double > &rY) |
bool | GetUseAnalyticJacobian () |
const std::vector< double > & | rGetConstStateVariables () const |
Public Member Functions inherited from AbstractParameterisedSystem< std::vector< double > > | |
AbstractParameterisedSystem (unsigned numberOfStateVariables) | |
std::vector< double > & | rGetStateVariables () |
std::vector< double > | GetStateVariables () |
void | SetStateVariables (const std::vector< double > &rStateVariables) |
double | GetStateVariable (unsigned index) const |
double | GetStateVariable (const std::string &rName) const |
void | SetStateVariable (unsigned index, double newValue) |
void | SetStateVariable (const std::string &rName, double newValue) |
virtual void | VerifyStateVariables () |
void | SetDefaultInitialConditions (const std::vector< double > &rInitialConditions) |
void | SetDefaultInitialCondition (unsigned index, double initialCondition) |
std::vector< double > | GetInitialConditions () const |
void | ResetToInitialConditions () |
double | GetParameter (unsigned index) const |
double | GetParameter (const std::string &rName) const |
void | SetParameter (const std::string &rName, double value) |
void | SetParameter (unsigned index, double value) |
double | GetAnyVariable (unsigned index, double time=0.0, std::vector< double > *pDerivedQuantities=NULL) |
double | GetAnyVariable (const std::string &rName, double time=0.0, std::vector< double > *pDerivedQuantities=NULL) |
void | SetAnyVariable (unsigned index, double value) |
void | SetAnyVariable (const std::string &rName, double value) |
virtual std::vector< double > | ComputeDerivedQuantities (double time, const std::vector< double > &rState) |
std::vector< double > | ComputeDerivedQuantitiesFromCurrentState (double time) |
Public Member Functions inherited from AbstractUntemplatedParameterisedSystem | |
AbstractUntemplatedParameterisedSystem (unsigned numberOfStateVariables) | |
virtual | ~AbstractUntemplatedParameterisedSystem () |
boost::shared_ptr< const AbstractOdeSystemInformation > | GetSystemInformation () const |
std::string | GetSystemName () const |
unsigned | GetNumberOfAttributes () const |
bool | HasAttribute (const std::string &rName) const |
double | GetAttribute (const std::string &rName) const |
unsigned | GetNumberOfStateVariables () const |
const std::vector< std::string > & | rGetStateVariableNames () const |
const std::vector< std::string > & | rGetStateVariableUnits () const |
unsigned | GetStateVariableIndex (const std::string &rName) const |
bool | HasStateVariable (const std::string &rName) const |
std::string | GetStateVariableUnits (unsigned index) const |
unsigned | GetNumberOfParameters () const |
const std::vector< std::string > & | rGetParameterNames () const |
const std::vector< std::string > & | rGetParameterUnits () const |
unsigned | GetParameterIndex (const std::string &rName) const |
bool | HasParameter (const std::string &rName) const |
std::string | GetParameterUnits (unsigned index) const |
unsigned | GetNumberOfDerivedQuantities () const |
const std::vector< std::string > & | rGetDerivedQuantityNames () const |
const std::vector< std::string > & | rGetDerivedQuantityUnits () const |
unsigned | GetDerivedQuantityIndex (const std::string &rName) const |
bool | HasDerivedQuantity (const std::string &rName) const |
std::string | GetDerivedQuantityUnits (unsigned index) const |
unsigned | GetAnyVariableIndex (const std::string &rName) const |
bool | HasAnyVariable (const std::string &rName) const |
std::string | GetAnyVariableUnits (unsigned index) const |
std::string | GetAnyVariableUnits (const std::string &rName) const |
Protected Attributes | |
bool | mUseAnalyticJacobian |
Protected Attributes inherited from AbstractParameterisedSystem< std::vector< double > > | |
std::vector< double > | mStateVariables |
std::vector< double > | mParameters |
Protected Attributes inherited from AbstractUntemplatedParameterisedSystem | |
unsigned | mNumberOfStateVariables |
boost::shared_ptr< AbstractOdeSystemInformation > | mpSystemInfo |
Private Member Functions | |
template<class Archive > | |
void | save (Archive &archive, const unsigned int version) const |
template<class Archive > | |
void | load (Archive &archive, const unsigned int version) |
Friends | |
class | TestAbstractOdeSystem |
class | boost::serialization::access |
Additional Inherited Members | |
Protected Member Functions inherited from AbstractParameterisedSystem< std::vector< double > > | |
std::string | DumpState (const std::string &rMessage) |
std::string | DumpState (const std::string &rMessage, std::vector< double > Y) |
std::string | DumpState (const std::string &rMessage, std::vector< double > Y, double time) |
void | CheckParametersOnLoad (const std::vector< double > &rParameters, const std::vector< std::string > &rParameterNames) |
Abstract OdeSystem class.
Sets up variables and functions for a general ODE system.
ODE systems are specified primarily by the EvaluateYDerivatives() method, which calculates the right-hand side of the system.
Instances can store their state internally in the mStateVariables vector in our base class AbstractParameterisedSystem (see also GetNumberOfStateVariables(), SetStateVariables() and rGetStateVariables()), although this is not essential - the vector may be empty, in which case AbstractIvpOdeSolver::SolveAndUpdateStateVariable may not be used to solve the system.
ODE systems may also have a vector of parameters, which can be accessed through the GetParameter() and SetParameter() methods of our base class.
Information about what the parameters and state variables represent is provided by a subclass of AbstractOdeSystemInformation. Various wrapper methods (e.g. rGetStateVariableNames()) are provided in our base class to access this information.
There are two more advanced facilities available for subclass authors. An analytic form for the Jacobian matrix of the system may be provided, in which case you must subclass AbstractOdeSystemWithAnalyticJacobian. The GetUseAnalyticJacobian() method will test whether this is the case.
Also, subclasses may define a condition at which ODE solvers should stop prematurely. For the Chaste solvers this is done by overriding CalculateStoppingEvent(); if the more advanced CVODE solvers are being used then implement CalculateRootFunction() instead to detect the stopping time more accurately.
Definition at line 87 of file AbstractOdeSystem.hpp.
AbstractOdeSystem::AbstractOdeSystem | ( | unsigned | numberOfStateVariables | ) |
Constructor.
numberOfStateVariables | the number of state variables in the ODE system |
Definition at line 39 of file AbstractOdeSystem.cpp.
|
virtual |
Virtual destructor since we have virtual methods.
Definition at line 45 of file AbstractOdeSystem.cpp.
|
virtual |
An alternative approach to stopping events; currently only useful with CVODE. CVODE can search for roots (zeros) of this function while solving the ODE system, and home in on them to find sign transitions to high precision.
The default implementation here fakes a root function using CalculateStoppingEvent.
time | the current time |
rY | the current values of the state variables |
Reimplemented in TysonNovak2001OdeSystem, VanLeeuwen2009WntSwatCellCycleOdeSystem, and WntCellCycleOdeSystem.
Definition at line 54 of file AbstractOdeSystem.cpp.
References CalculateStoppingEvent().
|
virtual |
CalculateStoppingEvent() - can be overloaded if the ODE is to be solved only until a particular event (for example, only until the y value becomes negative.
After each timestep the solver will call this method on the ODE to see if it should stop there.
time | the current time |
rY | the current values of the state variables |
Reimplemented in Alarcon2004OxygenBasedCellCycleOdeSystem, TysonNovak2001OdeSystem, VanLeeuwen2009WntSwatCellCycleOdeSystem, and WntCellCycleOdeSystem.
Definition at line 49 of file AbstractOdeSystem.cpp.
Referenced by CalculateRootFunction(), AbstractOneStepIvpOdeSolver::InternalSolve(), RungeKuttaFehlbergIvpOdeSolver::InternalSolve(), AbstractOneStepIvpOdeSolver::Solve(), RungeKuttaFehlbergIvpOdeSolver::Solve(), RungeKuttaFehlbergIvpOdeSolver::Solve(), AbstractOneStepIvpOdeSolver::Solve(), CvodeAdaptor::Solve(), and CvodeAdaptor::Solve().
|
pure virtual |
Method to evaluate the derivatives of the system.
time | the current time |
rY | the current values of the state variables |
rDY | storage for the derivatives of the system; will be filled in on return |
Implemented in Alarcon2004OxygenBasedCellCycleOdeSystem, DeltaNotchEdgeOdeSystem, DeltaNotchInteriorOdeSystem, DeltaNotchOdeSystem, Goldbeter1991OdeSystem, TysonNovak2001OdeSystem, Mirams2010WntOdeSystem, VanLeeuwen2009WntSwatCellCycleOdeSystem, WntCellCycleOdeSystem, AbstractBackwardEulerCardiacCell< SIZE >, AbstractBackwardEulerCardiacCell< 0u >, AbstractGeneralizedRushLarsenCardiacCell, AbstractRushLarsenCardiacCell, Kerchoffs2003ContractionModel, Nash2004ContractionModel, NhsContractionModel, FakeBathCell, FitzHughNagumo1961OdeSystem, CorriasBuistICCModified, CorriasBuistSMCModified, CombinedOdeSystem, OdeSystemForCoupledHeatEquation, OdeSystemForCoupledHeatEquationWithSource, and CML_noble_varghese_kohl_noble_1998_basic_with_sac.
Referenced by EulerIvpOdeSolver::CalculateNextYValue(), GRL1IvpOdeSolver::CalculateNextYValue(), GRL2IvpOdeSolver::CalculateNextYValue(), HeunIvpOdeSolver::CalculateNextYValue(), RKC21IvpOdeSolver::CalculateNextYValue(), RungeKutta2IvpOdeSolver::CalculateNextYValue(), RungeKutta4IvpOdeSolver::CalculateNextYValue(), RungeKuttaFehlbergIvpOdeSolver::CalculateNextYValue(), and BackwardEulerIvpOdeSolver::ComputeResidual().
bool AbstractOdeSystem::GetUseAnalyticJacobian | ( | ) |
Get whether an analytic Jacobian is used.
Definition at line 60 of file AbstractOdeSystem.cpp.
References mUseAnalyticJacobian.
Referenced by BackwardEulerIvpOdeSolver::ComputeJacobian().
|
inlineprivate |
Archive the member variables.
archive | the archive |
version | the current version of this class |
Definition at line 129 of file AbstractOdeSystem.hpp.
References AbstractParameterisedSystem< std::vector< double > >::CheckParametersOnLoad(), AbstractUntemplatedParameterisedSystem::mNumberOfStateVariables, AbstractParameterisedSystem< std::vector< double > >::mParameters, AbstractParameterisedSystem< std::vector< double > >::mStateVariables, and mUseAnalyticJacobian.
const std::vector< double > & AbstractOdeSystem::rGetConstStateVariables | ( | ) | const |
Definition at line 65 of file AbstractOdeSystem.cpp.
References AbstractParameterisedSystem< std::vector< double > >::mStateVariables.
|
inlineprivate |
Archive the member variables.
archive | the archive |
version | the current version of this class |
Definition at line 102 of file AbstractOdeSystem.hpp.
References AbstractUntemplatedParameterisedSystem::mNumberOfStateVariables, AbstractParameterisedSystem< std::vector< double > >::mParameters, AbstractParameterisedSystem< std::vector< double > >::mStateVariables, mUseAnalyticJacobian, and AbstractUntemplatedParameterisedSystem::rGetParameterNames().
|
friend |
Definition at line 94 of file AbstractOdeSystem.hpp.
|
friend |
Definition at line 89 of file AbstractOdeSystem.hpp.
|
protected |
Whether to use an analytic Jacobian.
Definition at line 154 of file AbstractOdeSystem.hpp.
Referenced by AbstractOdeSystemWithAnalyticJacobian::AbstractOdeSystemWithAnalyticJacobian(), AbstractGeneralizedRushLarsenCardiacCell::ForceUseOfNumericalJacobian(), GetUseAnalyticJacobian(), load(), and save().