Exemplo n.º 1
0
########################################################################
# Program code
########################################################################

# Construct a test cloud
cloud = cloud()

# Assign density, gas temperature, abundances; they're all we need for
# this test. Just use pure para-H2 for simplicity.
cloud.nH = 1e3
cloud.comp.xpH2 = 0.5
cloud.Tg = 10.0

# Add three exmaple emitters; abundance values don't matter for this
# example, so just set them to 1
cloud.addEmitter('co', 1.0)
cloud.addEmitter('c+', 1.0, extrap=True, emitterURL='*****@*****.**')
cloud.addEmitter('o-nh3', 1.0, extrap=True)

# Compute level populations for optically thin cloud with no clumping;
# get back the dict containing diagnostic information
codict = cloud.emitters['co'].setLevPop(cloud, thin=True, noClump=True)
cdict = cloud.emitters['c+'].setLevPop(cloud, thin=True, noClump=True)
nh3dict = cloud.emitters['o-nh3'].setLevPop(cloud, thin=True, noClump=True)

# Print condition numbers, before and after reduction
print "CO condition number = "+str(np.linalg.cond(codict['m']))
print "C condition number = "+str(np.linalg.cond(cdict['m']))
print "NH3 condition number = "+str(np.linalg.cond(nh3dict['m']))

# Plot matrices graphically
Exemplo n.º 2
0
########################################################################
# Program code
########################################################################

# Construct a test cloud
cloud = cloud()

# Assign temperature; we'll keep this fixed as we vary the volume and
# column density
cloud.Tg = 10.0

# Set dust opacity to 0, since RADEX doesn't include it
cloud.dust.sigma10 = 0.0

# Add CO as an emitter
cloud.addEmitter('co', 1e-4)

# Assign abundances of bulk constituents. To do a fair comparison, we
# make the same assumptions RADEX does about abundances, i.e. that the
# ratio of ortho-to-para H_2 equals the thermal ratio of the J = 0 to
# J = 1 level of H2. The Boltzmann factor of J = 1 state is 3(2J+1)
# exp(-J(J+1)Theta_rot / T), where Theta_rot = 85.3 K
boltzfac_oH2 = 9.0*exp(-2*85.3/cloud.Tg)
cloud.comp.xoH2 = 0.5 * boltzfac_oH2 / (1.0 + boltzfac_oH2)
cloud.comp.xpH2 = 0.5 / (1.0 + boltzfac_oH2)

# Compute sound speed
cloud.nH = 1.0  # Avoid annoying warning message
cloud.comp.computeDerived(cloud.nH)
cs = sqrt(kB*cloud.Tg/(cloud.comp.mu*mH))