Пример #1
0
def derivative(y, z):
    T, lnP = y
    P = np.exp(lnP)
    #	print z, T, P
    #	return np.array([ T*TDeriv(T, P, z)/H(T, P, z), 1/H(T, P, z) ])
    return np.array(
        [T * TDeriv(T, P, z) / H(T, P, z),
         rho(T, P, z) * g(z) / P])
Пример #2
0
def Fconv(T, P, z, alpha):
    u = U(T, P, z)
    logG = TDeriv(T, P, z)
    logadG = adG(T, P)  #definovano v temp_derivative
    #commaG = logadG-2*u**2+2*u*np.sqrt(logG-logadG+u**2)
    return rho(T, P, z) * cp(T, P, z) * T * np.sqrt(
        g(z) * delta(T, P, z)) * alpha**2 * np.sqrt(H(T, P, z)) * 8 * U(
            T, P, z) * (radG(T, P, z) - logG) / (4 * 9 * np.sqrt(2.))
Пример #3
0
def mass(P0, y, z, T):
	P = integrate.odeint(PDeriv, P0, np.linspace(1.25e7, 0, 500), args = (T))
	y = comp_mag(y, P)
	B = y*y

	rhoArr = np.zeros(500)
	for i in range(500):
		rhoArr[i] = rho(T[i], P[i], z[i])
	mmbrs = np.zeros(499)
	for i in range(499):
		mmbrs[i] = (rhoArr[i]/B[i]+rhoArr[i+1]/B[i+1])*(z[i+1]-z[i])/2
	integral = mmbrs.sum()
	return phi*integral
Пример #4
0
def mass(P0, y, z, T):
    P = integrate.odeint(PDeriv, P0, np.linspace(1.25e7, 0, 500), args=(T))
    y = comp_mag(y, P)
    B = y * y

    rhoArr = np.zeros(500)
    for i in range(500):
        rhoArr[i] = rho(T[i], P[i], z[i])
    mmbrs = np.zeros(499)
    for i in range(499):
        mmbrs[i] = (rhoArr[i] / B[i] + rhoArr[i + 1] / B[i + 1]) * (z[i + 1] -
                                                                    z[i]) / 2
    integral = mmbrs.sum()
    return phi * integral
Пример #5
0
def flux(T, dTdz, P, dPdz, z, alpha):
    G = (P / T) * (dTdz / dPdz)
    rG = radG(T, P, z)
    #	rho = dPdz/g(z)
    r = rho(T, P, z)
    o = opac(T, r)
    u = U(T, P, z)
    aG = adG(T, P)
    #	frad = 16*sigma*T**3*g(z)/(3*opac(T, P, z)*r*P)*dTdz/dPdz
    frad = (16. / 3.) * sigma * g(z) * T**4 * G / (o * P)
    #	if frad>sigma*Teff**4:
    #		return np.array([ sigma*Teff**4, 0, sigma*Teff**4 ])
    #	else:
    eG = aG - 2 * u**2 + 2 * u * np.sqrt(G - aG + u**2)
    fconv = r * cp(
        T, P, z) * T * np.sqrt(g(z) * delta(T, P, z)) * alpha**2 * np.sqrt(
            H(T, P, z)) * (G - eG)**1.5 / (4 * np.sqrt(2.))
    #	fconv = r*cp(T, P, z)*T*np.sqrt(g(z)*delta(T,P,z))*alpha**2*np.sqrt(H(T,P,z))*(abs(G-eG))**(3./2.)/(4*np.sqrt(2.))
    #	return np.array([ frad, fconv ])
    #	ftot = c*3.846e26*g(z)/(4*M(z)*G*np.pi)
    ftot = (16. / 3.) * sigma * g(z) * T**4 * rG / (o * P)
    return np.array([frad, fconv, ftot])
Пример #6
0
# -*- coding: utf-8 -*-
import os.path
import sys
sys.path.append('/home/tom/Documents/skola/bakalarka/python/')

from derivatives import Frad, Fconv
from scipy.interpolate import UnivariateSpline
from EOS import rho, cp
from const import *
from ext_data import opac

for i in range(0, z.size):
    FconvArr[i] = Fconv(T[i], P[i], z[i])
    FradArr[i] = Frad(T[i], P[i], z[i])
    rhoArr[i] = rho(T[i], P[i], z[i])
    cpArr[i] = cp(T[i], P[i])
    opacArr[i] = opac(T[i], rhoArr[i])

F = FconvArr + FradArr
F_spline = UnivariateSpline(z, F, s=0)
dFdz = F_spline.derivative()
dFdz = dFdz(z)

#dFdz = np.diff(F)/h
#dFdz = np.append(dFdz, dFdz[dFdz.size-1])

#  semi-implicitni metoda pro casovy prirustek

#d_main = np.empty(500)
#d_sub = np.zeros(500)
#d_sup = np.zeros(500)
Пример #7
0
from derivatives import Frad, Fconv
from EOS import rho, cp
from const import dt

def disconnection_check(y):
	B = y*y
	return False

while disconnection_check(y) == False:
	for i in range (0, z.size):
		FconvArr[i] = Fconv(T[i], P[i], z[i])
		FradArr[i] = Frad(T[i], P[i], z[i])
		rhoArr[i] = rho(T[i], P[i], z[i])
		cpArr[i] = cp(T[i], P[i])

	F = FconvArr+FradArr
	dFdz = np.diff(F)/h
	dFdz = np.append(dFdz, dFdz[dFdz.size-1])
	
	dTdt = -dFdz/(cpArr*rhoArr)
	T = T+dt*dTdt
	P0 = adjust_baseP(y, z, T, rho(T[499], P[499], z[499]))
	P = integrate.odeint(lambda P, z: PDeriv(T_func(z), P, z), P0, z_inv)
Пример #8
0
# -*- coding: utf-8 -*-
import os.path
import sys
sys.path.append('/home/tom/Documents/skola/bakalarka/python/')

from derivatives import Frad, Fconv
from scipy.interpolate import UnivariateSpline
from EOS import rho, cp
from const import *
from ext_data import opac


for i in range (0, z.size):
	FconvArr[i] = Fconv(T[i], P[i], z[i])
	FradArr[i] = Frad(T[i], P[i], z[i])
	rhoArr[i] = rho(T[i], P[i], z[i])
	cpArr[i] = cp(T[i], P[i])
	opacArr[i] = opac(T[i],rhoArr[i])

F = FconvArr+FradArr
F_spline = UnivariateSpline(z, F, s=0)
dFdz = F_spline.derivative()
dFdz = dFdz(z)

#dFdz = np.diff(F)/h
#dFdz = np.append(dFdz, dFdz[dFdz.size-1])

#  semi-implicitni metoda pro casovy prirustek

#d_main = np.empty(500)
#d_sub = np.zeros(500)
Пример #9
0
def PDeriv(P, z, T):
    r = rho(T, P, z)
    D = r * g(z)
    return D
Пример #10
0
def Frad(T, P, z):
    dTdz = T * TDeriv(T, P, z) / H(T, P, z)
    FR = -(16 * sigma * T**3 / (3 * opac(T, P, z) * rho(T, P, z))) * dTdz
    return FR