two-pop-py to ProDiMo interface

Interface from two-pop-py to ProDiMo. Provides to routines to run two-pop-py, prepare to output of two-pop-py for the use in ProDiMo and generates the 1D interace inputfile for ProDiMo.

To use this iterface an installation of two-pop-py is required. You can get two-pop-py here github two-pop-py.

Usage example

import twopoppy
from twopoppy.const import M_sun, R_sun, year, AU
import prodimopy.interface1D.twoppToProDiMo as twopp2P

# input parameters for two-pop-py
# they are all stored in the args object
# For details see the two-pop-py documentation https://github.com/birnstiel/two-pop-py
args = twopoppy.args()

# output directory for the results written by two-pop-py
args.dir = "tppdata"

args.tmax = 2e6*year # maximum time for the two-pop-py simulation
args.nt   = 5           # five time snapshots

# dust grain parameters
args.na   = 80    # number of size bins for the grain size grid (150 is recommended)
args.a0   = 5e-07 # minimum grain size (monomer), [cm]
args.rhos = 2.076 # the mass density of a grain [g/cm^3] should be consistent with the
                  # chosen dust composition in ProDiMo

# Stellar parameters. This is the ProDiMo standard T Tauri model
# to be consistent the stellar parameters also need to be set in ProDiMo (in Parameter.in)
# this is not yet done automatically
args.rstar = 2.0862*R_sun
args.mstar = 0.7*M_sun
args.tstar = 4000

# Disk parameters
# These parameters also similar to the T Tauri standard model. However, two-pop-py uses a
# a different method to construct the disk and also consideres the evolution
args.nr    = 80      # number of radial grid points for the disk
args.mdisk = 0.01*M_sun
args.d2g   = 0.01    # the initial dust to gas mass ratio
args.r0    = 0.07*AU # inner disk radius
args.rc    = 100*AU  # characteristic disk radius (tapering off radius)
args.r1    = 1200*AU # outer radius, chose large one for two-pop-py, but will be set to where
                     # NH_ver reaches approx 1.e20 like in ProDiMo (happens in twopp_to_ProDiMo)
args.alpha = 1e-3    # viscosity alpha
args.gamma = 0.75    # exponent for the viscosity


# run two-pop-py
res = twopoppy.model_wrapper(args,save=True,plot=False)

# Do some post-processing and generate the input file for ProDiMo.
# Should be a proper ProDiMo model directory (e.g. with all other input files).
twopp2P.twopp_to_ProDiMo(res,"./sdprofile.in",timeidx=-1)

# To use the sdprofile.in the "! fixed_surface_density " paramter needs to be set in Parameter.in
# here the last snapshot of the two-pop-py simulation is used for ProDiMo

Source documentation

prodimopy.interface1D.twoppToProDiMo.twopp_to_ProDiMo(twopp_res, fname, timeidx=-1)[source]

Interface from two-pop-py to ProDiMo. Does the necessary post-processing steps and produces the ProDiMo input file (fname)

Parameters:
  • twopp_res (results) – The results of a two-pop-py run.

  • fname (str) – The filename (or path) for the ProDiMo input file.

  • timeidx (int) – index of the two-pop-py time snapshot to use. DEFAULT: the last one.

prodimopy.interface1D.twoppToProDiMo.pp_tpp_results(twopp_res, timeidx=-1)[source]

Some post-processing of the two-pop-py results for ProDiMo. Also writes out additional results from two-pop-py (to the directory set via the twopp_res object.

TODO: document the additional output files.

Parameters:
  • twopp_res (results) – The results of a two-pop-py run.

  • a_max (array_like(float,ndim=1)) – The maximum grain sizes as a function of radius from the grain size distribution recontruction of two-pop-py. UNIT: cm

  • timeidx (int) – the index of the two-pop-py time snapshot that should be used.

Returns:

grain size distribution which shape (na,nx), where na is the len of the grain size grid and nx is the len of the radial grid of two-pop-py. The size distribution is provide in surface density per grain size bin, just like in two-pop-py.

Return type:

array_like(float,ndim=2)

prodimopy.interface1D.twoppToProDiMo.calc_atrans(twopp_res, a_max, timeidx=-1)[source]

Calculate the transition grain radius as a function of radius for the small and large population according to the two-pop-py paper in the most simple way (Eq. 30-32 in Birnstiel+ (2012))

FIXME: uses the most simple approximation, might not be valid

Parameters:
  • twopp_res (results) – The results of a two-pop-py run.

  • a_max (array_like(float,ndim=1)) – The maximum grain sizes as a function of radius from the grain size distribution recontruction of two-pop-py. UNIT: cm

  • timeidx (int) – the index of the two-pop-py time snap shot that should be used.

Returns:

The transition radius that separates the small and large populatoin as function of radius (shape nx). UNIT: cm

Return type:

array_like(float,ndim=1)

prodimopy.interface1D.twoppToProDiMo.construct_2pop_sdd(twopp_res, a_trans, a_max)[source]

Constructs a small and large dust surface density profile from the two-pop-py results.

This routine is only for comparison, on should use the interface with the full size distribution.

Parameters:
  • twopp_res (results) – The results of a two-pop-py run.

  • a_trans (array_like(float,ndim=1)) – The transition dust grain radius that separates the small from from the large population at each radial grid point. Must have the same len as the two-pop-py radial grid (twopp_res.x) UNIT: cm

  • a_max (array_like(float,ndim=1)) – The maximum dust grain radius that at each radial grid point. Must have the same len as the two-pop-py radial grid (twopp_res.x). UNIT: cm

Returns:

  • array_like(float,ndim=1) (small dust surface density profile UNIT: g cm-2)

  • array_like(float,ndim=1) (large dust surface density profile UNIT: g cm-2)

prodimopy.interface1D.twoppToProDiMo.sizedist_from_sigmaa(a_grid, sdda)[source]

Creates a normalized grain size distribution from the given grain size grid and the according dust surface densities.

This one is not used anymore for the 1D interface to ProDiMo. However, it might be usefull for test.

Parameters:
  • a_grid (array_like(float,ndim=1)) – The grain size grid. UNIT: cm

  • sdda (array_like(float,ndim=2)) – The dust surface density per grain size as function of radius with shape(len(a_agrid),len(twopp_res.x)) UNIT: UNIT: g cm-2

Returns:

normalized size distribution which shape (na,nx), where na is the len of the grain size grid and nx is the len of the radial grid of two-pop-py.

Return type:

array_like(float,ndim=2)