Esempio n. 1
0
f.write("	1.1. Material: "+name[0] +"\n")
for i in range(1,7):
	f.write( '%45s' % (lines[i]))
f.write("\n")
f.write("	1.2. Method: Murnaghan equation of state."+"\n")
C=lines[8].strip().split()
f.write("	1.3. Elastic constants:"+"\n")
f.write("			C11=" + str(C[0]) + " GPa" + '\n' )
f.write("			C12="+ str(C[1] ) + " GPa"+ '\n' )
f.write("			C44="+ str(C[2] ) + " GPa"+ '\n' )

#Implementation of the equation of state (EOS) class
f.write('\n')

f.write("2. RESULTS FROM THE FIT OF MURNAGHAN EQUATION OF STATE:" + '\n\n')
material_eos = EOS.eos(interface.name_file)
f.write("	2.1. Experimental data:"+"\n")
f.write('%18s  %15s  %12s' % ('a (au)', 'Volume (au^3)', 'Energy (Ry)') + '\n' )
for j in range(10, len(lines)):
	value=lines[j].strip().split()
	f.write('%18s  %15s  %12s' % (str(value[0]), str(float(value[0])**3/material_eos.select()[3]), str(value[1])) + '\n' )
f.write('\n')
coef_pol=material_eos.fit_2()[0]
f.write( "	2.2. Second order fit: " + '\n')
f.write("			a=" + str(coef_pol[0]) + '\n' )
f.write("			b="+ str(coef_pol[1] ) + '\n' )
f.write("			c="+ str(coef_pol[2] ) + '\n\n' )
coef_guess=material_eos.fit_2()[2]
f.write("	2.3. Initial guess for Murnaghan parameters:" + '\n')
f.write("			E0=" + str(coef_guess[0]) + " Ry" + '\n' )
f.write("			B0="+ str(coef_guess[1] ) + " GPa" + '\n' )
Esempio n. 2
0
evol.mass = [0.0]
evol.temp = [0.0]
evol.press = [0.0]
for m_planet in masses:
    r_p = cgs.r_earth * m_planet**(1. / 3.)
    r_n = r_p
    r_H = a_planet * cgs.au * (cgs.m_earth * m_planet /
                               (3. * cgs.m_sun))**(1. / 3.)
    xlabel = 'r/r_H'
    for i in range(2):
        #for fsm in (0.01,0.02,0.05,0.125,0.0):
        for fsm in [0]:
            rsm = fsm * r_H
            root = 'm={:3.1f}'.format(m_planet)
            if i == 0:
                eos = EOS.eos_i(mu=2.35)
                file = open(root + "_i.atm", "w")
            else:
                eos = EOS.eos_t()
                file = open(root + "_t.atm", "w")
            file.write('Pressure   Temperature\n')
            d1 = d_start
            T1 = T_start
            P1 = eos.pressure(T1, d1)
            gamma1 = eos.gamma(T1, d1)
            r1 = r_start * r_H

            #r1=243*cgs.r_earth
            def vdrag(r, d):
                t_stop = 3e7 * 1e-12 / d
                return force(r, rsm) * t_stop / 1e5
Esempio n. 3
0
def atm_der(y,tau):
	z, P = y
	return np.array([ 1./(EOS.opac(T_atm(tau), P, z)*EOS.rho(T_atm(tau), P, z)), g(z)/EOS.opac(T_atm(tau), P, z) ])
Esempio n. 4
0
    ret = (g(z) / gamma) * rho**(2 - gamma) * np.exp(-gamma * S / cp)
    pdb.set_trace()
    return ret


z = np.linspace(0., 12.5e6, 2000)
dz = np.diff(z)
T = np.empty(z.size)
P = np.empty(z.size)
rho = np.empty(z.size)
mu = np.empty(z.size)
cp = np.empty(z.size)
cv = np.empty(z.size)

T[0] = 3500.
S0 = EOS.S(ext.T(12.5e6), ext.p(12.5e6), 12.5e6)
P[0] = bisect(lambda P: EOS.S(T[0], P, 0) - S0, 1e1, ext.p(0))
S0 = S0 * 1e2
state = gas_state(T[0], P[0])
cp[0] = state[1]
cv[0] = state[2]
mu[0] = EOS_id.mu(T[0], P[0])
rho[0] = EOS_id.rho(T[0], P[0], z[0])

model = [z[0], T[0], P[0]]
for i in range(1, z.size):
    T[i] = P[i - 1] * mu[i - 1] * 1e-3 / (rho[i - 1] * R)
    state = gas_state(T[i], P[i - 1])
    cp[i] = state[1]
    cv[i] = state[2]
    rho[i] = rho[i] + dz[i - 1] * derivative(z[i], rho[i - 1], cp[i], cv[i],
Esempio n. 5
0
	atm = integrate.odeint(atm_der, yinit, tau)
	z_atm = atm[:,0]
	P_atm = atm[:,1]
	return S(T_atm(tau_top), max(P_atm), max(z_atm))
	
	yinit = np.array([ T_atm(tau_top), np.log(P_atm[P_atm.size-1]) ])
	z = np.linspace(z0, 12.5e6, 500)
	y = integrate.odeint(derivative, yinit, z)
	T = y[:,0]
	P = np.exp(y[:,1])
	print S(max(T), max(P), max(z))
	return S(max(T), max(P), max(z))

P0 = bcg.P[0]*(1-(bcg.T[0]-T_atm(0))/bcg.T[0])
#tau0 = bisect(lambda P: atmosphere_enthropy(P)-S0, 10000., 30000.)
P0 = EOS.PofRho(T_spot,1e-5)

yinit = np.array([ top, P0 ])
atm = integrate.odeint(atm_der, yinit, tau)
z_atm = atm[:,0]
P_atm = atm[:,1]
print z_atm

top = max(z_atm)
top = 0

#____________________________________________________________

z = np.linspace(top, 12.5e6, 500)

def surface_temperature(B):