示例#1
0
    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
示例#2
0
 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
示例#3
0
        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.
            '''
            eps_ = (eps - theta * (1 + lambd)) / ((1 + theta) * (1 + lambd))

            eps_ *= Heaviside(eps_)
            eps_grid = eps_ * Heaviside(xi - eps_)
            q_grid = E_mod * A * eps_grid

            return q_grid
示例#4
0
 def __call__(self, e, la, xi):
     ''' Response function of a single fiber '''
     return la * e * Heaviside(xi - e)