csnd0=0.12,Rout=70,adiabatic_gamma=1.00001)

    def perturbation_function(R,phi):
        return sigma0 * 4e-2 * np.exp(-(R-3.0)**2/0.1) * np.exp(-(phi-0.0)**2/1.0)
    d.add_perturbation(perturbation_function)
    
    # DISK MESH
    mesh = dm.disk_mesh2d(mesh_type="polar",Rin=Rin,Rout=Rout,
                          NR=600,Nphi=400,
                          fill_center=True,fill_box=True,BoxSize=120,
                          N_inner_boundary_rings=0, N_outer_boundary_rings=0,
                          self_gravity = True) 


    # Create SNAPSHOT
    s = dm.snapshot()
    s.create(d,mesh)


    # Write files
    snapshot_file = 'disk_pert_000.hdf5'
    s.write_snapshot(d,mesh,filename = snapshot_file)
    s.write_parameter_file(d,mesh)

    # Read snapshot from disk and check the surface density
    snap = dda.get_snapshot_data('disk_pert_',0,['POS','MASS'],parttype=0)

    # get a sense of the dynamical range in radius in the simulation
    Rmin, Rmax = 0.1, 10.0
    NR, Nphi = 200, 600
    grid = dda.grid_polar(NR = NR, Nphi = Nphi,Rmin=Rmin,Rmax= Rmax,scale='log')
Esempio n. 2
0
                          Rout=Rout,
                          Rbreak=Rbreak,
                          mesh_alignment="interleaved",
                          NR1=NR1,
                          Nphi1=Nphi1,
                          NR2=NR2,
                          Nphi2=Nphi2,
                          Nphi_outer_bound=Nphi2,
                          fill_center=False,
                          fill_box=True,
                          BoxSize=BOX,
                          N_inner_boundary_rings=2,
                          N_outer_boundary_rings=1)

    # Create SNAPSHOT
    s = dm.snapshot()
    s.create(d, mesh)
    #s.incline(37,0,mesh)

    # Write files
    s.write_snapshot(d,
                     mesh,
                     filename='disk_qb%.2f_eb%.2f_alpha%.2f_h%.2f.hdf5' %
                     (qb, eb, alpha, h0),
                     relax_density_in_input=True)
    print s.params.cpu_time_bet_restart_file
    s.params.read('param_example.txt')
    s.params.time_limit_cpu = 28000
    s.params.reference_gas_part_mass = 1.1e-4
    s.params.target_gas_mass_factor = 1.0
    s.params.courant_fac = 0.25