| 848 | } |
| 849 | |
| 850 | int |
| 851 | Newmark::saveSensitivity(const Vector & vNew,int gradNum,int numGrads) |
| 852 | { |
| 853 | |
| 854 | if (displ != 1) { |
| 855 | opserr << "ERROR: Newmark::saveSensitivity() -- the implemented" |
| 856 | << " scheme only works if the displ variable is set to 1." << endln; |
| 857 | return 0; |
| 858 | } |
| 859 | |
| 860 | // Compute Newmark parameters in general notation |
| 861 | double a1 = c3; |
| 862 | double a2 = -c3; |
| 863 | double a3 = -c2/gamma; |
| 864 | double a4 = 1.0 - 1.0/(2.0*beta); |
| 865 | double a5 = c2; |
| 866 | double a6 = -c2; |
| 867 | double a7 = 1.0 - gamma/beta; |
| 868 | double dt = gamma/(beta*c2); |
| 869 | double a8 = dt*(1.0 - gamma/(2.0*beta)); |
| 870 | |
| 871 | |
| 872 | |
| 873 | // Obtain sensitivity vectors from previous step modified by lei July 2018 |
| 874 | int vectorSize = U->Size(); |
| 875 | Vector dUn(vectorSize); |
| 876 | Vector dVn(vectorSize); |
| 877 | Vector dAn(vectorSize); |
| 878 | int i, loc; |
| 879 | |
| 880 | AnalysisModel *myModel = this->getAnalysisModel(); |
| 881 | DOF_GrpIter &theDOFs = myModel->getDOFs(); |
| 882 | DOF_Group *dofPtr; |
| 883 | while ((dofPtr = theDOFs()) != 0) { |
| 884 | |
| 885 | const ID &id = dofPtr->getID(); |
| 886 | int idSize = id.Size(); |
| 887 | const Vector &dispSens = dofPtr->getDispSensitivity(gradNumber); |
| 888 | for (i = 0; i < idSize; i++) { |
| 889 | loc = id(i); |
| 890 | if (loc >= 0) { |
| 891 | dUn(loc) = dispSens(i); |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | const Vector &velSens = dofPtr->getVelSensitivity(gradNumber); |
| 896 | for (i = 0; i < idSize; i++) { |
| 897 | loc = id(i); |
| 898 | if (loc >= 0) { |
| 899 | dVn(loc) = velSens(i); |
| 900 | } |
| 901 | } |
| 902 | |
| 903 | const Vector &accelSens = dofPtr->getAccSensitivity(gradNumber); |
| 904 | for (i = 0; i < idSize; i++) { |
| 905 | loc = id(i); |
| 906 | if (loc >= 0) { |
| 907 | dAn(loc) = accelSens(i); |
no test coverage detected