int DisplacementControl::newStep(void) { if (theDofID == -1) { opserr << "DisplacementControl::newStep() - domainChanged has not been called\n"; return -1; } // get pointers to AnalysisModel and LinearSOE AnalysisModel *theModel = this->getAnalysisModel(); LinearSOE *theLinSOE = this->getLinearSOE(); if (theModel == 0 || theLinSOE == 0) { opserr << "WARNING DisplacementControl::newStep() "; opserr << "No AnalysisModel or LinearSOE has been set\n"; return -1; } // determine increment for this iteration double factor = specNumIncrStep/numIncrLastStep; theIncrement *=factor; if (theIncrement < minIncrement) theIncrement = minIncrement; else if (theIncrement > maxIncrement) theIncrement = maxIncrement; // get the current load factor currentLambda = theModel->getCurrentDomainTime(); // determine dUhat this->formTangent(); theLinSOE->setB(*phat); if (theLinSOE->solve() < 0) { opserr << "DisplacementControl::newStep(void) - failed in solver\n"; return -1; } (*deltaUhat) = theLinSOE->getX(); Vector &dUhat = *deltaUhat; double dUahat = dUhat(theDofID); if (dUahat == 0.0) { opserr << "WARNING DisplacementControl::newStep() "; opserr << "dUahat is zero -- zero reference displacement at control node DOF\n"; return -1; } // determine delta lambda(1) == dlambda double dLambda = theIncrement/dUahat; deltaLambdaStep = dLambda; currentLambda += dLambda; // opserr << "DisplacementControl: " << dUahat << " " << theDofID << endln; // opserr << "DisplacementControl::newStep() : " << deltaLambdaStep << endln; // determine delta U(1) == dU (*deltaU) = dUhat; (*deltaU) *= dLambda; (*deltaUstep) = (*deltaU); // update model with delta lambda and delta U theModel->incrDisp(*deltaU); theModel->applyLoadDomain(currentLambda); if (theModel->updateDomain() < 0) { opserr << "DisplacementControl::newStep - model failed to update for new dU\n"; return -1; } numIncrLastStep = 0; return 0; }
int DisplacementPath::newStep(void) { if (theDofID == -1) { opserr << "DisplacementPath::newStep() - domainChanged has not been called\n"; return -1; } // get pointers to AnalysisModel and LinearSOE AnalysisModel *theModel = this->getAnalysisModel(); LinearSOE *theLinSOE = this->getLinearSOE(); if (theModel == 0 || theLinSOE == 0) { opserr << "WARNING DisplacementPath::newStep() "; opserr << "No AnalysisModel or LinearSOE has been set\n"; return -1; } // check theIncrementVector Vector if ( theIncrementVector == 0 ) { opserr << "DisplacementPath::newStep() - no theIncrementVector associated with object\n"; return -2; } // determine increment for this iteration if (currentStep < theIncrementVector->Size()) { theCurrentIncrement = (*theIncrementVector)(currentStep); } else { theCurrentIncrement = 0.0; opserr << "DisplacementPath::newStep() - reach the end of specified load path\n"; opserr << " - setting theCurrentIncrement = 0.0\n"; } // get the current load factor currentLambda = theModel->getCurrentDomainTime(); // determine dUhat and dUabar this->formTangent(); this->formUnbalance(); (*deltaUbar) = theLinSOE->getX(); double dUabar = (*deltaUbar)(theDofID); theLinSOE->setB(*phat); if (theLinSOE->solve() < 0) { opserr << "DisplacementControl::newStep(void) - failed in solver\n"; return -1; } (*deltaUhat) = theLinSOE->getX(); Vector &dUhat = *deltaUhat; double dUahat = dUhat(theDofID); //opserr << " newStep( ) " << endln; //opserr << " theDofID = " << theDofID << endln; //opserr << "dUahat = " << dUahat << endln; if (dUahat == 0.0) { opserr << "WARNING DisplacementPath::newStep() "; opserr << "dUahat is zero -- zero reference displacement at control node DOF\n"; opserr << "currentStep = " << currentStep << endln; // add by zhong opserr << " theCurrentIncrement = " << theCurrentIncrement << endln; // zhong return -1; } // determine delta lambda(1) == dlambda double dLambda = (theCurrentIncrement-dUabar)/dUahat; deltaLambdaStep = dLambda; currentLambda += dLambda; // opserr << "DisplacementPath: " << dUahat << " " << theDofID << endln; // opserr << "DisplacementPath::newStep() : " << deltaLambdaStep << endln; // determine delta U(1) == dU (*deltaU) = dUhat; (*deltaU) *= dLambda; (*deltaUstep) = (*deltaU); // update model with delta lambda and delta U theModel->incrDisp(*deltaU); theModel->applyLoadDomain(currentLambda); if (theModel->updateDomain() < 0) { opserr << "DisplacementPath::newStep - model failed to update for new dU\n"; return -1; } currentStep++; return 0; }