Exemple #1
0
                                  
    num_dims = 8
    virus_model = VirusInfection()
    r = virus_model.run( virus_model.nominal_z )
    func_domain = TensorProductDomain( num_dims, 
                 numpy.hstack( ( virus_model.nominal_z.reshape(num_dims,1)*0.9, 
                 virus_model.nominal_z.reshape(num_dims,1)*1.1 ) ) )
    plot_2d_interaction_surfaces( virus_model, virus_model.nominal_z, 
                                  func_domain, active_dims = None, 
                                  num_test_pts_1d = 30 )

    num_dims = 6
    func_domain = TensorProductDomain( num_dims, 
               numpy.hstack( ( reaction_model.nominal_z.reshape(num_dims,1)*0.9, 
               reaction_model.nominal_z.reshape(num_dims,1)*1.1 ) ) )
    plot_2d_interaction_surfaces( reaction_model, reaction_model.nominal_z, 
                                  func_domain, active_dims = None, 
                                  num_test_pts_1d = 30 )
    """
    num_dims = 6
    func_domain = TensorProductDomain( num_dims, [[0.08,0.12],[0.03,0.04],
                                                 [0.08,0.12],[0.8,1.2],
                                                 [0.45,0.55],[-0.05,0.05]] )
    plot_2d_interaction_surfaces( oscillator_model, oscillator_model.nominal_z, 
                                  func_domain, active_dims = None, 
                                  num_test_pts_1d = 30 )

    

    pylab.show()
Exemple #2
0
    #pylab.show()

    # convergence analysis
    """
    z = numpy.random.uniform( 0., 1., 10 )
    q_old = 0.
    for nx in numpy.arange( 1001, 40001, 1000 ):
        heat_model.nx = nx
        q = heat_model.evaluate( z )
        print nx, abs(q-q_old)
        q_old = q
        """

    # exact solution for k = 1.0
    exact_u = x * ( 1.0 - x ) * numpy.exp ( x )
    print numpy.absolute( u - exact_u )

    #pylab.plot(x,exact_u,'r')

    from utilities.visualisation import plot_2d_interaction_surfaces
    from utilities.tensor_product_domain import TensorProductDomain
                                  
    num_dims = 10
    r = heat_model.run( heat_model.nominal_z )
    func_domain = TensorProductDomain( num_dims, 
                 numpy.hstack( ( heat_model.nominal_z.reshape(num_dims,1)-1., 
                 heat_model.nominal_z.reshape(num_dims,1)+1. ) ) )
    plot_2d_interaction_surfaces( heat_model, heat_model.nominal_z, 
                                  func_domain, active_dims = None, 
                                  num_test_pts_1d = 10 )