27 #include <boost/property_tree/ptree.hpp>
31 namespace TimeEvolver {
43 assert( cd.
Check() &&
"CoreData not ok.");
45 const auto& p = m_cd.m_parameters;
47 m_abs_tolerance = p->get<
double>(
"ode_integration.abs_tolerance");
48 m_is_stationary =
false;
49 m_ode_solver = p->get<
string>(
"ode_integration.ode_solver",
"runge_kutta_dopri5");
50 m_rel_tolerance = p->get<
double>(
"ode_integration.rel_tolerance");
51 m_small_time_increment = p->get<
double>(
"ode_integration.small_time_increment");
52 m_stationarity_check = p->get<
bool>(
"termination.stationarity_check");
61 bool is_stationary =
false;
69 using State = vector<double>;
70 using System = OdeintTraits<State>::System;
71 using Solver = OdeintTraits<State>::Solver;
74 State y_curr(num_eqns);
78 System ode_function = [&equations](
const State& y, State& dydt,
const double) {
90 ode_solver =
OdeintFactory2().Create(m_ode_solver, m_abs_tolerance, m_rel_tolerance);
93 ode_solver =
OdeintFactory2().Create(
"runge_kutta_dopri5", m_abs_tolerance, m_rel_tolerance);
97 const auto start_time = m_cd.m_time_data->m_sim_time;
98 ode_solver(ode_function, y_curr, start_time, start_time + time_slice, m_small_time_increment);
106 if (m_stationarity_check) {
107 State dydt(num_eqns);
110 for (
size_t i = 0; i < num_eqns; ++i) {
111 norm = max(norm, fabs(dydt[i]));
113 is_stationary = (norm <= m_abs_tolerance);
120 m_cd.m_time_data->m_sim_time += time_slice;
127 return make_tuple(timings, is_stationary);
Produces factory function for odeint integrator algorithm.
void GetVariables(std::vector< double > &values) const
Interact with the mesh to get values of transport variables.
Core data with mesh, parameters, random engine and time data.
void SetVariables(std::vector< double > const &values) const
Interact with mesh to set values for transport variables.
Odeint traits header file.
Interface for OdeintFactory0.
Produces factory function for odeint integrator algorithm.
std::string GetName() const
Return name of this stopwatch.
Namespace for components of the Default model group.
Utility class to record durations in a cumulative manner.
Time evolver for diffusion and active transport.
std::tuple< SimTimingTraits::CumulativeTimings, bool > operator()(double time_slice, SimPhase phase=SimPhase::NONE)
Take a time step.
Transport(const CoreData &cd)
Initializing constructor.
void Initialize(const CoreData &cd)
Initialize or re-initialize.
T::duration Get() const
Returns the accumulated value without altering the stopwatch state.
int GetEquationCount() const
Two equations per chemical for each walls, and one equation per chemical for each cell...
Equations for reaction and transport processes.
void GetDerivatives(std::vector< double > &derivs) const
Interact with the mesh to calculate values of derivatives,.
Provides a stopwatch interface to time: it accumulates time between start/stop pairs.
Equations for diffusion and transport.
Interface for OdeintFactory2.
void Record(const std::string &name, const std::chrono::duration< R, P > &duration)
Record the duration for the given name.
bool Check() const
Verify all pointers non-null.
Namespace for clock and timekeeping related classes.