| 539 | |
| 540 | |
| 541 | static double |
| 542 | determineDt(double dT, |
| 543 | double dtMin, |
| 544 | double dtMax, |
| 545 | int Jd, |
| 546 | ConvergenceTest *theTest) |
| 547 | { |
| 548 | double newDt = dT; |
| 549 | |
| 550 | // get the number of trial steps in the last solveCurrentStep() |
| 551 | double numLastIter = 1.0; |
| 552 | if (theTest != 0) |
| 553 | numLastIter = theTest->getNumTests(); |
| 554 | |
| 555 | |
| 556 | // determine new dT based on last dT and Jd and #iter of last step |
| 557 | double factor = Jd/numLastIter; |
| 558 | newDt *= factor; |
| 559 | |
| 560 | // ensure: dtMin <~~ dT <= dtMax |
| 561 | if (newDt < dtMin) |
| 562 | newDt = dtMin - DBL_EPSILON; // to ensure we get out of the analysis |
| 563 | // loop if can't converge on next step |
| 564 | else if (newDt > dtMax) |
| 565 | newDt = dtMax; |
| 566 | |
| 567 | return newDt; |
| 568 | } |
| 569 | |
| 570 | |
| 571 | int |
no test coverage detected