| 79 | } |
| 80 | |
| 81 | int |
| 82 | PFEMAnalysis::analyze(bool flush) |
| 83 | { |
| 84 | Domain* theDomain = this->getDomainPtr(); |
| 85 | double current = theDomain->getCurrentTime(); |
| 86 | if(newstep) { |
| 87 | next = current + dtmax; |
| 88 | } |
| 89 | bool instep = false; |
| 90 | |
| 91 | while(true) { |
| 92 | |
| 93 | // identify domain |
| 94 | if (this->identify() < 0) { |
| 95 | opserr<<"WARNING: failed to identify domain -- PFEMAnalysis\n"; |
| 96 | return -1; |
| 97 | } |
| 98 | |
| 99 | // analyze |
| 100 | #ifdef _PARALLEL_INTERPRETERS |
| 101 | int myid; |
| 102 | MPI_Comm_rank(MPI_COMM_WORLD, &myid); |
| 103 | if(myid == 0) { |
| 104 | opserr<<"\n\nTime = "<<current<<", dt = "<<dt<<"\n\n"; |
| 105 | } |
| 106 | #else |
| 107 | opserr<<"\n\nTime = "<<current<<", dt = "<<dt<<"\n\n"; |
| 108 | #endif |
| 109 | |
| 110 | // analysis |
| 111 | int converged = DirectIntegrationAnalysis::analyze(1, dt); |
| 112 | |
| 113 | // if failed |
| 114 | if(converged < 0) { |
| 115 | dt *= ratio; |
| 116 | if(dt < dtmin) { |
| 117 | return -1; |
| 118 | } |
| 119 | instep = true; |
| 120 | newstep = false; |
| 121 | continue; |
| 122 | } |
| 123 | |
| 124 | // if converged |
| 125 | if(instep) { |
| 126 | current = theDomain->getCurrentTime(); |
| 127 | dt = next - current; |
| 128 | } else { |
| 129 | newstep = true; |
| 130 | dt = dtmax; |
| 131 | } |
| 132 | |
| 133 | break; |
| 134 | } |
| 135 | |
| 136 | Domain* the_Domain = this->getDomainPtr(); |
| 137 | if (the_Domain != 0 && flush) { |
| 138 | the_Domain->flushRecorders(); |