14#ifndef MEMBRANEMODELS_HH
15#define MEMBRANEMODELS_HH
17#include <dune/common/config.h>
18#include <dune/common/fvector.hh>
19#include <dune/common/fmatrix.hh>
55 template <
class Derived,
int n>
93 std::string
const&
name()
const {
return nm; }
98 std::pair<double,Gating>
const&
restState()
const {
return fix; }
111 double fuv =
static_cast<Derived const&
>(*this).current(u-h,v);
112 double fuiv =
static_cast<Derived const&
>(*this).current(u+h,v);
114 return (fuiv-fuv)/(2*h);
128 double f =
static_cast<Derived const&
>(*this).current(u,v);
134 fv_uv[i] = (
static_cast<Derived const&
>(*this).current(u,v+dir)-f)/1e-5;
148 Gating guA =
static_cast<Derived const&
>(*this).gatingRhs(u-1e-5,v);
149 Gating guB =
static_cast<Derived const&
>(*this).gatingRhs(u+1e-5,v);
150 return (guB-guA)/2e-5;
161 Gating col, dir, guv =
static_cast<Derived const&
>(*this).gatingRhs(u,v);
165 col = (
static_cast<Derived const&
>(*this).gatingRhs(u,v+dir)-guv)/1e-5;
166 for (
int j=0; j<
nGating; ++j) gv_uv[j][i] = col[j];
188 x[0] = uFix;
for (
int i=0; i<
nGating; ++i) x[i+1] = vFix[i];
189 std::cout <<
"x_init = " << x << std::endl;
199 double normF = 0, dxNorm = 0;
206 double c =
static_cast<Derived const&
>(*this).current(uFix0,vFix0);
208 Gating g =
static_cast<Derived const&
>(*this).gatingRhs(uFix0,vFix0);
210 F[0] = c;
for (
int i=0; i<
nGating; ++i) F[i+1] = g[i];
211 normF = F.infinity_norm();
214 Gating current_v =
static_cast<Derived const&
>(*this).current_dv(uFix0, vFix0);
215 Gating gatingRHS_u =
static_cast<Derived const&
>(*this).gatingRhs_du(uFix0, vFix0);
219 DF[0][0] = current_u;
220 for (
int i=0; i<
nGating; ++i) DF[0][i+1] = -current_v[i];
221 for (
int i=0; i<
nGating; ++i) DF[i+1][0] = gatingRHS_u[i];
224 DF[i+1][j+1] = gatingRHS_v[i][j];
233 vFix0[i] += d*dx[i+1];
235 dxNorm = dx.infinity_norm();
236 }
while ( (normF > 1e-6) || (dxNorm > 1e-4) );
238 std::cout <<
" Newton steps = " << steps << std::endl;
243 fix.second[i] = vFix0[i];
245 std::cout <<
"fixpoint = " << fix.first <<
" " << fix.second << std::endl;
252 std::pair<double,Gating> fix;
338 double a, eps0, k, mu1, mu2;
529 double h(
double x)
const;
535 double Cm, gfi, taur, tausi, tau0, tauvplus, tauv1minus, tauv2minus, tauwplus, tauwminus, uc, uv, usic, taud;
671 template <
class Derived,
int n,
int m>
719 std::string
const&
name()
const {
return nm; }
733 auto const& me =
static_cast<Derived const&
>(*this);
735 State r = me.state(s,t), dr, h;
736 for (
int i=0; i<
nState; ++i)
740 dr = (me.state(h,t)-r)/1e-5;
741 for (
int j=0; j<
nState; ++j)
754 auto const& me =
static_cast<Derived const&
>(*this);
756 State r = me.state(s,t), dr;
762 dr = (me.state(s,h)-r)/1e-5;
763 for (
int j=0; j<
nState; ++j)
776 auto const& me =
static_cast<Derived const&
>(*this);
778 double r = me.stress(s);
779 for (
int i=0; i<
nState; ++i)
783 da[i] = (me.stress(h)-r)/1e-5;
812 return e0 * (kta*un-s) / (1+exp(-100*(un-.05)));
The 3-variable Fenton-Karma membrane model.
ParameterSet
Different parameter sets provided.
@ MBR
modified Beeler-Reuter
@ MLRI
modified Luo-Rudy I
Dune::FieldVector< double, nGating > Gating
Dune::FieldMatrix< double, nGating, nGating > GatingJacobian
FentonKarma(ParameterSet p, double Cm=1e-2)
Constructor.
Gating gatingRhs_du(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
GatingJacobian gatingRhs_dv(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
static int const nGating
number of gating variables
Gating gatingRhs(double u, Gating const &v, double Istim=0) const
The right hand side for the evolution of gating variables.
double current_du(double u, Gating const &v) const
The transmembrane ion current derivative w.r.t. the transmembrane voltage.
double current(double u, Gating const &v) const
The transmembrane ion current.
Gating current_dv(double u, Gating const &v) const
The transmembrane ion current derivative w.r.t. the gating variables.
Active stress generation from XX.
double stress(State const &s) const
State state(State const &s, Trigger const &t) const
Convenience base class for active stress generation models providing numerical differentiation.
StateJacobian state_ds(State const &s, Trigger const &t) const
The deriviative of internal state dynamics wrt state variables.
Dune::FieldMatrix< double, nState, nTrigger > StateTriggerJacobian
Matrix type for the derivative of the state dynamics wrt the triggers.
StateTriggerJacobian state_dt(State const &s, Trigger const &t) const
The deriviative of internal state dynamics wrt trigger variables.
Dune::FieldVector< double, nState > State
Vector type holding the internal variables.
std::string const & name() const
Human-readable name of the active stress model.
State const & restState() const
Value of the resting state fixed point.
static int const nTrigger
Number of trigger variables.
static int const nState
Number of internal state variables.
State stress_ds(State const &s) const
The derivative of stress wrt state variables.
ActiveStressModelBase()
Default constructor.
ActiveStressModelBase(std::string const &name, State const &fix_)
Constructor specifying the model data.
Dune::FieldMatrix< double, nState, nState > StateJacobian
Matrix type for the Jacobian of the State dynamics.
Dune::FieldVector< double, nTrigger > Trigger
Vector type holding trigger variables.
Phenomenological model by Aliev and Panfilov.
double current_du(double u, Gating const &v) const
The transmembrane ion current derivative w.r.t. the transmembrane voltage.
double current(double u, Gating const &v) const
The transmembrane ion current.
Gating gatingRhs_du(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
GatingJacobian gatingRhs_dv(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
static int const nGating
number of gating variables
Dune::FieldVector< double, nGating > Gating
AlievPanfilov()
Default constructor.
Gating current_dv(double u, Gating const &v) const
The transmembrane ion current derivative w.r.t. the gating variables.
Dune::FieldMatrix< double, nGating, nGating > GatingJacobian
Gating gatingRhs(double u, Gating const &v, double Istim=0) const
The right hand side for the evolution of gating variables.
Convenience base class for membrane models providing numerical differentiation.
MembraneModelBase(std::string const &name)
Constructor specifying the model data.
double current_du(double u, Gating const &v, double h=1e-5) const
The transmembrane ion current derivative w.r.t. the transmembrane voltage.
Dune::FieldVector< double, nGating > Gating
Vector type holding gating variables.
Gating gatingRhs_du(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
Dune::FieldMatrix< double, nGating, nGating > GatingJacobian
Matrix type for the Jacobian of the gating dynamics.
Gating current_dv(double u, Gating const &v) const
The transmembrane ion current derivative w.r.t. the gating variables.
static int const nGating
Number of gating variables.
MembraneModelBase()
Default constructor.
GatingJacobian gatingRhs_dv(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
void setRestState(double uFix, Gating const &vFix)
Accepts an (approximate) resting state.
std::string const & name() const
Human-readable name of the membrane model.
std::pair< double, Gating > const & restState() const
Value of the resting state fixed point.
Phenomenological model based on Aliev and Panfilov, scaled to physiological values.
Dune::FieldVector< double, nGating > Gating
double current(double u, Gating const &v) const
The transmembrane ion current.
GatingJacobian gatingRhs_dv(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
static int const nGating
number of gating variables
Gating gatingRhs_du(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
Gating gatingRhs(double u, Gating const &v, double Istim=0) const
The right hand side for the evolution of gating variables.
Dune::FieldMatrix< double, nGating, nGating > GatingJacobian
PhysiologicalAlievPanfilov(double Cm=1e-2/16)
Constructor.
Gating current_dv(double u, Gating const &v) const
The transmembrane ion current derivative w.r.t. the gating variables.
double current_du(double u, Gating const &v) const
The transmembrane ion current derivative w.r.t. the transmembrane voltage.
Physiologcial model by tenTusscher et al.
double current_du(double u, Gating const &v, double h=1e-5) const
The transmembrane ion current derivative w.r.t. the transmembrane voltage.
Gating gatingRhs(double u, Gating const &v, double Istim=0) const
The right hand side for the evolution of gating variables.
Gating current_dv(double u, Gating const &v) const
The transmembrane ion current derivative w.r.t. the gating variables.
GatingJacobian gatingRhs_dv(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
Gating gatingRhs_du(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
double current(double u, Gating const &v) const
The transmembrane ion current.
TenTusscher16()
Default constructor.
Physiologcial model by tenTusscher et al. (2006)
Gating gatingRhs_du(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
GatingJacobian gatingRhs_dv(double u, Gating const &v) const
The derivative of the right hand side for the evolution of gating variables w.r.t....
Gating current_dv(double u, Gating const &v) const
The transmembrane ion current derivative w.r.t. the gating variables.
double gatingRhs1(double u, Gating const &v, int vId, double Istim=0) const
double current(double u, Gating const &v) const
The transmembrane ion current.
Gating gatingRhs(double u, Gating const &v, double Istim=0) const
The right hand side for the evolution of gating variables.
double current_du(double u, Gating const &v, double h=1e-5) const
The transmembrane ion current derivative w.r.t. the transmembrane voltage.
TenTusscher18()
Default constructor.