or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

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

index.mddocs/

0

# DustPy

1

2

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.

3

4

## Package Information

5

6

- **Package Name**: dustpy

7

- **Language**: Python

8

- **Installation**: `pip install dustpy`

9

- **Documentation**: https://stammler.github.io/dustpy/

10

- **Dependencies**: numpy, matplotlib, simframe>=0.5.3, requests

11

12

## Core Imports

13

14

```python

15

import dustpy

16

```

17

18

Common patterns:

19

20

```python

21

from dustpy import Simulation

22

from dustpy import constants as c

23

from dustpy import plot

24

import dustpy.std as std

25

import dustpy.utils as utils

26

```

27

28

Access to simframe integration:

29

30

```python

31

from dustpy import hdf5writer, readdump

32

```

33

34

Direct access to standard functions:

35

36

```python

37

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

38

39

# Use standard functions directly

40

particle_sizes = dust.a(sim)

41

sound_speed = gas.cs_isothermal(sim)

42

keplerian_freq = grid.OmegaK(sim)

43

```

44

45

## Basic Usage

46

47

```python

48

from dustpy import Simulation

49

import dustpy.constants as c

50

51

# Create a new simulation

52

sim = Simulation()

53

54

# Set initial conditions

55

sim.ini.gas.Mdisk = 0.05 * c.M_sun # Disk mass

56

sim.ini.gas.SigmaRc = 10 * c.au # Characteristic radius

57

sim.ini.dust.aIniMax = 0.0001 # Maximum initial grain size (cm)

58

59

# Create grids

60

sim.makegrids()

61

62

# Initialize simulation

63

sim.initialize()

64

65

# Run simulation

66

sim.run()

67

68

# Access results

69

gas_surface_density = sim.gas.Sigma # Gas surface density [g/cm²]

70

dust_surface_density = sim.dust.Sigma # Dust surface density per mass bin [g/cm²]

71

particle_sizes = sim.dust.a # Particle sizes [cm]

72

```

73

74

## Architecture

75

76

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

77

78

- **Simulation Class**: Main interface managing the full simulation state, grids, and evolution

79

- **Standard Functions**: Physics implementations in `dustpy.std` for dust, gas, stellar, and grid calculations

80

- **Fortran Extensions**: Performance-critical calculations implemented in compiled Fortran code

81

- **Constants**: Physical constants in CGS units shared between Python and Fortran

82

- **Integration Framework**: Built on simframe for flexible numerical integration schemes

83

84

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

85

86

## Capabilities

87

88

### Main Simulation Interface

89

90

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

91

92

```python { .api }

93

class Simulation:

94

def __init__(self, **kwargs): ...

95

def makegrids(self): ...

96

def initialize(self): ...

97

def run(self): ...

98

def checkmassconservation(self): ...

99

def setdustintegrator(self, scheme="explicit", method="cash-karp"): ...

100

```

101

102

[Simulation Interface](./simulation.md)

103

104

### Dust Physics Functions

105

106

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

107

108

```python { .api }

109

from dustpy.std import dust

110

111

def dust.a(sim): ...

112

def dust.kernel(sim): ...

113

def dust.vrel_tot(sim): ...

114

def dust.S_coag(sim, Sigma=None): ...

115

def dust.p_stick(sim): ...

116

def dust.F_tot(sim, Sigma=None): ...

117

```

118

119

[Dust Physics](./dust-physics.md)

120

121

### Gas Physics Functions

122

123

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

124

125

```python { .api }

126

from dustpy.std import gas

127

128

def gas.cs_isothermal(sim): ...

129

def gas.nu(sim): ...

130

def gas.P_midplane(sim): ...

131

def gas.vrad(sim): ...

132

def gas.S_tot(sim): ...

133

```

134

135

[Gas Physics](./gas-physics.md)

136

137

### Physical Constants

138

139

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

140

141

```python { .api }

142

from dustpy import constants as c

143

144

au: float # Astronomical unit

145

G: float # Gravitational constant

146

M_sun: float # Solar mass

147

k_B: float # Boltzmann constant

148

sigma_sb: float # Stefan-Boltzmann constant

149

year: float # Year in seconds

150

```

151

152

[Constants](./constants.md)

153

154

### Plotting Functions

155

156

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

157

158

```python { .api }

159

from dustpy import plot

160

161

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

162

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

163

```

164

165

[Plotting](./plotting.md)

166

167

### Utility Functions

168

169

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

170

171

```python { .api }

172

import dustpy.utils as utils

173

174

class utils.Boundary: ...

175

def utils.read_data(data, filename="data", extension="hdf5", Na=50): ...

176

class utils.SimpleNamespace: ...

177

def utils.print_version_warning(timeout=0.5): ...

178

```

179

180

[Utilities](./utilities.md)

181

182

### Grid and Stellar Functions

183

184

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

185

186

```python { .api }

187

from dustpy.std import grid, star

188

189

def grid.OmegaK(sim): ...

190

def star.luminosity(sim): ...

191

```

192

193

[Grid and Stellar](./grid-stellar.md)

194

195

### Simulation Control Functions

196

197

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

198

199

```python { .api }

200

from dustpy.std import sim

201

202

def sim.dt(sim): ...

203

def sim.dt_adaptive(sim): ...

204

def sim.prepare_explicit_dust(sim): ...

205

def sim.finalize_implicit_dust(sim): ...

206

```

207

208

[Simulation Control](./simulation-control.md)

209

210

## Data Access Integration

211

212

DustPy integrates with simframe for data I/O:

213

214

```python { .api }

215

from dustpy import hdf5writer, readdump

216

217

# HDF5 output writer from simframe

218

hdf5writer: callable

219

220

# Read dump files from simframe

221

def readdump(filename): ...

222

```