예제 #1
0
def getGasDensity(grid=None, ppar=None):
    """Calculates the total gas density distribution 
    
    Parameters
    ----------
    grid : radmc3dGrid
            An instance of the radmc3dGrid class containing the spatial and wavelength grid
    
    ppar : dictionary
            Dictionary containing all parameters of the model 
    
    Returns
    -------
    Returns the gas volume density in g/cm^3
    """
    rhogas = np.zeros([grid.nx, grid.ny, grid.nz], dtype=np.float64) + 1e-20
    xaxis = grid.x
    yaxis = grid.y
    zaxis = grid.z
    nx = grid.nx
    ny = grid.ny
    nz = grid.nz
    
    # for spherical coordinates
    if ppar['crd_sys'] == 'sph':
        for xx in range(nx):
    	    for yy in range(ny):
                xii = xaxis[xx] * np.sin(yaxis[yy])
                zii = xaxis[xx] * abs(np.cos(yaxis[yy]))
                # hii = ppar['H0'] * (xii / ppar['Rt'])**(ppar['qheight'])
                hii = fneq.eq_taperheight(xii, ppar['Rt'], ppar['H0'], 
                    ppar['qheight'], ppar['Router'], ppar['Hd'])
                sigii = fneq.eq_sig(xii,ppar['mdisk'],ppar['Rinner'],ppar['Rt'],
                    ppar['Router'],ppar['sigp'],ppar['sigma_type'])
                gdensii = sigii / (2.0*np.pi)**0.5 / hii * np.e**(-0.5*zii**2 / hii**2)
                if gdensii < ppar['cutgdens']:
                    rhogas[xx,yy,:] = ppar['cutgdens']
                else:
                    rhogas[xx,yy,:] = gdensii

    # for cartesian coordinates
    if ppar['crd_sys'] == 'car':
        for xx in range(nx):
            for yy in range(ny):
                for zz in range(nz):
                    xii = (xaxis[xx]**2 + yaxis[yy]**2)**0.5
                    zii = abs(zaxis[yy])
                    #hii = ppar['H0'] * (xii / ppar['Rt'])**(ppar['qheight'])
                    hii = fneq.eq_taperheight(xii, ppar['Rt'], ppar['H0'], 
                        ppar['qheight'], ppar['Router'], ppar['Hd'])
                    sigii = fneq.eq_sig(xii,ppar['mdisk'], ppar['Rinner'], ppar['Rt'],
                        ppar['Router'], ppar['sigp'], ppar['sigma_type'])
                    gdensii = sigii / (2.0*np.pi)**0.5 / hii * np.e**(-0.5*zii**2 / hii**2)
                    if gdensii < ppar['cutgdens']:
                        rhogas[xx,yy,zz] = ppar['cutgdens']
                    else:
                        rhogas[xx,yy,zz] = gdensii
                
    return rhogas
예제 #2
0
def getGasDensity(grid=None, ppar=None):
    """Calculates the total gas density distribution 
    
    Parameters
    ----------
    grid : radmc3dGrid
            An instance of the radmc3dGrid class containing the spatial and wavelength grid
    
    ppar : dictionary
            Dictionary containing all parameters of the model 
    
    Returns
    -------
    Returns the gas volume density in g/cm^3
    """

    mesh = np.meshgrid(grid.x, grid.y, grid.z, indexing='ij')
    if ppar['crd_sys'] == 'sph':
        rr = mesh[0]
        tt = mesh[1]
        pp = mesh[2]
        xx = rr * np.sin(tt) * np.cos(pp)
        yy = rr * np.sin(tt) * np.sin(pp)
        zz = rr * np.cos(tt)
        cyrr = np.sqrt(xx**2. + yy**2.)
    elif ppar['crd_sys'] == 'car':
        xx = mesh[0]
        yy = mesh[1]
        zz = mesh[2]
        rr = np.sqrt(xx**2 + yy * 2 + zz**2)
        cyrr = np.sqrt(xx**2 + yy**2)
    else:
        raise ValueError('crd_sys not specified')

    hh = ppar['Ht'] * (cyrr / ppar['Rt'])**(ppar['qheight'])
    sig_cyrr = fneq.eq_sig(cyrr, ppar['mdisk'], xx.min(), ppar['Rsig'],
                           xx.max(), ppar['sigp'], 1)

    #    armpart = getSpiral(cyrr, pp, ppar['Rspir'], ppar['bspir'], ppar['wspir'])
    armpart = getSpiral(cyrr, grid.x, grid.y, grid.z, ppar['Rspir'],
                        ppar['bspir'], ppar['wspir'], ppar['pspir'],
                        ppar['Rend'])

    gappart = getGap(cyrr, ppar['Rgap'], ppar['wgap'])

    rhogas = sig_cyrr * armpart * gappart / np.sqrt(2. * np.pi) / hh * np.exp(
        -0.5 * (zz / hh)**2)
    vol = grid.getCellVolume()
    sumd = rhogas * vol
    rat = ppar['mdisk'] / sumd.sum()
    rhogas = rhogas * rat

    return rhogas
예제 #3
0
def getDustDensity(grid=None, ppar=None):
    """Calculates the dust density distribution 
    if given 2 dust grain species, then first one is for envelope, second one is for disk
    if only 1 dust grain species, then used for both
    
    Parameters
    ----------
    grid : radmc3dGrid
            An instance of the radmc3dGrid class containing the spatial and wavelength grid
    
    ppar : dictionary
            Dictionary containing all parameters of the model 
    
    Returns
    -------
    Returns the dust volume density in g/cm^3
    """

    mesh = np.meshgrid(grid.x, grid.y, grid.z, indexing='ij')
    if ppar['crd_sys'] == 'sph':
        rr = mesh[0]
        tt = mesh[1]
        pp = mesh[2]
        xx = rr * np.sin(tt) * np.cos(pp)
        yy = rr * np.sin(tt) * np.sin(pp)
        zz = rr * np.cos(tt)
        cyrr = np.sqrt(xx**2. + yy**2.)
    elif ppar['crd_sys'] == 'car':
        xx = mesh[0]
        yy = mesh[1]
        zz = mesh[2]
        rr = np.sqrt(xx**2 + yy*2 + zz**2)
        cyrr = np.sqrt(xx**2 + yy**2)
    else:
        raise ValueError('crd_sys not specified')

    # read dust grain information
    op = dustopac.radmc3dDustOpac()
    dinfo = op.readDustInfo()
    ngs = len(dinfo['gsize'])
    dweights = dinfo['dweights']

    # create dust distribution
    rhodust = np.zeros([grid.nx, grid.ny, grid.nz, ngs], dtype=np.float64) 

    # cavity 
    cavfac = DiskEqs.eqCavity(cyrr, zz, ppar)

    # envelope component
    rho_env3d = cyrr * 0 
    if ppar['envmode'] == 0:    # Ulrich model
        r2d = rr[:,:,0]
        t2d = tt[:,:,0]
        if ppar['dMenv'] >= 0:
            GMR3 = natconst.gg * ppar['mstar'][0] * ppar['Rc']**3
            dMenv = ppar['dMenv'] * natconst.ms / natconst.year
            rhoRc = dMenv / (8.*np.pi) / np.sqrt(GMR3)
        else:
            rhoRc = ppar['rhoRc']
        envdens2d = DiskEqs.eqEnvelopeDens(r2d, t2d, ppar['Rc'], rhoRc)
        for ip in range(grid.nz):
            rho_env3d[:,:,ip] = envdens2d

    elif ppar['envmode'] == 1:  # oblate model
        rho_env3d = DiskEqs.eqOblateDens(cyrr, zz, ppar['rhoRc'], ppar['Rc'], ppar['eta'], ppar['envq_1'])

    rho_env3d = rho_env3d * ppar['g2d'] * cavfac

    # disk component
    hh = fn_scaleheight(cyrr, ppar['Rt'], ppar['H0'], ppar['qheight'],
            ppar['Rhouter'], 5., mode=ppar['hmode'])

    sig_cyrr = fneq.eq_sig(cyrr, ppar['mdisk'], ppar['Rinner'], ppar['Rsig'],
        ppar['Router'], ppar['sigp'], ppar['sigma_type'], 
        sigp2=ppar['sigp2'], sig0=ppar['sig0'])

    rho_disk = sig_cyrr * 0
    reg = hh > 0
    rho_disk[reg] = sig_cyrr[reg] / np.sqrt(2.*np.pi) / hh[reg] * np.exp(-0.5*(zz[reg]/hh[reg])**2.)

    rho_disk = rho_disk * ppar['g2d'] * cavfac

    # decide on how to add it together
    if ngs == 1:
        rhodust[:,:,:,0] = rho_env3d + rho_disk
    elif ngs == 2:
        ig = 0 # first one for envelope
        rhodust[:,:,:,ig] = rho_env3d

        ig = 1 # second one for disk
        rhodust[:,:,:,ig] = rho_disk
    else:
        # same for all?
#        for ig in range(ngs):
#            rhodust[:,:,:,ig] = (rho_env3d + rho_disk) * dweights[ig]
        raise ValueError('number of grains can only be less than 2 for this model')

    # flag out regions lower than cutgdens
    reg = rhodust < (ppar['cutgdens'] * ppar['g2d'])
    rhodust[reg] = ppar['cutgdens'] * ppar['g2d']
    
    return rhodust
예제 #4
0
def getGasDensity(grid=None, ppar=None):
    """Calculates the total gas density distribution 
    
    Parameters
    ----------
    grid : radmc3dGrid
            An instance of the radmc3dGrid class containing the spatial and wavelength grid
    
    ppar : dictionary
            Dictionary containing all parameters of the model 
    
    Returns
    -------
    Returns the gas volume density in g/cm^3
    """

    mesh = np.meshgrid(grid.x, grid.y, grid.z, indexing='ij')
    if ppar['crd_sys'] == 'sph':
        rr = mesh[0]
        tt = mesh[1]
        pp = mesh[2]
        xx = rr * np.sin(tt) * np.cos(pp)
        yy = rr * np.sin(tt) * np.sin(pp)
        zz = rr * np.cos(tt)
        cyrr = np.sqrt(xx**2. + yy**2.)
    elif ppar['crd_sys'] == 'car':
        xx = mesh[0]
        yy = mesh[1]
        zz = mesh[2]
        rr = np.sqrt(xx**2 + yy*2 + zz**2)
        cyrr = np.sqrt(xx**2 + yy**2)
    else:
        raise ValueError('crd_sys not specified')

    rhogas = np.zeros([grid.nx, grid.ny, grid.nz], dtype=np.float64) + 1e-30
    hh = fn_scaleheight(cyrr, ppar['Rt'], ppar['H0'], ppar['qheight'], 
            ppar['Rhouter'], 5., mode=ppar['hmode'])

    sig_cyrr = fneq.eq_sig(cyrr, ppar['mdisk'], ppar['Rinner'], ppar['Rsig'], 
        ppar['Router'], ppar['sigp'], ppar['sigma_type'], 
        sigp2=ppar['sigp2'], sig0=ppar['sig0'])

    reg = hh > 0
    rhogas[reg] = sig_cyrr[reg] / np.sqrt(2.*np.pi) / hh[reg] * np.exp(-0.5*(zz[reg]/hh[reg])**2.)

    # flag out regions with 0 scale height
    reg = hh <= 0.
    rhogas[reg] = ppar['cutgdens']

    # include envelope
    if ppar['envmode'] == 0:	# Ulrich model
        r2d = rr[:,:,0]
        t2d = tt[:,:,0]
        if ppar['dMenv'] >= 0:
            GMR3 = natconst.gg * ppar['mstar'][0] * ppar['Rc']**3
            dMenv = ppar['dMenv'] * natconst.ms / natconst.year
            rhoRc = dMenv / (8.*np.pi) / np.sqrt(GMR3)
        else:
            rhoRc = ppar['rhoRc']
        envdens2d = DiskEqs.eqEnvelopeDens(r2d, t2d, ppar['Rc'], rhoRc, envq_1=ppar['envq_1'])

        for ip in range(grid.nz):
            rhoin = rhogas[:,:,ip]
            rhogas[:,:,ip] = rhogas[:,:,ip] + envdens2d
    elif ppar['envmode'] == 1:	# oblate model
        rhogas = DiskEqs.eqOblateDens(cyrr, zz, ppar['rhoRc'], ppar['Rc'], ppar['eta'], ppar['envq_1'])
    
    # cavity
    fac = DiskEqs.eqCavity(cyrr, zz, ppar)

    rhogas = rhogas * fac

    # flag out regions lower than cutgdens
    reg = rhogas < ppar['cutgdens']
    rhogas[reg] = ppar['cutgdens']

    return rhogas
예제 #5
0
def getDustDensity(grid=None, ppar=None):
    """Calculates the dust density distribution 
    
    Parameters
    ----------
    grid : radmc3dGrid
            An instance of the radmc3dGrid class containing the spatial and wavelength grid
    
    ppar : dictionary
            Dictionary containing all parameters of the model 
    
    Returns
    -------
    Returns the dust volume density in g/cm^3
    """
    op = dustopac.radmc3dDustOpac()
    dinfo = op.readDustInfo()
    ngs = len(dinfo['gsize'])

    rhodust = np.zeros([grid.nx, grid.ny, grid.nz, ngs], dtype=np.float64) 
    rhogas = getGasDensity(grid=grid, ppar=ppar)

    if ppar['dosettle'] == 0:
        for gg in range(ngs):
            rhodust[:, :, :, gg] = rhogas * dinfo['dweights'][gg] * ppar['g2d']
    else: # if we want to do dust settling
        tgas = getGasTemperature(grid=grid, ppar=ppar)
        if ppar['crd_sys'] == 'sph':
            # need to interpolate the temperature to cartesian first
            res = crd_trans.contSph2Cart(contSph=tgas[:,:,0], raxis=grid.x, ttaaxis=grid.y,
                log=True, pad=ppar['cuttemp'], midplane=False)
            tgas_xz = res['contCart']
            tgas_x = res['xaxis']
            tgas_z = res['zaxis']
            tgas_zi = np.zeros([len(tgas_z)+1], dtype=np.float64)
            tgas_zi[1:-1] = 0.5*(tgas_z[1:] + tgas_z[0:-1])
            tgas_zi[0] = tgas_zi[1] - abs(tgas_zi[2]-tgas_zi[1])
            tgas_zi[-1] = tgas_zi[-2] + abs(tgas_zi[-3]-tgas_zi[-2])
            tgas_dz = tgas_zi[1:] - tgas_zi[0:-1]
            res = crd_trans.contSph2Cart(contSph=rhogas[:,:,0], raxis=grid.x, ttaaxis=grid.y,
                log=True, pad=ppar['cutgdens'], midplane=False)
            rhogas_xz = res['contCart']

        if ppar['crd_sys'] == 'car':
            inx = np.argmin(yaxis)
            reg = grid.x >= 0.0
            tgas_xz = tgas[reg,inx,:]
            tgas_x = grid.x[reg]
            tgas_z = grid.z
            tgas_zi = grid.zi
            tgas_dz = tgas_zi[1:] - tgas_zi[0:-1]
            rhogas_xz = rhogas[reg, inx, :]

        sig_x = fneq.eq_sig(tgas_x,ppar['mdisk'], ppar['Rinner'], ppar['Rsig'],
                            ppar['Router'], ppar['sigp'], ppar['sigma_type'])

        alphaxz = ppar['alpha'] + np.zeros(list(tgas_xz.shape), dtype=np.float64)

        print('--calculating dust density--')
        for gg in range(ngs):
            print('.')
            matdens = dinfo['matdens'][gg]
            gsize = dinfo['gsize'][gg]
            gam = ppar['gam']
            dsig_x = sig_x * ppar['g2d'] * dinfo['dweights'][gg]

            dustgg = dubrulle_settle(tgas_x, tgas_z, tgas_dz, tgas_xz, rhogas_xz, ppar['mstar'], dsig_x, 
                alphaxz, gam, matdens, gsize, cutdens=ppar['cutgdens']*ppar['g2d']*dinfo['dweights'][gg])

            if ppar['crd_sys'] == 'sph':
                dust_slice = crd_trans.contCart2Sph(contCart=dustgg, xaxis=tgas_x, zaxis=tgas_z, raxis=grid.x,
                    ttaaxis=grid.y, log=True, pad=ppar['cutgdens']*ppar['g2d']*dinfo['dweights'][gg])
                for zz in range(grid.nz):
                    rhodust[:,:,zz,gg] = dust_slice['contSph']
            if ppar['crd_sys'] == 'car':
                finterp = interpolate.interp2d(tgas_x, tgas_z, np.log(dustgg), kind='cubic',
                    fill_value=np.log(ppar['cutgdens']))
                for xx in range(grid.nx):
                    for yy in range(grid.ny):
                        rii = np.sqrt(xaxis[xx]**2 + yaxis[yy]**2)
                        rhodust[xx,yy,:,gg] = np.exp(finterp(np.array([rii]), zaxis))
    return rhodust
예제 #6
0
def getGasDensity(grid=None, ppar=None, walls=False):
    """Calculates the total gas density distribution 
    
    Parameters
    ----------
    grid : radmc3dGrid
            An instance of the radmc3dGrid class containing the spatial and wavelength grid
    
    ppar : dictionary
            Dictionary containing all parameters of the model 
    
    Returns
    -------
    Returns the gas volume density in g/cm^3
    """
    if walls is False:
        xaxis = grid.x; nx = grid.nx
        yaxis = grid.y; ny = grid.ny
        zaxis = grid.z; nz = grid.nz
    else:
        xaxis = grid.xi; nx = grid.nxi
        yaxis = grid.yi; ny = grid.nyi
        zaxis = grid.zi; nz = grid.nzi
    rhogas = np.zeros([nx, ny, nz], dtype=np.float64) + 1e-30

    if ppar['dohydroeq'] == 0:
        if ppar['crd_sys'] == 'sph':        
            for xx in range(nx):
                for yy in range(ny):
                    xii = xaxis[xx] * np.sin(yaxis[yy])
                    zii = xaxis[xx] * abs(np.cos(yaxis[yy]))
                    # hii = ppar['H0'] * (xii / ppar['Rt'])**(ppar['qheight'])
                    hii = fneq.eq_taperheight(xii, ppar['Rt'], ppar['H0'],
                        ppar['qheight'], ppar['Router'], ppar['Hd'])
                    sigii = fneq.eq_sig(xii,ppar['mdisk'],ppar['Rinner'],ppar['Rsig'],
                        ppar['Router'],ppar['sigp'],ppar['sigma_type'])
                    gdensii = sigii / (2.0*np.pi)**0.5 / hii * np.exp(-0.5*(zii/hii)**2)
                    if gdensii < ppar['cutgdens']:
                        rhogas[xx,yy,:] = ppar['cutgdens']
                    else:
                        rhogas[xx,yy,:] = gdensii

        if ppar['crd_sys'] == 'car':
            for xx in range(nx):
                for yy in range(ny):
                    for zz in range(nz):
                        xii = (xaxis[xx]**2 + yaxis[yy]**2)**0.5
                        zii = abs(zaxis[yy])
                        #hii = ppar['H0'] * (xii / ppar['Rt'])**(ppar['qheight'])
                        hii = fneq.eq_taperheight(xii, ppar['Rt'], ppar['H0'], 
                            ppar['qheight'], ppar['Router'], ppar['Hd'])
                        sigii = fneq.eq_sig(xii,ppar['mdisk'], ppar['Rinner'], ppar['Rsig'],
                            ppar['Router'], ppar['sigp'], ppar['sigma_type'])
                        gdensii = sigii / (2.0*np.pi)**0.5 / hii * np.exp(-0.5*(zii/hii)**2)
                        if gdensii < ppar['cutgdens']:
                            rhogas[xx,yy,zz] = ppar['cutgdens']
                        else:
                            rhogas[xx,yy,zz] = gdensii

    else: #if want to do hydo equilibrium
        tgas = getGasTemperature(grid=grid, ppar=ppar)

        if ppar['crd_sys'] == 'sph':
            # need to interpolate the temperature to cartesian first
            res = crd_trans.contSph2Cart(contSph=tgas[:,:,0], raxis=grid.x, ttaaxis=grid.y,
                log=True, pad=ppar['cuttemp'], midplane=False)
            tgas_xz = res['contCart']
            tgas_x = res['xaxis']
            tgas_z = res['zaxis']
            tgas_zi = np.zeros([len(tgas_z)+1], dtype=np.float64)
            tgas_zi[1:-1] = 0.5*(tgas_z[1:] + tgas_z[0:-1])
            tgas_zi[0] = tgas_zi[1] - abs(tgas_zi[2]-tgas_zi[1])
            tgas_zi[-1] = tgas_zi[-2] + abs(tgas_zi[-3]-tgas_zi[-2])

        if ppar['crd_sys'] == 'car':
            inx = np.argmin(yaxis)
            reg = grid.x >= 0.0
            tgas_xz = tgas[reg,inx,:]
            tgas_x = grid.x[reg]
            tgas_z = grid.z
            tgas_zi = grid.zi

        sig_x = fneq.eq_sig(tgas_x,ppar['mdisk'], ppar['Rinner'], ppar['Rsig'],
                            ppar['Router'], ppar['sigp'], ppar['sigma_type'])

        rhogasxz = hydro_xz(tgas_x, tgas_zi, tgas_z, sig_x, tgas_xz, ppar['mstar'], ppar['cutgdens'])

        if ppar['crd_sys'] == 'sph':
            rhogas_slice = crd_trans.contCart2Sph(contCart=rhogasxz, xaxis=tgas_x, zaxis=tgas_z, raxis=xaxis, ttaaxis=yaxis,
                log=True, pad=ppar['cutgdens'])
            for zz in range(nz):
                rhogas[:,:,zz] = rhogas_slice['contSph']

        if ppar['crd_sys'] == 'car':
            finterp = interpolate.interp2d(tgas_x, tgas_z, np.log(rhogasxz), kind='cubic', fill_value=np.log(ppar['cutgdens']))
            for xx in range(nx):
                for yy in range(ny):
                    rii = np.sqrt(xaxis[xx]**2 + yaxis[yy]**2)
                    rhogas[xx,yy,:] = np.exp(finterp(np.array([rii]), zaxis))

    return rhogas
예제 #7
0
def getGasDensity(grid=None, ppar=None):
    """Calculates the total gas density distribution 
    
    Parameters
    ----------
    grid : radmc3dGrid
            An instance of the radmc3dGrid class containing the spatial and wavelength grid
    
    ppar : dictionary
            Dictionary containing all parameters of the model 
    
    Returns
    -------
    Returns the gas volume density in g/cm^3
    """

    mesh = np.meshgrid(grid.x, grid.y, grid.z, indexing='ij')
    if ppar['crd_sys'] == 'sph':
        rr = mesh[0]
        tt = mesh[1]
        pp = mesh[2]
        xx = rr * np.sin(tt) * np.cos(pp)
        yy = rr * np.sin(tt) * np.sin(pp)
        zz = rr * np.cos(tt)
        cyrr = np.sqrt(xx**2. + yy**2.)
    elif ppar['crd_sys'] == 'car':
        xx = mesh[0]
        yy = mesh[1]
        zz = mesh[2]
        rr = np.sqrt(xx**2 + yy*2 + zz**2)
        cyrr = np.sqrt(xx**2 + yy**2)
    else:
        raise ValueError('crd_sys not specified')

    rhogas = np.zeros([grid.nx, grid.ny, grid.nz], dtype=np.float64) + 1e-30
    hh = fn_scaleheight(cyrr, ppar['Rt'], ppar['H0'], ppar['qheight'], 
            ppar['Router'], ppar['Hd'], mode=ppar['hmode'])

    sig_cyrr = fneq.eq_sig(cyrr, ppar['mdisk'], ppar['Rinner'], ppar['Rsig'], 
        ppar['Router'], ppar['sigp'], ppar['sigma_type'])

    reg = hh > 0
    rhogas[reg] = sig_cyrr[reg] / np.sqrt(2.*np.pi) / hh[reg] * np.exp(-0.5*(zz[reg]/hh[reg])**2.)

    # flag out regions with 0 scale height
    reg = hh <= 0.
    rhogas[reg] = ppar['cutgdens']

    # include envelope
    if ppar['envrho0'] > 0:
        r2d = rr[:,:,0]
        t2d = tt[:,:,0]
#        envdens2d = DiskEqs.eqEnvelopeDens(r2d, t2d, ppar['Rrot'], ppar['envrho0'])
        envdens2d = ppar['envrho0'] / (1. + (r2d/ppar['Rrot'])**(ppar['envalph']))
        for ip in range(grid.nz):
            rhogas[:,:,ip] = rhogas[:,:,ip] + envdens2d

    # flag out regions lower than cutgdens
    reg = rhogas < ppar['cutgdens']
    rhogas[reg] = ppar['cutgdens']

    """ old stuff
    # for spherical coordinates
    if ppar['crd_sys'] == 'sph':
        for xx in range(nx):
    	    for yy in range(ny):
                xii = xaxis[xx] * np.sin(yaxis[yy])
                zii = xaxis[xx] * abs(np.cos(yaxis[yy]))
                # hii = ppar['H0'] * (xii / ppar['Rt'])**(ppar['qheight'])
                hii = fneq.eq_taperheight(xii, ppar['Rt'], ppar['H0'], 
                    ppar['qheight'], ppar['Router'], ppar['Hd'])
                sigii = fneq.eq_sig(xii,ppar['mdisk'],ppar['Rinner'],ppar['Rt'],
                    ppar['Rsig'],ppar['sigp'],ppar['sigma_type'])
                if hii > 1e-90:
                    gdensii = sigii / (2.0*np.pi)**0.5 / hii * np.exp(-0.5*(zii/hii)**2)
                else:
                    gdensii = ppar['cutgdens']
                  
                if gdensii < ppar['cutgdens']:
                    rhogas[xx,yy,:] = ppar['cutgdens']
                else:
                    rhogas[xx,yy,:] = gdensii
    """
                
    return rhogas