def DOE(w_arr): reinf1 = Reinforcement( r=0.00345, #r=RV('uniform', loc=0.002, scale=0.002), tau=RV('uniform', loc=.2, scale=1.), V_f=0.1, E_f=200e3, xi=RV('weibull_min', shape=5., scale=.02), n_int=100) ccb = CompositeCrackBridge(E_m=25e3, reinforcement_lst=[reinf1], Ll=100., Lr=100.) def eps_w(w_arr): eps = [] ccb.iters = 6 for w in w_arr: # print 'w_ctrl=', ccb.w = w ccb.damage = np.zeros_like(ccb.sorted_E_f) eps.append(ccb.profile[3]) plt.plot(w_arr, eps, color='black', lw=2, label=str(ccb.iters)) eps_w(w_arr)
def rand_tau(): E_f, V_f, r, m, sV0 = 200e3, 0.01, 0.01, 7.0, 3.e-3 Pf = RV('uniform', loc=0.0, scale=1.0) w_arr = np.linspace(0, 1., 200) cb = CBResidual(include_pullout=True) for i, taui in enumerate([ RV('uniform', loc=.0999, scale=.0002), #COV = 0.01 RV('uniform', loc=.05, scale=.1), #COV = 0.3 RV('uniform', loc=.01, scale=0.18) ]): #COV = 0.5 total = SPIRRID(q=cb, sampling_type='MCS', evars=dict(w=w_arr), tvars=dict(tau=taui, E_f=E_f, V_f=V_f, r=r, m=m, sV0=sV0, Pf=Pf), n_int=300) 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 result = total.mu_q_arr / Er plt.plot(w_arr, result, lw=2, color='black') plt.xlabel('$w\, [\mathrm{mm}]$') plt.ylabel('$\mu_{\sigma_\mathrm{c},\\xi \\tau}\,[\mathrm{MPa}]$') plt.ylim(0, 10) plt.xlim(0, 1.) plt.show()
def general_diagram(): E_f, V_f, r, tau, m, sV0 = 200e3, 0.01, 0.01, .1, 7., 3.e-3 Pf = RV('uniform', loc=0.0, scale=1.0) w_arr = np.linspace(0, 1.2, 200) cb = CBResidual(include_pullout=True) total = SPIRRID(q=cb, sampling_type='TGrid', evars=dict(w=w_arr), tvars=dict(tau=tau, E_f=E_f, V_f=V_f, r=r, m=m, sV0=sV0, Pf=Pf), n_int=1000) 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 total = total.mu_q_arr / Er plt.plot(w_arr, total, lw=2, color='black') cb = CBResidual(include_pullout=False) broken = SPIRRID(q=cb, sampling_type='PGrid', evars=dict(w=w_arr), tvars=dict(tau=tau, E_f=E_f, V_f=V_f, r=r, m=m, sV0=sV0, Pf=Pf), n_int=1000) 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 broken = broken.mu_q_arr / Er plt.plot(w_arr, broken, lw=2, ls='dashed', color='black') plt.plot(w_arr, total - broken, lw=2, ls='dashed', color='black') plt.ylim(0, 10) plt.xlim(0, .8) plt.xlabel('$w\, [\mathrm{mm}]$') plt.ylabel('$\mu_{\sigma_\mathrm{c},\mathbf{X}}\,[\mathrm{MPa}]$') plt.show()
# statistical characteristics (mean, stdev) m_la, std_la = 10., 1.0 m_xi, std_xi = 1.0, 0.1 # discretize the control variable (x-axis) e_arr = np.linspace(0, 1.2, 40) # Exact solution def mu_q_ex(e, m_xi, std_xi, m_la): return e * (0.5 - 0.5 * erf(0.5 * math.sqrt(2) * (e - m_xi) / std_xi)) * m_la mu_q_ex_arr = mu_q_ex(e_arr, m_xi, std_xi, m_la) g_la = RV('norm', m_la, std_la) g_xi = RV('norm', m_xi, std_xi) s = SPIRRID( q=fiber_tt_2p, e_arr=e_arr, n_int=10, tvars=dict(la=g_la, xi=g_xi), ) mu_q_ex_arr = mu_q_ex(e_arr, m_xi, std_xi, m_la) slab = SPIRRIDLAB(s=s, save_output=False, show_output=True, exact_arr=mu_q_ex(e_arr, m_xi, std_xi, m_la))
from quaducom.micro.resp_func.cb_emtrx_clamped_fiber_stress import \ CBEMClampedFiberStress from quaducom.micro.resp_func.cb_emtrx_clamped_fiber_stress_residual import \ CBEMClampedFiberStressResidual from stats.spirrid.spirrid import SPIRRID from stats.spirrid.rv import RV from matplotlib import pyplot as plt import numpy as np if __name__ == '__main__': # filaments r = 0.00345 V_f = 0.0103 tau = RV('uniform', loc=0.1, scale=.3) E_f = 200e3 E_m = 25e3 l = RV('uniform', scale=10., loc=2.) theta = 0.0 xi = RV('weibull_min', scale=0.02, shape=5) phi = 1. Ll = 20. Lr = 30. s0 = 0.0205 m = 5.0 Pf = RV('uniform', loc=0., scale=1.0) w = np.linspace(0, 1.3, 100) cb_emtrx = CBEMClampedFiberStress()
omega)) q = self.q(wD, tau, l, E_f, E_m, theta, xi, phi, Ll, Lr, V_f, r, omega) * (1. - omega) w_lst.append(wD) q_lst.append(q) return np.array(w_lst), np.array(q_lst) if __name__ == '__main__': from stats.spirrid.rv import RV a = WAnalytIter() # filaments r = 0.00345 V_f = 0.04 tau = 0.5 #RV('uniform', loc=0.2, scale=1.) E_f = 200e3 E_m = 25e3 l = 0.0 theta = 0.0 phi = 1. Ll = 100. Lr = 100. xi = RV('weibull_min', shape=5., scale=.02) ctrl_damage = np.linspace(0.0, .9999, 50) w = np.linspace(0., 0.7, 100) #q = a.damage_func(w, tau, l, E_f, E_m, theta, xi, phi, Ll, Lr, V_f, r, 0.3) w, q = a.eval_w_q(tau, l, E_f, E_m, theta, xi, phi, Ll, Lr, V_f, r, ctrl_damage) plt.plot(w, q) plt.show()
import numpy as np from matplotlib import pyplot as plt from stats.spirrid.rv import RV import math import numpy as np ################### def same_length( l ): return np.arccos( l[0] / l ) n_int = 200 phi = RV( 'sin2x', loc = 0., scale = 1. ) a_l = RV( 'uniform', loc = 0., scale = 1. ) discr_ppf = np.linspace( .0001 / n_int, 1. - .0001 / n_int, n_int ) phi = phi.ppf( discr_ppf ) a = a_l.ppf( discr_ppf ) #for ae in a: # x = np.ones( len( a ) ) * ae # print x, phi # plt.plot( x , phi, 'ro' ) isol = np.linspace( a[5], a[-5], 5 ) ''' for i, il in enumerate( isol ): x_l = np.linspace( il, np.max( a ), 200 ) y_l = same_length( x_l ) if i != 1: plt.plot( x_l, y_l , 'k' ) else:
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 plt.plot(w, sigma_c, lw=2, label='sigma c') #plt.ylim(0, 35) plt.xlabel('w [mm]') plt.ylabel('sigma_c [MPa]') plt.legend(loc='best') plt.show() w = np.linspace(0, .5, 300) tau = 0.5 #RV('weibull_min', shape=3., scale=.03) E_f = 200e3 V_f = 0.01 r = RV('uniform', loc=0.001, scale=0.004) m = 7. # sV0=XXX corresponds to sL0=0.02 at L0=100 and r=0.002 sV0 = 3.1e-3 Pf = RV('uniform', loc=0., scale=1.0) n_int = 300 #cb = CBResidual() #plt.plot(w, cb(w, 0.5, E_f, V_f, 0.001, m, sV0, 0.5) / 0.001 ** 2, label='r=0.001') #plt.plot(w, cb(w, 0.5, E_f, V_f, 0.002, m, sV0, 0.5) / 0.002 ** 2, label='r=0.002') #plt.plot(w, cb(w, 0.5, E_f, V_f, 0.003, m, sV0, 0.5) / 0.003 ** 2, label='r=0.003') #plt.legend() #plt.show() CB_composite_stress(w, tau, E_f, V_f, r, m, sV0, Pf, n_int)