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
def calibration_cb(tau_weights): sigma = cali.get_sigma_tau_w(0.0045) sig_avg = np.sum(tau_weights * sigma, axis=1) reinf = FiberBundle(r=0.0035, tau=tau_arr, tau_weights=tau_weights, V_f=0.01, E_f=200e3, xi=fibers_MC(m=8, sV0=0.0045)) ccb = RandomBondCB(E_m=25e3, reinforcement_lst=[reinf], Ll=6.85, Lr=6.85, L_max = 100) ccb.max_sig_c(ccb.Ll, ccb.Lr) ccb.damage print((ccb.E_m*ccb._epsm_arr[-1])) residual = np.sum(np.abs(exp_data-sig_avg)) + \ 100000*np.abs(ccb.E_m*ccb._epsm_arr[-1]-3.5) print(residual) return residual
def Gxi(): r, tau, Ef, m, sV0 = 0.00345, 0.1, 200e3, 3.0, 0.0026 e = np.linspace(0.001, 0.04, 20) a = e * Ef / (2. * tau / r) L = 10.0 rat = 2. * a / L wfd = fibers_dry(m=m, sV0=sV0) CDFdry = wfd.cdf(e, r, 2 * a) wfcbr = fibers_CB_rigid(m=m, sV0=sV0) CDFCB = wfcbr.cdf(e, 2 * tau / Ef / r, r) wfmc = fibers_MC(m=m, sV0=sV0, Ll=L, Lr=L) CDFexct = wfmc.cdf_exact(e, 2 * tau / Ef / r, r) CDFrypl = wfmc.cdf(e, 2 * tau / Ef / r, r, a, a) # linear scale # plt.plot(e, CDFrypl, label='Rypl') # plt.plot(e, CDFexct, label='exact') # plt.plot(e, CDFdry, label='Phoenix 1992') # plt.plot(e, CDFCB, label='CB') # Weibull plot # print rat plt.plot(np.log(e), np.log(-np.log(1.0 - CDFdry)), label='Phoenix 1992') plt.plot(np.log(e), np.log(-np.log(1.0 - CDFCB)), label='CB') plt.plot(np.log(e), np.log(-np.log(1.0 - CDFrypl)), label='Rypl') plt.plot(np.log(e), np.log(-np.log(1.0 - CDFexct)), label='exact') # plt.ylim(0) plt.legend(loc='best') plt.show()
def Gxi(): r, tau, Ef, m, sV0 = 0.00345, 0.1, 200e3, 3.0, 0.0026 e = np.linspace(0.001, 0.04, 20) a = e * Ef / (2. * tau / r) L = 10.0 rat = 2.*a / L wfd = fibers_dry(m=m, sV0=sV0) CDFdry = wfd.cdf(e, r, 2 * a) wfcbr = fibers_CB_rigid(m=m, sV0=sV0) CDFCB = wfcbr.cdf(e, 2 * tau / Ef / r, r) wfmc = fibers_MC(m=m, sV0=sV0, Ll=L, Lr=L) CDFexct = wfmc.cdf_exact(e, 2 * tau / Ef / r, r) CDFrypl = wfmc.cdf(e, 2 * tau / Ef / r, r, a, a) # linear scale # plt.plot(e, CDFrypl, label='Rypl') # plt.plot(e, CDFexct, label='exact') # plt.plot(e, CDFdry, label='Phoenix 1992') # plt.plot(e, CDFCB, label='CB') # Weibull plot # print rat plt.plot(np.log(e), np.log(-np.log(1.0 - CDFdry)), label='Phoenix 1992') plt.plot(np.log(e), np.log(-np.log(1.0 - CDFCB)), label='CB') plt.plot(np.log(e), np.log(-np.log(1.0 - CDFrypl)), label='Rypl') plt.plot(np.log(e), np.log(-np.log(1.0 - CDFexct)), label='exact') # plt.ylim(0) plt.legend(loc='best') plt.show()
def run_ctt(*args, **kw): reinf1 = ContinuousFibers(r=3.5e-3, tau=RV( 'gamma', loc=0.0126, scale=1.440, shape=0.0539), V_f=0.01, E_f=180e3, #xi=fibers_MC(m=6.7, sV0=0.0076), xi=fibers_MC(m=30, sV0=0.02), label='carbon', n_int=500) cb = BMCSRandomBondCB(E_m=25e3, reinforcement_lst=[reinf1], n_BC=10, L_max=200.) #cb = ConstantBondCB() random_field = RandomField(seed=False, lacor=1., length=500, nx=1000, nsim=1, loc=.0, shape=60., scale=3.1, distr_type='Weibull') ctt = CompositeTensileTest(n_x=1000, L=500, V_f=0.01, E_f=180e3, cb=cb, sig_mu_x=random_field.random_field) print(('STRENGH', ctt.strength)) print((ctt.BC_x)) viz2d_sig_eps = Viz2DSigEps(name='stress-strain', vis2d=ctt) viz2d_state_field = Viz2DStateVarField(name='matrix stress', vis2d=ctt) viz2d_cb_field = Viz2DCBFieldVar(name='crack bridge field', vis2d=cb, visible=False) w = BMCSWindow(model=ctt) w.viz_sheet.viz2d_list.append(viz2d_sig_eps) w.viz_sheet.viz2d_list.append(viz2d_state_field) w.viz_sheet.viz2d_list.append(viz2d_cb_field) w.viz_sheet.n_cols = 1 w.viz_sheet.monitor_chunk_size = 1 # w.run() w.offline = False w.configure_traits(*args, **kw)
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
def mtrx_shape(): # shapes: 1000, 16.5, 8.0; scales: 3.0 3.1, 3.2 length = 2000. nx = 2000 random_field = RandomField(seed=False, lacor=5., length=length, nx=1000, nsim=1, loc=.0, shape=8., scale=3.2, distr_type='Weibull') plt.plot(random_field.xgrid, random_field.random_field, lw=1, color='black') plt.ylim(0) plt.show() reinf1 = ContinuousFibers( r=0.0035, tau=0.03, #RV('weibull_min', loc=0.0, shape=3., 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.figure() plt.plot(eps, sigma, color='black', lw=2, label='model') plt.legend(loc='best') plt.xlabel('composite strain [-]') plt.ylabel('composite stress [MPa]')
def mtrx_shape(): # shapes: 1000, 16.5, 8.0; scales: 3.0 3.1, 3.2 length = 2000. nx = 2000 random_field = RandomField(seed=False, lacor=5., length=length, nx=1000, nsim=1, loc=.0, shape=8., scale=3.2, distr_type='Weibull' ) plt.plot(random_field.xgrid, random_field.random_field, lw=1, color='black') plt.ylim(0) plt.show() reinf1 = ContinuousFibers(r=0.0035, tau=0.03,#RV('weibull_min', loc=0.0, shape=3., 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.figure() plt.plot(eps, sigma, color='black', lw=2, label='model') plt.legend(loc='best') plt.xlabel('composite strain [-]') plt.ylabel('composite stress [MPa]')
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]')
def plot_eps_sig_cs(m_fiber, vf, mean, stdev): # specify the model parameters reinf = ContinuousFibers(r=3.5e-3, # tau=RVBeta( # 'beta'), tau=RV( 'gamma', loc=0.001260, scale=0.2 * 1.440, shape=0.0539), V_f=vf, E_f=182e3, xi=fibers_MC(m=m_fiber, sV0=0.0076), label='carbon', n_int=500) cb = RandomBondCB(E_m=25e3, reinforcement_lst=[reinf], n_BC=10, L_max=300) ctt = CompositeTensileTest(n_x=1000, L=500., cb=cb) random_field = RandomField(seed=False, lacor=1., length=500., nx=1000, nsim=1, mean=mean, stdev=stdev, distr_type='Gauss') ctt.sig_mu_x = random_field.random_field sig_c_i, z_x_i, BC_x_i, sig_c_u, n_cracks = ctt.get_cracking_history() load_arr = np.linspace(0, sig_c_u, 100) print(('BC_x_i', BC_x_i)) eps_c_arr = ctt.get_eps_c_arr(sig_c_i, z_x_i, BC_x_i, load_arr) cs = 500. / (np.arange(len(z_x_i)) + 1) cs[cs > 120.] = 120. cs = np.hstack((cs, cs[-1])) eps_c_i = np.interp(np.hstack((sig_c_i, sig_c_u)), load_arr, eps_c_arr) return eps_c_arr, load_arr, eps_c_i, sig_c_i, cs
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]')
def strength(sV0): scale = float(interp_tau_scale(sV0, m)) shape = float(interp_tau_shape(sV0, m)) # print scale, shape reinf = ContinuousFibers(r=3.5e-3, tau=RV( 'gamma', loc=0.0, scale=scale, shape=shape), V_f=0.015, E_f=180e3, xi=fibers_MC(m=m, sV0=sV0), label='carbon', n_int=500) ccb = RandomBondCB(E_m=25e3, reinforcement_lst=[reinf], Ll=7., Lr=350., L_max=400, n_BC=20) return ccb.max_sig_c(1., 375.)[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()
length=length, nx=500, nsim=1, loc=.0, shape=12., scale=5.2, distr_type='Weibull') reinf1 = ContinuousFibers(r=3.5e-3, tau=RV('gamma', loc=1e-6, shape=0.1040, scale=0.6554), V_f=0.01, E_f=182e3, xi=fibers_MC(m=7.1, sV0=0.0069), label='carbon', n_int=500) cracks = [] Gf = [0.2, 0.05, 0.1, 0.15, 0.2] for Gfi in Gf: CB_model = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf1], ft=1.0, Gf=Gfi) scm = SCM(length=length, nx=nx, random_field=random_field, CB_model=CB_model)
# def interp_damage(self, load): # '''calculate the damaged portion of filaments''' # return self.f_damage(load) if __name__ == '__main__': from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import time as t reinf = ContinuousFibers(r=0.0035, tau=RV('weibull_min', loc=0.0, shape=1., scale=4), V_f=0.01, E_f=180e3, xi=fibers_MC(m=2, sV0=0.003), label='carbon', n_int=100) cb1 = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf], Ll=100., Lr=100., ) cb2 = CrackBridgeConstantBond(T = 30., E_m = 25e3, E_r = 180e3, v_r = 0.05)
# # print shape, scale # shape = 0.0479314809805*1.0 # scale = 2.32739332143*1.0 shape = 0.0479314809805 * 1.0 scale = 2.32739332143 reinf1 = ContinuousFibers(r=3.5e-3, tau=RV('gamma', loc=0., scale=scale, shape=shape), V_f=0.01, E_f=180e3, xi=fibers_MC(m=m, sV0=sV0), label='carbon', n_int=500) cb = RandomBondCB(E_m=25e3, reinforcement_lst=[reinf1], n_BC=8, L_max=120) def get_z(y, position): try: z_grid = np.abs(position - y) return np.amin(z_grid) except ValueError: # no cracks exist return np.ones_like(position) * 2. * 1000.
random_field = RandomField(seed=True, lacor=1., length=length, nx=500, nsim=1, loc=.0, shape=12., scale=5.2, distr_type='Weibull' ) reinf1 = ContinuousFibers(r=3.5e-3, tau=RV('gamma', loc=1e-6, shape=0.1040, scale=0.6554), V_f=0.01, E_f=182e3, xi=fibers_MC(m=7.1, sV0=0.0069), label='carbon', n_int=500) cracks = [] Gf=[0.2, 0.05, 0.1, 0.15, 0.2] for Gfi in Gf: CB_model = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf1], ft=1.0, Gf=Gfi ) scm = SCM(length=length, nx=nx, random_field=random_field,
from scipy.special import gamma import numpy as np tau_shape = 0.0650 tau_loc = 1410e-6 xi_shape = 7.1 xi_scale = 0.0069 #xi_scale = 1578. / (182e3 * (pi * 3.5e-3 **2 * 500. * e)**(-1./xi_shape)) mu_tau = 0.075 tau_scale = (mu_tau - tau_loc)/tau_shape reinf_cont = ContinuousFibers(r=3.5e-3, tau=RV('gamma', loc=tau_loc, scale=tau_scale, shape=tau_shape), V_f=0.01, E_f=181e3, xi=fibers_MC(m=xi_shape, sV0=xi_scale), label='carbon', n_int=500) model = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf_cont], Ll=50., Lr=200., ) ccb_view = CompositeCrackBridgeView(model=model) def profile(w): ccb_view.model.w = w plt.plot(ccb_view.x_arr, ccb_view.epsm_arr, lw=2, label='Ll=' + str(ccb_view.model.Ll)) plt.plot(ccb_view.x_arr, ccb_view.epsf_arr, color='red', lw=2)
tau_shape = 0.0650 tau_loc = 1410e-6 xi_shape = 7.1 xi_scale = 0.0069 #xi_scale = 1578. / (182e3 * (pi * 3.5e-3 **2 * 500. * e)**(-1./xi_shape)) mu_tau = 0.075 tau_scale = (mu_tau - tau_loc) / tau_shape reinf_cont = ContinuousFibers(r=3.5e-3, tau=RV('gamma', loc=tau_loc, scale=tau_scale, shape=tau_shape), V_f=0.01, E_f=181e3, xi=fibers_MC(m=xi_shape, sV0=xi_scale), label='carbon', n_int=500) model = CompositeCrackBridge( E_m=25e3, reinforcement_lst=[reinf_cont], Ll=50., Lr=200., ) ccb_view = CompositeCrackBridgeView(model=model) def profile(w): ccb_view.model.w = w plt.plot(ccb_view.x_arr,
def test01(): reinf = ContinuousFibers(r=0.0035, tau=RV('weibull_min', loc=0.0, shape=1., scale=4.), V_f=0.01, E_f=180e3, xi=fibers_MC(m=2.0, sV0=0.003), label='carbon', n_int=100) model1 = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf], Ll=100., Lr=100., ) CB_random = CrackBridge(ccb=model1) interp_random = Interpolater(cb=CB_random) ctt1 = CompositeTensileTest(xgrid = np.linspace(0, 100, 501), mstrength = np.array( [ 24.76556112, 24.84911334, 24.88073353, 24.86340468, 24.8047707 , 24.71617777, 24.61180218, 24.50777456, 24.42108606, 24.36810484, 24.36271929, 24.41436522, 24.52636471, 24.69502106, 24.90976223, 25.15436838, 25.4090629 , 25.65307283, 25.86721941, 26.03615527, 26.14997404, 26.20503201, 26.20392349, 26.15465034, 26.06913251, 25.96131355, 25.84519168, 25.73311484, 25.63460145, 25.55580526, 25.49958474, 25.46601399, 25.45312002, 25.45764424, 25.47567871, 25.50308945, 25.53569316, 25.56920031, 25.59898765, 25.61981464, 25.62564352, 25.60973324, 25.56513809, 25.48564362, 25.36703352, 25.20843568, 25.01339357, 24.79029621, 24.55190781, 24.31396033, 24.09305293, 23.90434559, 23.75963137, 23.6662571 , 23.62705595, 23.6410732 , 23.70458282, 23.8118522 , 23.95535162, 24.12551881, 24.31056234, 24.49691345, 24.67070863, 24.82018582, 24.93832762, 25.02476357, 25.08603248, 25.13381513, 25.18148196, 25.23996536, 25.31427581, 25.40180522, 25.49296187, 25.57389378, 25.63038172, 25.65165749, 25.63301926, 25.57659368, 25.49023349, 25.38510739, 25.27286095, 25.1632345 , 25.06276104, 24.97474897, 24.90033458, 24.84008144, 24.79549086, 24.76987443, 24.76828173, 24.79648895, 24.85934064, 24.95891826, 25.09304611, 25.25454942, 25.431487 , 25.60836327, 25.76811987, 25.89455936, 25.97476842, 26.00109728, 25.97232049, 25.89374997, 25.77628398, 25.63460488, 25.48492657, 25.34277086, 25.22119403, 25.12970297, 25.07387243, 25.05548379, 25.07292425, 25.12163253, 25.19451164, 25.28236891, 25.37451724, 25.45963308, 25.52684121, 25.56684897, 25.57286495, 25.54106451, 25.47050196, 25.36256635, 25.22024006, 25.04747833, 24.84895238, 24.63021895, 24.3981707 , 24.16147007, 23.93063212, 23.71751397, 23.53416046, 23.39117422, 23.29596008, 23.25127964, 23.25451382, 23.29788287, 23.36964823, 23.456081 , 23.54379808, 23.62198003, 23.68402977, 23.72838177, 23.7583766 , 23.7813158 , 23.80694365, 23.84565396, 23.90670121, 23.9966496 , 24.11824881, 24.26989595, 24.44579967, 24.63688431, 24.83233738, 25.02154153, 25.19599429, 25.35077092, 25.4851668 , 25.60235376, 25.70813981, 25.80915469, 25.91091876, 26.01625549, 26.12439444, 26.23092207, 26.32853495, 26.40838205, 26.46168219, 26.48127733, 26.46283223, 26.40549042, 26.31192674, 26.18785868, 26.04117407, 25.88087509, 25.71603585, 25.55493225, 25.40444571, 25.26978991, 25.15455556, 25.06102409, 24.99065125, 24.94457941, 24.92401465, 24.93031502, 24.96469634, 25.02755875, 25.11755375, 25.2306167 , 25.35925614, 25.49239771, 25.61601736, 25.71466041, 25.77374322, 25.78230051, 25.7356293 , 25.63716601, 25.49897937, 25.34050717, 25.18557206, 25.0581804 , 24.97799694, 24.95655572, 24.99514168, 25.08487374, 25.20895394, 25.34649003, 25.47691907, 25.58396501, 25.65826765, 25.69823821, 25.709188 , 25.70119273, 25.6863886 , 25.67641403, 25.68054162, 25.70476656, 25.75181882, 25.82182054, 25.91317764, 26.02329124, 26.1488026 , 26.28530628, 26.42671544, 26.56465962, 26.68836055, 26.7853249 , 26.84293249, 26.85066637, 26.80244283, 26.69837636, 26.5454111 , 26.35655305, 26.14884339, 25.94058213, 25.74851158, 25.58563654, 25.46011064, 25.37525866, 25.33046465, 25.32244814, 25.34643574, 25.39688364, 25.46765167, 25.55176686, 25.64106987, 25.72607046, 25.79625236, 25.84090544, 25.85037734, 25.81748848, 25.7387778 , 25.61526938, 25.45255147, 25.26011591, 25.05006475, 24.83541478, 24.62829463, 24.4383263 , 24.27143408, 24.12924162, 24.00912586, 23.90490168, 23.80802449, 23.70912423, 23.59963682, 23.47328761, 23.32721121, 23.16255934, 22.98453947, 22.80191872, 22.62610065, 22.46992791, 22.34637448, 22.26728026, 22.24225595, 22.27785791, 22.37710275, 22.53935839, 22.76060815, 23.03403786, 23.35084635, 23.70114154, 24.0747632 , 24.46188327, 24.85327705, 25.24022822, 25.61412194, 25.96587148, 26.28539816, 26.56141383, 26.78172258, 26.93415763, 27.00811446, 26.99646274, 26.8974719 , 26.71630647, 26.46567481, 26.16534831, 25.84048491, 25.51893911, 25.22796539, 24.99086263, 24.82413831, 24.73567254, 24.7241705 , 24.77993922, 24.88678165, 25.02461132, 25.17230543, 25.31033218, 25.4228029 , 25.49876074, 25.53268345, 25.52429943, 25.47787683, 25.40114925, 25.30401216, 25.19709132, 25.0902789 , 24.99135415, 24.90484744, 24.83134436, 24.76741554, 24.70628625, 24.63921608, 24.55737849, 24.45387072, 24.32540729, 24.17330165, 24.00350515, 23.82570517, 23.65170184, 23.49341813, 23.3609297 , 23.26084477, 23.19526462, 23.16145911, 23.15230444, 23.15744893, 23.1650741 , 23.16400625, 23.14583316, 23.10663225, 23.0479586 , 22.97687096, 22.90496805, 22.84660339, 22.81660048, 22.82786464, 22.88928178, 23.00422558, 23.16988822, 23.37752144, 23.61354366, 23.86133847, 24.10345736, 24.32386878, 24.50988289, 24.65344566, 24.75163008, 24.80632285, 24.82327337, 24.81078681, 24.7783673 , 24.73555804, 24.69109834, 24.65238215, 24.62510832, 24.61300002, 24.6175379 , 24.63776609, 24.67032827, 24.70991851, 24.75025388, 24.78550989, 24.81196447, 24.8294469 , 24.8421494 , 24.8584646 , 24.88973503, 24.94808061, 25.04373131, 25.18244806, 25.36362848, 25.5795525 , 25.81596104, 26.05384864, 26.27207729, 26.45025136, 26.5712862 , 26.62323899, 26.60020216, 26.50230214, 26.33502117, 26.10813206, 25.8344986 , 25.52890064, 25.20694485, 24.88406188, 24.57458676, 24.29095003, 24.04304603, 23.83786147, 23.6794253 , 23.56909201, 23.50610533, 23.48833479, 23.51304501, 23.57755062, 23.67963021, 23.81760821, 23.990065 , 24.19520156, 24.42996195, 24.6891014 , 24.96445605, 25.24469405, 25.51577824, 25.76223051, 25.96908697, 26.12421257, 26.22048478, 26.25731268, 26.24107105, 26.18426542, 26.10355038, 26.01700679, 25.94125861, 25.8890338 , 25.8676357 , 25.87854033, 25.91804195, 25.97863088, 26.05065532, 26.12384376, 26.1884038 , 26.23562463, 26.25810021, 26.24980261, 26.20623456, 26.12479628, 26.00535564, 25.85087584, 25.66786627, 25.46641059, 25.25958457, 25.06219596, 24.8889297 , 24.7521455 , 24.6597023 , 24.61325379, 24.60742671, 24.63016675, 24.66431713, 24.69024289, 24.68908247, 24.64605646, 24.55322904, 24.41120703, 24.2294516 , 24.02512542, 23.82065198, 23.64038099, 23.50689561, 23.43755046, 23.44178865, 23.51966037, 23.66177874, 23.85072316, 24.06366917, 24.27583037, 24.46416343, 24.610749 , 24.70532068, 24.74656411, 24.74200901, 24.70655865, 24.65990073, 24.62319998, 24.61557791, 24.65093363, 24.73563574, 24.8675153 , 25.036386 , 25.22603848, 25.41733206, 25.59173366, 25.73451032, 25.83684547, 25.89641623, 25.91638718, 25.90321088, 25.86394591, 25.80390011, 25.7252557 , 25.62699067, 25.50600347, 25.35901372, 25.18464715, 24.98514697, 24.76732771]), interp=interp_random, crack_list=[], maxload=35.) avg_strain = ctt1.stress_strain_diagram()[1] assert np.allclose(avg_strain, [ 0.00000000e+00, 1.40000000e-05, 2.80000000e-05, 4.20000000e-05, 5.60000000e-05, 7.00000000e-05, 8.40000000e-05, 9.80000000e-05, 1.12000000e-04, 1.26000000e-04, 1.40000000e-04, 1.54000000e-04, 1.68000000e-04, 1.82000000e-04, 1.96000000e-04, 2.10000000e-04, 2.24000000e-04, 2.38000000e-04, 2.52000000e-04, 2.66000000e-04, 2.80000000e-04, 2.94000000e-04, 3.08000000e-04, 3.22000000e-04, 3.36000000e-04, 3.50000000e-04, 3.64000000e-04, 3.78000000e-04, 3.92000000e-04, 4.06000000e-04, 4.20000000e-04, 4.34000000e-04, 4.48000000e-04, 4.62000000e-04, 4.76000000e-04, 4.90000000e-04, 5.04000000e-04, 5.18000000e-04, 5.32000000e-04, 5.46000000e-04, 5.60000000e-04, 5.74000000e-04, 5.88000000e-04, 6.02000000e-04, 6.16000000e-04, 6.30000000e-04, 6.44000000e-04, 6.58000000e-04, 6.72000000e-04, 6.86000000e-04, 7.00000000e-04, 7.14000000e-04, 7.28000000e-04, 7.42000000e-04, 7.56000000e-04, 7.70000000e-04, 7.84000000e-04, 7.98000000e-04, 8.12000000e-04, 8.26000000e-04, 8.40000000e-04, 8.54000000e-04, 8.68000000e-04, 8.82000000e-04, 2.10227420e-03, 2.15034410e-03, 2.18347982e-03, 3.40911184e-03, 4.55584211e-03, 5.58019872e-03, 6.81027062e-03, 6.96400869e-03, 7.82187304e-03, 7.96035059e-03, 8.06987750e-03, 9.07737156e-03, 9.27014306e-03, 9.74847171e-03, 9.91229237e-03, 1.00399080e-02, 1.01675236e-02, 1.02951392e-02, 1.04227548e-02, 1.05503704e-02, 1.06779860e-02, 1.08057994e-02, 1.09338535e-02, 1.16366621e-02, 1.17876251e-02, 1.21253943e-02, 1.28637696e-02, 1.34904968e-02, 1.37012941e-02, 1.38512391e-02, 1.40011842e-02, 1.41511293e-02, 1.43010743e-02, 1.44510194e-02, 1.50854127e-02, 1.52927259e-02, 1.54489481e-02]) model2 = CrackBridgeConstantBond(T = 80., E_m = 25e3, E_r = 180e3, v_r = 0.05) CB_constant = CrackBridge(ccb=model2) interp_constant = Interpolater(cb=CB_constant) ctt2 = CompositeTensileTest(xgrid = np.linspace(0, 100, 201), mstrength = np.array( [ 24.48308021, 24.17911779, 24.13299083, 24.32705351, 24.6264534 , 24.82303314, 24.74039541, 24.35155233, 23.80737415, 23.33441077, 23.08313741, 23.06721277, 23.22692182, 23.51390379, 23.90791804, 24.36900479, 24.79077504, 25.02508878, 24.98338138, 24.74594657, 24.57881479, 24.77692481, 25.40194414, 26.18394637, 26.74831162, 26.92945645, 26.83665131, 26.68929627, 26.65821645, 26.8113602 , 27.11577482, 27.45141088, 27.64283761, 27.53018842, 27.04829411, 26.25204993, 25.28737054, 24.3461152 , 23.61653737, 23.2343871 , 23.24419843, 23.57700352, 24.06264401, 24.48654647, 24.67594913, 24.58577189, 24.3337556 , 24.14607803, 24.23271766, 24.66229721, 25.32167385, 25.98702865, 26.44361372, 26.58546443, 26.45183735, 26.16985931, 25.85235278, 25.55070872, 25.2700121 , 24.98630377, 24.66572488, 24.30380988, 23.95254653, 23.71342463, 23.68954881, 23.87938838, 24.10385826, 24.13860135, 23.97686719, 23.87736004, 24.08840377, 24.5903218 , 25.1449034 , 25.5210235 , 25.63789498, 25.55440919, 25.37428555, 25.16288381, 24.9362816 , 24.69865374, 24.46255288, 24.25373203, 24.13839841, 24.2225524 , 24.56307844, 25.0763397 , 25.56745361, 25.87099791, 25.98938739, 26.08373808, 26.27365962, 26.45361058, 26.36990845, 25.87705932, 25.07589727, 24.2177474 , 23.52644633, 23.11273179, 22.99407158, 23.13294487, 23.45475559, 23.86357998, 24.25631195, 24.53628603, 24.64378436, 24.58777989, 24.45310937, 24.3823323 , 24.52203243, 24.92868846, 25.49266401, 25.97769779, 26.18101206, 26.06243146, 25.72644364, 25.33514652, 25.04779269, 24.96763711, 25.09114697, 25.31856272, 25.54947512, 25.78917554, 26.13096768, 26.59553076, 27.02601045, 27.20375992, 27.05358088, 26.69410687, 26.30477605, 25.98557358, 25.74427114, 25.57283974, 25.48516081, 25.47364594, 25.48197579, 25.46860378, 25.48005166, 25.62428991, 25.95406378, 26.36161286, 26.61254107, 26.53456491, 26.14965526, 25.58213039, 24.91962102, 24.25529408, 23.78302045, 23.69119485, 23.94942671, 24.31205911, 24.5536455 , 24.62338104, 24.60479144, 24.64632961, 24.89166967, 25.32657695, 25.70222518, 25.74416271, 25.44691368, 25.06559609, 24.83202699, 24.77691847, 24.79933813, 24.77665421, 24.5997768 , 24.24385896, 23.87010347, 23.75875879, 24.05454561, 24.61112415, 25.13760003, 25.4764081 , 25.69151128, 25.90696206, 26.13876921, 26.30639627, 26.343004 , 26.25110704, 26.08588359, 25.91875447, 25.78554165, 25.63769723, 25.38599222, 25.03264357, 24.71923155, 24.59473392, 24.65429921, 24.75260315, 24.77504273, 24.75961968, 24.84533564, 25.11440995, 25.4710194 , 25.67538136, 25.54299902, 25.13922711, 24.75326324, 24.64724944, 24.82471052, 25.05149967, 25.09773906]), interp=interp_constant, crack_list=[], maxload=35.) avg_strain2 = ctt2.stress_strain_diagram()[1] assert np.allclose(avg_strain2, [ 0.00000000e+00, 1.40000000e-05, 2.80000000e-05, 4.20000000e-05, 5.60000000e-05, 7.00000000e-05, 8.40000000e-05, 9.80000000e-05, 1.12000000e-04, 1.26000000e-04, 1.40000000e-04, 1.54000000e-04, 1.68000000e-04, 1.82000000e-04, 1.96000000e-04, 2.10000000e-04, 2.24000000e-04, 2.38000000e-04, 2.52000000e-04, 2.66000000e-04, 2.80000000e-04, 2.94000000e-04, 3.08000000e-04, 3.22000000e-04, 3.36000000e-04, 3.50000000e-04, 3.64000000e-04, 3.78000000e-04, 3.92000000e-04, 4.06000000e-04, 4.20000000e-04, 4.34000000e-04, 4.48000000e-04, 4.62000000e-04, 4.76000000e-04, 4.90000000e-04, 5.04000000e-04, 5.18000000e-04, 5.32000000e-04, 5.46000000e-04, 5.60000000e-04, 5.74000000e-04, 5.88000000e-04, 6.02000000e-04, 6.16000000e-04, 6.30000000e-04, 6.44000000e-04, 6.58000000e-04, 6.72000000e-04, 6.86000000e-04, 7.00000000e-04, 7.14000000e-04, 7.28000000e-04, 7.42000000e-04, 7.56000000e-04, 7.70000000e-04, 7.84000000e-04, 7.98000000e-04, 8.12000000e-04, 8.26000000e-04, 8.40000000e-04, 8.54000000e-04, 8.68000000e-04, 8.82000000e-04, 8.96000000e-04, 9.10000000e-04, 7.57866479e-03, 8.56771732e-03, 9.62006227e-03, 1.08803966e-02, 1.18963317e-02, 1.29511301e-02, 1.41603623e-02, 1.55798313e-02, 1.63174009e-02, 1.75381169e-02, 1.88708247e-02, 2.11500704e-02, 2.15384000e-02, 2.19052000e-02, 2.22720000e-02, 2.26388000e-02, 2.30056000e-02, 2.33724000e-02, 2.37392000e-02, 2.41060000e-02, 2.44728000e-02, 2.48396000e-02, 2.52064000e-02, 2.55732000e-02, 2.59400000e-02, 2.63068000e-02, 2.66736000e-02, 2.70404000e-02, 2.74072000e-02, 2.77740000e-02, 2.81408000e-02, 2.85076000e-02, 2.88744000e-02, 2.92412000e-02, 2.96080000e-02])
# print tau_scale.reshape(6,6) n_cracks = [] for i, m in enumerate([6.0, 7.0, 8.0, 9.0, 10.0, 11.0]): for j, s in enumerate([0.0070, 0.0075, 0.0080, 0.0085, 0.0090, 0.0095]): scale = tau_scale[i * 6 + j] shape = tau_shape[i * 6 + j] reinf = ContinuousFibers(r=3.5e-3, tau=RV( 'gamma', loc=0., scale=scale, shape=shape), V_f=0.01, E_f=180e3, xi=fibers_MC(m=m, sV0=s), label='carbon', n_int=500) cb = RandomBondCB(E_m=25e3, reinforcement_lst=[reinf], n_BC=12, L_max=300) ctt = CompositeTensileTest(n_x=600, L=300, cb=cb, sig_mu_x=random_field.random_field) sig_c_i, z_x_i, BC_x_i, sig_c_u = ctt.get_cracking_history() print(sig_c_i) print((m, s)) print(('number of cracks:', len(ctt.y)))
# scale = interp_tau_scale(s, m) # shape = 0.0718309208735*1.0 # scale = 1.12965815478*1.0 # # shape = 0.0479314809805 * 1.5 # scale = 2.32739332143 # # print shape, scale reinf1 = ContinuousFibers(r=3.5e-3, tau=RV( 'gamma', loc=0.00126, scale=1.440, shape=0.0539), V_f=0.01, E_f=180e3, # xi=fibers_MC(m=6.7, sV0=0.0076), xi=fibers_MC(m=60, sV0=0.02), label='carbon', n_int=500) cb = RandomBondCB(E_m=25e3, reinforcement_lst=[reinf1], n_BC=10, L_max=200.) random_field = RandomField(seed=False, lacor=1., length=500, nx=1000, nsim=1, loc=.0, shape=60.,
random_field = RandomField(seed=True, lacor=1., length=length, nx=500, nsim=1, loc=.0, shape=15., scale=4.0, distr_type='Weibull' ) reinf1 = ContinuousFibers(r=3.5e-3, tau=RV('weibull_min', loc=0.01, scale=.01, shape=2.), V_f=0.05, E_f=200e3, xi=fibers_MC(m=7., sV0=0.01), label='carbon', n_int=100) reinf2 = ContinuousFibers(r=3.5e-3, tau=RV('weibull_min', loc=0.01, scale=.02, shape=2.), V_f=0.008, E_f=200e3, xi=fibers_MC(m=7., sV0=0.011), label='carbon', n_int=100) reinf_short = ShortFibers(bond_law = 'plastic', r=.2, tau=1.5, V_f=0.01,
def valid(CS, param_set, w_max): plt.figure() TT() from quaducom.meso.homogenized_crack_bridge.elastic_matrix.reinforcement import ContinuousFibers from stats.pdistrib.weibull_fibers_composite_distr import fibers_MC length = 250. nx = 5000 tau_loc, tau_shape, xi_shape = param_set E_f = 182e3 mu_tau = 1.3 * 3.5e-3 * 3.6 * (1.-0.01) / (2. * 0.01 * CS) tau_scale = (mu_tau - tau_loc)/tau_shape xi_scale = 3243. / (182e3 * (pi * 3.5e-3 **2 * 50.)**(-1./xi_shape)*gamma(1+1./xi_shape)) #xi_scale = 1578. / (182e3 * (pi * 3.5e-3 **2 * 500. * e)**(-1./xi_shape)) n_CB = 8 ld = False w_width = False w_density = False random_field1 = RandomField(seed=False, lacor=1., length=length, nx=800, nsim=1, loc=.0, shape=45., scale=3.6, distr_type='Weibull' ) reinf1 = ContinuousFibers(r=3.5e-3, tau=RV('gamma', loc=tau_loc, scale=tau_scale, shape=tau_shape), V_f=0.01, E_f=E_f, xi=fibers_MC(m=xi_shape, sV0=xi_scale), label='carbon', n_int=500) CB_model1 = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf1], ) scm1 = SCM(length=length, nx=nx, random_field=random_field1, CB_model=CB_model1, load_sigma_c_arr=np.linspace(0.01, 35., 100), n_BC_CB=n_CB ) scm_view1 = SCMView(model=scm1) scm_view1.model.evaluate() eps1, sigma1 = scm_view1.eps_sigma eps11, sigma11 = scm_view1.eps_sigma_altern cr_lst1 = scm_view1.model.cracking_stress_lst interp1 = interp1d(sigma1, eps1) plt.plot(eps11, sigma11, color='red', lw=2, label='Vf=1.0, crack spacing = ' + str(length/float(len(cr_lst1)))) #plt.plot(eps11, sigma11, color='black', ls='dashed', lw=2, label='altern eps') plt.plot(interp1(np.array(cr_lst1) - np.max(sigma1)/100.), np.array(cr_lst1) - np.max(sigma1)/100., 'ro') if len(cr_lst1) > 2: random_field2 = RandomField(seed=False, lacor=1., length=length, nx=700, nsim=1, loc=.0, shape=45., scale=4.38, distr_type='Weibull' ) reinf2 = ContinuousFibers(r=3.5e-3, tau=RV('gamma', loc=tau_loc, scale=tau_scale, shape=tau_shape), V_f=0.015, E_f=E_f, xi=fibers_MC(m=xi_shape, sV0=xi_scale), label='carbon', n_int=500) CB_model2 = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf2], ) scm2 = SCM(length=length, nx=nx, random_field=random_field2, CB_model=CB_model2, load_sigma_c_arr=np.linspace(0.01, 40., 100), n_BC_CB=n_CB ) scm_view2 = SCMView(model=scm2) scm_view2.model.evaluate() eps2, sigma2 = scm_view2.eps_sigma cr_lst2 = scm_view2.model.cracking_stress_lst interp2 = interp1d(sigma2, eps2) plt.plot(eps2, sigma2, color='blue', lw=2, label='Vf=1.5, crack spacing = ' + str(length/float(len(cr_lst2)))) plt.plot(interp2(np.array(cr_lst2) - np.max(sigma2)/100.), np.array(cr_lst2) - np.max(sigma2)/100., 'bo') plt.xlabel('composite strain [-]') plt.ylabel('composite stress [MPa]') plt.xlim(0., np.max(eps1) * 1.15) plt.legend(loc='best') plt.savefig('validation_figsCS%1.f/w_max%.1f.png'%(CS,w_max)) plt.close() if ld == True: plt.plot(eps1, sigma1, color='red', lw=2, label='Vf=1.0, crack spacing = ' + str(length/float(len(cr_lst1)))) #plt.plot(eps11, sigma11, color='black', ls='dashed', lw=2, label='altern eps') plt.plot(interp1(np.array(cr_lst1) - np.max(sigma1)/100.), np.array(cr_lst1) - np.max(sigma1)/100., 'ro') plt.plot(eps2, sigma2, color='blue', lw=2, label='Vf=1.5, crack spacing = ' + str(length/float(len(cr_lst2)))) plt.plot(interp2(np.array(cr_lst2) - np.max(sigma2)/100.), np.array(cr_lst2) - np.max(sigma2)/100., 'bo') plt.xlabel('composite strain [-]') plt.ylabel('composite stress [MPa]') plt.xlim(0., np.max(eps1) * 1.1) plt.legend(loc='best') if w_width == True: plt.figure() plt.plot(scm_view1.model.load_sigma_c_arr, scm_view1.w_mean) plt.plot(scm_view1.model.load_sigma_c_arr, scm_view1.w_max) # plt.plot(scm_view2.model.load_sigma_c_arr, scm_view2.w_mean) # plt.plot(scm_view2.model.load_sigma_c_arr, scm_view2.w_max) if w_density == True: plt.figure() plt.plot(scm_view1.model.load_sigma_c_arr , scm_view1.w_density)
def cal(k): home_dir = 'D:\\Eclipse\\' path1 = [home_dir, 'git', # the path of the data file 'rostar', 'scratch', 'diss_figs', 'TT-4C-01.txt'] filepath1 = os.path.join(*path1) data = np.loadtxt(filepath1, delimiter=';') eps_max = np.amax(-data[:, 2] / 2. / 250. - data[:, 3] / 2. / 250.) eps_arr = np.linspace(0, eps_max, 100) interp_exp = interp1d(-data[:, 2] / 2. / 250. - data[:, 3] / 2. / 250., data[:, 1] / 2., bounds_error=False, fill_value=0.) sig_exp = interp_exp(eps_arr) reinf = ContinuousFibers(r=3.5e-3, tau=RV( 'gamma', loc=0.001260, scale=1.440, shape=0.0539), V_f=0.01, E_f=180e3, xi=fibers_MC(m=6.7, sV0=0.0076), label='carbon', n_int=500) cb = RandomBondCB(E_m=25e3, reinforcement_lst=[reinf], n_BC=10, L_max=300) ctt = CompositeTensileTest(n_x=600, L=300., cb=cb) n = 10 s_m_arr = np.linspace(2.8, 3.8, n) lack_of_fit = np.zeros(10) crack_spacing = np.zeros(10) for i in range(10): m_m = bisect(lambda m: scale(m) - s_m_arr[i], 1., 1000.) print(m_m) random_field = RandomField(seed=False, lacor=1., length=300., nx=600, nsim=1, loc=.0, scale=s_m_arr[i], shape=m_m, distr_type='Weibull') ctt.sig_mu_x = random_field.random_field sig_c_i, z_x_i, BC_x_i, sig_c_u, n_cracks = ctt.get_cracking_history() load_arr = np.linspace(0, sig_c_u, 100) eps_c_arr = ctt.get_eps_c_arr(sig_c_i, z_x_i, BC_x_i, load_arr) interp_sim = interp1d( eps_c_arr, load_arr, bounds_error=False, fill_value=0.) sig_sim = interp_sim(eps_arr) lack_of_fit[i] += np.sum((sig_sim - sig_exp) ** 2) / k crack_spacing[i] += ctt.L / n_cracks / k return lack_of_fit, crack_spacing
length=length, nx=1000, nsim=1, loc=.0, shape=50., scale=3.4, distr_type='Weibull') reinf_cont = ContinuousFibers(r=3.5e-3, tau=RV('weibull_min', loc=0.01, scale=.1, shape=2.), V_f=0.01, E_f=200e3, xi=fibers_MC(m=7., sV0=0.005), label='carbon', n_int=100) reinf_short = ShortFibers(bond_law='plastic', r=.2, tau=1., V_f=0.01, E_f=200e3, xi=10., snub=0.5, phi=RV('sin2x', scale=1.0, shape=0.0), Lf=20., label='short steel fibers', n_int=50)
'CB1.txt'] filepath = os.path.join(*path) exp_data = np.zeros_like(w_arr) file1 = open(filepath, 'r') cb = np.loadtxt(file1, delimiter=';') test_xdata = -cb[:, 2] / 4. - cb[:, 3] / 4. - cb[:, 4] / 2. test_ydata = cb[:, 1] / (11. * 0.445) * 1000 interp = interp1d(test_xdata, test_ydata, bounds_error=False, fill_value=0.) exp_data = interp(w_arr) reinf1 = ContinuousFibers(r=3.5e-3, tau=RV('weibull_min', loc=0.01, scale=.1, shape=2.), V_f=0.005, E_f=200e3, xi=fibers_MC(m=7., sV0=0.005), label='carbon', n_int=200) cb1 = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf1] ) rcb = RepresentativeCB(ccb=cb1) print((rcb.sig_cu)) # print scb.data[0].shape # print scb.data[1].shape z = np.linspace(0, 500, 501) # _lambda = np.ones_like(x)*60
def valid(CS, param_set, w_max): plt.figure() TT() from quaducom.meso.homogenized_crack_bridge.elastic_matrix.reinforcement import ContinuousFibers from stats.pdistrib.weibull_fibers_composite_distr import fibers_MC length = 250. nx = 5000 tau_loc, tau_shape, xi_shape = param_set E_f = 182e3 mu_tau = 1.3 * 3.5e-3 * 3.6 * (1. - 0.01) / (2. * 0.01 * CS) tau_scale = (mu_tau - tau_loc) / tau_shape xi_scale = 3243. / (182e3 * (pi * 3.5e-3**2 * 50.)**(-1. / xi_shape) * gamma(1 + 1. / xi_shape)) #xi_scale = 1578. / (182e3 * (pi * 3.5e-3 **2 * 500. * e)**(-1./xi_shape)) n_CB = 8 ld = False w_width = False w_density = False random_field1 = RandomField(seed=False, lacor=1., length=length, nx=800, nsim=1, loc=.0, shape=45., scale=3.6, distr_type='Weibull') reinf1 = ContinuousFibers(r=3.5e-3, tau=RV('gamma', loc=tau_loc, scale=tau_scale, shape=tau_shape), V_f=0.01, E_f=E_f, xi=fibers_MC(m=xi_shape, sV0=xi_scale), label='carbon', n_int=500) CB_model1 = CompositeCrackBridge( E_m=25e3, reinforcement_lst=[reinf1], ) scm1 = SCM(length=length, nx=nx, random_field=random_field1, CB_model=CB_model1, load_sigma_c_arr=np.linspace(0.01, 35., 100), n_BC_CB=n_CB) scm_view1 = SCMView(model=scm1) scm_view1.model.evaluate() eps1, sigma1 = scm_view1.eps_sigma eps11, sigma11 = scm_view1.eps_sigma_altern cr_lst1 = scm_view1.model.cracking_stress_lst interp1 = interp1d(sigma1, eps1) plt.plot(eps11, sigma11, color='red', lw=2, label='Vf=1.0, crack spacing = ' + str(length / float(len(cr_lst1)))) #plt.plot(eps11, sigma11, color='black', ls='dashed', lw=2, label='altern eps') plt.plot(interp1(np.array(cr_lst1) - np.max(sigma1) / 100.), np.array(cr_lst1) - np.max(sigma1) / 100., 'ro') if len(cr_lst1) > 2: random_field2 = RandomField(seed=False, lacor=1., length=length, nx=700, nsim=1, loc=.0, shape=45., scale=4.38, distr_type='Weibull') reinf2 = ContinuousFibers(r=3.5e-3, tau=RV('gamma', loc=tau_loc, scale=tau_scale, shape=tau_shape), V_f=0.015, E_f=E_f, xi=fibers_MC(m=xi_shape, sV0=xi_scale), label='carbon', n_int=500) CB_model2 = CompositeCrackBridge( E_m=25e3, reinforcement_lst=[reinf2], ) scm2 = SCM(length=length, nx=nx, random_field=random_field2, CB_model=CB_model2, load_sigma_c_arr=np.linspace(0.01, 40., 100), n_BC_CB=n_CB) scm_view2 = SCMView(model=scm2) scm_view2.model.evaluate() eps2, sigma2 = scm_view2.eps_sigma cr_lst2 = scm_view2.model.cracking_stress_lst interp2 = interp1d(sigma2, eps2) plt.plot(eps2, sigma2, color='blue', lw=2, label='Vf=1.5, crack spacing = ' + str(length / float(len(cr_lst2)))) plt.plot(interp2(np.array(cr_lst2) - np.max(sigma2) / 100.), np.array(cr_lst2) - np.max(sigma2) / 100., 'bo') plt.xlabel('composite strain [-]') plt.ylabel('composite stress [MPa]') plt.xlim(0., np.max(eps1) * 1.15) plt.legend(loc='best') plt.savefig('validation_figsCS%1.f/w_max%.1f.png' % (CS, w_max)) plt.close() if ld == True: plt.plot(eps1, sigma1, color='red', lw=2, label='Vf=1.0, crack spacing = ' + str(length / float(len(cr_lst1)))) #plt.plot(eps11, sigma11, color='black', ls='dashed', lw=2, label='altern eps') plt.plot(interp1(np.array(cr_lst1) - np.max(sigma1) / 100.), np.array(cr_lst1) - np.max(sigma1) / 100., 'ro') plt.plot(eps2, sigma2, color='blue', lw=2, label='Vf=1.5, crack spacing = ' + str(length / float(len(cr_lst2)))) plt.plot(interp2(np.array(cr_lst2) - np.max(sigma2) / 100.), np.array(cr_lst2) - np.max(sigma2) / 100., 'bo') plt.xlabel('composite strain [-]') plt.ylabel('composite stress [MPa]') plt.xlim(0., np.max(eps1) * 1.1) plt.legend(loc='best') if w_width == True: plt.figure() plt.plot(scm_view1.model.load_sigma_c_arr, scm_view1.w_mean) plt.plot(scm_view1.model.load_sigma_c_arr, scm_view1.w_max) # plt.plot(scm_view2.model.load_sigma_c_arr, scm_view2.w_mean) # plt.plot(scm_view2.model.load_sigma_c_arr, scm_view2.w_max) if w_density == True: plt.figure() plt.plot(scm_view1.model.load_sigma_c_arr, scm_view1.w_density)
from quaducom.meso.homogenized_crack_bridge.elastic_matrix.reinforcement import ContinuousFibers, ShortFibers from stats.pdistrib.weibull_fibers_composite_distr import fibers_MC import matplotlib.pyplot as plt tau_scale =1.53419049 tau_shape = 1. tau_loc = 0.00 xi_shape = 8.6 xi_scale = .0114 reinf1 = ContinuousFibers(r=3.5e-3, tau=RV('weibull_min', loc=0.01, scale=.1, shape=2.), V_f=0.005, E_f=200e3, xi=fibers_MC(m=7., sV0=0.005), label='carbon', n_int=100) reinf_cont = ContinuousFibers(r=3.5e-3, tau=RV('gamma', loc=tau_loc, scale=tau_scale, shape=tau_shape), V_f=0.00001, E_f=181e3, xi=fibers_MC(m=xi_shape, sV0=xi_scale), label='carbon', n_int=500) reinf_short = ShortFibers(bond_law = 'plastic', r=.2, tau=1., V_f=0.01,
length=length, nx=500, nsim=1, loc=.0, shape=15., scale=4.0, distr_type='Weibull') reinf1 = ContinuousFibers(r=3.5e-3, tau=RV('weibull_min', loc=0.01, scale=.01, shape=2.), V_f=0.05, E_f=200e3, xi=fibers_MC(m=7., sV0=0.01), label='carbon', n_int=100) reinf2 = ContinuousFibers(r=3.5e-3, tau=RV('weibull_min', loc=0.01, scale=.02, shape=2.), V_f=0.008, E_f=200e3, xi=fibers_MC(m=7., sV0=0.011), label='carbon', n_int=100) reinf_short = ShortFibers(bond_law='plastic',
# print x sigma = cali.get_sigma_tau_w(0.0045) sig_avg = np.sum(x * sigma, axis=1) plt.figure() plt.plot(w_arr, exp_data, '--') plt.plot(w_arr, sig_avg) reinf = FiberBundle(r=0.0035, tau=tau_arr, tau_weights=x, V_f=0.01, E_f=200e3, xi=fibers_MC(m=8, sV0=0.0045)) ccb1 = RandomBondCB(E_m=25e3, reinforcement_lst=[reinf], Ll=6.85, Lr=6.85, L_max = 100) print((ccb1.max_sig_c(ccb1.Ll, ccb1.Lr))) plt.figure() plt.plot(ccb1._x_arr, ccb1.E_m*ccb1._epsm_arr) plt.figure() plt.plot(np.zeros_like(ccb1._epsf0_arr), ccb1._epsf0_arr, 'ro', label='maximum') for i, depsf in enumerate(ccb1.sorted_depsf): epsf_x = np.maximum(ccb1._epsf0_arr[i] - depsf * np.abs(ccb1._x_arr), ccb1._epsm_arr) print((np.trapz(epsf_x - ccb1._epsm_arr, ccb1._x_arr)))
import ContinuousFibers from spirrid.rv import RV from calibration.tau_strength_dependence import interp_tau_shape, interp_tau_scale from calibration.matrix_strength_dependence import interp_m_shape from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from scipy.special import gamma home_dir = 'D:\\Eclipse\\' reinf = ContinuousFibers(r=3.5e-3, tau=RV( 'gamma', loc=0.001260, scale=1.440, shape=0.0539), V_f=0.01, E_f=180e3, xi=fibers_MC(m=6.7, sV0=0.0076), label='carbon', n_int=500) cb = RandomBondCB(E_m=25e3, reinforcement_lst=[reinf], n_BC=10, L_max=300) ctt = CompositeTensileTest(n_x=1000, L=500., cb=cb) for i, s_m in enumerate([2.82, 2.65, 2.85, 3.42, 3.30]): path1 = [home_dir, 'git', # the path of the data file 'rostar',
from scipy.interpolate import interp1d x_arr = np.linspace(-487.40753435, 0., 500) slip_arr = np.zeros((500, 100)) bond_arr = np.zeros((500, 100)) for k, w in enumerate(np.linspace(1e-5, 1, 100)): reinf = ContinuousFibers(r=3.5e-3, tau=RV( 'gamma', loc=0.001260, scale=1.440, shape=0.0539), V_f=0.01, E_f=180e3, xi=fibers_MC(m=6.7, sV0=1.0076), label='carbon', n_int=500) ccb = RandomBondCB(E_m=25e3, reinforcement_lst=[reinf], Ll=1500., Lr=1500., L_max=400, n_BC=12, w=w) ccb.damage Kf_intact = ccb.Kf * (1. - ccb.damage) mu_T = np.cumsum((ccb.sorted_depsf * Kf_intact)[::-1])[::-1] tau = (mu_T / reinf.V_f * reinf.r / 2)[::-1]
def get_sigma_m_x_input( self, sigma ): self.apply_load( sigma ) line = MFnLineArray( xdata = self.x_arr, ydata = self.epsm_arr ) return line.get_values( self.x_input ) if __name__ == '__main__': from quaducom.meso.homogenized_crack_bridge.elastic_matrix.reinforcement import ContinuousFibers from stats.pdistrib.weibull_fibers_composite_distr import WeibullFibers, fibers_MC reinf = ContinuousFibers(r=0.0035, tau=RV('weibull_min', loc=0.0, shape=1., scale=0.1), V_f=0.01, E_f=240e3, xi=fibers_MC(m=20.0, sV0=0.0026), label='carbon', n_int=500) model = CompositeCrackBridge(E_m=25e10, reinforcement_lst=[reinf], Ll=1000., Lr=1000., ) ccb_view = CompositeCrackBridgeView(model=model) def profile( w ): ccb_view.model.w = w plt.plot( ccb_view.x_arr, ccb_view.epsm_arr, lw = 2, label = 'Ll=' + str( ccb_view.model.Ll ) ) plt.plot( ccb_view.x_arr, ccb_view.mu_epsf_arr, color = 'red', lw = 2 )
filepath2 = os.path.join(*path2) data = np.loadtxt(filepath1, delimiter=';') plt.plot(-data[:, 2] / 2. / 250. - data[:, 3] / 2. / 250., data[:, 1] / 2., lw=1, color='0.5') data = np.loadtxt(filepath2, delimiter=';') plt.plot(-data[:, 2] / 2. / 250. - data[:, 3] / 2. / 250., data[:, 1] / 2., lw=1, color='0.5') # 4 layers reinf1 = ContinuousFibers(r=3.5e-3, tau=RV( 'gamma', loc=0., scale=2.276, shape=0.0505), V_f=0.01, E_f=180e3, xi=fibers_MC(m=8.806, sV0=0.0134), label='carbon', n_int=500) cb = RandomBondCB(E_m=25e3, reinforcement_lst=[reinf1], n_BC=12, L_max=120.) force1 = np.array([7.3054, 8.3827, 8.4770, 9.1553, 9.1553, 11.9988, 14.9728, 15.8779, 20.9879, 20.9879]) position1 = np.array([66.9834, 106.4972, 22.4680, 40.2742, 83.7893, 29.9706, 113.4996, 57.9803, 8.1630, 94.3930]) ctta = CTTAramis(n_x=400, L=120, cb=cb,
return np.array(t_idx, np.int_) def get_time_idx(self, vot): return int(self.get_time_idx_arr(vot)) if __name__ == '__main__': reinf = ContinuousFibers(r=3.5e-3, tau=RV( 'gamma', loc=0., scale=2.3273933214348754, shape=0.04793148098051675), V_f=0.010, E_f=180e3, xi=fibers_MC(m=6, sV0=0.0095), label='carbon', n_int=500) rb_cb = BMCSRandomBondCB(E_m=25e3, reinforcement_lst=[reinf], Ll=100., Lr=150., L_max=300, n_BC=6) viz2d_sig_eps = Viz2DCBFieldVar(name='field variable', vis2d=rb_cb) w = BMCSWindow(model=rb_cb)
from spirrid.spirrid import SPIRRID from spirrid.rv import RV from matplotlib import pyplot as plt from scipy.stats import weibull_min from stats.pdistrib.weibull_fibers_composite_distr import fibers_MC, fibers_CB_rigid, fibers_dry, fibers_CB_elast from math import pi from quaducom.meso.homogenized_crack_bridge.elastic_matrix.reinforcement_old import ContinuousFibers from stats.pdistrib.weibull_fibers_composite_distr import WeibullFibers, fibers_MC from quaducom.meso.homogenized_crack_bridge.elastic_matrix.hom_CB_elastic_mtrx_view import CompositeCrackBridge, CompositeCrackBridgeView import copy reinf = ContinuousFibers(r=0.0035, tau=0.1, V_f=0.05, E_f=200e3, xi=fibers_MC(m=5.0, sV0=10.006), label='carbon', n_int=200) model = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf], Ll=100., Lr=100., ) ccb_view = CompositeCrackBridgeView(model=model) def BC_effect(w_arr): model.Ll = 1e10 model.Lr = 1e10 sigma_c_arr = ccb_view.sigma_c_arr(w_arr)