-
Notifications
You must be signed in to change notification settings - Fork 0
/
functionsPlanFormation.py
46 lines (31 loc) · 1.29 KB
/
functionsPlanFormation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
Sets up rules for planetesimal formation. Mostly copied from DustPy except for the hyperbolic tangent code + boundaries.
Author: Elle Miller & Sebastian Marino (2021)
"""
import dustpy.std.sim as std_sim
import numpy as np
import time
import matplotlib.pyplot as plt
def M_plan(s):
return (np.pi * (s.grid.ri[1:]**2 - s.grid.ri[:-1]**2) * s.planetesimals.Sigma[:]).sum()
def S_ext(s):
# Planetesimal formation efficiency
# zeta = 0.1
# Midplane dust-to-gas ratio
d2g_mid = s.dust.rho.sum(-1) / s.gas.rho
# Old step function way
# d2g_crit = 1.0
# mask = np.where(d2g_mid >= d2g_crit, True, False)
# ret = np.where(mask[:, None], -zeta * s.dust.Sigma * s.dust.St * s.grid.OmegaK[:, None], 0.)
# New hyperbolic tangent way
switch = 0.5 * (1. + np.tanh((np.log10(d2g_mid)) / s.bump.steep))
ret = -s.bump.zeta * s.dust.Sigma * s.dust.St * s.grid.OmegaK[:, None] * switch[:, None]
# Set to zero at boundaries - ret is Nr x Nm
ret[0, :] = 0.
ret[-10:, :] = 0.
return ret
# The negative sum over all external source terms is the planetesimal formation rate
# We can write a source term function which we add as a derivative to the planetesiamal
# surface density for integration
def dSigmaPlan(s, x, Y):
return -s.dust.S.ext.sum(-1)