def u_omega_spirrid():
        cb = UOmega()
        s = SPIRRID(q=cb,
             sampling_type='PGrid',
             evars=dict(w=w),
             tvars=dict(tau=tau, l=l, E_f=E_f, theta=theta, xi=xi, phi=phi,
                        E_m=E_m, r=r, V_f=V_f, Ll=Ll, Lr=Lr),
             n_int=n_int)

        damage_func = UOmegaDamage()
        s_damage = SPIRRID(q=damage_func,
                    sampling_type='PGrid',
                    tvars=dict(tau=tau, l=l, E_f=E_f, theta=theta, xi=xi,
                               phi=phi, E_m=E_m, r=r, V_f=V_f, Ll=Ll, Lr=Lr),
                    n_int=n_int)

        def residuum(w, omega):
            s_damage.evars['w'] = np.array([w])
            s_damage.tvars['omega'] = omega
            return s_damage.mu_q_arr - omega

        for omega in ctrl_damage:
            wD = brentq(residuum, 0.0, 5.0, args=(omega,))
            s.q = UOmega()
            s.evars['w'] = np.array([wD])
            s.tvars['omega'] = omega
            mu = s.mu_q_arr
            plt.plot(wD, mu, 'b*')
            if spirrid_plot == True:
                s.evars['w'] = w
                plt.plot(w, s.mu_q_arr, color='blue', lw=0.2)
    def u_u():
        cb = UOmega()
        s = SPIRRID(q=cb,
             sampling_type='PGrid',
             evars=dict(w=w),
             tvars=dict(tau=tau, l=l, E_f=E_f, theta=theta, xi=xi, phi=phi,
                        E_m=E_m, r=r, V_f=V_f, Ll=Ll, Lr=Lr),
             n_int=n_int)

        damage_func = UOmegaDamage()
        s_damage = SPIRRID(q=damage_func,
                    sampling_type='PGrid',
                    tvars=dict(tau=tau, l=l, E_f=E_f, theta=theta, xi=xi,
                               phi=phi, E_m=E_m, r=r, V_f=V_f, Ll=Ll, Lr=Lr),
                    n_int=n_int)

        def residuum(omega, w):
            s_damage.evars['w'] = np.array([w])
            s_damage.tvars['omega'] = omega
            return s_damage.mu_q_arr - omega

        for wi in w:
            omega = brentq(residuum, 0.0, 1. - 1e-10, args=(wi,))
            s.evars['w'] = np.array([wi])
            s.tvars['omega'] = omega
            mu = s.mu_q_arr
            plt.plot(wi, mu, 'ko')
Example #3
0
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()
Example #4
0
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()
Example #5
0
 def CB_composite_stress(w, tau, E_f, V_f, r, m, sV0, Pf, n_int):
     cb = CBResidual()
     spirrid = SPIRRID(q=cb,
                       sampling_type='PGrid',
                       evars=dict(w=w),
                       tvars=dict(tau=tau,
                                  E_f=E_f,
                                  V_f=V_f,
                                  r=r,
                                  m=m,
                                  sV0=sV0,
                                  Pf=Pf),
                       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
     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()
Example #6
0
    def u_u():
        cb = UOmega()
        s = SPIRRID(q=cb,
                    sampling_type='PGrid',
                    evars=dict(w=w),
                    tvars=dict(tau=tau,
                               l=l,
                               E_f=E_f,
                               theta=theta,
                               xi=xi,
                               phi=phi,
                               E_m=E_m,
                               r=r,
                               V_f=V_f,
                               Ll=Ll,
                               Lr=Lr),
                    n_int=n_int)

        damage_func = UOmegaDamage()
        s_damage = SPIRRID(q=damage_func,
                           sampling_type='PGrid',
                           tvars=dict(tau=tau,
                                      l=l,
                                      E_f=E_f,
                                      theta=theta,
                                      xi=xi,
                                      phi=phi,
                                      E_m=E_m,
                                      r=r,
                                      V_f=V_f,
                                      Ll=Ll,
                                      Lr=Lr),
                           n_int=n_int)

        def residuum(omega, w):
            s_damage.evars['w'] = np.array([w])
            s_damage.tvars['omega'] = omega
            return s_damage.mu_q_arr - omega

        for wi in w:
            omega = brentq(residuum, 0.0, 1. - 1e-10, args=(wi, ))
            s.evars['w'] = np.array([wi])
            s.tvars['omega'] = omega
            mu = s.mu_q_arr
            plt.plot(wi, mu, 'ko')
Example #7
0
    def _redraw( self ):

        s = SPIRRID( rf = self.rf,
                    min_eps = 0.00, max_eps = self.w_max, n_eps = self.n_w_pts,
                    cached_dG = True,
                    compiled_QdG_loop = False,
                    compiled_eps_loop = False
                )
        # construct the random variables

        if self.pdf_xi_on:
            s.rv_dict['xi'] = RV( pd = self.pdf_xi, name = 'xi', n_int = self.n_G_ipts )

        if self.pdf_theta_on:
            s.rv_dict['theta'] = RV( pd = self.pdf_theta, name = 'theta', n_int = self.n_G_ipts )

        if self.pdf_l_on:
            s.rv_dict['l'] = RV( pd = self.pdf_l, name = 'l', n_int = self.n_G_ipts )

        if self.pdf_phi_on:
            s.rv_dict['phi'] = RV( pd = self.pdf_phi, name = 'phi', n_int = self.n_G_ipts )

        print 'checking unity', s.eval_i_dG_grid()

        mc = s.mean_curve
        axes = self.figure.axes[0]
        axes.plot( mc.xdata, mc.ydata * self.n_f,
                   linewidth = 2, label = self.lab )

        axes.set_xlabel( 'crack opening w[mm]' )
        axes.set_ylabel( 'force P[N]' )
        axes.legend( loc = 'best' )

        self.data_changed = True
    def eps_w(w_arr):
        reinf1 = Reinforcement(r=r, tau=tau, V_f=V_f, E_f=E_f, xi=xi, n_int=n_int)
        ccb = CompositeCrackBridge(E_m=E_m, reinforcement_lst=[reinf1], Ll=Ll, Lr=Lr)
        eps = []
        for w in w_arr:
            ccb.w = w
            eps.append(ccb.max_norm_stress)
        plt.plot(w_arr, eps, color='red', label='ODE')

        cb = WOmega()
        s = SPIRRID(q=cb,
             sampling_type='PGrid',
             evars=dict(w=w_arr),
             tvars=dict(tau=tau, l=l, E_f=E_f, theta=theta, xi=xi, phi=phi,
                        E_m=E_m, r=r, V_f=V_f, Ll=Ll, Lr=Lr),
             n_int=n_int)

        damage_func = WOmegaDamage()
        s_damage = SPIRRID(q=damage_func,
                    sampling_type='PGrid',
                    tvars=dict(tau=tau, l=l, E_f=E_f, theta=theta, xi=xi,
                               phi=phi, E_m=E_m, r=r, V_f=V_f, Ll=Ll, Lr=Lr),
                    n_int=n_int)

        def residuum(w, omega):
            s_damage.evars['w'] = np.array([w])
            s_damage.tvars['omega'] = omega
            return s_damage.mu_q_arr - omega

        for omega in ctrl_damage:
            print omega
            wD = brentq(residuum, 0.0, 5.0, args=(omega,))
            s.q = WOmega()
            s.evars['w'] = np.array([wD])
            s.tvars['omega'] = omega
            mu = s.mu_q_arr
            plt.plot(wD, mu, 'ro')

        plt.legend(loc='best')
        plt.show()
def random_samples_profiles(n):
    w = np.linspace(0, .5, 2)
    x = np.linspace(-50., 20., 100)
    P = CBEMClampedFiberSP()
    spirrid = SPIRRID(q = P,
                      sampling_type = 'LHS',
                      evars = dict(w = w,
                                    x = x),
                      tvars = dict(Ll = Ll,
                                   Lr = Lr,
                                   tau = RV('uniform', 0.0, .2),
                                   l = RV('uniform', 5.0, 15.0),
                                   A_f = Af,
                                   E_f = Ef,
                                   theta = RV('uniform', 0.0, .02),
                                   xi = xi,#RV('weibull_min', scale = 0.0179, shape = 5, n_int = 10),
                                   phi = phi,
                                   E_m = Em,
                                   A_m = Am,
                                   Nf = Nf
                                    ),
                    n_int = 20)

    for i in range(n):
        if i == n - 1:
            plt.plot(x, P(0.0, x, *spirrid.get_samples(n)[:, i]),
                      color = 'black', label = 'random filament response')
        plt.plot(x, P(0.0, x, *spirrid.get_samples(n)[:, i]), color = 'black')
    plt.plot(x, spirrid.mu_q_arr[1, :], lw = 4, color = 'black', ls = '--',
              label = 'normalized yarn repsonse')
    #plt.xlabel( '$\mathrm{position}{[mm]}$', fontsize = 24 )
    #plt.ylabel( '$\mathrm{force} \, P_\mathrm{y}/N_\mathrm{f} \mathrm{[N]}$', fontsize = 24 )
    #plt.title( '$\mathrm{yarn \, crack \, bridge}$' , fontsize = 20 )
    plt.xticks(fontsize = 20)
    plt.yticks(fontsize = 20)
    plt.legend(loc = 'lower right')
    plt.ylim(0, 0.35)
    plt.show()
Example #10
0
    def no_damage():
        cb = WOmega()
        s = SPIRRID(q=cb,
                    sampling_type='PGrid',
                    evars=dict(w=w),
                    tvars=dict(tau=tau,
                               l=l,
                               E_f=E_f,
                               theta=theta,
                               xi=xi,
                               phi=phi,
                               E_m=E_m,
                               r=r,
                               V_f=V_f,
                               Ll=Ll,
                               Lr=Lr,
                               omega=0.0),
                    n_int=100)
        plt.plot(w, s.mu_q_arr, lw=2, color='red', label='w ctrl')

        cb = UOmega()
        s = SPIRRID(q=cb,
                    sampling_type='PGrid',
                    evars=dict(w=w),
                    tvars=dict(tau=tau,
                               l=l,
                               E_f=E_f,
                               theta=theta,
                               xi=xi,
                               phi=phi,
                               E_m=E_m,
                               r=r,
                               V_f=V_f,
                               Ll=Ll,
                               Lr=Lr,
                               omega=0.0),
                    n_int=200)
Example #11
0
def random_samples_Pw(n):
    w = np.linspace(0, 1.7, 300)
    P = CBEMClampedFiber()
    spirrid = SPIRRID(q = P,
                      sampling_type = 'LHS',
                      evars = dict(w = w
                                    ),
                      tvars = dict(Ll = 50.,
                                   Lr = 20.,
                                   tau = RV('uniform', 0.05, .15),
                                   l = RV('uniform', 5.0, 10.0),
                                   A_f = Af,
                                   E_f = Ef,
                                   theta = RV('uniform', 0.0, .02),
                                   xi = RV('weibull_min', scale = 0.017, shape = 5, n_int = 10),
                                   phi = phi,
                                   E_m = Em,
                                   A_m = 50.,
                                   Nf = 1700.
                                    ),
                    n_int = 20)

    for i in range(n):
        if i == n - 1:
            plt.plot(w, P(w, *spirrid.get_samples(n)[:, i]),
                      color = 'black', label = 'random filament response')
        plt.plot(w, P(w, *spirrid.get_samples(n)[:, i]), color = 'black')
    plt.plot(w, spirrid.mu_q_arr, lw = 4, color = 'black', ls = '--',
              label = 'normalized yarn repsonse')
    plt.xlabel('$\mathrm{crack width} \, w \mathrm{[mm]}$', fontsize = 24)
    plt.ylabel('$\mathrm{force} \, P_\mathrm{y,0}/N_\mathrm{f} \mathrm{[N]}$', fontsize = 24)
    plt.xticks(fontsize = 20)
    plt.yticks(fontsize = 20)
    #plt.title( '$\mathrm{yarn \, crack \, bridge}$' , fontsize = 20 )
    plt.legend(loc = 'best')
    plt.show()
Example #12
0
    def w_omega_spirrid():
        cb = WOmega()
        s = SPIRRID(q=cb,
                    sampling_type='PGrid',
                    evars=dict(w=w),
                    tvars=dict(tau=tau,
                               l=l,
                               E_f=E_f,
                               theta=theta,
                               xi=xi,
                               phi=phi,
                               E_m=E_m,
                               r=r,
                               V_f=V_f,
                               Ll=Ll,
                               Lr=Lr),
                    n_int=n_int)

        damage_func = WOmegaDamage()
        s_damage = SPIRRID(q=damage_func,
                           sampling_type='PGrid',
                           tvars=dict(tau=tau,
                                      l=l,
                                      E_f=E_f,
                                      theta=theta,
                                      xi=xi,
                                      phi=phi,
                                      E_m=E_m,
                                      r=r,
                                      V_f=V_f,
                                      Ll=Ll,
                                      Lr=Lr),
                           n_int=n_int)

        def residuum(w, omega):
            s_damage.evars['w'] = np.array([w])
            s_damage.tvars['omega'] = omega
            return s_damage.mu_q_arr - omega

        for omega in ctrl_damage:
            wD = brentq(residuum, 0.0, 5.0, args=(omega, ))
            s.q = WOmega()
            s.evars['w'] = np.array([wD])
            s.tvars['omega'] = omega
            mu = s.mu_q_arr
            plt.plot(wD, mu, 'ro')
            if spirrid_plot == True:
                s.evars['w'] = w
                plt.plot(w, s.mu_q_arr, color='red', lw=0.2)
Example #13
0
    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()
    s = SPIRRID(q=cb_emtrx,
                sampling_type='PGrid',
                evars=dict(w=w),
                tvars=dict(tau=tau,
                           l=l,
                           E_f=E_f,
                           theta=theta,
                           xi=xi,
                           phi=phi,
                           E_m=E_m,
                           r=r,
                           V_f=V_f,
                           Ll=Ll,
                           Lr=Lr),
                n_int=30)

    cb_emtrx_r = CBEMClampedFiberStressResidual()
    s_r = SPIRRID(q=cb_emtrx_r,
                  sampling_type='PGrid',
                  evars=dict(w=w),
                  tvars=dict(tau=tau,
                             l=l,
                             E_f=E_f,
def run():
    # Quantities for the response function
    # and randomization
    # 
    #E_mod = 70 * 1e+9 # Pa
    #sig_u = 1.25 * 1e+9 # Pa
    D = 26 * 1.0e-6 # m
    A = ( D / 2.0 ) ** 2 * pi
    #xi_u = sig_u / E_mod

    dict_var = {'E_mod':70.e9,
                'xi':0.02,
                'A':A,
                'theta':0,
                'lambd':0}

    # random variable dictionary
    n_int = 300
    dict_rv = {
               'xi':{'variable':'xi', 'distribution':'weibull_min', 'scale':0.02, 'shape':10., 'n_int':n_int},
               'E_mod':{'variable':'E_mod', 'distribution':'uniform', 'loc':70e+9, 'scale':15e+9, 'n_int':n_int},
               'theta':{'variable':'theta', 'distribution':'uniform', 'loc':0.0, 'scale':0.01, 'n_int':n_int},
               'lambd':{'variable':'lambd', 'distribution':'uniform', 'loc':0.0, 'scale':.2, 'n_int':n_int},
               'A':{'variable':'A', 'distribution':'uniform', 'loc':A * 0.3, 'scale':0.7 * A, 'n_int':n_int},
               }

    # list of all combinations of response function parameters
    rv_comb_list = list( powerset( dict_rv ) )

    # define a tables with the run configurations to start in a batch
    run_list = [
#                ( 
#                 {'cached_dG'         : False,
#                  'compiled_QdG_loop'  : True,
#                  'compiled_eps_loop' : True },
#                  'bx-',
#                  '$\mathrm{C}_{e,\\theta} ( q(e,\\theta) \cdot g[\\theta_1]  g[\\theta_2] \dots g[\\theta_n] ) $ - %4.2f sec'
#                 ),
#                ( 
#                 {'cached_dG'         : False,
#                  'compiled_QdG_loop'  : True,
#                  'compiled_eps_loop' : False },
#                 'r-2',
#                 '$\mathrm{P}_{e} ( \mathrm{C}_{\\theta} ( q(e,\\theta) \cdot g[\\theta_1]  g[\\theta_2] \dots g[\\theta_n] ) ) $ - %4.2f sec',
#                 ),
                 ( 
                 {'cached_dG'         : True,
                  'compiled_QdG_loop'  : False,
                  'compiled_eps_loop' : False },
                 'y--',
                 '$\mathrm{P}_{e} ( \mathrm{N}_{\\theta} ( q(e,\\theta) \cdot G[\\theta] ) ) $ - %4.2f sec'
                 ),
#                ( 
#                 {'cached_dG'         : True,
#                  'compiled_QdG_loop'  : True,
#                  'compiled_eps_loop' : True },
#                  'go-',
#                  '$\mathrm{C}_{e,\\theta} ( q(e,\\theta) \cdot G[\\theta] ) $ - %4.2f sec',
#                  ),
                ]

    outfile = open( 'filament_comb_stat.dat', 'w' )
    sp1_outfile = open( 'filament_comb_1.dat', 'w' )
    sp2_outfile = open( 'filament_comb_2.dat', 'w' )

    plot = False

    for id, rv_comb in enumerate( rv_comb_list[15:25] ):#[0,-1]
        for i in range( 0, 1 ):#2
            num_rv = len( rv_comb ) # number of randomized variables
            if i == 0:
                sp1_outfile.write( '%i \t %i' % ( id, num_rv ) )
            else:
                sp2_outfile.write( '%i \t %i' % ( id, num_rv ) )
            # construct a default response function
            rf = Filament()
            rf.set( **dict_var )

            # construct the integrator and provide it with the response function.  
            s = SPIRRID( rf = rf,
                        min_eps = 0.00, max_eps = 0.04, n_eps = 20 ) # max_eps = 0.05

            for rv in rv_comb:
                s.add_rv( **dict_rv[rv] )

            if plot == True:
                legend = []

            print 'Combination', rv_comb, ' -- ', i
            outfile.write( "Combination %s -- %i\n" % ( rv_comb, i ) )
            outfile.write( "%s \t %s\n" % ( "Run", "Time" ) )

            for idx, run in enumerate( run_list ):
                run_options, plot_options, legend_string = run
                print 'run', idx,
                s.set( **run_options )
                if plot == True:
                    plt.figure( id )
                    s.mean_curve.plot( plt, plot_options )
                    legend.append( legend_string % s.exec_time )
                print 'execution time', s.exec_time
                outfile.write( "%s \t %.6f\n" % ( idx, s.exec_time ) )

                if i == 0:
                    sp1_outfile.write( "\t %.6f" % ( s.exec_time ) )
                else:
                    sp2_outfile.write( "\t %.6f" % ( s.exec_time ) )

            outfile.write( "=================\n" )
            outfile.flush()

            if i == 0:
                sp1_outfile.write( '\t %s\n' % str( rv_comb ) )
                sp1_outfile.flush()
            else:
                sp2_outfile.write( '\t %s\n' % str( rv_comb ) )
                sp2_outfile.flush()
            if plot == True:
                plt.xlabel( 'strain [-]' )
                plt.ylabel( 'stress' )
                plt.legend( legend )
                plt.title( s.rf.title )

        del s


    outfile.close()
    sp1_outfile.close()
    sp2_outfile.close()
    if plot == True:
        plt.show()
def run():
    # Quantities for the response function
    # and randomization

    # construct a default response function for a single filament

    rf = ConstantFrictionFiniteFiber( fu = 1200e15, qf = 1200,
                           L = 0.02, A = 0.00000002,
                           E_mod = 210.e9, z = 0.004,
                           phi = 0.5, f = 0.01 )

    # construct the integrator and provide it with the response function.

    s = SPIRRID( rf = rf,
                 min_eps = 0.00, max_eps = 0.0008, n_eps = 80 )

    # construct the random variables

    n_int = 10

    s.add_rv( 'E_mod', distribution = 'uniform', loc = 170.e9, scale = 250.e9, n_int = n_int )
    s.add_rv( 'L', distribution = 'uniform', loc = 0.02, scale = 0.03, n_int = n_int )
    s.add_rv( 'phi', distribution = 'cos_distr', loc = 0., scale = 1., n_int = n_int )
    s.add_rv( 'z', distribution = 'uniform', loc = 0, scale = rf.L / 2., n_int = n_int )
    #s.add_rv( 'fu', distribution='weibull_min', loc=1200.0e6, scale=200., n_int=n_int )
    s.add_rv( 'qf', distribution = 'uniform', loc = 1500., scale = 100., n_int = n_int )
    s.add_rv( 'A', distribution = 'uniform', loc = 5.30929158457e-10, scale = .03 * 5.30929158457e-10, n_int = n_int )
    #s.add_rv( 'f', distribution='uniform', loc=0., scale=.03, n_int=n_int )

    # define a tables with the run configurations to start in a batch

    run_list = [
                ( 
                 {'cached_qg'         : False,
                  'compiled_qg_loop'  : True,
                  'compiled_eps_loop' : True },
                  'bx-',
                  '$\mathrm{C}_{e,\\theta} ( q(e,\\theta) \cdot g[\\theta_1]  g[\\theta_2] \dots g[\\theta_n] ) $ - %4.2f sec'
                 ),
#                ( 
#                 {'cached_qg'         : False,
#                  'compiled_qg_loop'  : True,
#                  'compiled_eps_loop' : False },
#                 'r-2',
#                 '$\mathrm{P}_{e} ( \mathrm{C}_{\\theta} ( q(e,\\theta) \cdot g[\\theta_1]  g[\\theta_2] \dots g[\\theta_n] ) ) $ - %4.2f sec',
#                 ),
##                ( 
##                 {'cached_qg'         : True,
##                  'compiled_qg_loop'  : True,
##                  'compiled_eps_loop' : True },
##                  'go-',
##                  '$\mathrm{C}_{e,\\theta} ( q(e,\\theta) \cdot G[\\theta] ) $ - %4.2f sec',
##                  ),
#                ( 
#                 {'cached_qg'         : True,
#                  'compiled_qg_loop'  : False,
#                  'compiled_eps_loop' : False },
#                 'b--',
#                 '$\mathrm{P}_{e} ( \mathrm{N}_{\\theta} ( q(e,\\theta) \cdot G[\\theta] ) ) $ - %4.2f sec'
#                 ),
                ]

#    import cProfile
#    cProfile.run( 'tloop.eval()', 'spirrid_prof' )
#    print tloop.eval()
    #import pstats
    #p = pstats.Stats('tloop_prof')
    #p.strip_dirs()
    #print 'cumulative'
    #p.sort_stats('cumulative').print_stats(20)
    #print 'time'
    #p.sort_stats('time').print_stats(20)


    for idx, run in enumerate( run_list ):
        run_options, plot_options, legend_string = run
        print 'run', idx,
        s.set( **run_options )
        import time
        start = time.time()
        s.mean_curve.plot( plt, plot_options, linewidth = 2, label = legend_string % s.exec_time )
        print 'execution time', s.exec_time, s.mu_q_peak
        print time.time() - start

    plt.xlabel( 'strain [-]' )
    plt.ylabel( 'stress' )
    plt.legend( loc = 'lower right' )

    plt.title( s.rf.title )
    plt.show()