| 569 | |
| 570 | |
| 571 | int |
| 572 | BasicAnalysisBuilder::analyzeVariable(int numSteps, double dT, double dtMin, double dtMax, int Jd) |
| 573 | { |
| 574 | |
| 575 | // set some variables |
| 576 | int result = 0; |
| 577 | double totalTimeIncr = numSteps * dT; |
| 578 | double currentTimeIncr = 0.0; |
| 579 | double currentDt = dT; |
| 580 | |
| 581 | // loop until analysis has performed the total time incr requested |
| 582 | while (currentTimeIncr < totalTimeIncr) { |
| 583 | |
| 584 | if (theAnalysisModel->analysisStep(currentDt) < 0) { |
| 585 | opserr << "DirectIntegrationAnalysis::analyze() - the AnalysisModel failed in newStepDomain"; |
| 586 | opserr << " at time " << theDomain->getCurrentTime() << "\n"; |
| 587 | theDomain->revertToLastCommit(); |
| 588 | return -2; |
| 589 | } |
| 590 | |
| 591 | // check if domain has undergone change |
| 592 | int stamp = theDomain->hasDomainChanged(); |
| 593 | if (stamp != domainStamp) { |
| 594 | domainStamp = stamp; |
| 595 | if (this->domainChanged() < 0) { |
| 596 | opserr << "DirectIntegrationAnalysis::analyze() - domainChanged() failed\n"; |
| 597 | return -1; |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | // |
| 602 | // do newStep(), solveCurrentStep() and commit() as in regular |
| 603 | // DirectINtegrationAnalysis - difference is we do not return |
| 604 | // if a failure - we stop the analysis & resize time step if failure |
| 605 | // |
| 606 | |
| 607 | if (theTransientIntegrator->newStep(currentDt) < 0) { |
| 608 | result = -2; |
| 609 | } |
| 610 | |
| 611 | |
| 612 | if (result >= 0) { |
| 613 | result = theAlgorithm->solveCurrentStep(); |
| 614 | if (result < 0) |
| 615 | result = -3; |
| 616 | } |
| 617 | |
| 618 | if (result >= 0) { |
| 619 | result = theTransientIntegrator->commit(); |
| 620 | if (result < 0) |
| 621 | result = -4; |
| 622 | } |
| 623 | |
| 624 | // if the time step was successful increment delta T for the analysis |
| 625 | // otherwise revert the Domain to last committed state & see if can go on |
| 626 | |
| 627 | if (result >= 0) |
| 628 | currentTimeIncr += currentDt; |
no test coverage detected