36 #include "NhsModelWithBackwardSolver.hpp"
39 #include "LogFile.hpp"
41 #include "TimeStepper.hpp"
55 double& dCaTrop,
double& dz)
58 #define COVERAGE_IGNORE
59 if(calciumTroponin < 0)
61 EXCEPTION(
"CalciumTrop concentration went negative");
71 #undef COVERAGE_IGNORE
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)
98 double& residualComponent1,
double& residualComponent2)
105 residualComponent2 = z -
mDt*dz - mTemporaryStateVariables[1];
119 assert(startTime < endTime);
145 double norm_resid = sqrt(f1*f1+f2*f2);
149 unsigned counter = 0;
150 while ((norm_resid>
mTolerance) && (counter++<15))
153 double j11,j12,j21,j22;
156 double h = std::max(fabs(catrop_guess/100),1e-8);
161 h = std::max(fabs(z_guess/100),1e-8);
167 double one_over_det = 1.0/(j11*j22-j12*j21);
168 double u1 = one_over_det*(j22*f1 - j12*f2);
169 double u2 = one_over_det*(-j21*f1 + j11*f2);
175 norm_resid = sqrt(f1*f1+f2*f2);
193 return T0*(1+(2+
mA)*Q)/(1+Q);
197 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