or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

constants.mddust-physics.mdgas-physics.mdgrid-stellar.mdindex.mdplotting.mdsimulation-control.mdsimulation.mdutilities.md
tile.json

tessl/pypi-dustpy

Dust evolution in protoplanetary disks

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/dustpy@1.0.x

To install, run

npx @tessl/cli install tessl/pypi-dustpy@1.0.0

index.mddocs/

DustPy

A comprehensive Python package for simulating dust coagulation and evolution in protoplanetary disks. DustPy combines high-level Python interfaces with performance-optimized Fortran implementations to model the radial evolution of gas and dust in protoplanetary disks through viscous evolution, advection, diffusion, and dust growth processes using the Smoluchowski equation.

Package Information

  • Package Name: dustpy
  • Language: Python
  • Installation: pip install dustpy
  • Documentation: https://stammler.github.io/dustpy/
  • Dependencies: numpy, matplotlib, simframe>=0.5.3, requests

Core Imports

import dustpy

Common patterns:

from dustpy import Simulation
from dustpy import constants as c
from dustpy import plot
import dustpy.std as std
import dustpy.utils as utils

Access to simframe integration:

from dustpy import hdf5writer, readdump

Direct access to standard functions:

from dustpy.std import dust, gas, grid, sim, star

# Use standard functions directly
particle_sizes = dust.a(sim)
sound_speed = gas.cs_isothermal(sim)
keplerian_freq = grid.OmegaK(sim)

Basic Usage

from dustpy import Simulation
import dustpy.constants as c

# Create a new simulation
sim = Simulation()

# Set initial conditions
sim.ini.gas.Mdisk = 0.05 * c.M_sun  # Disk mass
sim.ini.gas.SigmaRc = 10 * c.au     # Characteristic radius
sim.ini.dust.aIniMax = 0.0001       # Maximum initial grain size (cm)

# Create grids
sim.makegrids()

# Initialize simulation
sim.initialize()

# Run simulation
sim.run()

# Access results
gas_surface_density = sim.gas.Sigma  # Gas surface density [g/cm²]
dust_surface_density = sim.dust.Sigma  # Dust surface density per mass bin [g/cm²]
particle_sizes = sim.dust.a          # Particle sizes [cm]

Architecture

DustPy is built on the simframe scientific simulation framework and organized into several key components:

  • Simulation Class: Main interface managing the full simulation state, grids, and evolution
  • Standard Functions: Physics implementations in dustpy.std for dust, gas, stellar, and grid calculations
  • Fortran Extensions: Performance-critical calculations implemented in compiled Fortran code
  • Constants: Physical constants in CGS units shared between Python and Fortran
  • Integration Framework: Built on simframe for flexible numerical integration schemes

The simulation maintains interconnected Groups for dust, gas, grid, and stellar properties, with automatic dependency tracking for efficient computation.

Capabilities

Main Simulation Interface

The core Simulation class that manages dust coagulation and disk evolution simulations, providing setup, initialization, execution, and analysis methods.

class Simulation:
    def __init__(self, **kwargs): ...
    def makegrids(self): ...
    def initialize(self): ...
    def run(self): ...
    def checkmassconservation(self): ...
    def setdustintegrator(self, scheme="explicit", method="cash-karp"): ...

Simulation Interface

Dust Physics Functions

Standard functions for dust physics including particle dynamics, coagulation kernels, velocities, probabilities, fluxes, and source terms with Fortran-accelerated implementations.

from dustpy.std import dust

def dust.a(sim): ...
def dust.kernel(sim): ...
def dust.vrel_tot(sim): ...
def dust.S_coag(sim, Sigma=None): ...
def dust.p_stick(sim): ...
def dust.F_tot(sim, Sigma=None): ...

Dust Physics

Gas Physics Functions

Standard functions for gas disk physics including thermodynamics, viscosity, pressure profiles, and hydrodynamic evolution with Fortran-accelerated implementations.

from dustpy.std import gas

def gas.cs_isothermal(sim): ...
def gas.nu(sim): ...
def gas.P_midplane(sim): ...
def gas.vrad(sim): ...
def gas.S_tot(sim): ...

Gas Physics

Physical Constants

Comprehensive set of physical constants in CGS units, defined in Fortran for consistency across Python and compiled extensions.

from dustpy import constants as c

au: float          # Astronomical unit
G: float           # Gravitational constant
M_sun: float       # Solar mass
k_B: float         # Boltzmann constant
sigma_sb: float    # Stefan-Boltzmann constant
year: float        # Year in seconds

Constants

Plotting Functions

Simple plotting functions for visualizing simulation data and results with interactive capabilities.

from dustpy import plot

def plot.panel(data, filename="data", extension="hdf5", **kwargs): ...
def plot.ipanel(data, filename="data", extension="hdf5", **kwargs): ...

Plotting

Utility Functions

Helper classes and functions for boundary conditions, data handling, and simulation utilities.

import dustpy.utils as utils

class utils.Boundary: ...
def utils.read_data(data, filename="data", extension="hdf5", Na=50): ...
class utils.SimpleNamespace: ...
def utils.print_version_warning(timeout=0.5): ...

Utilities

Grid and Stellar Functions

Functions for setting up computational grids and stellar properties in disk simulations.

from dustpy.std import grid, star

def grid.OmegaK(sim): ...
def star.luminosity(sim): ...

Grid and Stellar

Simulation Control Functions

Functions for managing simulation execution, time-stepping, and integration schemes.

from dustpy.std import sim

def sim.dt(sim): ...
def sim.dt_adaptive(sim): ...
def sim.prepare_explicit_dust(sim): ...
def sim.finalize_implicit_dust(sim): ...

Simulation Control

Data Access Integration

DustPy integrates with simframe for data I/O:

from dustpy import hdf5writer, readdump

# HDF5 output writer from simframe
hdf5writer: callable

# Read dump files from simframe
def readdump(filename): ...