Creating input files for the 1D interface

This module provides routines to generate the the input files for the 1D (radial) interface of ProDiMo.

# Create some 1d inputfile for ProDiMo using the interface1D option
# just a simply one made by hand with a gap.

import prodimopy.interface1D.infile as in1D
import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate as integ
import astropy.constants as const

# create a radial grid from 0.1 to 600 au
rin=0.1
rout=600.
r=np.logspace(np.log10(rin),np.log10(rout),endpoint=True,num=80)

# make a gas density profile
# powerlaw surface density profile with index -1.0
q=-1.0
sdg=r[:]*0.0
sdg = r**q
# normalize the profile to a disk mass of 1.e-2 Msun
rcm=r*in1D.autocm # use the au conversion factor from ProDiMo
norm=1.e-2*const.M_sun.cgs.value/(np.pi*np.trapz(sdg*rcm,rcm))
sdg[:]=sdg[:]*norm

# make the gas to dust ratio profile
g2d=sdg[:]*0.0+100 # assume g2d 100 everywhere

# produce some gaps, shallow gas gap, deeper dust gap
gap=(r>10) & (r<20)
sdg[gap]=sdg[gap]*0.1
g2d[gap]=g2d[gap]*100  # increase the gas to dust ratio, but keep gas

#assume some smaller gaps outside of the gap
amax=sdg[:]*0+3 # 3 cm maximum size
amax[r>=20]=0.3 # smaller grains

# Write the inputfile for ProDiMo, with a fixed g2dratio of 100 at all radii
# factor +0.5 for top and bottom half of disk, ProDiMo uses only one half
# this way the disk also has 1.e-2 in ProDiMo (a bit less because of the gap)
in1D.write("sdprofile.in", rcm, sdg*0.5,g2d,amax=amax )


# just make a plot
fig,ax=plt.subplots()
ax.plot(r,sdg,label="gas")
ax.plot(r,sdg/g2d,label="dust")

ax.semilogx()
ax.semilogy()
ax.set_xlabel("r [au]")
ax.set_ylabel("surface density [$\mathrm{g\,cm^{-2}}$]")
ax.legend()

Source documentation

prodimopy.interface1D.infile.writeV1(fname, r, sdg, g2dratio)[source]

Produces an input file for the 1D interface (version 1) to ProDiMo.

All array input parameters need to have the same length.

Parameters:
  • fname (string) – The filename (path) to be use for the input file.

  • r (array_like(float,ndim=1)) – radial gridpoints (distance to the star) for the disk. UNIT: cm

  • sdg (array_like(float,ndim=1)) – The total gas surface density profile (the sum of both sides of the disk) UNIT: g cm-2

  • g2dratio (array_like(float,ndim=1)) – The gas to dust mass ratio as function of radius.

prodimopy.interface1D.infile.writeV2(fname, r, sdg, sdd_small, sdd_large, amax)[source]

Produces an input file for the 1D interface (version 2) to ProDiMo.

All array input parameters need to have the same length.

This is format that is used for E. Vorobyovs code.

However, one should use the newer more flexible, (but compatible) format. see writeV3()

Parameters:
  • fname (string) – The filename (path) to be use for the input file.

  • r (array_like(float,ndim=1)) – The radius array. UNIT: cm

  • sdg (array_like(float,ndim=1)) – The gas surface density profile. UNIT: g cm-2

  • sdd_small (array_like(float,ndim=1)) – The dust surface density of the small grain dust popoulation UNIT: g cm-2

  • sdd_large (array_like(float,ndim=1)) – The dust surface density of the large grain dust popoulation UNIT: g cm-2

  • amax (array_like(float,ndim=1)) – the maxium grain size at each radial grid point UNIT: cm

prodimopy.interface1D.infile.writeV3(fname, r, sdg, sdd_small, sdd_large, amin, atrans, amax)[source]

Produces an input file for the 1D interface (version 3) to ProDiMo.

All array input parameters need to have the same length.

Parameters:
  • fname (string) – The filename (path) to be use for the input file.

  • r (array_like(float,ndim=1)) – The radius array. UNIT: cm

  • sdg (array_like(float,ndim=1)) – The gas surface density profile. UNIT: g cm-2

  • sdd_small (array_like(float,ndim=1)) – The dust surface density of the small grain dust popoulation UNIT: g cm-2

  • sdd_large (array_like(float,ndim=1)) – The dust surface density of the large grain dust popoulation UNIT: g cm-2

  • amin (array_like(float,ndim=1)) – the minimum grain size at each radial grid point UNIT: cm

  • atrans (array_like(float,ndim=1)) – the transition radius at each radial grid point UNIT: cm

  • amax (array_like(float,ndim=1)) – the maxium grain size at each radial grid point UNIT: cm

prodimopy.interface1D.infile.writeV4(fname, r, sdg, g2dratio, agrid, fsize)[source]

Produces an input file for the 1D interface (version 4) to ProDiMo.

This routine requires a full size distribution given by the grain size grid a and the size distribution fsize. fsize should contain the surface density as function of radius for each grain size bin.

Parameters:
  • fname (string) – The filename (path) to be use for the input file.

  • r (array_like(float,ndim=1)) – The radius array. UNIT: cm

  • sdg (array_like(float,ndim=1)) – The gas surface density profile. UNIT: g cm-2

  • g2dratio (array_like(float,ndim=1)) – The gas to dust mass ratio as function of radius.

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

  • fsize (array_like(float,ndim=2)) – The grain size distribution given as surface density per grain size bin. The dimension is (len(a),len(r)). UNIT: g cm-2

prodimopy.interface1D.infile.write(fname, r, sdg, g2dratio, agrid=None, fsize=None, amin=None, amax=None, elabunFacs=None)[source]

Produces an input file for the general 1D interface to ProDiMo.

Parameters:
  • fname (string) – The filename (path) to be use for the input file.

  • r (array_like(float,ndim=1)) – The radius array. UNIT: cm

  • sdg (array_like(float,ndim=1)) – The gas surface density profile. UNIT: g cm-2

  • g2dratio (array_like(float,ndim=1)) – The gas to dust mass ratio as function of radius.

  • agrid (array_like(float,ndim=1)) – The grain size grid. If None (default) no size distribution is included. Only required if fsize is used. UNIT: cm

  • fsize (array_like(float,ndim=2)) – The grain size distribution given as surface density per grain size bin. If None (default) no size distribution is included. The dimension is (len(a),len(r)). OPTIONAL, UNIT: g cm-2

  • amin (array_like(float,ndim=1)) – the minimum grain size at each radial grid point. OPTIONAL, UNIT: cm

  • amax (array_like(float,ndim=1)) – the maximum grain size at each radial grid point. OPTIONAL, UNIT: cm

  • elabunFac (dictionary) – Dictionary with correction factors for each Element that should be considered. Each entry has to have the Element name (as in ProDiMo) as key and an array of len(r) with the correctoin factor (i.e. 1 means no change). Only the elements that should be changed need to be included. OPTIONAL.

prodimopy.interface1D.infile.generate_sdd_twopop(twopp_res, atrans)[source]

‘ Generates a small and large dust surface density profile for the given atrans, from the two-pop-py results.

Parameters:
  • twopp_res (two-pop-py results) –

  • atrans (array_like(float,ndim=1)) – The transition radius from the small to the large population. UNIT: cm

prodimopy.interface1D.infile.generate_from_obsradprof(model, mradprof, oradprof, distance, asmall=None, apowfac=None, outfile=None, rinexclude=None)[source]

Generates a 1D infile (version1) by using the observed radial intensity profile for the continuum. The observed profiles is compared to the modelled one to calculate a correction for the dust surface density (gas to dust ratio). From this a new 1D input file (with a different gas to dust ratio) is generated.

Todo

Applying this method can introduce some numerical errors due to a lot of conversions and interpolations. However, these should be <0.5%. And as this routint is used for fitting it should not be an issue. However, the error most likely comes from calculating the gas and dust surface densities when a ProDiMo model is read (those are not calculated within ProDiMo). So maybe this calc_surfd() should be made more accurate.

Note

Further Ideas

Focus the fitting on the grain size that is best traced by the wavelength of the observations. One could use a gaussian to centered at this grain size to estimate the correction factor. However, this is probably more useful if mulitple images are available for the fitting.

Use asmall and apowfac together. The apowfac method is then only applied to the grian sizes < asmall. Other anlternative: normalize the apowfac function to a grain size of choice (i.e. the one that is most sensitive to the wavelength of the observations. And use it to decrease the correctoin for grain < asmall and increase the correction for grains > asmall.

Parameters:
  • model (Data_ProDiMo) – the ProDiMo model data (the initial model)

  • mradprof (RadialProfile) – The modelled radial profile (the initial one).

  • oradprof (RadialProfile) – The observed radial profile.

  • distance (float) – the distance of the object in au. Is required to convert the radial profiles to au.

  • asmall (float) – A grain size in micron. If this is set only the surfacedensities of grains with sizes > asmall are adapated all other remain unchanged. This can only work if the model has the output dust_sigmaa.out. This mode uses writeV4() to write the 1D input file.

  • apowfac (float) – If apow is set the correction factor becomes a function of the dust size. For the largest grain size the correction factor stays the same but for all other grains the correction factor is reduced depending on the grain size. apow needs to be positive. apowfac cannot be used with asmall together.

  • outfile (str) – the path/filename of the output file (the 1D input file). Default is sdprofile.in within the directory of the provided PRoDiMo model.

  • rinexclude (float) – within this radius (in au) the surface density profile is not adapted. This means for r < rinexclude the gas to dust ratio remains unaffected.