scalar P_alpha(scalar x,sasfit_param * param) { ALPHA = x; if (EPSILON == 1.0) { return P_theta(1.0,param)*sin(ALPHA); } else { return sasfit_integrate(0.0,M_PI/2.0,&P_theta,param)*2.0/M_PI*sin(ALPHA); } }
void umat_plasticity_kin_iso_CCP(const vec &Etot, const vec &DEtot, vec &sigma, mat &Lt, mat &L, vec &sigma_in, const mat &DR, const int &nprops, const vec &props, const int &nstatev, vec &statev, const double &T, const double &DT, const double &Time, const double &DTime, double &Wm, double &Wm_r, double &Wm_ir, double &Wm_d, const int &ndi, const int &nshr, const bool &start, const int &solver_type, double &tnew_dt) { UNUSED(nprops); UNUSED(nstatev); UNUSED(Time); UNUSED(DTime); UNUSED(nshr); UNUSED(tnew_dt); //From the props to the material properties double E = props(0); double nu= props(1); double alpha_iso = props(2); double sigmaY = props(3); double k=props(4); double m=props(5); double kX = props(6); //definition of the CTE tensor vec alpha = alpha_iso*Ith(); ///@brief Temperature initialization double T_init = statev(0); //From the statev to the internal variables double p = statev(1); vec EP(6); EP(0) = statev(2); EP(1) = statev(3); EP(2) = statev(4); EP(3) = statev(5); EP(4) = statev(6); EP(5) = statev(7); ///@brief a is the internal variable associated with kinematical hardening vec a = zeros(6); a(0) = statev(8); a(1) = statev(9); a(2) = statev(10); a(3) = statev(11); a(4) = statev(12); a(5) = statev(13); //Rotation of internal variables (tensors) EP = rotate_strain(EP, DR); a = rotate_strain(a, DR); ///@brief Initialization if(start) { //Elstic stiffness tensor L = L_iso(E, nu, "Enu"); T_init = T; vec vide = zeros(6); sigma = vide; EP = vide; a = vide; p = 0.; Wm = 0.; Wm_r = 0.; Wm_ir = 0.; Wm_d = 0.; } //Additional parameters and variables vec X = kX*(a%Ir05()); double Hp=0.; double dHpdp=0.; if (p > iota) { dHpdp = m*k*pow(p, m-1); Hp = k*pow(p, m); } else { dHpdp = 0.; Hp = 0.; } //Variables values at the start of the increment vec sigma_start = sigma; vec EP_start = EP; vec a_start = a; vec X_start = X; double A_p_start = -Hp; vec A_a_start = -X_start; //Variables required for the loop vec s_j = zeros(1); s_j(0) = p; vec Ds_j = zeros(1); vec ds_j = zeros(1); ///Elastic prediction - Accounting for the thermal prediction vec Eel = Etot + DEtot - alpha*(T+DT-T_init) - EP; sigma = el_pred(L, Eel, ndi); //Define the plastic function and the stress vec Phi = zeros(1); mat B = zeros(1,1); vec Y_crit = zeros(1); double dPhidp=0.; vec dPhida = zeros(6); vec dPhidsigma = zeros(6); double dPhidtheta = 0.; //Compute the explicit flow direction vec Lambdap = eta_stress(sigma-X); vec Lambdaa = eta_stress(sigma-X); std::vector<vec> kappa_j(1); kappa_j[0] = L*Lambdap; mat K = zeros(1,1); //Loop parameters int compteur = 0; double error = 1.; //Loop for (compteur = 0; ((compteur < maxiter_umat) && (error > precision_umat)); compteur++) { p = s_j(0); if (p > iota) { dHpdp = m*k*pow(p, m-1); Hp = k*pow(p, m); } else { dHpdp = 0.; Hp = 0.; } dPhidsigma = eta_stress(sigma-X); dPhidp = -1.*dHpdp; dPhida = -1.*kX*(eta_stress(sigma - X)%Ir05()); //compute Phi and the derivatives Phi(0) = Mises_stress(sigma-X) - Hp - sigmaY; Lambdap = eta_stress(sigma-X); Lambdaa = eta_stress(sigma-X); kappa_j[0] = L*Lambdap; K(0,0) = dPhidp + sum(dPhida%Lambdaa); B(0, 0) = -1.*sum(dPhidsigma%kappa_j[0]) + K(0,0); Y_crit(0) = sigmaY; Fischer_Burmeister_m(Phi, Y_crit, B, Ds_j, ds_j, error); s_j(0) += ds_j(0); EP = EP + ds_j(0)*Lambdap; a = a + ds_j(0)*Lambdaa; X = kX*(a%Ir05()); //the stress is now computed using the relationship sigma = L(E-Ep) Eel = Etot + DEtot - alpha*(T + DT - T_init) - EP; sigma = el_pred(L, Eel, ndi); } //Computation of the increments of variables vec Dsigma = sigma - sigma_start; vec DEP = EP - EP_start; double Dp = Ds_j[0]; vec Da = a - a_start; if (solver_type == 0) { //Computation of the tangent modulus mat Bhat = zeros(1, 1); Bhat(0, 0) = sum(dPhidsigma%kappa_j[0]) - K(0,0); vec op = zeros(1); mat delta = eye(1,1); for (int i=0; i<1; i++) { if(Ds_j[i] > iota) op(i) = 1.; } mat Bbar = zeros(1,1); for (int i = 0; i < 1; i++) { for (int j = 0; j < 1; j++) { Bbar(i, j) = op(i)*op(j)*Bhat(i, j) + delta(i,j)*(1-op(i)*op(j)); } } mat invBbar = zeros(1, 1); mat invBhat = zeros(1, 1); invBbar = inv(Bbar); for (int i = 0; i < 1; i++) { for (int j = 0; j < 1; j++) { invBhat(i, j) = op(i)*op(j)*invBbar(i, j); } } std::vector<vec> P_epsilon(1); P_epsilon[0] = invBhat(0, 0)*(L*dPhidsigma); std::vector<double> P_theta(1); P_theta[0] = dPhidtheta - sum(dPhidsigma%(L*alpha)); Lt = L - (kappa_j[0]*P_epsilon[0].t()); } else if(solver_type == 1) { sigma_in = -L*EP; } double A_p = -Hp; vec A_a = -X; double Dgamma_loc = 0.5*sum((sigma_start+sigma)%DEP) + 0.5*(A_p_start + A_p)*Dp + 0.5*sum((A_a_start + A_a)%Da); //Computation of the mechanical and thermal work quantities Wm += 0.5*sum((sigma_start+sigma)%DEtot); Wm_r += 0.5*sum((sigma_start+sigma)%(DEtot-DEP)) - 0.5*sum((A_a_start + A_a)%Da); Wm_ir += -0.5*(A_p_start + A_p)*Dp; Wm_d += Dgamma_loc; ///@brief statev evolving variables //statev statev(0) = T_init; statev(1) = p; statev(2) = EP(0); statev(3) = EP(1); statev(4) = EP(2); statev(5) = EP(3); statev(6) = EP(4); statev(7) = EP(5); statev(8) = a(0); statev(9) = a(1); statev(10) = a(2); statev(11) = a(3); statev(12) = a(4); statev(13) = a(5); }