Commit 890353f1 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

fix flat rate particle mortality

parent d496ef2b
...@@ -843,7 +843,7 @@ int dgParticleTracker2D::isDead(double t) ...@@ -843,7 +843,7 @@ int dgParticleTracker2D::isDead(double t)
case 0: case 0:
return 0; return 0;
case 1: /* Const. mortality rate */ case 1: /* Const. mortality rate */
mortRatePerDt = _dt * _mortRate_max/(3600.0*24.0); mortRatePerDt = 1-pow(1-_mortRate_max, _dt/(3600*24));
if ( ((randoraw()/2)+0.5) < mortRatePerDt ) return 1; if ( ((randoraw()/2)+0.5) < mortRatePerDt ) return 1;
else return 0; else return 0;
case 2: /* Weibull mortality rate */ case 2: /* Weibull mortality rate */
......
...@@ -370,6 +370,9 @@ public: ...@@ -370,6 +370,9 @@ public:
void addMortality(int type, double rateMax, double weibullLambda = 0, double weibullNu = 0) { void addMortality(int type, double rateMax, double weibullLambda = 0, double weibullNu = 0) {
_mortFlag = true; _mortFlag = true;
_mortType = type; _mortType = type;
if (type != 1) {
Msg::Warning("Weibull mortality implementation may be wrong\n");
}
_mortRate_max = rateMax; _mortRate_max = rateMax;
_mortLambda = weibullLambda; //(Connolly & Baird 2010)lambda = 1/b(Pinder et al. 1978) _mortLambda = weibullLambda; //(Connolly & Baird 2010)lambda = 1/b(Pinder et al. 1978)
_mortNu = weibullNu; //(Connolly & Baird 2010)nu = c(Pinder et al. 1978) _mortNu = weibullNu; //(Connolly & Baird 2010)nu = c(Pinder et al. 1978)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment