Esempio n. 1
0
print "Settings for the Sun"
print "M = %10.6g g" % Ms
print "X = %10.3f" % X
print "Y = %10.3f" % Y
print u"ε = %10.3f ergs/g" % epsilon
print u"μ = %10.3f" % mmw(X=X, Y=Y)

print "Outer Boundary Conditions"
print "Testing Outer Presure Conversion Mehtods"
print "    Inital Guess:"
print "    R = %10.6e cm" % Rs
print "    L = %10.6e erg/s" % Lsun
start = time.clock()
ri, li, Pi, Ti = outer_boundary(R=Rs,
                                L=Lsun,
                                M=Ms,
                                mu=mmw(X=X, Y=Y),
                                optable=Opacity,
                                Piter=10)
print "Iterable time taken: %g" % (time.clock() - start)
start = time.clock()
r, l, P, T = outer_boundary(R=Rs,
                            L=Lsun,
                            M=Ms,
                            mu=mmw(X=X, Y=Y),
                            optable=Opacity,
                            Piter=False)
print "Absolute time taken: %g" % (time.clock() - start)
print "At m=M:"
print "    -- Algebraic -------------- | -- Iterable -------------- | -- Delta --------| "
print u"    R = %10.6e cm,        | R = %10.6e cm        | ΔR = %11.4e |" % (
    r, ri, (r - ri) / r)
Esempio n. 2
0
print "Problem #4&5:"

print "Settings for the Sun"
print "M = %10.6g g" % Ms
print "X = %10.3f" % star.X
print "Y = %10.3f" % star.Y
print u"μ = %10.3f" % mmw(X=X, Y=Y)
print ""

print "Outer Boundary Conditions"
print "    Inital Guess:"
print "    R = %10.6e cm" % Rs
print "    L = %10.6e erg/s" % Lsun
r, l, P, T = outer_boundary(R=Rs,
                            L=Lsun,
                            M=Ms,
                            mu=mmw(X=X, Y=Y),
                            optable=Opacity,
                            Piter=P_Guess_Iteration)
print "At m=M:"
print "    r = %10.6e cm" % r
print "    l = %10.6e erg/s" % l
print "    P = %10.6e Dyne/cm^2" % P
print "    T = %10.6e K" % T
# print "Derivatives"
# dr,dl,dP,dT = derivatives(np.array([Ms]),np.atleast_2d([r,l,P,T]),mu=mmw(X=X,Y=Y),optable=Opacity)
# print "    dr = %10.6e" % dr
# print "    dl = %10.6e" % dl
# print "    dP = %10.6e" % dP
# print "    dT = %10.6e" % dT
# print ""
Esempio n. 3
0
print "Stellar Model Photospheric Boundary Conditions"

print "Settings for the Sun"
print "M = %10.6g g" % Ms
print "X = %10.3f" % X
print "Y = %10.3f" % Y
print u"ε = %10.3f ergs/g" % epsilon
print u"μ = %10.3f" % mmw(X=X,Y=Y)

print "Outer Boundary Conditions"
print "Testing Outer Presure Conversion Mehtods"
print "    Inital Guess:"
print "    R = %10.6e cm" % Rs
print "    L = %10.6e erg/s" % Lsun
start = time.clock()
ri,li,Pi,Ti = outer_boundary(R=Rs,L=Lsun,M=Ms,mu=mmw(X=X,Y=Y),optable=Opacity,Piter=10)
print "Iterable time taken: %g" % (time.clock() - start)
start = time.clock()
r,l,P,T = outer_boundary(R=Rs,L=Lsun,M=Ms,mu=mmw(X=X,Y=Y),optable=Opacity,Piter=False)
print "Absolute time taken: %g" % (time.clock() - start)
print "At m=M:"
print "    -- Algebraic -------------- | -- Iterable -------------- | -- Delta --------| "
print u"    R = %10.6e cm,        | R = %10.6e cm        | ΔR = %11.4e |" % (r,ri,(r-ri)/r)
print u"    L = %10.6e erg/s,     | L = %10.6e erg/s     | ΔL = %11.4e |" % (l,li,(l-li)/l)
print u"    P = %10.6e Dyne/cm^2, | P = %10.6e Dyne/cm^2 | ΔP = %11.4e |" % (P,Pi,(P-Pi)/P)
print u"    T = %10.6e K,         | T = %10.6e K         | ΔT = %11.4e |" % (T,Ti,(T-Ti)/T)


Pc = 2.477e17
Tc = 1.571e7
m = 1e-30*Ms