//================================================================================ const tensor& DM04_PF::Dm_Dkin(const stresstensor &Stre, const straintensor &Stra, const MaterialParameter &MaterialParameter_in) const { const double oneOver3 = 1.0/3.0; const double rt23 = sqrt(2.0/3.0); tensor I2("I", 2, def_dim_2); tensor I4 = I2("ij")*I2("kl"); tensor I4s = ( I4.transpose0110() + I4.transpose0111() ) *0.5; double e0 = gete0(MaterialParameter_in); double e_r = gete_r(MaterialParameter_in); double lambda_c = getlambda_c(MaterialParameter_in); double xi = getxi(MaterialParameter_in); double Pat = getPat(MaterialParameter_in); //double m = getm(MaterialParameter_in); double M_cal = getM_cal(MaterialParameter_in); double cc = getcc(MaterialParameter_in); double A0 = getA0(MaterialParameter_in); double nd = getnd(MaterialParameter_in); stresstensor alpha = getalpha(MaterialParameter_in); stresstensor z = getz(MaterialParameter_in); stresstensor n; stresstensor alpha_d; stresstensor alpha_d_alpha; double g = 0.0; double ec = e_r; double stateParameter = 0.0; double expnd = 1.0; //double ad = 0.0; double A_d = 0.0; double B = 1.0; double C = 0.0; double D0 = 0.0; stresstensor s_bar; double norm_s = 0.0; double epsilon_v = 0.0; double e = e0; double J3D; double cos3theta = 0.0; double z_n = 0.0; double alpha_n = 0.0; double s_n = 0.0; double p = Stre.p_hydrostatic(); stresstensor s = Stre.deviator(); s_bar = s - (alpha *p); norm_s = sqrt( (s_bar("ij")*s_bar("ij")).trace() ); if (p > 0.0 && norm_s > 0.0) n = s_bar * (1.0/norm_s); J3D = n.Jinvariant3(); cos3theta = -3.0*sqrt(6.0) *J3D; if (cos3theta > 1.0) cos3theta = 1.0; if (cos3theta < -1.0) cos3theta = -1.0; g = getg(cc, cos3theta); if ( (p/Pat) >= 0.0 ) ec = getec(e_r, lambda_c, xi, Pat, p); epsilon_v = Stra.Iinvariant1(); e = e0 + (1.0 + e0) *epsilon_v; stateParameter = e - ec; expnd = exp(nd*stateParameter); alpha_n = (alpha("ij")*n("ij")).trace(); s_n = (s("ij")*n("ij")).trace(); // way 1 //ad = g*M_cal*expnd - m; //D0 = rt23 * ad - alpha_n; // way 2 D0 = rt23*g*M_cal*expnd - s_n /p; z_n = (z("ij")*n("ij")).trace(); if (z_n < 0.0) z_n = 0.0; A_d = A0 * (1.0 + z_n); B = 1.0 + 1.5 *((1.0-cc)/cc) *g *cos3theta; C = 3.0 *sqrt(1.5) *((1.0-cc)/cc) *g; tensor n_n = n("ik")*n("kj"); n_n.null_indices(); tensor nt_nt = n("ij")*n("kl"); nt_nt.null_indices(); tensor alpha_I = alpha("ij")*I2("kl"); alpha_I.null_indices(); tensor n_I = n("ij")*I2("kl"); n_I.null_indices(); // dn_dalpha: tensor dn_da = nt_nt - I4s; dn_da = dn_da *(p/norm_s); // dcos3theta_dalpha: tensor dcos3theta_da = dn_da("ijmn")*n_n("ji"); dcos3theta_da.null_indices(); dcos3theta_da = dcos3theta_da *(-3.0*sqrt(6.0)); // dg_da: tensor dg_da = dcos3theta_da *(g*g*(1.0-cc)/(2.0*cc)); // dB_da: tensor dB_da = (dg_da*cos3theta + dcos3theta_da*g) *(1.5*(1.0-cc)/cc); // dC_ds: tensor dC_da = dg_da *(3.0*sqrt(1.5)*(1.0-cc)/cc); // dR_da: tensor tensor1 = n("ij")*dB_da("mn"); tensor1.null_indices(); tensor tensor2 = n_n - I2 *oneOver3; tensor tensor3 = tensor2("ij")*dC_da("mn"); tensor3.null_indices(); tensor tensor4 = n("kj")*dn_da("ikmn"); tensor4.null_indices(); tensor4.transpose1100(); tensor dR_da = dn_da *B + tensor1 + tensor4 *(2.0*C) + tensor3; // dad_da: tensor dad_da = dg_da *(M_cal*expnd); // dD_da: // way 1 //tensor tensor5 = alpha("pq")*dn_da("pqmn"); // tensor5.null_indices(); //tensor dD_da = (dad_da *rt23 - n - tensor5) *(-A_d); // way 2 tensor tensor5 = s("pq")*dn_da("pqmn"); tensor5.null_indices(); tensor dD_da = (dad_da *rt23 - tensor5 *(1.0/p)) *(-A_d); if (z_n > 0.0) { tensor tensor6 = z("pq")*dn_da("pqmn"); tensor6.null_indices(); dD_da += tensor6 *(-A0*D0); } // dm_da: tensor tensor7 = I2("ij")*dD_da("mn"); tensor7.null_indices(); PlasticFlow::PF_tensorR4 = dR_da + tensor7 *oneOver3; return PlasticFlow::PF_tensorR4; }
void tbl_bufif (syn_ctx * ctx, char *name, int width, Opdesc const *op) { char *buf = cell_name ("%s_%d", op->name, width); assert (width > 0); if (!name) { //create definition if (!exists (ctx, buf)) { int i; char *inv1 = NULL; char **inv_en = NULL; char **tris = NULL; if (op->buf_pol) { exprInv (ctx, NULL, width); } if (!op->en_pol) { exprInv (ctx, NULL, 1); } exprTri1 (ctx, NULL); o_p ("(cell %s (celltype GENERIC)\n", buf); i_i (); o_p ("(view netlist (viewtype NETLIST)\n"); i_i (); o_p ("(interface\n"); i_i (); for (i = 0; i < width; i++) o_p ("(port A_%d (direction INPUT))\n", i); //inputs for (i = 0; i < width; i++) o_p ("(port B_%d (direction INPUT))\n", i); //the enable for (i = 0; i < width; i++) o_p ("(port Q_%d (direction OUTPUT))\n", i); //outputs i_d (); o_p (")\n"); //interface o_p ("(contents\n"); i_i (); if (op->buf_pol) { inv1 = l_n (); exprInv (ctx, inv1, width); } if (!op->en_pol) { inv_en = calloc (width, sizeof (char *)); assert (inv_en); for (i = 0; i < width; i++) { inv_en[i] = l_n (); exprInv (ctx, inv_en[i], 1); } } tris = calloc (width, sizeof (char *)); assert (tris); for (i = 0; i < width; i++) { tris[i] = l_n (); exprTri1 (ctx, tris[i]); } if (op->buf_pol) { for (i = 0; i < width; i++) { n_n (); o_p ("(portref A_%d)\n", i); o_p ("(portref A_%d (instanceref %s))\n", i, inv1); n_e (); n_n (); o_p ("(portref Q_%d (instanceref %s))\n", i, inv1); o_p ("(portref A (instanceref %s))\n", tris[i]); n_e (); } } else { for (i = 0; i < width; i++) { n_n (); o_p ("(portref A_%d)\n", i); o_p ("(portref A (instanceref %s))\n", tris[i]); n_e (); } } if (!op->en_pol) { for (i = 0; i < width; i++) { n_n (); o_p ("(portref B_%d)\n"); o_p ("(portref A (instanceref %s))\n", inv_en[i]); n_e (); n_n (); o_p ("(portref Q (instanceref %s))\n", inv_en[i]); o_p ("(portref ENA (instanceref %s))\n", tris[i]); n_e (); } } else { for (i = 0; i < width; i++) { n_n (); o_p ("(portref B_%d)\n", i); o_p ("(portref ENA (instanceref %s))\n", tris[i]); n_e (); } } for (i = 0; i < width; i++) { n_n (); o_p ("(portref Q (instanceref %s))\n", tris[i]); o_p ("(portref Q_%d)\n", i); n_e (); } i_d (); o_p (")\n"); //contents i_d (); o_p (")\n"); //view i_d (); o_p (")\n"); //cell hash_put (ctx, buf); for (i = 0; i < width; i++) free (tris[i]); free (tris); if (!op->en_pol) { for (i = 0; i < width; i++) free (inv_en[i]); free (inv_en); } if (op->buf_pol) free (inv1); } } else { o_p ("(instance %s (viewref netlist (cellref %s (libraryref DESIGNS))))\n", name, buf); } free (buf); }