def __call__(self, eps, lambd, xi, E_mod, theta, A): ''' Implements the response function with arrays as variables. first extract the variable discretizations from the orthogonal grid. ''' # NOTE: as each variable is an array oriented in different direction # the algebraic expressions (-+*/) perform broadcasting,. i.e. performing # the operation for all combinations of values. Thus, the resulgin eps # is contains the value of local strain for any combination of # global strain, xi, theta and lambda # eps_ = (eps - theta * (1 + lambd)) / ((1 + theta) * (1 + lambd)) # cut off all the negative strains due to delayed activation # eps_ *= Heaviside(eps_) # broadcast eps also in the xi - dimension # (by multiplying with array containing ones with the same shape as xi ) # eps_grid = eps_ * Heaviside(xi - eps_) # cut off all the realizations with strain greater than the critical one. # # eps_grid[ eps_grid >= xi ] = 0 # transform it to the force # q_grid = E_mod * A * eps_grid return q_grid
def __call__(self, w, fu, qf, L, A, E_mod, z, phi, f): '''Lexically optimized expresseion - each result is calculated only once. Further optimization possible by printing out the shape and doing inplace operation where possible. However, this does not seem to have a significant effect. ''' t4 = sqrt(w * E_mod * A * qf) t5 = f * phi t6 = exp(t5) t7 = t4 * t6 t11 = Heaviside(fu * A - 0.1000000000e1 * t7) t12 = exp(t5); t14 = 0.5000000000e0 * L t15 = cos(phi) t17 = z / t15 t18 = t14 - t17 t19 = pow(t18, 0.20e1) t24 = t12 * qf * t19 / E_mod / A t25 = t24 - w t26 = Heaviside(t25) t28 = Heaviside(t18) t32 = t18 * qf t38 = (t32 + t32 / (t14 - t17 - t24) * t25) * t6 t39 = Heaviside(t38) t40 = Heaviside(-t25) res = 0.1000000000e1 * t7 * t11 * t26 * t28 + t38 * t39 * t40 return res
def __call__(self, w, x, tau, l, D_f, E_f, theta, xi, phi, Ll, Lr): T = tau * phi * D_f * pi q = super(CBClampedFiberSP, self).__call__(w, tau, l, D_f, E_f, theta, xi, phi, Ll, Lr) q_x = q * Heaviside(l / 2. - abs(x)) + (q - T * (abs(x) - l / 2.)) * Heaviside(abs(x) - l / 2.) q_x = q_x * Heaviside(x + Ll) * Heaviside(Lr - x) q_x = q_x * Heaviside(q_x) return q_x
def __callx__(self, w, fu, qf, L, A, E_mod, z, phi, f): '''Intial vectorized implementation - without regarding the lexical structure of the expression. ''' Le = L / 2. - z / cos(phi) w_deb = e ** (f * phi) * qf * Le ** 2.0 / E_mod / A P_deb_full = sqrt(2. * w / 2. * E_mod * A * qf) * e ** (f * phi) P_deb = P_deb_full * Heaviside(fu * A - P_deb_full) * Heaviside(w_deb - w) * Heaviside(Le) P_pull_x = (Le * qf - Le * qf / (Le - w_deb) * (w - w_deb)) * e ** (f * phi) P_pull = P_pull_x * Heaviside(P_pull_x) * Heaviside(w - w_deb) return P_deb + P_pull
def __call__(self, w, tau, l, D_f, E_f, theta, xi, phi, Ll, Lr): A = pi * D_f**2 / 4. Lmin = minimum(Ll, Lr) Lmax = maximum(Ll, Lr) Lmin = maximum(Lmin - l / 2., 0) Lmax = maximum(Lmax - l / 2., 0) l = minimum(Lr + Ll, l) l = l * (1 + theta) w = w - theta * l T = tau * phi * D_f * pi # double sided debonding l0 = l / 2. q0 = (-l0 * T + sqrt((l0 * T)**2 + w * Heaviside(w) * E_f * A * T)) # displacement at which the debonding to the closer clamp is finished # the closer distance is min(L1,L2) w0 = Lmin * T * (Lmin + 2 * l0) / E_f / A # debonding from one side; the other side is clamped # equal to L1*T + one sided pullout with embedded length Lmax - Lmin and free length 2*L1 + l # force at w0 Q0 = Lmin * T l1 = 2 * Lmin + l q1 = (-(l1) * T + sqrt((l1 * T)**2 + 2 * (w - w0) * Heaviside(w - w0) * E_f * A * T)) + Q0 # displacement at debonding finished at both sides # equals a force of T*(larger clamp distance) # displacement, at which both sides are debonded w1 = w0 + (Lmax - Lmin) * T * ((Lmax - Lmin) + 2 * (l + 2 * Lmin)) / 2 / E_f / A # linear elastic response with stiffness EA/(clamp distance) q2 = E_f * A * (w - w1) / (Lmin + Lmax + l) + (Lmax) * T q0 = q0 * Heaviside(w0 - w) q1 = q1 * Heaviside(w - w0) * Heaviside(w1 - w) q2 = q2 * Heaviside(w - w1) q = q0 + q1 + q2 # include breaking strain q = q * Heaviside(A * E_f * xi - q) #return q0, q1, q2 * Heaviside( A * E_f * xi - q2 ), w0 + theta * l, w1 + theta * l return q
def __call__(self, e, la, xi): ''' Response function of a single fiber ''' return la * e * Heaviside(xi - e)