Пример #1
0
def profiles():
    reinf = ContinuousFibers(r=0.0035,
                      tau=RV('uniform', loc=1., scale=3.0),
                      V_f=0.1,
                      E_f=200e3,
                      xi=RV('weibull_min', loc=0., shape=1000., scale=.01),
                      label='carbon',
                      n_int=30)

    ccb = CompositeCrackBridge(E_m=25e3,
                                 reinforcement_lst=[reinf],
                                 Ll=1.,
                                 Lr=1.,
                                 w=.0056)

#     ccb = CompositeCrackBridge(E_m=25e13,
#                                  reinforcement_lst=[reinf],
#                                  Ll=2.,
#                                  Lr=2.,
#                                  w=.0088)

    ccb.damage
    for i, depsf in enumerate(ccb.sorted_depsf):
        epsf_x = np.maximum(ccb._epsf0_arr[i] - depsf * np.abs(ccb._x_arr), ccb._epsm_arr)
        if i == 0:
            plt.plot(ccb._x_arr, epsf_x, color='black', label='fibers')
        else:
            plt.plot(ccb._x_arr, epsf_x, color='black')
    plt.plot(ccb._x_arr, ccb._epsm_arr, lw=2, color='blue', label='matrix')
    plt.legend(loc='best')
    plt.ylabel('matrix and fiber strain [-]')
    plt.ylabel('long. position [mm]')
    plt.show()
Пример #2
0
def fcn2min(params, x, data):
    shape = params['shape'].value
    scale = params['scale'].value
    loc = params['loc'].value
#         m = params['f_shape'].value
#     sV0 = params['f_scale'].value
    sV0 = 0.0076
    m = 6.7

    tau = RV('gamma', shape=shape, scale=scale, loc=loc)
    n_int = 500
    p_arr = np.linspace(0.5 / n_int, 1 - 0.5 / n_int, n_int)
    tau_arr = tau.ppf(p_arr) + 1e-10
    r = 3.5e-3
    E_f = 182e3
    T = 2. * tau_arr / r
    # scale parameter with respect to a reference volume
    s = ((T * (m + 1.) * sV0 ** m) /
         (2. * E_f * pi * r ** 2)) ** (1. / (m + 1.))
    ef0 = np.sqrt(x[:, np.newaxis] * T[np.newaxis, :] / E_f)
    Gxi = 1 - np.exp(-(ef0 / s) ** (m + 1.))
    mu_int = ef0 * (1 - Gxi)
    sigma = mu_int * E_f

    return np.sum(sigma, axis=1) / n_int * (11. * 0.445) / 1000 - data
Пример #3
0
 def T_effect():
     strength_CB = []
     strength_MC = []
     m_arr = np.linspace(.5, 5., 30)
     for m in m_arr:
         # strengths.append(sigmac_max(l)[0])
         # print 'strentgth = ', strengths[-1]
         w_CB = np.linspace(0.0, .5, 100)
         w_MC = np.linspace(0.0, .03, 100)
         sigma_c_CB = -sigmac(
             w_CB, 1000., RV('weibull_min', shape=m, scale=0.1, loc=0.0),
             5.0)
         sigma_c_MC = -sigmac(
             w_MC, 1.0, RV('weibull_min', shape=m, scale=0.1, loc=0.0), 5.0)
         strength_CB.append(np.max(sigma_c_CB))
         strength_MC.append(np.max(sigma_c_MC))
 #         plt.plot(w_CB, sigma_c_CB, label='CB')
 #         plt.plot(w_CB, sigma_c_MC, label='MC')
 #         plt.show()
     COV = [
         np.sqrt(weibull_min(m, scale=0.1).var()) /
         weibull_min(m, scale=0.1).mean() for m in m_arr
     ]
     CB_arr = np.ones_like(np.array([strength_CB]))
     MC_arr = np.array([strength_MC]) / np.array([strength_CB])
     plt.plot(COV, CB_arr.flatten())
     plt.plot(COV, MC_arr.flatten())
     plt.ylim(0)
     plt.show()
Пример #4
0
 def mean_CB():
     w_arr = np.linspace(0., .5, 200)
     micro = GFRCMicro(FilamentCB=CBShortFiber)
     meso = GFRCMeso(micro_model=micro, N_fil=100)
     macro = GFRCMacro(meso_model=meso,
                       W=40.,
                       H=40.,
                       L=200.,
                       Lf=18.,
                       Vf=.001)
     theta_dict = dict(tau=RV('uniform', loc=0.001, scale=0.4),
                       r=3.5e-3,
                       E_f=70e3,
                       le=9.0,
                       phi=0.0,
                       snub=0.5,
                       xi=RV('weibull_min', shape=5., scale=0.025),
                       spall=0.5)
     mean_r, var_r = macro.mean_response(w_arr, theta_dict)
     plt.plot(w_arr,
              mean_r,
              lw=2,
              label='tau $\sim$ $\mathcal{U}(0.1,0.8)$')
     plt.plot(w_arr, mean_r + np.sqrt(var_r), lw=2)
     plt.plot(w_arr, mean_r - np.sqrt(var_r), lw=2)
     plt.xlabel('crack opening w [mm]')
     plt.ylabel('force [N]')
     plt.legend(loc='best')
     plt.show()
Пример #5
0
def k_COV_plots(k_arr, COV_arr):
    sig_max_arr = np.zeros((len(k_arr), len(COV_arr)))
    wmax_arr = np.zeros((len(k_arr), len(COV_arr)))
    mu_r, mu_tau = 0.01, 0.1
    for i, k in enumerate(k_arr):
        for j, cov in enumerate(COV_arr):
            Vf = Vf_k(k)
            loc_r = mu_r * (1 - cov * np.sqrt(3.0))
            scale_r = cov * 2 * np.sqrt(3.0) * mu_r
            loc_tau = mu_tau * (1 - cov * np.sqrt(3.0))
            scale_tau = cov * 2 * np.sqrt(3.0) * mu_tau
            reinf = ContinuousFibers(r=RV('uniform', loc=loc_r, scale=scale_r),
                                     tau=RV('uniform',
                                            loc=loc_tau,
                                            scale=scale_tau),
                                     xi=WeibullFibers(shape=7.0, sV0=0.003),
                                     V_f=Vf,
                                     E_f=200e3,
                                     n_int=100)
            ccb_view.model.reinforcement_lst = [reinf]
            sig_max, wmax = ccb_view.sigma_c_max
            sig_max_arr[i, j] = sig_max / Vf
            wmax_arr[i, j] = wmax
    ctrl_vars = orthogonalize([np.arange(len(k_arr)), np.arange(len(COV_arr))])
    print sig_max_arr
    print wmax_arr
    mlab.surf(ctrl_vars[0], ctrl_vars[1], sig_max_arr / np.max(sig_max_arr))
    mlab.surf(ctrl_vars[0], ctrl_vars[1], wmax_arr / np.max(wmax_arr))
    mlab.show()
Пример #6
0
 def mean_bundle():
     w_arr = np.linspace(0., .5, 150)
     micro = GFRCMicro(FilamentCB=CBShortFiber)
     meso = GFRCMeso(micro_model=micro, N_fil=100)
     theta_dict = dict(tau=RV('uniform', loc=0.01, scale=0.4),
                       r=3.5e-3,
                       E_f=70e3,
                       le=RV('uniform', loc=0.0, scale=9.0),
                       phi=RV('sin2x', scale=1.0),
                       snub=0.5,
                       xi=RV('weibull_min', shape=5., scale=0.025),
                       spall=0.5)
     #         mean_resp = meso.mean_response(w_arr, theta_dict)
     #         plt.plot(w_arr, mean_resp, lw=2, color='black')
     for j in range(3):
         print j
         mean_resp = 0.0
         for i in range(100):
             phic_i = sin2x(scale=1).rvs(1)
             le_i = uniform(loc=0.0, scale=9.).rvs(1)
             theta_dict['phi'] = float(phic_i)
             theta_dict['le'] = float(le_i)
             mean_resp_i = meso.mean_response(w_arr, theta_dict)
             mean_resp += mean_resp_i / 100.
         plt.plot(w_arr, mean_resp, lw=1)
     plt.show()
Пример #7
0
def k_influence_rand(k_arr):
    fig = plt.figure()
    ax1 = fig.add_subplot(111)
    fig2 = plt.figure()
    ax2 = fig2.add_subplot(111)
    for i, m in enumerate([4., 8., 30.]):
        sig_max_lst = []
        wmax_lst = []
        for ki in k_arr:
            Vf = Vf_k(ki)
            reinf = ContinuousFibers(r=RV('uniform', loc=.005, scale=.01),
                                     tau=RV('uniform', loc=.05, scale=.1),
                                     xi=WeibullFibers(shape=m, sV0=0.003),
                                     V_f=Vf,
                                     E_f=200e3,
                                     n_int=100)
            mur = reinf.r._distr.mean
            mutau = reinf.tau._distr.mean
            muxi = reinf.xi.mean(2 * mutau / mur / reinf.E_f, mur)
            g = gamma(1. + 1. / (1 + m))
            sV0 = ((muxi / g)**(m + 1) * (pi * mur**3 * reinf.E_f) /
                   (mutau * (m + 1)))**(1. / m)
            reinf.xi.sV0 = sV0
            ccb_view.model.reinforcement_lst = [reinf]
            sig_max, wmax = ccb_view.sigma_c_max
            sig_max_lst.append(sig_max / Vf)
            wmax_lst.append(wmax)
        ax1.plot(k_arr, np.array(sig_max_lst) / sig_max_lst[0])
        ax2.plot(k_arr, np.array(wmax_lst) / wmax_lst[0], label=str(m))
    ax1.set_ylim(0)
    ax2.set_ylim(0)
Пример #8
0
def fcn2min(shape, scale, loc, x):
    #     shape = params['shape'].value
    #     scale = params['scale'].value
    #     loc = params['loc'].value
    #     m = params['f_shape'].value
    #         sV0 = params['f_scale'].value
    sV0 = 0.0069
    m = 7.1

    tau = RV('gamma', shape=shape, scale=scale, loc=loc)
    n_int = 500
    p_arr = np.linspace(0.5 / n_int, 1 - 0.5 / n_int, n_int)
    tau_arr = tau.ppf(p_arr) + 1e-10
    r = 3.5e-3
    E_f = 180e3
#     lm = 1000
#
#     def cdf(e, depsf, r, lm, m, sV0):
#         '''weibull_fibers_cdf_mc'''
#         s = ((depsf * (m + 1.) * sV0 ** m) /
#              (2. * pi * r ** 2.)) ** (1. / (m + 1.))
#         a0 = (e + 1e-15) / depsf
#         expfree = (e / s) ** (m + 1.)
#         expfixed = a0 / \
#             (lm / 2.0) * (e / s) ** (m + 1) * \
#             (1. - (1. - lm / 2.0 / a0) ** (m + 1.))
#         print expfree
#         print expfixed
#         mask = a0 < lm / 2.0
#         exp = expfree * mask + \
#             np.nan_to_num(expfixed * (mask == False))
#         return 1. - np.exp(- exp)
#
#     T = 2. * tau_arr / r + 1e-10
#     ef0cb = np.sqrt(x[:, np.newaxis] * T[np.newaxis, :] / E_f)
#     ef0lin = x[:, np.newaxis] / lm + \
#         T[np.newaxis, :] * lm / 4. / E_f
#     depsf = T / E_f
#     a0 = ef0cb / depsf
#     mask = a0 < lm / 2.0
#     e = ef0cb * mask + ef0lin * (mask == False)
#     Gxi = cdf(e, depsf, r, lm, m, sV0)
#     mu_int = e * (1. - Gxi)
#     sigma = mu_int * E_f

    T = 2. * tau_arr / r
    # scale parameter with respect to a reference volume
    s = ((T * (m + 1.) * sV0 ** m) /
         (2. * E_f * pi * r ** 2)) ** (1. / (m + 1.))
    ef0 = np.sqrt(x[:, np.newaxis] * T[np.newaxis, :] / E_f)
    Gxi = 1 - np.exp(-(ef0 / s) ** (m + 1.))
    mu_int = ef0 * (1 - Gxi)
    sigma = mu_int * E_f

    return np.sum(sigma, axis=1) / n_int * (11. * 0.445) / 1000
Пример #9
0
def fcn2min(params, x, data):
    """ model decaying sine wave, subtract data"""
    shape = params['shape'].value
    scale = params['scale'].value
    m = params['f_shape'].value
    sV0 = params['f_scale'].value
#     m = 8.806672387136711
#     sV0 = 0.013415768576509945
#     sV0 = 3243. / \
#         (182e3 * (pi * 3.5e-3 ** 2 * 50.) ** (-1. / m) * gamma(1 + 1. / m))
#     shape = 0.0505
#     scale = 2.276
#     CS = 12.
#     mu_tau = 1.3 * 3.5e-3 * 3.6 * (1. - 0.01) / (2. * 0.01 * CS)
#     scale = mu_tau / shape

    tau = RV('gamma', shape=shape, scale=scale, loc=0.)
    n_int = 500
    p_arr = np.linspace(0.5 / n_int, 1 - 0.5 / n_int, n_int)
    tau_arr = tau.ppf(p_arr) + 1e-10
    r = 3.5e-3
    E_f = 180e3
    lm = 1000.

    def cdf(e, depsf, r, lm, m, sV0):
        '''weibull_fibers_cdf_mc'''
        s = ((depsf * (m + 1.) * sV0 ** m) /
             (2. * pi * r ** 2.)) ** (1. / (m + 1.))
        a0 = (e + 1e-15) / depsf
        expfree = (e / s) ** (m + 1)
        expfixed = a0 / \
            (lm / 2.0) * (e / s) ** (m + 1) * \
            (1. - (1. - lm / 2.0 / a0) ** (m + 1.))
        mask = a0 < lm / 2.0
        exp = expfree * mask + \
            np.nan_to_num(expfixed * (mask == False))
        return 1. - np.exp(- exp)

    T = 2. * tau_arr / r + 1e-10

    ef0cb = np.sqrt(x[:, np.newaxis] * T[np.newaxis, :] / E_f)
    ef0lin = x[:, np.newaxis] / lm + \
        T[np.newaxis, :] * lm / 4. / E_f
    depsf = T / E_f
    a0 = ef0cb / depsf
    mask = a0 < lm / 2.0
    e = ef0cb * mask + ef0lin * (mask == False)
    Gxi = cdf(e, depsf, r, lm, m, sV0)
    mu_int = e * (1. - Gxi)
    sigma = mu_int * E_f

    return np.sum(sigma, axis=1) / n_int * (11. * 0.445) / 1000 - data
Пример #10
0
 def m_effect():
     m_xi_arr = np.linspace(1., 20., 15)
     m_tau_arr = np.linspace(0.3, 5.0, 10)
     try:
         res_file = open('res_m.pkl', 'rb')
         res_arr = pickle.load(res_file)
         res_file.close()
         #            for res_part in res_arr:
         #                plt.plot(m_xi_arr, res_part)
         #            plt.show()
         eps_vars = orthogonalize([np.arange(15), np.arange(10)])
         resCB = np.ones_like(res_arr)
         resMC = res_arr
         mlab.surf(eps_vars[0], eps_vars[1], resCB * 10)
         mlab.surf(eps_vars[0], eps_vars[1], resMC * 10)
         mlab.show()
     except:
         res_arr = []
         for m_tau in m_tau_arr:
             strength_CB = []
             strength_MC = []
             for m_xi in m_xi_arr:
                 wmCB, smCB = maxsigma(
                     1000.,
                     RV('weibull_min', shape=m_tau, scale=0.1, loc=0.0),
                     m_xi)
                 wmMC, smMC = maxsigma(
                     1., RV('weibull_min', shape=m_tau, scale=0.1, loc=0.0),
                     m_xi)
                 #            w_CB = np.linspace(0.0,100./m**2,200)
                 #            w_MC = np.linspace(0.0,1.5/m**2,200)
                 #            plt.plot(wmCB, smCB, 'ro')
                 #            plt.plot(wmMC, smMC, 'bo')
                 #            sigma_c_CB = sigmac(w_CB, 1000., RV('weibull_min', shape=3.0, scale=0.1, loc=0.0), m)
                 #            sigma_c_MC = sigmac(w_MC, 1.0, RV('weibull_min', shape=3.0, scale=0.1, loc=0.0), m)
                 #            plt.plot(w_CB, sigma_c_CB, label='CB')
                 #            plt.plot(w_MC, sigma_c_MC, label='MC')
                 #            plt.show()
                 strength_CB.append(smCB)
                 strength_MC.append(smMC)
             CB_arr = np.ones_like(np.array([strength_CB]))
             MC_arr = np.array([strength_MC]) / np.array([strength_CB])
             res_arr.append(MC_arr.flatten())
             plt.plot(m_xi_arr, CB_arr.flatten(), lw=2., color='black')
             plt.plot(m_xi_arr, MC_arr.flatten(), label=str(m_tau) + ' MC')
         res_arr = np.array(res_arr)
         file_res = open('res_m.pkl', 'wb')
         pickle.dump(res_arr, file_res, -1)
         file_res.close()
         plt.legend(loc='best')
         plt.ylim(0)
         plt.show()
Пример #11
0
def short_fibers_lf():
    w = np.linspace(0.0, 0.02, 200)
    Ef = sf_spirrid.theta_vars['E_f']
    Vf = 0.01
    sf_spirrid.eps_vars['w'] = w
    sf_spirrid.theta_vars['le'] = RV('uniform', scale=5.0, loc=0.0)
    plt.plot(w, sf_spirrid.mu_q_arr * Ef * Vf / 2., label='10.0')
    sf_spirrid.theta_vars['le'] = RV('uniform', scale=7.0, loc=0.0)
    plt.plot(w, sf_spirrid.mu_q_arr * Ef * Vf / 2., label='14.0')
    sf_spirrid.theta_vars['le'] = RV('uniform', scale=9.0, loc=0.0)
    plt.plot(w, sf_spirrid.mu_q_arr * Ef * Vf / 2., label='18.0')
    plt.legend(loc='best')
    plt.show()
Пример #12
0
 def model_free(self, tau_loc, tau_shape, tau_scale):
     xi_shape = 6.7
     #xi_scale = 3243. / (182e3 * (pi * 3.5e-3 **2 * 50.)**(-1./xi_shape)*gamma(1+1./xi_shape))
     xi_scale = 7.6e-3
     #CS=8.
     #mu_tau = 1.3 * self.r * 3.6 * (1.-0.01) / (2. * 0.01 * CS)
     #tau_scale = (mu_tau - tau_loc)/tau_shape
     #xi_scale = 0.0077
     #xi_shape = 6.7
     #tau_scale = (mu_tau - tau_loc)/tau_shape
     cb = CBClampedRandXi(pullout=False)
     spirrid = SPIRRID(q=cb, sampling_type='LHS')
     tau = RV('gamma', shape=tau_shape, scale=tau_scale, loc=tau_loc)
     w = self.w
     spirrid.eps_vars = dict(w=w)
     spirrid.theta_vars = dict(tau=tau,
                               E_f=self.Ef,
                               V_f=self.V_f,
                               r=self.r,
                               m=xi_shape,
                               sV0=xi_scale)
     spirrid.n_int = 5000
     sigma_c = spirrid.mu_q_arr / self.r**2
     plt.plot(w, sigma_c)
     return sigma_c
Пример #13
0
def strength():
    length = 2000.
    nx = 2000
    cracks = []
    strengths = []
    maxsigma = [12., 15., 20., 22., 24.]
    Vfs = [0.05, 0.01, 0.013, 0.017, 0.02]
    for i, Vf in enumerate(Vfs):
        random_field = RandomField(
            seed=False,
            lacor=5.0,
            length=length,
            nx=800,
            nsim=1,
            loc=.0,
            shape=8.,
            scale=3.2,
        )

        reinf1 = ContinuousFibers(r=0.0035,
                                  tau=RV('weibull_min',
                                         loc=0.0,
                                         shape=1.,
                                         scale=0.03),
                                  V_f=Vf,
                                  E_f=180e3,
                                  xi=fibers_MC(m=5.0, sV0=0.003),
                                  label='carbon',
                                  n_int=500)

        CB_model = CompositeCrackBridge(
            E_m=25e3,
            reinforcement_lst=[reinf1],
        )

        scm = SCM(
            length=length,
            nx=nx,
            random_field=random_field,
            CB_model=CB_model,
            load_sigma_c_arr=np.linspace(0.01, maxsigma[i], 100),
        )

        scm_view = SCMView(model=scm)
        scm_view.model.evaluate()

        eps, sigma = scm_view.eps_sigma
        plt.plot(eps, sigma, lw=1, label=str(Vf))
        strengths.append(np.max(sigma))
        cracks.append(len(scm_view.model.cracks_list[-1]))

    plt.legend(loc='best')
    plt.xlabel('composite strain [-]')
    plt.ylabel('composite stress [MPa]')
    plt.figure()
    plt.plot(Vfs, strengths, label='strengths')
    plt.figure()
    plt.plot(Vfs, cracks, label='cracks')
    print strengths
    print cracks
Пример #14
0
 def _get_model_extrapolate(self):
     cb = CBClampedRandXi(pullout=False)
     spirrid = SPIRRID(q=cb, sampling_type='LHS')
     sV0 = self.sV0
     V_f = 1.0
     r = 3.5e-3
     m = self.m
     tau = RV('gamma',
              shape=self.tau_shape,
              scale=self.tau_scale,
              loc=self.tau_loc)
     n_int = self.n_int
     w = self.w2
     lm = self.lm
     spirrid.eps_vars = dict(w=w)
     spirrid.theta_vars = dict(tau=tau,
                               E_f=self.Ef,
                               V_f=V_f,
                               r=r,
                               m=m,
                               sV0=sV0,
                               lm=lm)
     spirrid.n_int = n_int
     sigma_c = spirrid.mu_q_arr / self.r**2
     return sigma_c
Пример #15
0
    def model_rand(params, *args):
        w = args[0]
        sV0, tau_scale = params
        E_f = 180e3
        V_f = 1.0
        r = 3.45e-3
        m = 4.
        tau = RV('weibull_min', shape=.4, scale=tau_scale, loc=0.009)
#         a_lower = 0.0
#         tau = RV('piecewise_uniform', shape=0.0, scale=1.0)
#         tau._distr.distr_type.distribution.a_lower = a_lower
#         tau._distr.distr_type.distribution.a_upper = a_upper
#         tau._distr.distr_type.distribution.b_lower = a_upper
#         tau._distr.distr_type.distribution.b_upper = b_upper
#         tau._distr.distr_type.distribution.ratio = ratio
        n_int = 100

        spirrid.eps_vars=dict(w=w)
        spirrid.theta_vars=dict(tau=tau, E_f=E_f, V_f=V_f, r=r, m=m, sV0=sV0)
        spirrid.n_int=n_int
        if isinstance(r, RV):
            r_arr = np.linspace(r.ppf(0.001), r.ppf(0.999), 300)
            Er = np.trapz(r_arr ** 2 * r.pdf(r_arr), r_arr)
        else:
            Er = r ** 2
        sigma_c = spirrid.mu_q_arr / Er
        return sigma_c
Пример #16
0
    def analytical_comparison():
        '''for the case when tau is deterministic,
        there is an analytical solution.
        The differences are caused by the additional matrix
        stiffness due to broken fibers, which are in the CB model
        added to matrix stiffness. As the matrix E grows and the V_f
        decreases, the solutions tend to get closer'''
        tau, E_f, E_m, V_f = 0.1, 72e3, 25e3, 0.2
        r, shape, scale = 0.001, 5., 0.02
        # analytical solution for damage controlled test
        ctrl_damage = np.linspace(0.0, .99, 100)

        def crackbridge(w, tau, E_f, E_m, V_f, r, omega):
            Kf = E_f * V_f * (1 - omega)
            Km = E_m * (1 - V_f) + E_f * V_f * omega
            Kc = Kf + Km
            T = 2. * tau * V_f * (1. - omega) / r
            c = np.sqrt(Kc * T / Km / Kf)
            return c * np.sqrt(w) * (1 - omega)

        def w_omega(tau, E_f, E_m, V_f, r, omega, shape, scale):
            Kf = E_f * V_f * (1 - omega)
            Km = E_m * (1 - V_f) + E_f * V_f * omega
            Kc = Kf + Km
            T = 2. * tau * V_f * (1. - omega) / r
            return (-np.log(1. - omega)) ** (2. / shape) \
                    * scale ** 2 * Km * Kf / Kc / T

        w_lst = [
            w_omega(tau, E_f, E_m, V_f, r, omega, shape, scale)
            for omega in ctrl_damage
        ]
        epsf = crackbridge(np.array(w_lst), tau, E_f, E_m, V_f, r, ctrl_damage)
        plt.plot(np.array(w_lst),
                 epsf * E_f * V_f,
                 color='red',
                 lw=4,
                 ls='dashed',
                 label='analytical')

        reinf = Reinforcement(r=r,
                              tau=tau,
                              V_f=V_f,
                              E_f=E_f,
                              xi=RV('weibull_min', shape=shape, scale=scale),
                              n_int=20)

        ccb = CompositeCrackBridge(E_m=E_m,
                                   reinforcement_lst=[reinf],
                                   Ll=1000.,
                                   Lr=1000.)

        stress = []
        w_arr = np.linspace(0.0, np.max(w_lst), 100)
        for w in w_arr:
            ccb_view.model.w = w
            stress.append(ccb_view.sigma_c)
        plt.plot(w_arr, stress, color='blue', lw=2, label='CB model')
        plt.legend(loc='best')
Пример #17
0
 def mean_filament():
     w_arr = np.linspace(0., .5, 200)
     micro = GFRCMicro(FilamentCB=CBShortFiber)
     theta_dict = dict(tau=RV('uniform', loc=0.01, scale=0.4),
                       r=3.5e-3,
                       E_f=70e3,
                       le=9.0,
                       phi=1.0,
                       snub=0.5,
                       xi=RV('weibull_min', shape=5., scale=0.025),
                       spall=0.5)
     mean_resp = micro.mean_response(w_arr, theta_dict)
     var_resp = micro.var_response(w_arr, theta_dict)
     plt.plot(w_arr, mean_resp, lw=2)
     plt.plot(w_arr, mean_resp + np.sqrt(var_resp), lw=2, ls='dashed')
     plt.plot(w_arr, mean_resp - np.sqrt(var_resp), lw=2, ls='dashed')
     plt.show()
Пример #18
0
def short_fibers_CHOB():
    cb = CBShortFiber()
    Ef = 200e3
    Vf = 0.015
    r = 0.088
    Lc = 400.
    Ac = 1600.
    lf = 14.
    spirrid = SPIRRID(q=cb,
                      sampling_type='PGrid',
                      eps_vars=dict(w=np.array([100.0])),
                      theta_vars=dict(tau=1.8,
                                      E_f=Ef,
                                      r=r,
                                      le=RV('uniform', scale=lf / 2., loc=0.0),
                                      phi=RV('sin2x', scale=1.0),
                                      snub=.87,
                                      xi=20e10),
                      n_int=100)

    spirrid.codegen.implicit_var_eval = True
    var_e = spirrid.var_q_arr
    mu_e = spirrid.mu_q_arr
    Af = pi * r**2
    p = lf / 2. / Lc
    n = Ac * Lc * Vf / Af / lf
    mu_strength = Ef * Vf / 2. * mu_e
    var_strength = (Ef * Vf / 2.)**2 / n / p * (var_e + (1. - p) * mu_e**2)
    n = np.arange(10)
    distr = norm(loc=mu_strength, scale=var_strength**(0.5))
    sig_arr = np.linspace(mu_strength / 2., mu_strength * 1.5, 1000)
    CDF1 = distr.cdf(sig_arr)
    CDF2 = 1 - (1 - CDF1)**2
    CDF10 = 1 - (1 - CDF1)**10
    plt.figure()
    plt.plot(sig_arr, CDF1, label='strength distr 1')
    plt.plot(sig_arr, CDF2, label='strength distr 2')
    plt.plot(sig_arr, CDF10, label='strength distr 10')
    plt.figure()
    cracks = np.linspace(1, 100, 500)
    plt.plot(cracks, distr.ppf(1. - 0.5**(1. / cracks)), label='0.5')
    plt.plot(cracks, distr.ppf(1. - 0.99999**(1. / cracks)), label='0.000001')
    plt.ylim(1.0, 3.0)
    plt.legend()
    plt.show()
Пример #19
0
        def func1(w_arr, k):

            tau = RV('gamma', shape=k, scale=scale, loc=0.)
            n_int = 500
            p_arr = np.linspace(0.5 / n_int, 1 - 0.5 / n_int, n_int)
            tau_arr = tau.ppf(p_arr) + 1e-10

            #     sV0 = sV0
            #     m = m
            r = 3.5e-3
            E_f = 180e3
            lm = 1000.

            def cdf(e, depsf, r, lm, m, sV0):
                '''weibull_fibers_cdf_mc'''
                s = ((depsf * (m + 1.) * sV0 ** m) /
                     (2. * pi * r ** 2.)) ** (1. / (m + 1.))
                a0 = (e + 1e-15) / depsf
                expfree = (e / s) ** (m + 1.)
                expfixed = a0 / \
                    (lm / 2.0) * (e / s) ** (m + 1.) * \
                    (1. - (1. - lm / 2.0 / a0) ** (m + 1.))
                mask = a0 < lm / 2.0
                exp = expfree * mask + \
                    np.nan_to_num(expfixed * (mask == False))
                return 1. - np.exp(- exp)

            T = 2. * tau_arr / r + 1e-10

            ef0cb = np.sqrt(w_arr[:, np.newaxis] * T[np.newaxis, :] / E_f)
            ef0lin = w_arr[:, np.newaxis] / lm + \
                T[np.newaxis, :] * lm / 4. / E_f
            depsf = T / E_f
            a0 = ef0cb / depsf
            mask = a0 < lm / 2.0
            e = ef0cb * mask + ef0lin * (mask == False)
            Gxi = cdf(e, depsf, r, lm, m, sV0)
            #             plt.plot(w_arr, np.average(Gxi, axis=1), label='s='+str(s)+'m='+str(m))
            mu_int = e * (1. - Gxi)
            sigma = mu_int * E_f

            return np.sum(sigma, axis=1) / n_int * (11. * 0.445) / 1000
Пример #20
0
    def lackoffit(m, sV0, shape, scale, x, data):
        """ model decaying sine wave, subtract data"""

        tau = RV('gamma', shape=shape, scale=scale, loc=0.)
        n_int = 500
        p_arr = np.linspace(0.5 / n_int, 1 - 0.5 / n_int, n_int)
        tau_arr = tau.ppf(p_arr) + 1e-10
        r = 3.5e-3
        E_f = 180e3
        lm = 1000.

        def cdf(e, depsf, r, lm, m, sV0):
            '''weibull_fibers_cdf_mc'''
            s = ((depsf * (m + 1.) * sV0 ** m) /
                 (2. * pi * r ** 2.)) ** (1. / (m + 1.))
            a0 = (e + 1e-15) / depsf
            expfree = (e / s) ** (m + 1.)
            expfixed = a0 / \
                (lm / 2.0) * (e / s) ** (m + 1.) * \
                (1. - (1. - lm / 2.0 / a0) ** (m + 1.))
            mask = a0 < lm / 2.0
            exp = expfree * mask + \
                np.nan_to_num(expfixed * (mask == False))
            return 1. - np.exp(- exp)

        T = 2. * tau_arr / r + 1e-10

        ef0cb = np.sqrt(x[:, np.newaxis] * T[np.newaxis, :] / E_f)
        ef0lin = x[:, np.newaxis] / lm + \
            T[np.newaxis, :] * lm / 4. / E_f
        depsf = T / E_f
        a0 = ef0cb / depsf
        mask = a0 < lm / 2.0
        e = ef0cb * mask + ef0lin * (mask == False)
        Gxi = cdf(e, depsf, r, lm, m, sV0)
        mu_int = e * (1. - Gxi)
        sigma = mu_int * E_f

        residual = np.sum(sigma, axis=1) / n_int * (11. * 0.445) / 1000 - data

        return np.sum(residual ** 2)
Пример #21
0
def simplified():
    cb = CBClampedRandXi()
    spirrid = SPIRRID(q=cb,
                      sampling_type='PGrid',
                      theta_vars=dict(tau=RV('gamma',
                                             loc=0.0055,
                                             scale=0.7,
                                             shape=0.2),
                                      E_f=200e3,
                                      V_f=0.01,
                                      r=0.00345,
                                      m=7.0,
                                      sV0=0.0042,
                                      lm=1000.),
                      n_int=200)

    def sigmac(w, lm):
        spirrid.eps_vars['w'] = np.array([w])
        spirrid.theta_vars['lm'] = lm
        sigma_c = spirrid.mu_q_arr / spirrid.theta_vars['r']**2
        return sigma_c

    def maxsigma(lm):
        def minfunc(w):
            res = sigmac(w, lm)
            return -res * (w < 200.) + 1e-5 * w**2

        w_max = minimize_scalar(minfunc, bracket=(0.0001, 0.0002))
        return w_max.x, sigmac(w_max.x, lm) / spirrid.theta_vars['V_f']

    sigmaf = []
    w_lst = []
    lcs = 1. / np.linspace(8.4, 300.0, 20)
    for lcsi in lcs:
        print lcsi
        wi, sigi = maxsigma(1. / lcsi)
        sigmaf.append(sigi)
        w_lst.append(wi)
    plt.plot(lcs, sigmaf)
    plt.plot(1. / 13.7, 1201, 'ro')
    plt.plot(1. / 9.7, 1373, 'bo')
    plt.errorbar(1. / 13.7, 1201, 104.4)
    plt.errorbar(1. / 9.7, 1373, 36.4)
    plt.ylim(0)
    plt.figure()
    plt.plot(lcs, w_lst)
    plt.plot(1. / 13.7, 0.088, 'ro')
    plt.plot(1. / 9.7, 0.05, 'bo')
    plt.errorbar(1. / 13.7, 0.088, 0.003)
    plt.errorbar(1. / 9.7, 0.05, 0.005)
    plt.ylim(0)
    plt.show()
Пример #22
0
def sigma_c_arr(k_lst, mu_r, mu_tau, COV_r_lst, COV_tau_lst):
    w_arr = np.linspace(0.0, 1.0, 200)
    for ki in k_lst:
        Vf = Vf_k(ki)
        for i, cov_r in enumerate(COV_r_lst):
            loc_r = mu_r * (1 - cov_r * np.sqrt(3.0))
            scale_r = cov_r * 2 * np.sqrt(3.0) * mu_r
            loc_tau = mu_tau * (1 - COV_tau_lst[i] * np.sqrt(3.0))
            scale_tau = COV_tau_lst[i] * 2 * np.sqrt(3.0) * mu_tau
            reinf = ContinuousFibers(r=RV('uniform', loc=loc_r, scale=scale_r),
                                     tau=RV('uniform',
                                            loc=loc_tau,
                                            scale=scale_tau),
                                     V_f=Vf,
                                     E_f=200e3,
                                     xi=WeibullFibers(shape=7., sV0=0.003),
                                     n_int=50)
            ccb_view.model.reinforcement_lst = [reinf]
            #sig_max, wmax = ccb_view.sigma_c_max
            #ccb_view.model.w = wmax
            sigma = ccb_view.sigma_c_arr(w_arr)
            plt.plot(w_arr, sigma / Vf, lw=2, label=str(ki))
Пример #23
0
def k_influence(k_lst, mu_r, mu_tau, COV_r_lst, COV_tau_lst):
    k_arr = np.linspace(0.001, 0.8, 50)
    for i, cov_r in enumerate(COV_r_lst):
        epsf_max_lst = []
        loc_r = mu_r * (1 - cov_r * np.sqrt(3.0))
        scale_r = cov_r * 2 * np.sqrt(3.0) * mu_r
        loc_tau = mu_tau * (1 - COV_tau_lst[i] * np.sqrt(3.0))
        scale_tau = COV_tau_lst[i] * 2 * np.sqrt(3.0) * mu_tau
        for ki in k_arr:
            Vf = Vf_k(ki)
            ccb_view.model.w = 0.5
            reinf = ContinuousFibers(
                r=RV('uniform', loc=loc_r, scale=scale_r),
                tau=RV('uniform', loc=loc_tau, scale=scale_tau),
                V_f=Vf,
                E_f=200e3,
                xi=100.,  #WeibullFibers(shape=5., sV0=0.003),
                n_int=200)
            ccb_view.model.reinforcement_lst = [reinf]
            epsf_max_lst.append(np.max(ccb_view.mu_epsf_arr))
        plt.plot(k_arr, np.array(epsf_max_lst) * reinf.E_f)
    plt.ylim(0, 3000)
    plt.xlim(0, 0.8)
Пример #24
0
def short_fibers_strength_var():
    sf_spirrid.codegen.implicit_var_eval = True
    sf_spirrid.eps_vars['w'] = np.array([1000.])
    var = sf_spirrid.var_q_arr
    mu = sf_spirrid.mu_q_arr
    cov_e = np.sqrt(var) / mu

    Vf = 0.01
    r = sf_spirrid.theta_vars['r']
    Af = pi * r**2
    Lc = 100.
    Ac = 1600.
    lf = 14.0

    Ac_arr = np.linspace(1600.0, 6400., 200)
    COV_Ac = np.sqrt(2. * Af / Vf / Ac_arr) * np.sqrt(cov_e**2 +
                                                      (1. - lf / 2. / Lc))
    #plt.plot(Ac_arr, COV_Ac, label='COV')

    Vf_arr = np.linspace(0.01, 0.04, 200)
    COV_Vf = np.sqrt(2. * Af / Vf_arr / Ac) * np.sqrt(cov_e**2 +
                                                      (1. - lf / 2. / Lc))
    #plt.plot(Vf_arr, COV_Vf, label='COVVf',ls='dashed',lw=3)

    COV_lf = []
    lf_arr = np.linspace(1., 30., 100)
    for lfi in lf_arr:
        sf_spirrid.theta_vars['le'] = RV('uniform', scale=lf / 2., loc=0.0)
        var = sf_spirrid.var_q_arr
        mu = sf_spirrid.mu_q_arr
        cov_e = np.sqrt(var) / mu
        COV = np.sqrt(2. * Af / Vf / Ac) * np.sqrt(cov_e**2 +
                                                   (1. - lfi / 2. / Lc))
        COV_lf.append(COV)
    # plt.plot(lf_arr, COV_lf, label='COV_lf')

    COV_Lc = []
    Lc_arr = np.linspace(50., 1000., 100)
    for Lci in Lc_arr:
        var = sf_spirrid.var_q_arr
        mu = sf_spirrid.mu_q_arr
        cov_e = np.sqrt(var) / mu
        COV = np.sqrt(2. * Af / Vf / Ac) * np.sqrt(cov_e**2 +
                                                   (1. - lf / 2. / Lci))
        COV_Lc.append(COV)
    #plt.plot(Lc_arr, COV_Lc, label='COV_Lc')

    plt.ylim(0, 0.08)
    plt.legend()
    plt.show()
Пример #25
0
def profiles(k_lst, mu_r, mu_tau, COV_r_lst, COV_tau_lst):
    for ki in k_lst:
        Vf = Vf_k(ki)
        ccb_view.model.w = 0.5
        for i, cov_r in enumerate(COV_r_lst):
            loc_r = mu_r * (1 - cov_r * np.sqrt(3.0))
            scale_r = cov_r * 2 * np.sqrt(3.0) * mu_r
            loc_tau = mu_tau * (1 - COV_tau_lst[i] * np.sqrt(3.0))
            scale_tau = COV_tau_lst[i] * 2 * np.sqrt(3.0) * mu_tau
            reinf = ContinuousFibers(
                r=RV('uniform', loc=loc_r, scale=scale_r),
                tau=RV('uniform', loc=loc_tau, scale=scale_tau),
                V_f=Vf,
                E_f=200e3,
                xi=100.,  #WeibullFibers(shape=5., sV0=0.003),
                n_int=50)
            ccb_view.model.reinforcement_lst = [reinf]
            #sig_max, wmax = ccb_view.sigma_c_max
            #ccb_view.model.w = wmax
            x = ccb_view.x_arr[1:-1]
            epsm = ccb_view.epsm_arr[1:-1]
            plt.plot(x, epsm, lw=2)
            plt.xlim(0, 300)
Пример #26
0
def fcn2min(x):
    """ model decaying sine wave, subtract data"""
    shape = 0.0539
    scale = 1.44
    loc = 0.00126
    m = 6.7
    sV0 = 0.0076

    tau = RV('gamma', shape=shape, scale=scale, loc=loc)
    n_int = 500
    p_arr = np.linspace(0.5 / n_int, 1 - 0.5 / n_int, n_int)
    tau_arr = tau.ppf(p_arr) + 1e-10
    r = 3.5e-3
    E_f = 180e3
    T = 2. * tau_arr / r
    # scale parameter with respect to a reference volume
    s = ((T * (m + 1.) * sV0 ** m) /
         (2. * E_f * pi * r ** 2)) ** (1. / (m + 1.))
    ef0 = np.sqrt(x[:, np.newaxis] * T[np.newaxis, :] / E_f)
    Gxi = 1 - np.exp(-(ef0 / s) ** (m + 1.))
    mu_int = ef0 * (1 - Gxi)
    sigma = mu_int * E_f

    return np.sum(sigma, axis=1) / n_int * (11. * 0.445) / 1000
Пример #27
0
def sigmamu_shape_study():
    length = 2000.
    nx = 3000
    lacor = 1.0
    sigmamumin = 3.0
    reinf = ContinuousFibers(r=0.0035,
                          tau=RV('gamma', shape=0.2, scale=0.5),
                          V_f=0.01,
                          E_f=180e3,
                          xi=1000.,
                          label='carbon',
                          n_int=500)
    
    ccb = CompositeCrackBridge(E_m=25e3,
                                 reinforcement_lst=[reinf],
                                 )

    #for mm in [5., 10., 15., 20., 25., 30., 35.]:
    for mm in [5., 10., 15., 20., 30.]:
        fLc = (lacor/(lacor+length))**(1./mm)
        sm = sigmamumin / (fLc * gamma(1. + 1 / mm))
        random_field = RandomField(seed=True,
                               lacor=1.,
                               length=length,
                               nx=500,
                               nsim=1,
                               loc=.0,
                               shape=mm,
                               scale=sm,
                               distr_type='Weibull')
        
        scm = SCM(length=length,
                  nx=nx,
                  random_field=random_field,
                  CB_model=ccb,
                  load_sigma_c_arr=np.linspace(0.01, 20., 200),
                  n_BC_CB=15)
    
        scm_view = SCMView(model=scm)
        scm_view.model.evaluate()
        eps, sigma = scm_view.eps_sigma
        plt.plot(eps, sigma, label='mm = ' + str(mm) + ' sm = ' + str(sm))
    plt.xlabel('composite strain [-]')
    plt.ylabel('composite stress [MPa]')
    plt.legend(loc='best')
    plt.xlim(0)
    plt.ylim(0)
    plt.show()
Пример #28
0
def p_tau():
    length = 5000.
    nx = 5000
    for tau_shape in [1.0, 2.0, 1000.]:
        random_field = RandomField(seed=False,
                                   lacor=5.0,
                                   length=length,
                                   nx=1000,
                                   nsim=1,
                                   loc=.0,
                                   shape=8.,
                                   scale=3.2,
                                   distribution='Weibull')

        reinf1 = ContinuousFibers(r=0.0035,
                                  tau=RV('weibull_min',
                                         loc=0.0,
                                         shape=tau_shape,
                                         scale=0.03),
                                  V_f=0.01,
                                  E_f=180e3,
                                  xi=fibers_MC(m=5.0, sV0=10.003),
                                  label='carbon',
                                  n_int=500)

        CB_model = CompositeCrackBridge(
            E_m=25e3,
            reinforcement_lst=[reinf1],
        )

        scm = SCM(
            length=length,
            nx=nx,
            random_field=random_field,
            CB_model=CB_model,
            load_sigma_c_arr=np.linspace(0.01, 8., 100),
        )

        scm_view = SCMView(model=scm)
        scm_view.model.evaluate()

        eps, sigma = scm_view.eps_sigma
        plt.plot(eps, sigma, lw=1, label=str(tau_shape))
    plt.legend(loc='best')
    plt.xlabel('composite strain [-]')
    plt.ylabel('composite stress [MPa]')
Пример #29
0
def random_tau():
    w_arr = np.linspace(0., .3, 200)
    micro = GFRCMicro(resp_func=CBShortFiber)
    meso = GFRCMeso(micro_model=micro)
    macro = GFRCMacro(meso_model=meso,
                      W=40.,
                      H=40.,
                      L=200.,
                      Lf=18.,
                      r=8e-3,
                      Vf=.00020,
                      N_fil=100,
                      Ef=70e3,
                      snub=0.5,
                      xi=1e15,
                      tau=RV('uniform', loc=0.1, scale=0.7),
                      spall=0.5,
                      w_arr=w_arr,
                      phi=0.0)
    mean_resp, var_resp = macro.CB_response_asymptotic
    mean_N_fib = macro.N_fib_bridging.mean()

    plt.plot(w_arr,
             mean_resp * macro.N_fil * pi * (macro.r)**2 / macro.Vf /
             mean_N_fib,
             lw=2,
             label='tau $\sim$ $\mathcal{U}(0.1,0.8)$')

    for t in np.linspace(0.1, 0.8, 8):
        macro.tau = t
        mean_resp, var_resp = macro.CB_response_asymptotic
        mean_N_fib = macro.N_fib_bridging.mean()
        plt.plot(w_arr,
                 mean_resp * macro.N_fil * pi * (macro.r)**2 / macro.Vf /
                 mean_N_fib,
                 lw=1,
                 color='black',
                 label='tau = ' + str(t))

    #plt.plot(w_arr, mean_r + np.sqrt(var_r), lw=2)
    #plt.plot(w_arr, mean_r - np.sqrt(var_r), lw=2)
    plt.xlabel('crack opening w [mm]')
    plt.ylabel('force [N]')
    #plt.legend(loc='best')
    plt.show()
Пример #30
0
def variancePb():
    points = 0.0
    for i in range(100):
        le = uniform(0.0, 9.0).rvs(1)
        w_arr = np.array([0.1])
        micro = GFRCMicro(resp_func=CBShortFiber)
        meso = GFRCMeso(micro_model=micro)
        theta_dict = dict(tau=RV('uniform', loc=0.1, scale=0.7),
                          r=8e-3,
                          E_f=70e3,
                          le=le,
                          phi=0.0,
                          snub=0.5,
                          xi=1e15,
                          spall=0.5)
        points += meso.get_MC_response(
            w_arr, theta_dict, N_fil=20)**2 - meso.get_asymptotic_response(
                w_arr, theta_dict)[0]**2
    print var
Пример #31
0
def ld():
    length = 1000.
    nx = 3000
    random_field = RandomField(seed=True,
                           lacor=1.,
                           length=length,
                           nx=1000,
                           nsim=1,
                           loc=.0,
                           shape=45.,
                           scale=3.360,
                           distr_type='Weibull')
    
    
    reinf_cont = ContinuousFibers(r=3.5e-3,
                              tau=RV('gamma', loc=0.0, scale=1.534, shape=.0615),
                              V_f=0.01,
                              E_f=181e3,
                              xi=fibers_MC(m=8.6, sV0=11.4e-3),
                              label='carbon',
                              n_int=100)
    
    CB_model = CompositeCrackBridge(E_m=25e3,
                                 reinforcement_lst=[reinf_cont],
                                 )
    scm = SCM(length=length,
              nx=nx,
              random_field=random_field,
              CB_model=CB_model,
              load_sigma_c_arr=np.linspace(0.01, 30., 200),
              n_BC_CB = 12)
    
    scm_view = SCMView(model=scm)
    scm_view.model.evaluate() 
    eps, sigma = scm_view.eps_sigma
    plt.plot(eps, sigma, color='black', lw=2, label='continuous fibers')
    
    plt.legend(loc='best')
    plt.xlabel('composite strain [-]')
    plt.ylabel('composite stress [MPa]')
    plt.show()
Пример #32
0
def mechanisms():
    m = 5.15004407
    sV0 = 0.00915595
    r = 3.5e-3
    Ef = 181e3

    
    cb = CBClampedRandXi(pullout=False)
    spirrid = SPIRRID(q=cb,
                      sampling_type='LHS',
                      theta_vars=dict(E_f=Ef,
                                      sV0=sV0,
                                      V_f=1.0,
                                      r=r,
                                      m=m,
                                      tau=RV('gamma', shape=0.03684979, scale=3.75278102, loc=0.0),
                                      lm=1000.),
                      n_int=100,
                      )
    
    lm_arr = np.linspace(1000., 3., 20)
    sigma_u_hommech = []
    for lm_i in lm_arr:
        spirrid.theta_vars['lm'] = lm_i
        max_w = min(30., lm_i * 0.07)
        w_arr = np.linspace(0.0, max_w, 200)
        spirrid.eps_vars = dict(w=w_arr)
        sig_w = spirrid.mu_q_arr / r ** 2
        plt.plot(w_arr, sig_w)
        plt.show()
        sigma_u_hommech.append(np.max(sig_w))
    sigma_u_hommech = np.array(sigma_u_hommech)
    plt.plot(lm_arr, sigma_u_hommech)#/np.min(sigma_u_hommech))
    plt.xlabel('crack spacing')
    plt.ylabel('normalized strength')
    plt.show()   
Пример #33
0
def multiple_phi():
    w_arr = np.linspace(0., .3, 200)
    micro = GFRCMicro(resp_func=CBShortFiber)
    meso = GFRCMeso(micro_model=micro)
    macro = GFRCMacro(meso_model=meso,
                      phi=0.0,
                      W=40.,
                      H=40.,
                      L=200.,
                      Lf=18.,
                      r=8e-3,
                      Vf=.00020,
                      N_fil=100,
                      Ef=70e3,
                      snub=0.5,
                      xi=1e15,
                      tau=RV('uniform', loc=0.1, scale=0.7),
                      w_arr=w_arr,
                      spall=0.5)

    for i, p in enumerate(np.linspace(15.0, 75.0, 5)):
        macro.phi = p / 180. * pi
        mean_resp, var_resp = macro.CB_response_asymptotic
        mean_N_fib = macro.N_fib_bridging.mean()
        plt.plot(w_arr,
                 mean_resp * macro.N_fil * pi * (macro.r)**2 / macro.Vf /
                 mean_N_fib,
                 lw=1 + (i / 2),
                 label='phi = ' + str(p))

    #plt.plot(w_arr, mean_r + np.sqrt(var_r), lw=2)
    #plt.plot(w_arr, mean_r - np.sqrt(var_r), lw=2)
    plt.xlabel('crack opening w [mm]')
    plt.ylabel('force [N]')
    plt.legend(loc='best')
    plt.show()
Пример #34
0
from depend_CB_model import CompositeCrackBridge
from depend_CB_postprocessor import CompositeCrackBridgeView
from reinforcement import Reinforcement, WeibullFibers
from spirrid.rv import RV
from matplotlib import pyplot as plt
import numpy as np

if __name__ == '__main__':

    # AR-glass
    reinf1 = Reinforcement(
        r=0.001,  #RV('uniform', loc=0.012, scale=0.002),
        tau=0.1,  #RV('uniform', loc=.3, scale=.1),
        V_f=0.2,
        E_f=72e3,
        xi=RV('weibull_min', shape=5., scale=.02),
        n_int=50)

    # carbon
    reinf2 = Reinforcement(r=RV('uniform', loc=0.002, scale=0.002),
                           tau=RV('uniform', loc=.6, scale=.1),
                           V_f=0.05,
                           E_f=200e3,
                           xi=RV('weibull_min', shape=10., scale=.015),
                           n_int=15)

    # instance of CompCrackBridge with matrix E and BC
    model = CompositeCrackBridge(E_m=25e3,
                                 reinforcement_lst=[reinf1],
                                 Ll=10.,
                                 Lr=20.)
Пример #35
0
if __name__ == '__main__':
    from etsproxy.mayavi import mlab
    from stats.spirrid import make_ogrid as orthogonalize
    from matplotlib import pyplot as plt
    from quaducom.micro.resp_func.cb_emtrx_clamped_fiber_stress import \
        CBEMClampedFiberStressSP
    from quaducom.micro.resp_func.cb_emtrx_clamped_fiber_stress_residual \
        import CBEMClampedFiberStressResidualSP

    # filaments
    r = 0.00345
    V_f = 0.0103
    tau = 0.1  # RV('uniform', loc=0.02, scale=.2)
    E_f = 200e3
    E_m = 25e3
    l = RV('uniform', scale=20., loc=2.)
    theta = 0.0
    xi = RV('weibull_min', scale=0.01, shape=5)
    phi = 1.
    Ll = 40.
    Lr = 20.
    s0 = 0.01
    m = 5.0
    Pf = RV('uniform', loc=0., scale=1.0)

    rf = CBEMClampedFiberStressSP()
    ra = RangeAdaption(
        load_sigma_c_max=22.0,
        load_n_sigma_c=30,
        n_w=100,
        n_x=101,
Пример #36
0
'''
Created on Jun 21, 2018

@author: liyin
'''

import matplotlib.pyplot as plt
from spirrid.rv import RV
import numpy as np

tau=RV('gamma', loc=0.001260, scale=1.440, shape=0.0539)

tau_1=RV('beta', loc=0.001260, scale=1.440, shape=0.0539)


x = np.linspace(0, 10, 1000)
y = tau_1.pdf(x)

plt.plot(x,y)
plt.show()
Пример #37
0
'''
Created on 15.10.2015

@author: Yingxiong
'''
from spirrid.rv import RV
import numpy as np
import matplotlib.pyplot as plt

tau = RV('gamma', shape=0.539, scale=1.44, loc=0.00126)

x = np.linspace(0, 1, 1000)

y = tau.pdf(x)

plt.plot(x, y)
plt.xlabel('bond strength [Mpa]')
plt.title('probability distribution function')

plt.show()
Пример #38
0
#-------------------------------------------------------------------------------
#
# Copyright (c) 2012
# IMB, RWTH Aachen University,
# ISM, Brno University of Technology
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in the Spirrid top directory "licence.txt" and may be
# redistributed only under the conditions described in the aforementioned
# license.
#
# Thanks for using Simvisage open source!
#
#-------------------------------------------------------------------------------

if __name__ == '__main__':
    from spirrid.rv import RV
    from etsproxy.traits.ui.api import View, Item
    v = View(Item('type', label = 'Distribution type'),
             Item('loc', label = 'Location'),
             Item('scale', label = 'Scale'),
             Item('shape', label = 'Shape'),
             title = 'Random variable',
             buttons = ['OK', 'Cancel'])
    
    rv = RV(type = 'norm', scale = 10, shape = 1)
    rv.configure_traits(view = v)
Пример #39
0
    sampling = Property(depends_on = 'sampling')
    @cached_property
    def _get_sampling(self):
        return self.sampling_type_(randomization = self)    

    codegen_type = Trait('numpy',
                         {'numpy' : CodeGenNumpyFactory(),
                          'weave' : CodeGenCFactory(),
                          'cython' : CodeGenCythonFactory()},
                         codegen = True)
    codegen = Property(depends_on = 'sampling, codegen')
    @cached_property
    def _get_codegen(self):
        return self.codegen_type_(spirrid = self)

    mu_q_arr = Property(depends_on = 'sampling, codegen')
    @cached_property
    def _get_mu_q_arr(self):
        '''getter for mean value array property .
        '''
        e_orth = make_ogrid(self.evar_lst)
        mu_q_method = self.codegen.get_code() 
        mu_q_arr, var_q_arr = mu_q_method(*e_orth)
        return mu_q_arr

if __name__ == '__main__':
    s = SPIRRID(q = lambda eps, theta: theta * eps,
                eps_vars = {'eps' : [0.1, 0.2, 0.3] },
                theta_vars = {'theta' : RV('norm', 1.0, 1.0)})
    print 'mean values', s.mu_q_arr
Пример #40
0
import numpy as np
from spirrid.rv import RV


from stats.pdistrib.weibull_fibers_composite_distr import \
    WeibullFibers, fibers_MC

tau_shape = [0.079392235619918011, 0.070557619484416842, 0.063299300020833421, 0.057273453501868139, 0.052218314012133477, 0.04793148098051675]
tau_scale = [0.85377504364710732, 1.0754895775375046, 1.3336402595345596, 1.6285211551178209, 1.9598281655654299, 2.3273933214348754]

# p = np.linspace(1e-5, 1., 1000)
x = np.linspace(0., 0.5, 1000)


for i, k in enumerate(tau_shape):
    tau = RV('gamma', shape=k, scale=tau_scale[i], loc=0.)
#     x = tau.ppf(p)
    plt.plot(x, tau.pdf(x), label=str(i))
plt.legend()
plt.show()
    
    


# rv1 = fibers_MC(m = 7.0, sV0=0.0095)
# 
# 
# pdf = rv.pdf(x)
# 
# plt.plot(x, pdf, lw=2)
#