Exemple #1
0
def main():
    
    #my_test()
    
    np.seterr(all='ignore')

    options = arg.parse_args()
    
    cfg = pc.ParticlesConfig()
    
    if options.version :
        print( py_particle_version() )
        return
    
    if options.about :
        about()
        return
    
    if options.test :
        print("")
        print("Start a test simulation:")
        print(" It compares the simulated solution with the analytical solution in a specific problem")
        tst.test( options.test )
        return
    
    if options.config_model :
        file_name = "example_pyparticles_config.cfg"
        cfg.write_example_config_file("example_pyparticles_config.cfg")
        print( "A file named: %s has been written in the current directory" % file_name )
        print( "" )
        return     
    
    if options.demo == "fountain" :
        print("")
        print("Start the simulation example:")
        print(" 250K Particles fountain")
        fou.fountain()
        return    
    
    if options.demo == "springs" :
        print("")
        print("Start the simulation example:")
        print(" 3 body springs")
        spr.springs()
        return
    
    if options.demo == "cat_spri" :
        print("")
        print("Start the simulation example:")
        print(" catenary springs (constraints demo)")
        spc.spring_constr()
        return
    
    if options.demo == "gas_lj" :
        print("")
        print("Start the simulation example:")
        print(" Pseudo gas with Lennard Jones potential")
        lj.gas_lj()
        return    
    
    if options.demo == "bubble" :
        print("")
        print("Start the simulation example:")
        print(" Pseudo bubble demo")
        bu.bubble()
        return
    
    if options.demo == "el_static" :
        print("")
        print("Start the simulation example:")
        print(" electrostatic")
        eld.electro()
        return  
    
    if options.demo == "elmag_field" :
        print("")
        print("Start the simulation example:")
        print(" electromagnetic fields")
        emd.electromag_field()
        return      
    
    if options.demo == "galaxy" :
        print("")
        print("Start the simulation example:")
        print(" Gravitational clusters")
        grav.gravity_cluster()
        return       
    
    if options.path_name == None or options.demo == "solar_system":
        
        print("")
        print("Start the simulation example:")
        print(" Solar system")
        print(" -- Try to watch the Moon ... around the Earth ")
        print("")
        print(" Use your mouse for rotating, zooming and tranlating the scene.")
        print("")
        print("For more details type:")
        print(" pyparticles --help")
        print("")
            
        sol.solar_system()
        return 
    
    
    
    if options.path_name != None :
        
        cfg.read_config( options.path_name )
        ( an , pset , force , ode_solver ) = cfg.build_problem()
        
        an.build_animation()
        
        print("")
        print("Start the simulation described in: %s ... " % options.path_name )
        
        an.start()
        return 
    
    print("Ops ... ")
    return 
Exemple #2
0
def main():

    #my_test()

    np.seterr(all='ignore')

    options = arg.parse_args()

    cfg = pc.ParticlesConfig()

    if options.version :
        print( py_particle_version() )
        return

    if options.about :
        about()
        return

    if options.test :
        print("")
        print("Start a test simulation:")
        print(" It compares the simulated solution with the analytical solution in a specific problem")
        tst.test( options.test )
        return

    if options.config_model :
        file_name = "example_pyparticles_config.cfg"
        cfg.write_example_config_file("example_pyparticles_config.cfg")
        print( "A file named: %s has been written in the current directory" % file_name )
        print( "" )
        return

    if options.demo == "fountain" :
        print("")
        print("Start the simulation example:")
        print(" 250K Particles fountain")
        fou.fountain()
        return

    if options.demo == "springs" :
        print("")
        print("Start the simulation example:")
        print(" 3 body springs")
        spr.springs()
        return

    if options.demo == "cat_spri" :
        print("")
        print("Start the simulation example:")
        print(" catenary springs (constraints demo)")
        spc.spring_constr()
        return

    if options.demo == "gas_lj" :
        print("")
        print("Start the simulation example:")
        print(" Pseudo gas with Lennard Jones potential")
        lj.gas_lj()
        return

    if options.demo == "bubble" :
        print("")
        print("Start the simulation example:")
        print(" Pseudo bubble demo")
        bu.bubble()
        return

    if options.demo == "el_static" :
        print("")
        print("Start the simulation example:")
        print(" electrostatic")
        eld.electro()
        return

    if options.demo == "elmag_field" :
        print("")
        print("Start the simulation example:")
        print(" electromagnetic fields")
        emd.electromag_field()
        return

    if options.demo == "galaxy" :
        print("")
        print("Start the simulation example:")
        print(" Gravitational clusters")
        grav.gravity_cluster()
        return

    if options.demo == "smoothed_particle_hydrodynamics" :
        print("")
        print("Start the simulation example:")
        print(" smoothed particle hydrodynamics")
        sph.cube_water()
        return

    if options.path_name == None or options.demo == "solar_system":

        print("")
        print("Start the simulation example:")
        print(" Solar system")
        print(" -- Try to watch the Moon ... around the Earth ")
        print("")
        print(" Use your mouse for rotating, zooming and tranlating the scene.")
        print("")
        print("For more details type:")
        print(" pyparticles --help")
        print("")

        sol.solar_system()
        return



    if options.path_name != None :

        cfg.read_config( options.path_name )
        ( an , pset , force , ode_solver ) = cfg.build_problem()

        an.build_animation()

        print("")
        print("Start the simulation described in: %s ... " % options.path_name )

        an.start()
        return

    print("Ops ... ")
    return
Exemple #3
0
def main():
    
    #my_test()
    
    np.seterr(all='ignore')
    
    options = arg.parse_args()
    
    cfg = pc.ParticlesConfig()
    
    if options.version :
        print( py_particle_version() )
        return
    
    if options.config_model :
        file_name = "example_pyparticles_config.cfg"
        cfg.write_example_config_file("example_pyparticles_config.cfg")
        print( "A file named: %s has been written in the current directory" % file_name )
        print( "" )
        return     
    
    
    if options.demo == "springs" :
        print("")
        print("Start the simulation example:")
        print(" 3 body springs")
        spr.springs()
        return     
    
    if options.demo == "gas_lj" :
        print("")
        print("Start the simulation example:")
        print(" Pseudo gas with Lennard Jones potential")
        lj.gas_lj()
        return    
    
    if options.demo == "bubble" :
        print("")
        print("Start the simulation example:")
        print(" Pseudo bubble demo")
        bu.bubble()
        return   
    
    if options.path_name == None or options.demo == "solar_system":
        
        print("")
        print("Start the simulation example:")
        print(" Solar system")
        print(" -- Try to watch the Moon ... around the Earth ")
        print("")
        print(" Use your mouse for rotating, zooming and tranlating the scene.")
        print("")
        print("For more details type:")
        print(" pyparticles --help")
        print("")
            
        sol.solar_system()
        return 
    
    
    
    if options.path_name != None :
        
        cfg.read_config( options.path_name )
        ( an , pset , force , ode_solver ) = cfg.build_problem()
        
        an.build_animation()
        
        print("")
        print("Start the simulation described in: %s ... " % options.path_name )
        
        an.start()
        return 
    
    print("Ops ... ")
    return