36 #include "NhsModelWithBackwardSolver.hpp" 39 #include "LogFile.hpp" 41 #include "TimeStepper.hpp" 55 double& dCaTrop,
double& dz)
59 if (calciumTroponin < 0)
61 EXCEPTION(
"CalciumTrop concentration went negative");
78 Ta = T0*(1+(2+
mA)*Q)/(1+Q);
82 Ta = T0*(1+
mA*Q)/(1-Q);
88 double ca_trop_to_ca_trop50_ratio_to_n = pow(calciumTroponin/
mCalciumTrop50,
mN);
90 dz =
mAlpha0 * ca_trop_to_ca_trop50_ratio_to_n * (1-z)
96 double& residualComponent1,
double& residualComponent2)
103 residualComponent2 = z -
mDt*dz - mTemporaryStateVariables[1];
113 assert(startTime < endTime);
139 double norm_resid = sqrt(f1*f1+f2*f2);
143 unsigned counter = 0;
144 while ((norm_resid>
mTolerance) && (counter++<15))
147 double j11,j12,j21,j22;
150 double h = std::max(fabs(catrop_guess/100),1e-8);
155 h = std::max(fabs(z_guess/100),1e-8);
161 double one_over_det = 1.0/(j11*j22-j12*j21);
162 double u1 = one_over_det*(j22*f1 - j12*f2);
163 double u2 = one_over_det*(-j21*f1 + j11*f2);
169 norm_resid = sqrt(f1*f1+f2*f2);
187 return T0*(1+(2+
mA)*Q)/(1+Q);
191 return T0*(1+
mA*Q)/(1-Q);
void CalculateBackwardEulerResidual(double calciumTroponin, double z, double Q, double &residualComponent1, double &residualComponent2)
void CalculateCaTropAndZDerivatives(double calciumTroponin, double z, double Q, double &dCaTrop, double &dz)
NhsModelWithBackwardSolver()
double CalculateT0(double z)
std::vector< double > mStateVariables
static const double mTref
#define EXCEPTION(message)
static const unsigned mNr
void AdvanceOneTimeStep()
static const double mAlphaR1
static const double mAlpha0
double GetNextActiveTension()
static const double mAlpha3
static const double mCalciumTroponinMax
void RunAndUpdate(double startTime, double endTime, double timestep)
double ImplicitSolveForQ()
void RunDoNotUpdate(double startTime, double endTime, double timestep)
std::vector< double > mTemporaryStateVariables
static const double mAlpha2
static const double mGamma
static const double mTolerance
static const double mAlpha1
static const double mAlphaR2
void UpdateStateVariables()
static const double mKrefoff