int ViscousDamper::setTrialStrain(double strain, double strainRate) { //all variables to the last commit this->revertToLastCommit(); // Determine the strain rate and acceleration //double dStrain = (strain - Tstrain); double dVel, fd0, acc, vel1, vel0; if (fabs(strainRate) == 0.0) { //static analysis dVel = 0.0; acc = 0.0; } else { //dVel = dStrain/ops_Dt; dVel = strainRate; acc = (dVel - TdVel)/ops_Dt; } double smin = pow(0.5,MaxHalf); double s = 1.0; double stot = 0.0; double it = 0.0; fd0 = Tstress; double h, yt, eps; vel0 = TdVel; // Velocity of the previous step. while (it < 1.0) { h = s * ops_Dt; // Time step vel1 = vel0 + acc * h; // Velocity at the time step h // Selection of Numerical Method to solve the ODE if (NM == 1.0) { DormandPrince(vel0, vel1, fd0, h, yt, eps); } if (NM == 2.0) { ABM6(vel0, vel1, fd0, h, yt, eps); } if (NM == 3.0) { ROS(vel0, vel1, fd0, h, yt, eps); } // Error check: Adaptive Step Size if ((eps <= Tol) || (s == smin)) { vel0 = vel1; fd0 = yt; stot = stot+s; }else { if (s > smin) { s=0.5*s; // step gets smaller -now try this step again. } else { s=smin; } } if (stot == 1.0) { // The total internal stepsize reached dt it=1.0; } } // Total Stress Tstress = fd0; Tstrain = strain; TdVel = dVel; Ttangent = 0.; //// Total strain in the elastic part of the damper //double Tstrains = fd0/K; // //// Total strain in the viscous part of the damper // double Tstraind = strain - Tstrains; return 0; }
int ViscousDamper::setTrialStrain(double strain, double strainRate) { //all variables to the last commit this->revertToLastCommit(); // Determine the strain rate and acceleration double Vel, fd0, acc, vel1, vel0; if (fabs(strainRate) == 0.0) { //static analysis Vel = 0.0; acc = 0.0; } else { Vel = strainRate; acc = (Vel - TVel)/ops_Dt; } double smin = pow(0.5,MaxHalf); double s = 1.0; double stot = 0.0; double it = 0.0; fd0 = Tstress; double h, yt, eps, error; vel0 = TVel; // Velocity of the previous step. while (it < 1.0) { //iteration h = s * ops_Dt; // Time step vel1 = vel0 + acc * h; // Velocity at the time step h // Selection of Numerical Method to solve the ODE if (NM == 1.0) { DormandPrince(vel0, vel1, fd0, h, yt, eps, error); } if (NM == 2.0) { ABM6(vel0, vel1, fd0, h, yt, eps, error); } if (NM == 3.0) { ROS(vel0, vel1, fd0, h, yt, eps, error); } // Error check: Adaptive Step Size if ((eps <= RelTol) || (s == smin) || (fabs(error) <= AbsTol)) { vel0 = vel1; fd0 = yt; stot = stot+s; } else { if (s > smin) { s=0.5*s; // step gets smaller -now try this step again. } else { s=smin; } } if (stot == 1.0) { // The total internal stepsize reached dt it=1.0; } } // Effect of gap start if (LGap > 0.) { double dStrain = (strain - Tstrain); if ((fd0 > 0) && (Tstress < 0)) { //from negtive to positive Tpugr = Tstrain + dStrain * fabs(fd0)/fabs(fd0 - Tstress); // aproximate displacement for gap initiation Tnugr = 0.; if (fabs(strain-Tpugr) < LGap) { fd0 = 0.; } } if ((fd0 < 0) && (Tstress > 0)) { //from positive to negative Tnugr = Tstrain + dStrain * fabs(fd0)/fabs(fd0 - Tstress); // aproximate displacement for gap initiation Tpugr = 0.; if (fabs(strain-Tnugr) < LGap) { fd0 = 0.; } } // After gap inititon if ((fabs(Tpugr) > 0.) && (Tstress == 0)) { //from negtive to positive if ((strain > Tpugr) && ((strain-Tpugr) < LGap)) { fd0 = 0.; } } if ((fabs(Tnugr) > 0.) && (Tstress == 0)) { //from positive to negative if ((strain < Tnugr) && ((strain-Tnugr) > -LGap)) { fd0 = 0.; } } } // Effect of gap end Tstress = fd0; // Stress TVel = Vel; Tstrain = strain; return 0; }