def evaluate(self): '''evaluates the cracking history and saves it in a list''' if len(self.CB_objects_lst) == 0: # first crack position_first_crack = self.x_arr[np.argmin(self.matrix_strength)] sigmac_pre_crack = np.min( self.matrix_strength) / self.CB_model.E_m * self.CB_model.E_c pre_cracking_W = sigmac_pre_crack / self.CB_model.E_c * self.length first_CB = CB( position=position_first_crack, cracking_stress=sigmac_pre_crack, pre_cracking_W=pre_cracking_W, CB_model=CompositeCrackBridge( reinforcement_lst=self.CB_model.reinforcement_lst, E_m=self.CB_model.E_m, Gf=self.CB_model.Gf, ft=float(self.matrix_strength[np.argwhere( position_first_crack == self.x_arr)]) * 0.99)) self.CB_objects_lst.append(first_CB) while True: try: s = t.clock() sigmac_pre_crack, position_new_crack, pre_cracking_W, pre_cracking_w_lst = self.find_next_crack( ) cb_lst = [] for i, cb_i in enumerate(self.sorted_CB_lst): if cb_i.CB_model.w_unld < pre_cracking_w_lst[i]: cb_i.CB_model.w_unld = pre_cracking_w_lst[i] cb_lst.append(cb_i) self.CB_objects_lst = cb_lst new_CB = CB( position=position_new_crack, cracking_stress=sigmac_pre_crack, pre_cracking_W=pre_cracking_W, CB_model=CompositeCrackBridge( reinforcement_lst=self.CB_model.reinforcement_lst, E_m=self.CB_model.E_m, Gf=self.CB_model.Gf, ft=float(self.matrix_strength[np.argwhere( position_new_crack == self.x_arr)]) * 0.99)) self.CB_objects_lst.append(new_CB) print 'crack #' + str(len(self.CB_objects_lst) + 1), 'evaluated, time: ', t.clock( ) - s, 's, Gf = ', self.CB_model.Gf except: # #plt.plot(np.hstack((0.0,self.cracking_W_lst)), np.hstack((0.0,self.cracking_stresses_lst)), color='blue', lw=2) # #plt.show() print 'composite saturated' break
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 evaluate(self): # seek for the minimum strength redundancy to find the position # of the next crack while True: #try: s = t.clock() sigmac_pre_crack, position_new_crack, W_pre_crack = self.find_next_crack( ) print 'evaluation of the matrix crack #' + str( len(self.cracking_stresses_lst) + 1), t.clock() - s, 's' if len(self.cracking_W_lst) > 1000: plt.plot(self.x_arr, self.sigma_m(W=W_pre_crack) / self.CB_model.E_m, color='blue', lw=2) plt.plot(self.x_arr, self.matrix_strength / self.CB_model.E_m, color='black', lw=2) plt.show() self.crack_positions_lst.append(position_new_crack) self.cracking_stresses_lst.append(sigmac_pre_crack) self.cracking_W_lst.append(W_pre_crack) #append the last crack object self.CB_objects_lst.append( CB(position=self.crack_positions_lst[-1], cracking_stress=self.cracking_stresses_lst[-1], CB_model=CompositeCrackBridge( reinforcement_lst=self.CB_model.reinforcement_lst, E_m=self.CB_model.E_m, Gf=self.CB_model.Gf, ft=float(self.matrix_strength[np.argwhere( self.crack_positions_lst[-1] == self.x_arr)]) * 0.99)))
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 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()
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) plt.xlabel('position [mm]') plt.ylabel('strain')
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, E_f=200e3, xi=10., snub=0.5, phi=RV('sin2x', scale=1.0, shape=0.0), Lf=20., label='carbon', n_int=50) CB_model = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf1], ft=1.0, Gf=0.5) scm = SCM(length=length, nx=nx, random_field=random_field, CB_model=CB_model, load_sigma_c_arr=np.linspace(0.01, 20., 100), n_BC_CB=3) scm.evaluate()
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)
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) model = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf_cont], Ll=10., Lr=10., ft=3.0, Gf=.3 ) 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) plt.xlabel('position [mm]') plt.ylabel('strain') def sigma_c_w(w_arr): sigma_c_arr, u_arr, damage_arr = ccb_view.sigma_c_arr(w_arr, damage=False, u=True)
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) CB_model = CompositeCrackBridge( E_m=25e3, reinforcement_lst=[reinf_cont, reinf_short], ) scm = SCM(length=length, nx=nx, random_field=random_field, CB_model=CB_model, load_sigma_c_arr=np.linspace(0.01, 20., 200), n_BC_CB=10) scm_view = SCMView(model=scm) scm_view.model.evaluate() def plot(): eps, sigma = scm_view.eps_sigma plt.plot(eps, sigma, color='black', lw=2, label='model') plt.legend(loc='best')